diff --git a/Spigot-API-Patches/AnvilDamageEvent.patch b/Spigot-API-Patches/AnvilDamageEvent.patch new file mode 100644 index 0000000000..d6d5ec79e7 --- /dev/null +++ b/Spigot-API-Patches/AnvilDamageEvent.patch @@ -0,0 +1,152 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: BillyGalbreath +Date: Fri, 20 Jul 2018 23:36:55 -0500 +Subject: [PATCH] AnvilDamageEvent + + +diff --git a/src/main/java/com/destroystokyo/paper/event/block/AnvilDamagedEvent.java b/src/main/java/com/destroystokyo/paper/event/block/AnvilDamagedEvent.java +new file mode 100644 +index 00000000..fd3c5c02 +--- /dev/null ++++ b/src/main/java/com/destroystokyo/paper/event/block/AnvilDamagedEvent.java +@@ -0,0 +0,0 @@ ++package com.destroystokyo.paper.event.block; ++ ++import org.bukkit.Material; ++import org.bukkit.block.data.BlockData; ++import org.bukkit.event.Cancellable; ++import org.bukkit.event.HandlerList; ++import org.bukkit.event.inventory.InventoryEvent; ++import org.bukkit.inventory.AnvilInventory; ++import org.bukkit.inventory.InventoryView; ++ ++/** ++ * Called when an anvil is damaged from being used ++ */ ++public class AnvilDamagedEvent extends InventoryEvent implements Cancellable { ++ private static final HandlerList handlers = new HandlerList(); ++ private boolean cancel; ++ private DamageState damageState; ++ ++ public AnvilDamagedEvent(InventoryView inventory, BlockData blockData) { ++ super(inventory); ++ this.damageState = DamageState.getState(blockData); ++ } ++ ++ @Override ++ public AnvilInventory getInventory() { ++ return (AnvilInventory) super.getInventory(); ++ } ++ ++ /** ++ * Gets the new state of damage on the anvil ++ * ++ * @return Damage state ++ */ ++ public DamageState getDamageState() { ++ return damageState; ++ } ++ ++ /** ++ * Sets the new state of damage on the anvil ++ * ++ * @param damageState Damage state ++ */ ++ public void setDamageState(DamageState damageState) { ++ this.damageState = damageState; ++ } ++ ++ /** ++ * Gets if anvil is breaking on this use ++ * ++ * @return True if breaking ++ */ ++ public boolean isBreaking() { ++ return damageState == DamageState.BROKEN; ++ } ++ ++ /** ++ * Sets if anvil is breaking on this use ++ * ++ * @param breaking True if breaking ++ */ ++ public void setBreaking(boolean breaking) { ++ if (breaking) { ++ damageState = DamageState.BROKEN; ++ } else if (damageState == DamageState.BROKEN) { ++ damageState = DamageState.DAMAGED; ++ } ++ } ++ ++ public boolean isCancelled() { ++ return cancel; ++ } ++ ++ public void setCancelled(boolean cancel) { ++ this.cancel = cancel; ++ } ++ ++ public HandlerList getHandlers() { ++ return handlers; ++ } ++ ++ public static HandlerList getHandlerList() { ++ return handlers; ++ } ++ ++ /** ++ * Represents the amount of damage on an anvil block ++ */ ++ public enum DamageState { ++ FULL(Material.ANVIL), ++ CHIPPED(Material.CHIPPED_ANVIL), ++ DAMAGED(Material.DAMAGED_ANVIL), ++ BROKEN(Material.AIR); ++ ++ private Material material; ++ ++ DamageState(Material material) { ++ this.material = material; ++ } ++ ++ /** ++ * Get block material of this state ++ * ++ * @return Material ++ */ ++ public Material getMaterial() { ++ return material; ++ } ++ ++ /** ++ * Get damaged state by block data ++ * ++ * @param blockData Block data ++ * @return DamageState ++ * @throws IllegalArgumentException If non anvil block data is given ++ */ ++ public static DamageState getState(BlockData blockData) { ++ return blockData == null ? BROKEN : getState(blockData.getMaterial()); ++ } ++ ++ /** ++ * Get damaged state by block material ++ * ++ * @param material Block material ++ * @return DamageState ++ * @throws IllegalArgumentException If non anvil material is given ++ */ ++ public static DamageState getState(Material material) { ++ if (material == null) { ++ return BROKEN; ++ } ++ for (DamageState state : values()) { ++ if (state.material == material) { ++ return state; ++ } ++ } ++ throw new IllegalArgumentException("Material not an anvil"); ++ } ++ } ++} +-- \ No newline at end of file diff --git a/Spigot-API-Patches/Expand-Location-Manipulation-API.patch b/Spigot-API-Patches/Expand-Location-Manipulation-API.patch index 8d7b116056..b4fc93e736 100644 --- a/Spigot-API-Patches/Expand-Location-Manipulation-API.patch +++ b/Spigot-API-Patches/Expand-Location-Manipulation-API.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Expand Location Manipulation API Adds set(x, y, z), add(base, x, y, z), subtract(base, x, y, z); diff --git a/src/main/java/org/bukkit/Location.java b/src/main/java/org/bukkit/Location.java -index d0d86e1a4..253f0c2d5 100644 +index d0d86e1a..253f0c2d 100644 --- a/src/main/java/org/bukkit/Location.java +++ b/src/main/java/org/bukkit/Location.java @@ -0,0 +0,0 @@ public class Location implements Cloneable, ConfigurationSerializable { diff --git a/Spigot-Server-Patches/Always-process-chunk-removal-in-removeEntity.patch b/Spigot-Server-Patches/Always-process-chunk-removal-in-removeEntity.patch index c47495109f..7ef1936840 100644 --- a/Spigot-Server-Patches/Always-process-chunk-removal-in-removeEntity.patch +++ b/Spigot-Server-Patches/Always-process-chunk-removal-in-removeEntity.patch @@ -8,7 +8,7 @@ which can keep them in the chunk when they shouldnt be if done during entity ticking. diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index 89d0127af..f8458a2b4 100644 +index 89d0127afd..f8458a2b49 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java @@ -0,0 +0,0 @@ public abstract class World implements GeneratorAccess, IIBlockAccess, AutoClose diff --git a/Spigot-Server-Patches/AnvilDamageEvent.patch b/Spigot-Server-Patches/AnvilDamageEvent.patch new file mode 100644 index 0000000000..a1c89e5459 --- /dev/null +++ b/Spigot-Server-Patches/AnvilDamageEvent.patch @@ -0,0 +1,28 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: BillyGalbreath +Date: Fri, 20 Jul 2018 23:37:03 -0500 +Subject: [PATCH] AnvilDamageEvent + + +diff --git a/src/main/java/net/minecraft/server/ContainerAnvil.java b/src/main/java/net/minecraft/server/ContainerAnvil.java +index fb3413d81e..9f20348d0c 100644 +--- a/src/main/java/net/minecraft/server/ContainerAnvil.java ++++ b/src/main/java/net/minecraft/server/ContainerAnvil.java +@@ -0,0 +0,0 @@ public class ContainerAnvil extends Container { + if (!world.isClientSide) { + if (!entityhuman.abilities.canInstantlyBuild && iblockdata.a(TagsBlock.y) && entityhuman.getRandom().nextFloat() < 0.12F) { + IBlockData iblockdata1 = BlockAnvil.a_(iblockdata); ++ // Paper start ++ com.destroystokyo.paper.event.block.AnvilDamagedEvent event = new com.destroystokyo.paper.event.block.AnvilDamagedEvent(getBukkitView(), org.bukkit.craftbukkit.block.data.CraftBlockData.fromData(iblockdata1)); ++ if (!event.callEvent()) { ++ return itemstack; ++ } else if (event.getDamageState() == com.destroystokyo.paper.event.block.AnvilDamagedEvent.DamageState.BROKEN) { ++ iblockdata1 = null; ++ } else { ++ iblockdata1 = ((org.bukkit.craftbukkit.block.data.CraftBlockData) event.getDamageState().getMaterial().createBlockData()).getState().set(BlockAnvil.FACING, iblockdata.get(BlockAnvil.FACING)); ++ } ++ // Paper end + + if (iblockdata1 == null) { + world.setAir(blockposition); +-- \ No newline at end of file diff --git a/Spigot-Server-Patches/Don-t-call-getItemMeta-on-hasItemMeta.patch b/Spigot-Server-Patches/Don-t-call-getItemMeta-on-hasItemMeta.patch index 9dadfac3fc..3a21952782 100644 --- a/Spigot-Server-Patches/Don-t-call-getItemMeta-on-hasItemMeta.patch +++ b/Spigot-Server-Patches/Don-t-call-getItemMeta-on-hasItemMeta.patch @@ -11,7 +11,7 @@ Returns true if getDamage() == 0 or has damage tag or other tag is set. Check the `ItemMetaTest#testTaggedButNotMeta` method to see how this method behaves. diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java -index 5f3331de1..ae2178096 100644 +index 5f3331de13..ae21780964 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java @@ -0,0 +0,0 @@ public final class CraftItemStack extends ItemStack { @@ -24,7 +24,7 @@ index 5f3331de1..ae2178096 100644 static boolean hasItemMeta(net.minecraft.server.ItemStack item) { diff --git a/src/test/java/org/bukkit/craftbukkit/inventory/ItemMetaTest.java b/src/test/java/org/bukkit/craftbukkit/inventory/ItemMetaTest.java -index eb6cf1bb3..79ce3752e 100644 +index eb6cf1bb33..79ce3752e8 100644 --- a/src/test/java/org/bukkit/craftbukkit/inventory/ItemMetaTest.java +++ b/src/test/java/org/bukkit/craftbukkit/inventory/ItemMetaTest.java @@ -0,0 +0,0 @@ import static org.hamcrest.Matchers.*; diff --git a/Spigot-Server-Patches/EntityTransformedEvent.patch b/Spigot-Server-Patches/EntityTransformedEvent.patch index 16d325c650..4aea0af1b0 100644 --- a/Spigot-Server-Patches/EntityTransformedEvent.patch +++ b/Spigot-Server-Patches/EntityTransformedEvent.patch @@ -5,7 +5,7 @@ Subject: [PATCH] EntityTransformedEvent diff --git a/src/main/java/net/minecraft/server/EntityMushroomCow.java b/src/main/java/net/minecraft/server/EntityMushroomCow.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +index c6babe6af2..a7159ef964 100644 --- a/src/main/java/net/minecraft/server/EntityMushroomCow.java +++ b/src/main/java/net/minecraft/server/EntityMushroomCow.java @@ -0,0 +0,0 @@ public class EntityMushroomCow extends EntityCow { @@ -18,7 +18,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 for (int i = 0; i < 5; ++i) { diff --git a/src/main/java/net/minecraft/server/EntityVillager.java b/src/main/java/net/minecraft/server/EntityVillager.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +index b51543ea7a..51be54684e 100644 --- a/src/main/java/net/minecraft/server/EntityVillager.java +++ b/src/main/java/net/minecraft/server/EntityVillager.java @@ -0,0 +0,0 @@ public class EntityVillager extends EntityAgeable implements NPC, IMerchant { @@ -31,7 +31,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 this.die(); } diff --git a/src/main/java/net/minecraft/server/EntityZombie.java b/src/main/java/net/minecraft/server/EntityZombie.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +index 2818ded921..d2d17094df 100644 --- a/src/main/java/net/minecraft/server/EntityZombie.java +++ b/src/main/java/net/minecraft/server/EntityZombie.java @@ -0,0 +0,0 @@ public class EntityZombie extends EntityMonster { @@ -40,7 +40,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } - + if (!new com.destroystokyo.paper.event.entity.EntityTransformedEvent(this.getBukkitEntity(), entityzombie.getBukkitEntity(), com.destroystokyo.paper.event.entity.EntityTransformedEvent.TransformedReason.DROWNED).callEvent()) return; // Paper - this.world.addEntity(entityzombie); + this.world.addEntity(entityzombie, CreatureSpawnEvent.SpawnReason.DROWNED); // CraftBukkit - added spawn reason this.die(); } @@ -0,0 +0,0 @@ public class EntityZombie extends EntityMonster { @@ -52,7 +52,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 this.world.a((EntityHuman) null, 1026, new BlockPosition(this), 0); } diff --git a/src/main/java/net/minecraft/server/EntityZombieVillager.java b/src/main/java/net/minecraft/server/EntityZombieVillager.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +index 9f61523bec..b8b0d65921 100644 --- a/src/main/java/net/minecraft/server/EntityZombieVillager.java +++ b/src/main/java/net/minecraft/server/EntityZombieVillager.java @@ -0,0 +0,0 @@ public class EntityZombieVillager extends EntityZombie { diff --git a/Spigot-Server-Patches/Ignore-Dead-Entities-in-entityList-iteration.patch b/Spigot-Server-Patches/Ignore-Dead-Entities-in-entityList-iteration.patch index 0c47a7de05..b4a4e724cf 100644 --- a/Spigot-Server-Patches/Ignore-Dead-Entities-in-entityList-iteration.patch +++ b/Spigot-Server-Patches/Ignore-Dead-Entities-in-entityList-iteration.patch @@ -11,7 +11,7 @@ This will ensure that dead entities are skipped from iteration since they shouldn't of been in the list in the first place. diff --git a/src/main/java/com/destroystokyo/paper/PaperCommand.java b/src/main/java/com/destroystokyo/paper/PaperCommand.java -index 7ff8e70b2..4e854c6db 100644 +index 7ff8e70b24..4e854c6dbe 100644 --- a/src/main/java/com/destroystokyo/paper/PaperCommand.java +++ b/src/main/java/com/destroystokyo/paper/PaperCommand.java @@ -0,0 +0,0 @@ public class PaperCommand extends Command { @@ -23,7 +23,7 @@ index 7ff8e70b2..4e854c6db 100644 MutablePair> info = list.computeIfAbsent(key, k -> MutablePair.of(0, Maps.newHashMap())); ChunkCoordIntPair chunk = new ChunkCoordIntPair(e.getChunkX(), e.getChunkZ()); diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index 80955199e..3a4c9a02e 100644 +index 181a9b7546..3a6ada187b 100644 --- a/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java @@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke @@ -35,7 +35,7 @@ index 80955199e..3a4c9a02e 100644 public float length; public float J; diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index f8458a2b4..ece187129 100644 +index f8458a2b49..ece1871294 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java @@ -0,0 +0,0 @@ public abstract class World implements GeneratorAccess, IIBlockAccess, AutoClose @@ -63,7 +63,7 @@ index f8458a2b4..ece187129 100644 if (entity instanceof EntityInsentient) { EntityInsentient entityinsentient = (EntityInsentient) entity; diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index f4dc7e4ac..8923df898 100644 +index f4dc7e4ac6..8923df898f 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java @@ -0,0 +0,0 @@ public class CraftWorld implements World { diff --git a/Spigot-Server-Patches/Implement-Expanded-ArmorStand-API.patch b/Spigot-Server-Patches/Implement-Expanded-ArmorStand-API.patch index 33caecf400..bec8d53b34 100644 --- a/Spigot-Server-Patches/Implement-Expanded-ArmorStand-API.patch +++ b/Spigot-Server-Patches/Implement-Expanded-ArmorStand-API.patch @@ -8,7 +8,7 @@ Add the following: - Enable/Disable slot interactions diff --git a/src/main/java/net/minecraft/server/EntityArmorStand.java b/src/main/java/net/minecraft/server/EntityArmorStand.java -index e9a746f13..3b2b94d8c 100644 +index e9a746f138..3b2b94d8c6 100644 --- a/src/main/java/net/minecraft/server/EntityArmorStand.java +++ b/src/main/java/net/minecraft/server/EntityArmorStand.java @@ -0,0 +0,0 @@ public class EntityArmorStand extends EntityLiving { @@ -29,7 +29,7 @@ index e9a746f13..3b2b94d8c 100644 return (this.bH & 1 << enumitemslot.c()) != 0; } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftArmorStand.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftArmorStand.java -index 124c3185b..9f5c3b92e 100644 +index 124c3185bc..9f5c3b92e3 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftArmorStand.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftArmorStand.java @@ -0,0 +0,0 @@ public class CraftArmorStand extends CraftLivingEntity implements ArmorStand { diff --git a/Spigot-Server-Patches/Prevent-Saving-Bad-entities-to-chunks.patch b/Spigot-Server-Patches/Prevent-Saving-Bad-entities-to-chunks.patch index ec010364f5..123714e507 100644 --- a/Spigot-Server-Patches/Prevent-Saving-Bad-entities-to-chunks.patch +++ b/Spigot-Server-Patches/Prevent-Saving-Bad-entities-to-chunks.patch @@ -18,7 +18,7 @@ an invalid entity. This should reduce log occurrences of dupe uuid messages. diff --git a/src/main/java/net/minecraft/server/ChunkRegionLoader.java b/src/main/java/net/minecraft/server/ChunkRegionLoader.java -index a97e024ec..bd52bf656 100644 +index a97e024ec4..bd52bf6561 100644 --- a/src/main/java/net/minecraft/server/ChunkRegionLoader.java +++ b/src/main/java/net/minecraft/server/ChunkRegionLoader.java @@ -0,0 +0,0 @@ public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver { @@ -57,7 +57,7 @@ index a97e024ec..bd52bf656 100644 nbttagcompound.set("Entities", nbttaglist1); NBTTagList nbttaglist2 = new NBTTagList(); diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index 71b3aedfb..09198b866 100644 +index 52cf52ea73..89d0127afd 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java @@ -0,0 +0,0 @@ public abstract class World implements GeneratorAccess, IIBlockAccess, AutoClose @@ -70,7 +70,7 @@ index 71b3aedfb..09198b866 100644 return true; } diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java -index 7a9f28421..b57e1ff36 100644 +index 7a9f28421b..b57e1ff364 100644 --- a/src/main/java/net/minecraft/server/WorldServer.java +++ b/src/main/java/net/minecraft/server/WorldServer.java @@ -0,0 +0,0 @@ public class WorldServer extends World implements IAsyncTaskHandler { diff --git a/Spigot-Server-Patches/Provide-option-to-use-a-versioned-world-folder-for-t.patch b/Spigot-Server-Patches/Provide-option-to-use-a-versioned-world-folder-for-t.patch index b0ba58d87c..a4fa39c489 100644 --- a/Spigot-Server-Patches/Provide-option-to-use-a-versioned-world-folder-for-t.patch +++ b/Spigot-Server-Patches/Provide-option-to-use-a-versioned-world-folder-for-t.patch @@ -59,7 +59,7 @@ index 5a17ce3d22..f7ece47ed9 100644 + } } diff --git a/src/main/java/net/minecraft/server/ChunkRegionLoader.java b/src/main/java/net/minecraft/server/ChunkRegionLoader.java -index bd52bf6561..54840851ba 100644 +index e27e952a1b..bf79865105 100644 --- a/src/main/java/net/minecraft/server/ChunkRegionLoader.java +++ b/src/main/java/net/minecraft/server/ChunkRegionLoader.java @@ -0,0 +0,0 @@ public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver {