aboutsummaryrefslogtreecommitdiffhomepage
path: root/patch-remap/mache-spigotflower-stripped/net/minecraft/world/entity/animal/Sheep.java.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patch-remap/mache-spigotflower-stripped/net/minecraft/world/entity/animal/Sheep.java.patch')
-rw-r--r--patch-remap/mache-spigotflower-stripped/net/minecraft/world/entity/animal/Sheep.java.patch73
1 files changed, 73 insertions, 0 deletions
diff --git a/patch-remap/mache-spigotflower-stripped/net/minecraft/world/entity/animal/Sheep.java.patch b/patch-remap/mache-spigotflower-stripped/net/minecraft/world/entity/animal/Sheep.java.patch
new file mode 100644
index 0000000000..9669ced77d
--- /dev/null
+++ b/patch-remap/mache-spigotflower-stripped/net/minecraft/world/entity/animal/Sheep.java.patch
@@ -0,0 +1,73 @@
+--- a/net/minecraft/world/entity/animal/Sheep.java
++++ b/net/minecraft/world/entity/animal/Sheep.java
+@@ -65,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 {
+
+@@ -253,6 +252,11 @@
+
+ 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);
+ itemstack.hurtAndBreak(1, player, (player1) -> {
+@@ -275,7 +278,9 @@
+ int i = 1 + this.random.nextInt(3);
+
+ for (int j = 0; j < i; ++j) {
+- ItemEntity itementity = this.spawnAtLocation((ItemLike) Sheep.ITEM_BY_DYE.get(this.getColor()), 1);
++ this.forceDrops = true; // CraftBukkit
++ ItemEntity entityitem = this.spawnAtLocation((IMaterial) Sheep.ITEM_BY_DYE.get(this.getColor()), 1);
++ this.forceDrops = false; // CraftBukkit
+
+ 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)));
+@@ -377,6 +373,12 @@
+ @Override
+ @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()) {
+@@ -422,10 +421,18 @@
+ public boolean stillValid(Player player) {
+ return false;
+ }
++
++ // CraftBukkit start
++ @Override
++ public InventoryView getBukkitView() {
++ return null; // TODO: O.O
++ }
++ // CraftBukkit end
+ }, 2, 1);
+
+- transientcraftingcontainer.setItem(0, new ItemStack(DyeItem.byColor(dyecolor)));
+- transientcraftingcontainer.setItem(1, new ItemStack(DyeItem.byColor(dyecolor1)));
++ 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;
+ }
+