diff options
Diffstat (limited to 'patch-remap/mache-vineflower/net/minecraft/world/entity/animal/Sheep.java.patch')
-rw-r--r-- | patch-remap/mache-vineflower/net/minecraft/world/entity/animal/Sheep.java.patch | 522 |
1 files changed, 522 insertions, 0 deletions
diff --git a/patch-remap/mache-vineflower/net/minecraft/world/entity/animal/Sheep.java.patch b/patch-remap/mache-vineflower/net/minecraft/world/entity/animal/Sheep.java.patch new file mode 100644 index 0000000000..ba8f3e8afe --- /dev/null +++ b/patch-remap/mache-vineflower/net/minecraft/world/entity/animal/Sheep.java.patch @@ -0,0 +1,522 @@ +--- a/net/minecraft/world/entity/animal/Sheep.java ++++ b/net/minecraft/world/entity/animal/Sheep.java +@@ -2,8 +2,9 @@ + + import com.google.common.collect.Maps; + import java.util.Arrays; +-import java.util.EnumMap; + import java.util.Map; ++import java.util.Objects; ++import java.util.Optional; + import java.util.stream.Collectors; + import javax.annotation.Nullable; + import net.minecraft.Util; +@@ -20,18 +21,18 @@ + import net.minecraft.util.Mth; + import net.minecraft.util.RandomSource; + import net.minecraft.world.DifficultyInstance; +-import net.minecraft.world.InteractionHand; ++import net.minecraft.world.EnumHand; + import net.minecraft.world.InteractionResult; + import net.minecraft.world.damagesource.DamageSource; + import net.minecraft.world.entity.AgeableMob; + import net.minecraft.world.entity.Entity; + import net.minecraft.world.entity.EntityDimensions; ++import net.minecraft.world.entity.EntityPose; + import net.minecraft.world.entity.EntityType; ++import net.minecraft.world.entity.EnumMobSpawn; ++import net.minecraft.world.entity.GroupDataEntity; + import net.minecraft.world.entity.Mob; +-import net.minecraft.world.entity.MobSpawnType; +-import net.minecraft.world.entity.Pose; + import net.minecraft.world.entity.Shearable; +-import net.minecraft.world.entity.SpawnGroupData; + import net.minecraft.world.entity.ai.attributes.AttributeSupplier; + import net.minecraft.world.entity.ai.attributes.Attributes; + import net.minecraft.world.entity.ai.goal.BreedGoal; +@@ -46,49 +47,56 @@ + import net.minecraft.world.entity.item.ItemEntity; + import net.minecraft.world.entity.player.Player; + import net.minecraft.world.inventory.AbstractContainerMenu; +-import net.minecraft.world.inventory.CraftingContainer; ++import net.minecraft.world.inventory.InventoryCrafting; + import net.minecraft.world.inventory.MenuType; ++import net.minecraft.world.inventory.ResultContainer; + import net.minecraft.world.inventory.TransientCraftingContainer; +-import net.minecraft.world.item.DyeColor; +-import net.minecraft.world.item.DyeItem; + import net.minecraft.world.item.ItemStack; + import net.minecraft.world.item.Items; + import net.minecraft.world.item.crafting.Ingredient; +-import net.minecraft.world.item.crafting.RecipeHolder; ++import net.minecraft.world.item.crafting.RecipeCrafting; + import net.minecraft.world.item.crafting.RecipeType; +-import net.minecraft.world.level.ItemLike; ++import net.minecraft.world.level.IMaterial; + import net.minecraft.world.level.Level; + import net.minecraft.world.level.ServerLevelAccessor; + import net.minecraft.world.level.block.Blocks; +-import net.minecraft.world.level.block.state.BlockState; ++import net.minecraft.world.level.block.state.IBlockData; + import net.minecraft.world.level.gameevent.GameEvent; + import net.minecraft.world.level.storage.loot.BuiltInLootTables; + import org.joml.Vector3f; ++import net.minecraft.world.item.DyeColor; ++import net.minecraft.world.item.DyeItem; ++import net.minecraft.world.item.Item; ++import org.bukkit.craftbukkit.event.CraftEventFactory; ++import org.bukkit.event.entity.SheepRegrowWoolEvent; ++import org.bukkit.inventory.InventoryView; ++// CraftBukkit end + + public class Sheep extends Animal implements Shearable { ++ + private static final int EAT_ANIMATION_TICKS = 40; + private static final EntityDataAccessor<Byte> DATA_WOOL_ID = SynchedEntityData.defineId(Sheep.class, EntityDataSerializers.BYTE); +- private static final Map<DyeColor, ItemLike> ITEM_BY_DYE = Util.make(Maps.newEnumMap(DyeColor.class), map -> { +- map.put(DyeColor.WHITE, Blocks.WHITE_WOOL); +- map.put(DyeColor.ORANGE, Blocks.ORANGE_WOOL); +- map.put(DyeColor.MAGENTA, Blocks.MAGENTA_WOOL); +- map.put(DyeColor.LIGHT_BLUE, Blocks.LIGHT_BLUE_WOOL); +- map.put(DyeColor.YELLOW, Blocks.YELLOW_WOOL); +- map.put(DyeColor.LIME, Blocks.LIME_WOOL); +- map.put(DyeColor.PINK, Blocks.PINK_WOOL); +- map.put(DyeColor.GRAY, Blocks.GRAY_WOOL); +- map.put(DyeColor.LIGHT_GRAY, Blocks.LIGHT_GRAY_WOOL); +- map.put(DyeColor.CYAN, Blocks.CYAN_WOOL); +- map.put(DyeColor.PURPLE, Blocks.PURPLE_WOOL); +- map.put(DyeColor.BLUE, Blocks.BLUE_WOOL); +- map.put(DyeColor.BROWN, Blocks.BROWN_WOOL); +- map.put(DyeColor.GREEN, Blocks.GREEN_WOOL); +- map.put(DyeColor.RED, Blocks.RED_WOOL); +- map.put(DyeColor.BLACK, Blocks.BLACK_WOOL); ++ private static final Map<DyeColor, IMaterial> ITEM_BY_DYE = (Map) Util.make(Maps.newEnumMap(DyeColor.class), (enummap) -> { ++ enummap.put(DyeColor.WHITE, Blocks.WHITE_WOOL); ++ enummap.put(DyeColor.ORANGE, Blocks.ORANGE_WOOL); ++ enummap.put(DyeColor.MAGENTA, Blocks.MAGENTA_WOOL); ++ enummap.put(DyeColor.LIGHT_BLUE, Blocks.LIGHT_BLUE_WOOL); ++ enummap.put(DyeColor.YELLOW, Blocks.YELLOW_WOOL); ++ enummap.put(DyeColor.LIME, Blocks.LIME_WOOL); ++ enummap.put(DyeColor.PINK, Blocks.PINK_WOOL); ++ enummap.put(DyeColor.GRAY, Blocks.GRAY_WOOL); ++ enummap.put(DyeColor.LIGHT_GRAY, Blocks.LIGHT_GRAY_WOOL); ++ enummap.put(DyeColor.CYAN, Blocks.CYAN_WOOL); ++ enummap.put(DyeColor.PURPLE, Blocks.PURPLE_WOOL); ++ enummap.put(DyeColor.BLUE, Blocks.BLUE_WOOL); ++ enummap.put(DyeColor.BROWN, Blocks.BROWN_WOOL); ++ enummap.put(DyeColor.GREEN, Blocks.GREEN_WOOL); ++ enummap.put(DyeColor.RED, Blocks.RED_WOOL); ++ enummap.put(DyeColor.BLACK, Blocks.BLACK_WOOL); + }); +- private static final Map<DyeColor, float[]> COLORARRAY_BY_COLOR = Maps.<DyeColor, float[]>newEnumMap( +- Arrays.stream(DyeColor.values()).collect(Collectors.toMap(color -> (DyeColor)color, Sheep::createSheepColor)) +- ); ++ private static final Map<DyeColor, float[]> COLORARRAY_BY_COLOR = Maps.newEnumMap((Map) Arrays.stream(DyeColor.values()).collect(Collectors.toMap((enumcolor) -> { ++ return enumcolor; ++ }, Sheep::createSheepColor))); + private int eatAnimationTick; + private EatBlockGoal eatBlockGoal; + +@@ -96,14 +104,15 @@ + if (dyeColor == DyeColor.WHITE) { + return new float[]{0.9019608F, 0.9019608F, 0.9019608F}; + } else { +- float[] textureDiffuseColors = dyeColor.getTextureDiffuseColors(); ++ float[] afloat = dyeColor.getTextureDiffuseColors(); + float f = 0.75F; +- return new float[]{textureDiffuseColors[0] * 0.75F, textureDiffuseColors[1] * 0.75F, textureDiffuseColors[2] * 0.75F}; ++ ++ return new float[]{afloat[0] * 0.75F, afloat[1] * 0.75F, afloat[2] * 0.75F}; + } + } + + public static float[] getColorArray(DyeColor dyeColor) { +- return COLORARRAY_BY_COLOR.get(dyeColor); ++ return (float[]) Sheep.COLORARRAY_BY_COLOR.get(dyeColor); + } + + public Sheep(EntityType<? extends Sheep> entityType, Level level) { +@@ -114,12 +123,12 @@ + protected void registerGoals() { + this.eatBlockGoal = new EatBlockGoal(this); + this.goalSelector.addGoal(0, new FloatGoal(this)); +- this.goalSelector.addGoal(1, new PanicGoal(this, 1.25)); +- this.goalSelector.addGoal(2, new BreedGoal(this, 1.0)); +- this.goalSelector.addGoal(3, new TemptGoal(this, 1.1, Ingredient.of(Items.WHEAT), false)); +- this.goalSelector.addGoal(4, new FollowParentGoal(this, 1.1)); ++ this.goalSelector.addGoal(1, new PanicGoal(this, 1.25D)); ++ this.goalSelector.addGoal(2, new BreedGoal(this, 1.0D)); ++ this.goalSelector.addGoal(3, new TemptGoal(this, 1.1D, Ingredient.of(Items.WHEAT), false)); ++ this.goalSelector.addGoal(4, new FollowParentGoal(this, 1.1D)); + this.goalSelector.addGoal(5, this.eatBlockGoal); +- this.goalSelector.addGoal(6, new WaterAvoidingRandomStrollGoal(this, 1.0)); ++ this.goalSelector.addGoal(6, new WaterAvoidingRandomStrollGoal(this, 1.0D)); + this.goalSelector.addGoal(7, new LookAtPlayerGoal(this, Player.class, 6.0F)); + this.goalSelector.addGoal(8, new RandomLookAroundGoal(this)); + } +@@ -140,13 +149,13 @@ + } + + public static AttributeSupplier.Builder createAttributes() { +- return Mob.createMobAttributes().add(Attributes.MAX_HEALTH, 8.0).add(Attributes.MOVEMENT_SPEED, 0.23F); ++ return Mob.createMobAttributes().add(Attributes.MAX_HEALTH, 8.0D).add(Attributes.MOVEMENT_SPEED, 0.23000000417232513D); + } + + @Override + protected void defineSynchedData() { + super.defineSynchedData(); +- this.entityData.define(DATA_WOOL_ID, (byte)0); ++ this.entityData.define(Sheep.DATA_WOOL_ID, (byte) 0); + } + + @Override +@@ -154,24 +163,62 @@ + if (this.isSheared()) { + return this.getType().getDefaultLootTable(); + } else { +- return switch (this.getColor()) { +- case WHITE -> BuiltInLootTables.SHEEP_WHITE; +- case ORANGE -> BuiltInLootTables.SHEEP_ORANGE; +- case MAGENTA -> BuiltInLootTables.SHEEP_MAGENTA; +- case LIGHT_BLUE -> BuiltInLootTables.SHEEP_LIGHT_BLUE; +- case YELLOW -> BuiltInLootTables.SHEEP_YELLOW; +- case LIME -> BuiltInLootTables.SHEEP_LIME; +- case PINK -> BuiltInLootTables.SHEEP_PINK; +- case GRAY -> BuiltInLootTables.SHEEP_GRAY; +- case LIGHT_GRAY -> BuiltInLootTables.SHEEP_LIGHT_GRAY; +- case CYAN -> BuiltInLootTables.SHEEP_CYAN; +- case PURPLE -> BuiltInLootTables.SHEEP_PURPLE; +- case BLUE -> BuiltInLootTables.SHEEP_BLUE; +- case BROWN -> BuiltInLootTables.SHEEP_BROWN; +- case GREEN -> BuiltInLootTables.SHEEP_GREEN; +- case RED -> BuiltInLootTables.SHEEP_RED; +- case BLACK -> BuiltInLootTables.SHEEP_BLACK; +- }; ++ ResourceLocation minecraftkey; ++ ++ switch (this.getColor()) { ++ case WHITE: ++ minecraftkey = BuiltInLootTables.SHEEP_WHITE; ++ break; ++ case ORANGE: ++ minecraftkey = BuiltInLootTables.SHEEP_ORANGE; ++ break; ++ case MAGENTA: ++ minecraftkey = BuiltInLootTables.SHEEP_MAGENTA; ++ break; ++ case LIGHT_BLUE: ++ minecraftkey = BuiltInLootTables.SHEEP_LIGHT_BLUE; ++ break; ++ case YELLOW: ++ minecraftkey = BuiltInLootTables.SHEEP_YELLOW; ++ break; ++ case LIME: ++ minecraftkey = BuiltInLootTables.SHEEP_LIME; ++ break; ++ case PINK: ++ minecraftkey = BuiltInLootTables.SHEEP_PINK; ++ break; ++ case GRAY: ++ minecraftkey = BuiltInLootTables.SHEEP_GRAY; ++ break; ++ case LIGHT_GRAY: ++ minecraftkey = BuiltInLootTables.SHEEP_LIGHT_GRAY; ++ break; ++ case CYAN: ++ minecraftkey = BuiltInLootTables.SHEEP_CYAN; ++ break; ++ case PURPLE: ++ minecraftkey = BuiltInLootTables.SHEEP_PURPLE; ++ break; ++ case BLUE: ++ minecraftkey = BuiltInLootTables.SHEEP_BLUE; ++ break; ++ case BROWN: ++ minecraftkey = BuiltInLootTables.SHEEP_BROWN; ++ break; ++ case GREEN: ++ minecraftkey = BuiltInLootTables.SHEEP_GREEN; ++ break; ++ case RED: ++ minecraftkey = BuiltInLootTables.SHEEP_RED; ++ break; ++ case BLACK: ++ minecraftkey = BuiltInLootTables.SHEEP_BLACK; ++ break; ++ default: ++ throw new IncompatibleClassChangeError(); ++ } ++ ++ return minecraftkey; + } + } + +@@ -182,37 +229,39 @@ + } else { + super.handleEntityEvent(id); + } ++ + } + + public float getHeadEatPositionScale(float partialTick) { +- if (this.eatAnimationTick <= 0) { +- return 0.0F; +- } else if (this.eatAnimationTick >= 4 && this.eatAnimationTick <= 36) { +- return 1.0F; +- } else { +- return this.eatAnimationTick < 4 +- ? ((float)this.eatAnimationTick - partialTick) / 4.0F +- : -((float)(this.eatAnimationTick - 40) - partialTick) / 4.0F; +- } ++ return this.eatAnimationTick <= 0 ? 0.0F : (this.eatAnimationTick >= 4 && this.eatAnimationTick <= 36 ? 1.0F : (this.eatAnimationTick < 4 ? ((float) this.eatAnimationTick - partialTick) / 4.0F : -((float) (this.eatAnimationTick - 40) - partialTick) / 4.0F)); + } + + public float getHeadEatAngleScale(float partialTick) { + if (this.eatAnimationTick > 4 && this.eatAnimationTick <= 36) { +- float f = ((float)(this.eatAnimationTick - 4) - partialTick) / 32.0F; +- return (float) (Math.PI / 5) + 0.21991149F * Mth.sin(f * 28.7F); ++ float f1 = ((float) (this.eatAnimationTick - 4) - partialTick) / 32.0F; ++ ++ return 0.62831855F + 0.21991149F * Mth.sin(f1 * 28.7F); + } else { +- return this.eatAnimationTick > 0 ? (float) (Math.PI / 5) : this.getXRot() * (float) (Math.PI / 180.0); ++ return this.eatAnimationTick > 0 ? 0.62831855F : this.getXRot() * 0.017453292F; + } + } + + @Override +- public InteractionResult mobInteract(Player player, InteractionHand hand) { +- ItemStack itemInHand = player.getItemInHand(hand); +- if (itemInHand.is(Items.SHEARS)) { ++ public InteractionResult mobInteract(Player player, EnumHand hand) { ++ ItemStack itemstack = player.getItemInHand(hand); ++ ++ if (itemstack.is(Items.SHEARS)) { + if (!this.level().isClientSide && this.readyForShearing()) { ++ // CraftBukkit start ++ if (!CraftEventFactory.handlePlayerShearEntityEvent(player, this, itemstack, hand)) { ++ return InteractionResult.PASS; ++ } ++ // CraftBukkit end + this.shear(SoundSource.PLAYERS); + this.gameEvent(GameEvent.SHEAR, player); +- itemInHand.hurtAndBreak(1, player, entity -> entity.broadcastBreakEvent(hand)); ++ itemstack.hurtAndBreak(1, player, (entityhuman1) -> { ++ entityhuman1.broadcastBreakEvent(hand); ++ }); + return InteractionResult.SUCCESS; + } else { + return InteractionResult.CONSUME; +@@ -224,23 +273,20 @@ + + @Override + public void shear(SoundSource category) { +- this.level().playSound(null, this, SoundEvents.SHEEP_SHEAR, category, 1.0F, 1.0F); ++ this.level().playSound((Player) null, (Entity) this, SoundEvents.SHEEP_SHEAR, category, 1.0F, 1.0F); + this.setSheared(true); + int i = 1 + this.random.nextInt(3); + +- for (int i1 = 0; i1 < i; i1++) { +- ItemEntity itemEntity = this.spawnAtLocation(ITEM_BY_DYE.get(this.getColor()), 1); +- if (itemEntity != null) { +- itemEntity.setDeltaMovement( +- itemEntity.getDeltaMovement() +- .add( +- (double)((this.random.nextFloat() - this.random.nextFloat()) * 0.1F), +- (double)(this.random.nextFloat() * 0.05F), +- (double)((this.random.nextFloat() - this.random.nextFloat()) * 0.1F) +- ) +- ); ++ for (int j = 0; j < i; ++j) { ++ this.forceDrops = true; // CraftBukkit ++ ItemEntity entityitem = this.spawnAtLocation((IMaterial) Sheep.ITEM_BY_DYE.get(this.getColor()), 1); ++ this.forceDrops = false; // CraftBukkit ++ ++ if (entityitem != null) { ++ entityitem.setDeltaMovement(entityitem.getDeltaMovement().add((double) ((this.random.nextFloat() - this.random.nextFloat()) * 0.1F), (double) (this.random.nextFloat() * 0.05F), (double) ((this.random.nextFloat() - this.random.nextFloat()) * 0.1F))); + } + } ++ + } + + @Override +@@ -252,7 +298,7 @@ + public void addAdditionalSaveData(CompoundTag compound) { + super.addAdditionalSaveData(compound); + compound.putBoolean("Sheared", this.isSheared()); +- compound.putByte("Color", (byte)this.getColor().getId()); ++ compound.putByte("Color", (byte) this.getColor().getId()); + } + + @Override +@@ -278,93 +324,94 @@ + } + + @Override +- protected void playStepSound(BlockPos pos, BlockState block) { ++ protected void playStepSound(BlockPos pos, IBlockData block) { + this.playSound(SoundEvents.SHEEP_STEP, 0.15F, 1.0F); + } + + public DyeColor getColor() { +- return DyeColor.byId(this.entityData.get(DATA_WOOL_ID) & 15); ++ return DyeColor.byId((Byte) this.entityData.get(Sheep.DATA_WOOL_ID) & 15); + } + + public void setColor(DyeColor dyeColor) { +- byte b = this.entityData.get(DATA_WOOL_ID); +- this.entityData.set(DATA_WOOL_ID, (byte)(b & 240 | dyeColor.getId() & 15)); ++ byte b0 = (Byte) this.entityData.get(Sheep.DATA_WOOL_ID); ++ ++ this.entityData.set(Sheep.DATA_WOOL_ID, (byte) (b0 & 240 | dyeColor.getId() & 15)); + } + + public boolean isSheared() { +- return (this.entityData.get(DATA_WOOL_ID) & 16) != 0; ++ return ((Byte) this.entityData.get(Sheep.DATA_WOOL_ID) & 16) != 0; + } + + public void setSheared(boolean sheared) { +- byte b = this.entityData.get(DATA_WOOL_ID); ++ byte b0 = (Byte) this.entityData.get(Sheep.DATA_WOOL_ID); ++ + if (sheared) { +- this.entityData.set(DATA_WOOL_ID, (byte)(b | 16)); ++ this.entityData.set(Sheep.DATA_WOOL_ID, (byte) (b0 | 16)); + } else { +- this.entityData.set(DATA_WOOL_ID, (byte)(b & -17)); ++ this.entityData.set(Sheep.DATA_WOOL_ID, (byte) (b0 & -17)); + } ++ + } + + public static DyeColor getRandomSheepColor(RandomSource random) { +- int randomInt = random.nextInt(100); +- if (randomInt < 5) { +- return DyeColor.BLACK; +- } else if (randomInt < 10) { +- return DyeColor.GRAY; +- } else if (randomInt < 15) { +- return DyeColor.LIGHT_GRAY; +- } else if (randomInt < 18) { +- return DyeColor.BROWN; +- } else { +- return random.nextInt(500) == 0 ? DyeColor.PINK : DyeColor.WHITE; +- } ++ int i = random.nextInt(100); ++ ++ return i < 5 ? DyeColor.BLACK : (i < 10 ? DyeColor.GRAY : (i < 15 ? DyeColor.LIGHT_GRAY : (i < 18 ? DyeColor.BROWN : (random.nextInt(500) == 0 ? DyeColor.PINK : DyeColor.WHITE)))); + } + + @Nullable + @Override + public Sheep getBreedOffspring(ServerLevel level, AgeableMob otherParent) { +- Sheep sheep = EntityType.SHEEP.create(level); +- if (sheep != null) { +- sheep.setColor(this.getOffspringColor(this, (Sheep)otherParent)); ++ Sheep entitysheep = (Sheep) EntityType.SHEEP.create(level); ++ ++ if (entitysheep != null) { ++ entitysheep.setColor(this.getOffspringColor(this, (Sheep) otherParent)); + } + +- return sheep; ++ return entitysheep; + } + + @Override + public void ate() { ++ // CraftBukkit start ++ SheepRegrowWoolEvent event = new SheepRegrowWoolEvent((org.bukkit.entity.Sheep) this.getBukkitEntity()); ++ this.level().getCraftServer().getPluginManager().callEvent(event); ++ ++ if (event.isCancelled()) return; ++ // CraftBukkit end + super.ate(); + this.setSheared(false); + if (this.isBaby()) { + this.ageUp(60); + } ++ + } + + @Nullable + @Override +- public SpawnGroupData finalizeSpawn( +- ServerLevelAccessor level, DifficultyInstance difficulty, MobSpawnType reason, @Nullable SpawnGroupData spawnData, @Nullable CompoundTag dataTag +- ) { ++ public GroupDataEntity finalizeSpawn(ServerLevelAccessor level, DifficultyInstance difficulty, EnumMobSpawn reason, @Nullable GroupDataEntity spawnData, @Nullable CompoundTag dataTag) { + this.setColor(getRandomSheepColor(level.getRandom())); + return super.finalizeSpawn(level, difficulty, reason, spawnData, dataTag); + } + + private DyeColor getOffspringColor(Animal father, Animal mother) { +- DyeColor color = ((Sheep)father).getColor(); +- DyeColor color1 = ((Sheep)mother).getColor(); +- CraftingContainer craftingContainer = makeContainer(color, color1); +- return this.level() +- .getRecipeManager() +- .getRecipeFor(RecipeType.CRAFTING, craftingContainer, this.level()) +- .map(recipeHolder -> recipeHolder.value().assemble(craftingContainer, this.level().registryAccess())) +- .map(ItemStack::getItem) +- .filter(DyeItem.class::isInstance) +- .map(DyeItem.class::cast) +- .map(DyeItem::getDyeColor) +- .orElseGet(() -> this.level().random.nextBoolean() ? color : color1); ++ DyeColor enumcolor = ((Sheep) father).getColor(); ++ DyeColor enumcolor1 = ((Sheep) mother).getColor(); ++ InventoryCrafting inventorycrafting = makeContainer(enumcolor, enumcolor1); ++ Optional<Item> optional = this.level().getRecipeManager().getRecipeFor(RecipeType.CRAFTING, inventorycrafting, this.level()).map((recipeholder) -> { // CraftBukkit - decompile error ++ return ((RecipeCrafting) recipeholder.value()).assemble(inventorycrafting, this.level().registryAccess()); ++ }).map(ItemStack::getItem); ++ ++ Objects.requireNonNull(DyeItem.class); ++ optional = optional.filter(DyeItem.class::isInstance); ++ Objects.requireNonNull(DyeItem.class); ++ return (DyeColor) optional.map(DyeItem.class::cast).map(DyeItem::getDyeColor).orElseGet(() -> { ++ return this.level().random.nextBoolean() ? enumcolor : enumcolor1; ++ }); + } + +- private static CraftingContainer makeContainer(DyeColor fatherColor, DyeColor motherColor) { +- CraftingContainer craftingContainer = new TransientCraftingContainer(new AbstractContainerMenu(null, -1) { ++ private static InventoryCrafting makeContainer(DyeColor fatherColor, DyeColor motherColor) { ++ TransientCraftingContainer transientcraftingcontainer = new TransientCraftingContainer(new AbstractContainerMenu((MenuType) null, -1) { + @Override + public ItemStack quickMoveStack(Player player, int index) { + return ItemStack.EMPTY; +@@ -374,19 +421,28 @@ + public boolean stillValid(Player player) { + return false; + } ++ ++ // CraftBukkit start ++ @Override ++ public InventoryView getBukkitView() { ++ return null; // TODO: O.O ++ } ++ // CraftBukkit end + }, 2, 1); +- craftingContainer.setItem(0, new ItemStack(DyeItem.byColor(fatherColor))); +- craftingContainer.setItem(1, new ItemStack(DyeItem.byColor(motherColor))); +- return craftingContainer; ++ ++ transientcraftingcontainer.setItem(0, new ItemStack(DyeItem.byColor(fatherColor))); ++ transientcraftingcontainer.setItem(1, new ItemStack(DyeItem.byColor(motherColor))); ++ transientcraftingcontainer.resultInventory = new ResultContainer(); // CraftBukkit - add result slot for event ++ return transientcraftingcontainer; + } + + @Override +- protected float getStandingEyeHeight(Pose pose, EntityDimensions size) { ++ protected float getStandingEyeHeight(EntityPose pose, EntityDimensions size) { + return 0.95F * size.height; + } + + @Override +- protected Vector3f getPassengerAttachmentPoint(Entity entity, EntityDimensions entityDimensions, float f) { +- return new Vector3f(0.0F, entityDimensions.height - 0.0625F * f, 0.0F); ++ protected Vector3f getPassengerAttachmentPoint(Entity entity, EntityDimensions entitysize, float f) { ++ return new Vector3f(0.0F, entitysize.height - 0.0625F * f, 0.0F); + } + } |