diff --git a/Spigot-API-Patches/0166-Add-more-Witch-API.patch b/Spigot-API-Patches/0166-Add-more-Witch-API.patch new file mode 100644 index 0000000000..4c7b4a9dcc --- /dev/null +++ b/Spigot-API-Patches/0166-Add-more-Witch-API.patch @@ -0,0 +1,57 @@ +From 7ac07ac07ac07ac07ac07ac07ac07ac07ac07ac0 Mon Sep 17 00:00:00 2001 +From: BillyGalbreath +Date: Fri, 12 Oct 2018 03:47:26 -0500 +Subject: [PATCH] Add more Witch API + + +diff --git a/src/main/java/org/bukkit/entity/Witch.java b/src/main/java/org/bukkit/entity/Witch.java +index 7ac07ac07ac0..7ac07ac07ac0 100644 +--- a/src/main/java/org/bukkit/entity/Witch.java ++++ b/src/main/java/org/bukkit/entity/Witch.java +@@ -2,8 +2,42 @@ package org.bukkit.entity; + + import com.destroystokyo.paper.entity.RangedEntity; + ++// Paper start ++import org.bukkit.inventory.ItemStack; ++import javax.annotation.Nullable; ++// Paper end ++ + /** + * Represents a Witch + */ +-public interface Witch extends Monster, RangedEntity { // Paper ++// Paper start ++public interface Witch extends Monster, RangedEntity { ++ /** ++ * Check if Witch is drinking a potion ++ * ++ * @return True if drinking a potion ++ */ ++ boolean isDrinkingPotion(); ++ ++ /** ++ * Get time remaining (in ticks) the Witch is drinking a potion ++ * ++ * @return Time remaining (in ticks) ++ */ ++ int getPotionUseTimeLeft(); ++ ++ /** ++ * Get the potion the Witch is drinking ++ * ++ * @return The potion the witch is drinking ++ */ ++ ItemStack getDrinkingPotion(); ++ ++ /** ++ * Set the potion the Witch should drink ++ * ++ * @param potion Potion to drink ++ */ ++ void setDrinkingPotion(@Nullable ItemStack potion); ++ // Paper end + } +-- +2.19.1 + diff --git a/Spigot-Server-Patches/0004-MC-Utils.patch b/Spigot-Server-Patches/0004-MC-Utils.patch index ec33ac6f89..2881af5a4f 100644 --- a/Spigot-Server-Patches/0004-MC-Utils.patch +++ b/Spigot-Server-Patches/0004-MC-Utils.patch @@ -1,11 +1,26 @@ -From 8521645f1d0a690c7ba90ca59172f9dcec1df615 Mon Sep 17 00:00:00 2001 +From 9d3389fb2535b20a63c20203e34b59b5a83817e9 Mon Sep 17 00:00:00 2001 From: Aikar Date: Mon, 28 Mar 2016 20:55:47 -0400 Subject: [PATCH] MC Utils +diff --git a/src/main/java/net/minecraft/server/AttributeInstance.java b/src/main/java/net/minecraft/server/AttributeInstance.java +index 1c1a6a37a..0929e0189 100644 +--- a/src/main/java/net/minecraft/server/AttributeInstance.java ++++ b/src/main/java/net/minecraft/server/AttributeInstance.java +@@ -20,8 +20,10 @@ public interface AttributeInstance { + @Nullable + AttributeModifier a(UUID var1); + ++ default void addModifier(AttributeModifier modifier) { b(modifier); } // Paper - OBFHELPER + void b(AttributeModifier var1); + ++ default void removeModifier(AttributeModifier modifier) { c(modifier); } // Paper - OBFHELPER + void c(AttributeModifier var1); + + void b(UUID var1); diff --git a/src/main/java/net/minecraft/server/BlockPosition.java b/src/main/java/net/minecraft/server/BlockPosition.java -index 6ffc535146..5c5f19b4b4 100644 +index 6ffc53514..5c5f19b4b 100644 --- a/src/main/java/net/minecraft/server/BlockPosition.java +++ b/src/main/java/net/minecraft/server/BlockPosition.java @@ -9,7 +9,7 @@ import org.apache.logging.log4j.Logger; @@ -50,7 +65,7 @@ index 6ffc535146..5c5f19b4b4 100644 return this.c(MathHelper.floor(d0), MathHelper.floor(d1), MathHelper.floor(d2)); } diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java -index bc5e4a654a..d3eac35e4d 100644 +index bc5e4a654..d3eac35e4 100644 --- a/src/main/java/net/minecraft/server/Chunk.java +++ b/src/main/java/net/minecraft/server/Chunk.java @@ -28,7 +28,7 @@ import com.google.common.collect.Lists; // CraftBukkit @@ -71,7 +86,7 @@ index bc5e4a654a..d3eac35e4d 100644 public TileEntity a(BlockPosition blockposition, Chunk.EnumTileEntityState chunk_enumtileentitystate) { // CraftBukkit start diff --git a/src/main/java/net/minecraft/server/ChunkCoordIntPair.java b/src/main/java/net/minecraft/server/ChunkCoordIntPair.java -index 744762b8b9..d9608121b6 100644 +index 744762b8b..d9608121b 100644 --- a/src/main/java/net/minecraft/server/ChunkCoordIntPair.java +++ b/src/main/java/net/minecraft/server/ChunkCoordIntPair.java @@ -23,6 +23,8 @@ public class ChunkCoordIntPair { @@ -84,7 +99,7 @@ index 744762b8b9..d9608121b6 100644 return (long)i & 4294967295L | ((long)j & 4294967295L) << 32; } diff --git a/src/main/java/net/minecraft/server/ChunkTaskScheduler.java b/src/main/java/net/minecraft/server/ChunkTaskScheduler.java -index 3b6b3b9a99..22af9c1885 100644 +index 3b6b3b9a9..22af9c188 100644 --- a/src/main/java/net/minecraft/server/ChunkTaskScheduler.java +++ b/src/main/java/net/minecraft/server/ChunkTaskScheduler.java @@ -16,7 +16,7 @@ import org.apache.logging.log4j.Logger; @@ -97,7 +112,7 @@ index 3b6b3b9a99..22af9c1885 100644 private final IChunkLoader e; private final IAsyncTaskHandler f; diff --git a/src/main/java/net/minecraft/server/DataBits.java b/src/main/java/net/minecraft/server/DataBits.java -index 95ca5f6d80..0dc948a375 100644 +index 95ca5f6d8..0dc948a37 100644 --- a/src/main/java/net/minecraft/server/DataBits.java +++ b/src/main/java/net/minecraft/server/DataBits.java @@ -54,6 +54,7 @@ public class DataBits { @@ -109,7 +124,7 @@ index 95ca5f6d80..0dc948a375 100644 return this.a; } diff --git a/src/main/java/net/minecraft/server/DataPalette.java b/src/main/java/net/minecraft/server/DataPalette.java -index 7f905b1e09..fa5b9262b4 100644 +index 7f905b1e0..fa5b9262b 100644 --- a/src/main/java/net/minecraft/server/DataPalette.java +++ b/src/main/java/net/minecraft/server/DataPalette.java @@ -3,10 +3,11 @@ package net.minecraft.server; @@ -127,7 +142,7 @@ index 7f905b1e09..fa5b9262b4 100644 void b(PacketDataSerializer var1); diff --git a/src/main/java/net/minecraft/server/DataPaletteBlock.java b/src/main/java/net/minecraft/server/DataPaletteBlock.java -index 304e47bf20..6e7454b134 100644 +index 304e47bf2..6e7454b13 100644 --- a/src/main/java/net/minecraft/server/DataPaletteBlock.java +++ b/src/main/java/net/minecraft/server/DataPaletteBlock.java @@ -7,7 +7,7 @@ import java.util.function.Function; @@ -169,7 +184,7 @@ index 304e47bf20..6e7454b134 100644 this.b(); packetdataserializer.writeByte(this.i); diff --git a/src/main/java/net/minecraft/server/EntityCreature.java b/src/main/java/net/minecraft/server/EntityCreature.java -index 2c6fbd1d6f..a5c147b989 100644 +index 2c6fbd1d6..a5c147b98 100644 --- a/src/main/java/net/minecraft/server/EntityCreature.java +++ b/src/main/java/net/minecraft/server/EntityCreature.java @@ -6,6 +6,7 @@ import org.bukkit.event.entity.EntityUnleashEvent; @@ -181,7 +196,7 @@ index 2c6fbd1d6f..a5c147b989 100644 private float b; diff --git a/src/main/java/net/minecraft/server/EntityInsentient.java b/src/main/java/net/minecraft/server/EntityInsentient.java -index ebb177927f..60b1dcd8ea 100644 +index ebb177927..60b1dcd8e 100644 --- a/src/main/java/net/minecraft/server/EntityInsentient.java +++ b/src/main/java/net/minecraft/server/EntityInsentient.java @@ -124,6 +124,7 @@ public abstract class EntityInsentient extends EntityLiving { @@ -193,7 +208,7 @@ index ebb177927f..60b1dcd8ea 100644 // CraftBukkit start - fire event setGoalTarget(entityliving, EntityTargetEvent.TargetReason.UNKNOWN, true); diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java -index 1aefd3763a..76cc9085bd 100644 +index 1aefd3763..76cc9085b 100644 --- a/src/main/java/net/minecraft/server/EntityLiving.java +++ b/src/main/java/net/minecraft/server/EntityLiving.java @@ -122,6 +122,7 @@ public abstract class EntityLiving extends Entity { @@ -205,10 +220,10 @@ index 1aefd3763a..76cc9085bd 100644 @Override public float getBukkitYaw() { diff --git a/src/main/java/net/minecraft/server/EntityMonster.java b/src/main/java/net/minecraft/server/EntityMonster.java -index c0f48bbc29..f3cc2cef0a 100644 +index c0f48bbc2..a0e3b72c1 100644 --- a/src/main/java/net/minecraft/server/EntityMonster.java +++ b/src/main/java/net/minecraft/server/EntityMonster.java -@@ -1,6 +1,8 @@ +@@ -1,11 +1,14 @@ package net.minecraft.server; public abstract class EntityMonster extends EntityCreature implements IMonster { @@ -217,8 +232,14 @@ index c0f48bbc29..f3cc2cef0a 100644 protected EntityMonster(EntityTypes entitytypes, World world) { super(entitytypes, world); this.b_ = 5; + } + ++ public SoundCategory getSoundCategory() { return bV(); } // Paper - OBFHELPER + public SoundCategory bV() { + return SoundCategory.HOSTILE; + } diff --git a/src/main/java/net/minecraft/server/EntityTypes.java b/src/main/java/net/minecraft/server/EntityTypes.java -index 17bfa356f1..5c1ab6a0b6 100644 +index 17bfa356f..5c1ab6a0b 100644 --- a/src/main/java/net/minecraft/server/EntityTypes.java +++ b/src/main/java/net/minecraft/server/EntityTypes.java @@ -3,6 +3,7 @@ package net.minecraft.server; @@ -269,7 +290,7 @@ index 17bfa356f1..5c1ab6a0b6 100644 // Paper end } diff --git a/src/main/java/net/minecraft/server/ItemStack.java b/src/main/java/net/minecraft/server/ItemStack.java -index c54275bc2f..318c4204df 100644 +index c54275bc2..318c4204d 100644 --- a/src/main/java/net/minecraft/server/ItemStack.java +++ b/src/main/java/net/minecraft/server/ItemStack.java @@ -26,6 +26,7 @@ import org.bukkit.TreeType; @@ -300,7 +321,7 @@ index c54275bc2f..318c4204df 100644 } diff --git a/src/main/java/net/minecraft/server/MCUtil.java b/src/main/java/net/minecraft/server/MCUtil.java new file mode 100644 -index 0000000000..c97e116aaf +index 000000000..c97e116aa --- /dev/null +++ b/src/main/java/net/minecraft/server/MCUtil.java @@ -0,0 +1,316 @@ @@ -621,7 +642,7 @@ index 0000000000..c97e116aaf + } +} diff --git a/src/main/java/net/minecraft/server/NBTTagCompound.java b/src/main/java/net/minecraft/server/NBTTagCompound.java -index 41cd3ceabe..2a66a30264 100644 +index 41cd3ceab..2a66a3026 100644 --- a/src/main/java/net/minecraft/server/NBTTagCompound.java +++ b/src/main/java/net/minecraft/server/NBTTagCompound.java @@ -23,7 +23,7 @@ import org.apache.logging.log4j.Logger; @@ -666,7 +687,7 @@ index 41cd3ceabe..2a66a30264 100644 } } diff --git a/src/main/java/net/minecraft/server/NetworkManager.java b/src/main/java/net/minecraft/server/NetworkManager.java -index 0afaea8109..26da897243 100644 +index 0afaea810..26da89724 100644 --- a/src/main/java/net/minecraft/server/NetworkManager.java +++ b/src/main/java/net/minecraft/server/NetworkManager.java @@ -44,7 +44,7 @@ public class NetworkManager extends SimpleChannelInboundHandler> { @@ -707,7 +728,7 @@ index 0afaea8109..26da897243 100644 public QueuedPacket(Packet packet, @Nullable GenericFutureListener> genericfuturelistener) { this.a = packet; diff --git a/src/main/java/net/minecraft/server/PacketDataSerializer.java b/src/main/java/net/minecraft/server/PacketDataSerializer.java -index d04afceb70..a63a5811d6 100644 +index d04afceb7..a63a5811d 100644 --- a/src/main/java/net/minecraft/server/PacketDataSerializer.java +++ b/src/main/java/net/minecraft/server/PacketDataSerializer.java @@ -33,6 +33,7 @@ public class PacketDataSerializer extends ByteBuf { @@ -719,7 +740,7 @@ index d04afceb70..a63a5811d6 100644 for (int j = 1; j < 5; ++j) { if ((i & -1 << j * 7) == 0) { diff --git a/src/main/java/net/minecraft/server/PacketEncoder.java b/src/main/java/net/minecraft/server/PacketEncoder.java -index 8e312c7617..c20911c965 100644 +index 8e312c761..c20911c96 100644 --- a/src/main/java/net/minecraft/server/PacketEncoder.java +++ b/src/main/java/net/minecraft/server/PacketEncoder.java @@ -38,6 +38,7 @@ public class PacketEncoder extends MessageToByteEncoder> { @@ -731,7 +752,7 @@ index 8e312c7617..c20911c965 100644 throw new SkipEncodeException(throwable); } else { diff --git a/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java b/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java -index 12d6c99cf0..af382815f3 100644 +index 12d6c99cf..af382815f 100644 --- a/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java +++ b/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java @@ -11,7 +11,7 @@ public class PacketPlayOutMapChunk implements Packet { @@ -752,7 +773,7 @@ index 12d6c99cf0..af382815f3 100644 int j = 0; ChunkSection[] achunksection = chunk.getSections(); diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index d455eadfc7..8db0b6a6db 100644 +index d455eadfc..8db0b6a6d 100644 --- a/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java @@ -68,9 +68,9 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable { @@ -768,8 +789,20 @@ index d455eadfc7..8db0b6a6db 100644 // CraftBukkit start - multithreaded fields private volatile int chatThrottle; private static final AtomicIntegerFieldUpdater chatSpamField = AtomicIntegerFieldUpdater.newUpdater(PlayerConnection.class, "chatThrottle"); +diff --git a/src/main/java/net/minecraft/server/PotionUtil.java b/src/main/java/net/minecraft/server/PotionUtil.java +index 8fce3b022..58ac6eafc 100644 +--- a/src/main/java/net/minecraft/server/PotionUtil.java ++++ b/src/main/java/net/minecraft/server/PotionUtil.java +@@ -103,6 +103,7 @@ public class PotionUtil { + return nbttagcompound == null ? Potions.EMPTY : PotionRegistry.a(nbttagcompound.getString("Potion")); + } + ++ public static ItemStack addPotionToItemStack(ItemStack itemstack, PotionRegistry potionregistry) { return a(itemstack, potionregistry); } // Paper - OBFHELPER + public static ItemStack a(ItemStack itemstack, PotionRegistry potionregistry) { + MinecraftKey minecraftkey = IRegistry.POTION.getKey(potionregistry); + if (potionregistry == Potions.EMPTY) { diff --git a/src/main/java/net/minecraft/server/RegistryBlockID.java b/src/main/java/net/minecraft/server/RegistryBlockID.java -index a21006290c..6c6f006f3a 100644 +index a21006290..6c6f006f3 100644 --- a/src/main/java/net/minecraft/server/RegistryBlockID.java +++ b/src/main/java/net/minecraft/server/RegistryBlockID.java @@ -54,6 +54,7 @@ public class RegistryBlockID implements Registry { @@ -781,7 +814,7 @@ index a21006290c..6c6f006f3a 100644 return this.b.size(); } diff --git a/src/main/java/net/minecraft/server/SystemUtils.java b/src/main/java/net/minecraft/server/SystemUtils.java -index 1f1cb6a1b2..ced573d7fb 100644 +index 1f1cb6a1b..ced573d7f 100644 --- a/src/main/java/net/minecraft/server/SystemUtils.java +++ b/src/main/java/net/minecraft/server/SystemUtils.java @@ -34,8 +34,8 @@ public class SystemUtils { @@ -828,5 +861,5 @@ index 1f1cb6a1b2..ced573d7fb 100644 static enum IdentityHashingStrategy implements Strategy { -- -2.19.0 +2.19.1 diff --git a/Spigot-Server-Patches/0070-Optimized-Light-Level-Comparisons.patch b/Spigot-Server-Patches/0070-Optimized-Light-Level-Comparisons.patch index 808372244e..d8f0b5dda7 100644 --- a/Spigot-Server-Patches/0070-Optimized-Light-Level-Comparisons.patch +++ b/Spigot-Server-Patches/0070-Optimized-Light-Level-Comparisons.patch @@ -1,4 +1,4 @@ -From d1ca33ace69f0cd276ba58742fe9ff06482f4473 Mon Sep 17 00:00:00 2001 +From 60d9338b4bfe222121bb95d4df8955d906629b31 Mon Sep 17 00:00:00 2001 From: Aikar Date: Fri, 18 Mar 2016 21:22:56 -0400 Subject: [PATCH] Optimized Light Level Comparisons @@ -8,7 +8,7 @@ Use an optimized method to test if a block position meets a desired light level. This method benefits from returning as soon as the desired light level matches. diff --git a/src/main/java/net/minecraft/server/BlockCrops.java b/src/main/java/net/minecraft/server/BlockCrops.java -index 1506c9ede0..6ae6fc3ecb 100644 +index 1506c9ede..6ae6fc3ec 100644 --- a/src/main/java/net/minecraft/server/BlockCrops.java +++ b/src/main/java/net/minecraft/server/BlockCrops.java @@ -44,7 +44,7 @@ public class BlockCrops extends BlockPlant implements IBlockFragilePlantElement @@ -21,7 +21,7 @@ index 1506c9ede0..6ae6fc3ecb 100644 if (i < this.e()) { diff --git a/src/main/java/net/minecraft/server/BlockSapling.java b/src/main/java/net/minecraft/server/BlockSapling.java -index 42478d1fed..7426d14cbf 100644 +index 42478d1fe..7426d14cb 100644 --- a/src/main/java/net/minecraft/server/BlockSapling.java +++ b/src/main/java/net/minecraft/server/BlockSapling.java @@ -30,7 +30,7 @@ public class BlockSapling extends BlockPlant implements IBlockFragilePlantElemen @@ -34,7 +34,7 @@ index 42478d1fed..7426d14cbf 100644 world.captureTreeGeneration = true; // CraftBukkit end diff --git a/src/main/java/net/minecraft/server/BlockStem.java b/src/main/java/net/minecraft/server/BlockStem.java -index dd309030e5..7cddfc380c 100644 +index dd309030e..7cddfc380 100644 --- a/src/main/java/net/minecraft/server/BlockStem.java +++ b/src/main/java/net/minecraft/server/BlockStem.java @@ -27,7 +27,7 @@ public class BlockStem extends BlockPlant implements IBlockFragilePlantElement { @@ -47,10 +47,10 @@ index dd309030e5..7cddfc380c 100644 if (random.nextInt((int) ((100.0F / (this == Blocks.PUMPKIN_STEM ? world.spigotConfig.pumpkinModifier : world.spigotConfig.melonModifier)) * (25.0F / f)) + 1) == 0) { // Spigot diff --git a/src/main/java/net/minecraft/server/EntityMonster.java b/src/main/java/net/minecraft/server/EntityMonster.java -index f3cc2cef0a..7cba60e475 100644 +index a0e3b72c1..f6231f3e5 100644 --- a/src/main/java/net/minecraft/server/EntityMonster.java +++ b/src/main/java/net/minecraft/server/EntityMonster.java -@@ -63,8 +63,18 @@ public abstract class EntityMonster extends EntityCreature implements IMonster { +@@ -64,8 +64,18 @@ public abstract class EntityMonster extends EntityCreature implements IMonster { if (this.world.getBrightness(EnumSkyBlock.SKY, blockposition) > this.random.nextInt(32)) { return false; } else { @@ -72,7 +72,7 @@ index f3cc2cef0a..7cba60e475 100644 } diff --git a/src/main/java/net/minecraft/server/EntityZombie.java b/src/main/java/net/minecraft/server/EntityZombie.java -index 1ab3072cc3..e5170bff5b 100644 +index 1ab3072cc..e5170bff5 100644 --- a/src/main/java/net/minecraft/server/EntityZombie.java +++ b/src/main/java/net/minecraft/server/EntityZombie.java @@ -263,7 +263,7 @@ public class EntityZombie extends EntityMonster { @@ -85,5 +85,5 @@ index 1ab3072cc3..e5170bff5b 100644 if (!this.world.isPlayerNearby((double) i1, (double) j1, (double) k1, 7.0D) && this.world.a_(entityzombie, entityzombie.getBoundingBox()) && this.world.getCubes(entityzombie, entityzombie.getBoundingBox()) && !this.world.containsLiquid(entityzombie.getBoundingBox())) { this.world.addEntity(entityzombie, CreatureSpawnEvent.SpawnReason.REINFORCEMENTS); // CraftBukkit -- -2.19.0 +2.19.1 diff --git a/Spigot-Server-Patches/0399-Add-more-Witch-API.patch b/Spigot-Server-Patches/0399-Add-more-Witch-API.patch new file mode 100644 index 0000000000..692c55ec9e --- /dev/null +++ b/Spigot-Server-Patches/0399-Add-more-Witch-API.patch @@ -0,0 +1,140 @@ +From 7ac07ac07ac07ac07ac07ac07ac07ac07ac07ac0 Mon Sep 17 00:00:00 2001 +From: BillyGalbreath +Date: Fri, 12 Oct 2018 14:10:46 -0500 +Subject: [PATCH] Add more Witch API + + +diff --git a/src/main/java/net/minecraft/server/EntityWitch.java b/src/main/java/net/minecraft/server/EntityWitch.java +index 7ac07ac07ac0..7ac07ac07ac0 100644 +--- a/src/main/java/net/minecraft/server/EntityWitch.java ++++ b/src/main/java/net/minecraft/server/EntityWitch.java +@@ -1,5 +1,11 @@ + package net.minecraft.server; + ++// Paper start ++import com.destroystokyo.paper.event.entity.WitchReadyPotionEvent; ++import org.bukkit.craftbukkit.inventory.CraftItemStack; ++import org.bukkit.entity.Witch; ++// Paper end ++ + import java.util.Iterator; + import java.util.List; + import java.util.UUID; +@@ -8,9 +14,9 @@ import javax.annotation.Nullable; + public class EntityWitch extends EntityMonster implements IRangedEntity { + + private static final UUID a = UUID.fromString("5CD17E52-A79A-43D3-A529-90FDE04B181E"); +- private static final AttributeModifier b = (new AttributeModifier(EntityWitch.a, "Drinking speed penalty", -0.25D, 0)).a(false); ++ private static final AttributeModifier b = (new AttributeModifier(EntityWitch.a, "Drinking speed penalty", -0.25D, 0)).a(false); private static final AttributeModifier DRINKING_SPEED = b; // Paper - OBFHELPER + private static final DataWatcherObject c = DataWatcher.a(EntityWitch.class, DataWatcherRegistry.i); +- private int bC; ++ private int bC; public int getPotionUseTimeLeft() { return bC; } public void setPotionUseTimeLeft(int timeLeft) { bC = timeLeft; } // Paper - OBFHELPER + + public EntityWitch(World world) { + super(EntityTypes.WITCH, world); +@@ -44,10 +50,12 @@ public class EntityWitch extends EntityMonster implements IRangedEntity { + return SoundEffects.ENTITY_WITCH_DEATH; + } + ++ public void setDrinkingPotion(boolean drinkingPotion) { a(drinkingPotion); } // Paper - OBFHELPER + public void a(boolean flag) { + this.getDataWatcher().set(EntityWitch.c, Boolean.valueOf(flag)); + } + ++ public boolean isDrinkingPotion() { return l(); } // Paper - OBFHELPER + public boolean l() { + return ((Boolean) this.getDataWatcher().get(EntityWitch.c)).booleanValue(); + } +@@ -100,18 +108,17 @@ public class EntityWitch extends EntityMonster implements IRangedEntity { + } + + if (potionregistry != null) { +- // Paper start +- ItemStack potion = PotionUtil.a(new ItemStack(Items.POTION), potionregistry); +- org.bukkit.inventory.ItemStack bukkitStack = com.destroystokyo.paper.event.entity.WitchReadyPotionEvent.process((org.bukkit.entity.Witch) this.getBukkitEntity(), org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(potion)); +- this.setSlot(EnumItemSlot.MAINHAND, org.bukkit.craftbukkit.inventory.CraftItemStack.asNMSCopy(bukkitStack)); ++ // Paper start - moved all this down into its own method ++ //this.setSlot(EnumItemSlot.MAINHAND, PotionUtil.a(new ItemStack(Items.POTION), potionregistry)); ++ //this.bC = this.getItemInMainHand().k(); ++ //this.a(true); ++ //this.world.a((EntityHuman) null, this.locX, this.locY, this.locZ, SoundEffects.ENTITY_WITCH_DRINK, this.bV(), 1.0F, 0.8F + this.random.nextFloat() * 0.4F); ++ //AttributeInstance attributeinstance = this.getAttributeInstance(GenericAttributes.MOVEMENT_SPEED); ++ //attributeinstance.c(EntityWitch.b); ++ //attributeinstance.b(EntityWitch.b); ++ ++ setDrinkingPotion(PotionUtil.addPotionToItemStack(new ItemStack(Items.POTION), potionregistry)); + // Paper end +- this.bC = this.getItemInMainHand().k(); +- this.a(true); +- this.world.a((EntityHuman) null, this.locX, this.locY, this.locZ, SoundEffects.ENTITY_WITCH_DRINK, this.bV(), 1.0F, 0.8F + this.random.nextFloat() * 0.4F); +- AttributeInstance attributeinstance = this.getAttributeInstance(GenericAttributes.MOVEMENT_SPEED); +- +- attributeinstance.c(EntityWitch.b); +- attributeinstance.b(EntityWitch.b); + } + } + +@@ -123,6 +130,18 @@ public class EntityWitch extends EntityMonster implements IRangedEntity { + super.k(); + } + ++ // Paper start ++ public void setDrinkingPotion(ItemStack potion) { ++ setSlot(EnumItemSlot.MAINHAND, CraftItemStack.asNMSCopy(WitchReadyPotionEvent.process((Witch) getBukkitEntity(), CraftItemStack.asCraftMirror(potion)))); ++ setPotionUseTimeLeft(getItemInMainHand().getItemUseMaxDuration()); ++ setDrinkingPotion(true); ++ world.sendSoundEffect(null, locX, locY, locZ, SoundEffects.ENTITY_WITCH_DRINK, getSoundCategory(), 1.0F, 0.8F + random.nextFloat() * 0.4F); ++ AttributeInstance attributeinstance = getAttributeInstance(GenericAttributes.MOVEMENT_SPEED); ++ attributeinstance.removeModifier(EntityWitch.DRINKING_SPEED); ++ attributeinstance.addModifier(EntityWitch.DRINKING_SPEED); ++ } ++ // Paper end ++ + protected float applyMagicModifier(DamageSource damagesource, float f) { + f = super.applyMagicModifier(damagesource, f); + if (damagesource.getEntity() == this) { +diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftWitch.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftWitch.java +index 7ac07ac07ac0..7ac07ac07ac0 100644 +--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftWitch.java ++++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftWitch.java +@@ -6,6 +6,13 @@ import org.bukkit.craftbukkit.CraftServer; + import org.bukkit.entity.Witch; + import org.bukkit.entity.EntityType; + ++// Paper start ++import com.google.common.base.Preconditions; ++import org.bukkit.Material; ++import org.bukkit.craftbukkit.inventory.CraftItemStack; ++import org.bukkit.inventory.ItemStack; ++// Paper end ++ + public class CraftWitch extends CraftMonster implements Witch, CraftRangedEntity { // Paper + public CraftWitch(CraftServer server, EntityWitch entity) { + super(server, entity); +@@ -24,4 +31,23 @@ public class CraftWitch extends CraftMonster implements Witch, CraftRangedEntity + public EntityType getType() { + return EntityType.WITCH; + } ++ ++ // Paper start ++ public boolean isDrinkingPotion() { ++ return getHandle().isDrinkingPotion(); ++ } ++ ++ public int getPotionUseTimeLeft() { ++ return getHandle().getPotionUseTimeLeft(); ++ } ++ ++ public ItemStack getDrinkingPotion() { ++ return CraftItemStack.asCraftMirror(getHandle().getItemInMainHand()); ++ } ++ ++ public void setDrinkingPotion(ItemStack potion) { ++ Preconditions.checkArgument(potion == null || potion.getType().isEmpty() || potion.getType() == Material.POTION, "must be potion, air, or null"); ++ getHandle().setDrinkingPotion(CraftItemStack.asNMSCopy(potion)); ++ } ++ // Paper end + } +-- +2.19.1 +