diff options
Diffstat (limited to 'patch-remap/mache-vineflower-stripped/net/minecraft/world/entity/animal/Sheep.java.patch')
-rw-r--r-- | patch-remap/mache-vineflower-stripped/net/minecraft/world/entity/animal/Sheep.java.patch | 89 |
1 files changed, 89 insertions, 0 deletions
diff --git a/patch-remap/mache-vineflower-stripped/net/minecraft/world/entity/animal/Sheep.java.patch b/patch-remap/mache-vineflower-stripped/net/minecraft/world/entity/animal/Sheep.java.patch new file mode 100644 index 0000000000..d2e75670e0 --- /dev/null +++ b/patch-remap/mache-vineflower-stripped/net/minecraft/world/entity/animal/Sheep.java.patch @@ -0,0 +1,89 @@ +--- a/net/minecraft/world/entity/animal/Sheep.java ++++ b/net/minecraft/world/entity/animal/Sheep.java +@@ -64,6 +64,13 @@ + 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; +@@ -210,6 +252,11 @@ + ItemStack itemInHand = player.getItemInHand(hand); + if (itemInHand.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)); +@@ -228,17 +277,13 @@ + 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))); + } + } + } +@@ -332,6 +373,12 @@ + + @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()) { +@@ -374,10 +421,19 @@ + 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 |