From 3b4a9f98af5a16b87381fd18fc5dc29ceea319ab Mon Sep 17 00:00:00 2001 From: Ben Kerllenevich Date: Sat, 19 Jun 2021 07:28:59 -0400 Subject: [PATCH] more patches --- ...tent-TileEntity-Lore-and-DisplayName.patch | 235 ------------------ .../0113-Flying-squids-Oh-my.patch | 56 ----- .../0114-Infinity-bow-settings.patch | 47 ---- .../0115-Stonecutter-damage.patch | 69 ----- .../0116-Configurable-daylight-cycle.patch | 101 -------- ...tent-TileEntity-Lore-and-DisplayName.patch | 210 ++++++++++++++++ ...-to-recipe-s-ExactChoice-ingredient.patch} | 30 +-- patches/server/0110-Flying-squids-Oh-my.patch | 59 +++++ .../server/0111-Infinity-bow-settings.patch | 39 +++ patches/server/0112-Stonecutter-damage.patch | 78 ++++++ 10 files changed, 401 insertions(+), 523 deletions(-) delete mode 100644 patches/server-unmapped/0111-Persistent-TileEntity-Lore-and-DisplayName.patch delete mode 100644 patches/server-unmapped/0113-Flying-squids-Oh-my.patch delete mode 100644 patches/server-unmapped/0114-Infinity-bow-settings.patch delete mode 100644 patches/server-unmapped/0115-Stonecutter-damage.patch create mode 100644 patches/server/0108-Persistent-TileEntity-Lore-and-DisplayName.patch rename patches/{server-unmapped/0112-Add-predicate-to-recipe-s-ExactChoice-ingredient.patch => server/0109-Add-predicate-to-recipe-s-ExactChoice-ingredient.patch} (52%) create mode 100644 patches/server/0110-Flying-squids-Oh-my.patch create mode 100644 patches/server/0111-Infinity-bow-settings.patch create mode 100644 patches/server/0112-Stonecutter-damage.patch diff --git a/patches/server-unmapped/0111-Persistent-TileEntity-Lore-and-DisplayName.patch b/patches/server-unmapped/0111-Persistent-TileEntity-Lore-and-DisplayName.patch deleted file mode 100644 index 25b17f5f0..000000000 --- a/patches/server-unmapped/0111-Persistent-TileEntity-Lore-and-DisplayName.patch +++ /dev/null @@ -1,235 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jason Penilla <11360596+jpenilla@users.noreply.github.com> -Date: Wed, 30 Sep 2020 14:32:46 -0700 -Subject: [PATCH] Persistent TileEntity Lore and DisplayName - -Makes it so that when a TileEntity is placed in the world and then broken, -the dropped ItemStack retains any original custom display name/lore. - -diff --git a/src/main/java/net/minecraft/world/entity/decoration/EntityPainting.java b/src/main/java/net/minecraft/world/entity/decoration/EntityPainting.java -index 9c01ec42342cf0420bf5215604c24fbc89c1361b..3de0f21648ca60bdfcbc078bca896d51bf84e207 100644 ---- a/src/main/java/net/minecraft/world/entity/decoration/EntityPainting.java -+++ b/src/main/java/net/minecraft/world/entity/decoration/EntityPainting.java -@@ -15,6 +15,7 @@ import net.minecraft.sounds.SoundEffects; - import net.minecraft.world.entity.Entity; - import net.minecraft.world.entity.EntityTypes; - import net.minecraft.world.entity.player.EntityHuman; -+import net.minecraft.world.item.ItemStack; - import net.minecraft.world.item.Items; - import net.minecraft.world.level.GameRules; - import net.minecraft.world.level.IMaterial; -diff --git a/src/main/java/net/minecraft/world/entity/vehicle/EntityBoat.java b/src/main/java/net/minecraft/world/entity/vehicle/EntityBoat.java -index 01839c7319e175477ded7001e00e5937734ff516..e5cda8c040c93639211dacbf5b0c7cd6a9df9e6d 100644 ---- a/src/main/java/net/minecraft/world/entity/vehicle/EntityBoat.java -+++ b/src/main/java/net/minecraft/world/entity/vehicle/EntityBoat.java -@@ -34,6 +34,7 @@ import net.minecraft.world.entity.animal.EntityAnimal; - import net.minecraft.world.entity.animal.EntityWaterAnimal; - import net.minecraft.world.entity.player.EntityHuman; - import net.minecraft.world.item.Item; -+import net.minecraft.world.item.ItemStack; - import net.minecraft.world.item.Items; - import net.minecraft.world.level.GameRules; - import net.minecraft.world.level.IMaterial; -diff --git a/src/main/java/net/minecraft/world/item/ItemBlock.java b/src/main/java/net/minecraft/world/item/ItemBlock.java -index 59d52c252b2e59923b8e513dd4d2e1ec9ce34dc7..4be1c8ee85f411a8b01be50b8cc3dc3835f80a2e 100644 ---- a/src/main/java/net/minecraft/world/item/ItemBlock.java -+++ b/src/main/java/net/minecraft/world/item/ItemBlock.java -@@ -119,7 +119,24 @@ public class ItemBlock extends Item { - } - - protected boolean a(BlockPosition blockposition, World world, @Nullable EntityHuman entityhuman, ItemStack itemstack, IBlockData iblockdata) { -- return a(world, entityhuman, blockposition, itemstack); -+ // Purpur start -+ boolean handled = a(world, entityhuman, blockposition, itemstack); -+ if (world.purpurConfig.persistentTileEntityDisplayNames && itemstack.hasTag()) { -+ NBTTagCompound display = itemstack.getSubTag("display"); -+ if (display != null) { -+ TileEntity tile = world.getTileEntity(blockposition); -+ if (tile != null) { -+ if (display.hasKeyOfType("Name", 8)) { -+ tile.setPersistentDisplayName(display.getString("Name")); -+ } -+ if (display.hasKeyOfType("Lore", 9)) { -+ tile.setPersistentLore(display.getList("Lore", 8)); -+ } -+ } -+ } -+ } -+ return handled; -+ // Purpur end - } - - @Nullable -diff --git a/src/main/java/net/minecraft/world/level/block/Block.java b/src/main/java/net/minecraft/world/level/block/Block.java -index 4e0b88e26ad8017d93841c4149a1687c1db4ff0b..f65201f8cbf6d402b4366d63bfa03aacf329860f 100644 ---- a/src/main/java/net/minecraft/world/level/block/Block.java -+++ b/src/main/java/net/minecraft/world/level/block/Block.java -@@ -15,10 +15,15 @@ import net.minecraft.core.EnumDirection; - import net.minecraft.core.IRegistry; - import net.minecraft.core.NonNullList; - import net.minecraft.core.RegistryBlockID; -+import net.minecraft.nbt.NBTTagCompound; -+import net.minecraft.nbt.NBTTagList; -+import net.minecraft.nbt.NBTTagString; -+import net.minecraft.network.chat.IChatBaseComponent; - import net.minecraft.server.level.WorldServer; - import net.minecraft.stats.StatisticList; - import net.minecraft.tags.Tag; - import net.minecraft.tags.TagsBlock; -+import net.minecraft.world.INamableTileEntity; - import net.minecraft.world.entity.Entity; - import net.minecraft.world.entity.EntityExperienceOrb; - import net.minecraft.world.entity.EntityLiving; -@@ -247,7 +252,7 @@ public class Block extends BlockBase implements IMaterial { - public static void a(IBlockData iblockdata, GeneratorAccess generatoraccess, BlockPosition blockposition, @Nullable TileEntity tileentity) { - if (generatoraccess instanceof WorldServer) { - a(iblockdata, (WorldServer) generatoraccess, blockposition, tileentity).forEach((itemstack) -> { -- a((World) ((WorldServer) generatoraccess), blockposition, itemstack); -+ dropItem((WorldServer) generatoraccess, blockposition, applyDisplayNameAndLoreFromTile(itemstack, tileentity)); // Purpur - }); - iblockdata.dropNaturally((WorldServer) generatoraccess, blockposition, ItemStack.b); - } -@@ -256,14 +261,56 @@ public class Block extends BlockBase implements IMaterial { - - public static void dropItems(IBlockData iblockdata, World world, BlockPosition blockposition, @Nullable TileEntity tileentity, Entity entity, ItemStack itemstack) { - if (world instanceof WorldServer) { -- getDrops(iblockdata, (WorldServer) world, blockposition, tileentity, entity, itemstack).forEach((itemstack1) -> { -- a(world, blockposition, itemstack1); -+ // Purpur start -+ getDrops(iblockdata, (WorldServer) world, blockposition, tileentity, entity, itemstack).forEach(stackToDrop -> { -+ dropItem(world, blockposition, applyDisplayNameAndLoreFromTile(stackToDrop, tileentity)); -+ // Purpur end - }); - iblockdata.dropNaturally((WorldServer) world, blockposition, itemstack); - } - - } - -+ // Purpur start -+ private static ItemStack applyDisplayNameAndLoreFromTile(ItemStack itemStack, TileEntity tile) { -+ if (itemStack.getItem() instanceof ItemBlock) { -+ if (tile != null && tile.getWorld() instanceof WorldServer && tile.getWorld().purpurConfig.persistentTileEntityDisplayNames) { -+ String name = tile.getPersistentDisplayName(); -+ NBTTagList lore = tile.getPersistentLore(); -+ if (tile instanceof INamableTileEntity) { -+ INamableTileEntity namedTile = (INamableTileEntity) tile; -+ if (namedTile.hasCustomName()) { -+ name = IChatBaseComponent.ChatSerializer.componentToJson(namedTile.getCustomName()); -+ } -+ } -+ -+ if (name != null || lore != null) { -+ NBTTagCompound display = itemStack.getSubTag("display"); -+ if (display == null) { -+ display = new NBTTagCompound(); -+ } -+ -+ if (name != null) { -+ display.set("Name", NBTTagString.create(name)); -+ } -+ if (lore != null) { -+ display.set("Lore", lore); -+ } -+ -+ NBTTagCompound tag = itemStack.getTag(); -+ if (tag == null) { -+ tag = new NBTTagCompound(); -+ } -+ tag.set("display", display); -+ -+ itemStack.setTag(tag); -+ } -+ } -+ } -+ return itemStack; -+ } -+ // Purpur end -+ - public static void a(World world, BlockPosition blockposition, ItemStack itemstack) { dropItem(world, blockposition, itemstack); } public static void dropItem(World world, BlockPosition blockposition, ItemStack itemstack) { // Paper - OBFHELPER - if (!world.isClientSide && !itemstack.isEmpty() && world.getGameRules().getBoolean(GameRules.DO_TILE_DROPS)) { - float f = 0.5F; -diff --git a/src/main/java/net/minecraft/world/level/block/entity/TileEntity.java b/src/main/java/net/minecraft/world/level/block/entity/TileEntity.java -index 93d02ccb87c17404c55884f52ae40c7b7ddfb103..35c4d5414db66b977a354ac50d35a6aa0fcd4cf8 100644 ---- a/src/main/java/net/minecraft/world/level/block/entity/TileEntity.java -+++ b/src/main/java/net/minecraft/world/level/block/entity/TileEntity.java -@@ -6,6 +6,8 @@ import net.minecraft.ResourceKeyInvalidException; - import net.minecraft.core.BlockPosition; - import net.minecraft.core.IRegistry; - import net.minecraft.nbt.NBTTagCompound; -+import net.minecraft.nbt.NBTTagList; -+import net.minecraft.nbt.NBTTagString; - import net.minecraft.network.protocol.game.PacketPlayOutTileEntityData; - import net.minecraft.resources.MinecraftKey; - import net.minecraft.world.level.World; -@@ -105,9 +107,25 @@ public abstract class TileEntity implements net.minecraft.server.KeyedObject { / - this.persistentDataContainer.putAll((NBTTagCompound) persistentDataTag); - } - // CraftBukkit end -+ // Purpur start -+ if (nbttagcompound.hasKey("Purpur.persistentDisplayName")) { -+ this.persistentDisplayName = nbttagcompound.getString("Purpur.persistentDisplayName"); -+ } -+ if (nbttagcompound.hasKey("Purpur.persistentLore")) { -+ this.persistentLore = nbttagcompound.getList("Purpur.persistentLore", 8); -+ } -+ // Purpur end - } - - public NBTTagCompound save(NBTTagCompound nbttagcompound) { -+ // Purpur start -+ if (this.persistentDisplayName != null) { -+ nbttagcompound.set("Purpur.persistentDisplayName", NBTTagString.create(this.persistentDisplayName)); -+ } -+ if (this.persistentLore != null) { -+ nbttagcompound.set("Purpur.persistentLore", this.persistentLore); -+ } -+ // Purpur end - return this.b(nbttagcompound); - } - -@@ -274,4 +292,25 @@ public abstract class TileEntity implements net.minecraft.server.KeyedObject { / - return null; - } - // CraftBukkit end -+ -+ // Purpur start -+ private String persistentDisplayName = null; -+ private NBTTagList persistentLore = null; -+ -+ public void setPersistentDisplayName(String json) { -+ this.persistentDisplayName = json; -+ } -+ -+ public void setPersistentLore(NBTTagList lore) { -+ this.persistentLore = lore; -+ } -+ -+ public String getPersistentDisplayName() { -+ return this.persistentDisplayName; -+ } -+ -+ public NBTTagList getPersistentLore() { -+ return this.persistentLore; -+ } -+ // Purpur end - } -diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java -index 94681a3cb57950b0cd074927aa63bf84e3ef0cf7..a9f4732ece4764cabb1ae7b55fa9c273996f7d9d 100644 ---- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java -+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java -@@ -244,6 +244,7 @@ public class PurpurWorldConfig { - public boolean entitiesPickUpLootBypassMobGriefing = false; - public boolean entitiesCanUsePortals = true; - public boolean milkCuresBadOmen = true; -+ public boolean persistentTileEntityDisplayNames = false; - public double tridentLoyaltyVoidReturnHeight = 0.0D; - public double voidDamageHeight = -64.0D; - public double voidDamageDealt = 4.0D; -@@ -255,6 +256,7 @@ public class PurpurWorldConfig { - entitiesPickUpLootBypassMobGriefing = getBoolean("gameplay-mechanics.entities-pick-up-loot-bypass-mob-griefing", entitiesPickUpLootBypassMobGriefing); - entitiesCanUsePortals = getBoolean("gameplay-mechanics.entities-can-use-portals", entitiesCanUsePortals); - milkCuresBadOmen = getBoolean("gameplay-mechanics.milk-cures-bad-omen", milkCuresBadOmen); -+ persistentTileEntityDisplayNames = getBoolean("gameplay-mechanics.persistent-tileentity-display-names-and-lore", persistentTileEntityDisplayNames); - tridentLoyaltyVoidReturnHeight = getDouble("gameplay-mechanics.trident-loyalty-void-return-height", tridentLoyaltyVoidReturnHeight); - voidDamageHeight = getDouble("gameplay-mechanics.void-damage-height", voidDamageHeight); - voidDamageDealt = getDouble("gameplay-mechanics.void-damage-dealt", voidDamageDealt); diff --git a/patches/server-unmapped/0113-Flying-squids-Oh-my.patch b/patches/server-unmapped/0113-Flying-squids-Oh-my.patch deleted file mode 100644 index b29144311..000000000 --- a/patches/server-unmapped/0113-Flying-squids-Oh-my.patch +++ /dev/null @@ -1,56 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: William Blake Galbreath -Date: Sun, 4 Oct 2020 12:00:42 -0500 -Subject: [PATCH] Flying squids! Oh my! - - -diff --git a/src/main/java/net/minecraft/world/entity/animal/EntitySquid.java b/src/main/java/net/minecraft/world/entity/animal/EntitySquid.java -index 777c3bcf267d6cf31300588826d3af6b55cab350..7ec3e5d136cbb708b3bb29aa79bdd401d37d56dc 100644 ---- a/src/main/java/net/minecraft/world/entity/animal/EntitySquid.java -+++ b/src/main/java/net/minecraft/world/entity/animal/EntitySquid.java -@@ -81,6 +81,11 @@ public class EntitySquid extends EntityWaterAnimal { - vector.setX(cos * x - sine * z); - vector.setZ(sine * x + cos * z); - } -+ -+ @Override -+ public boolean isInWater() { -+ return this.inWater || world.purpurConfig.squidsCanFly; -+ } - // Purpur end - - @Override -@@ -146,6 +151,7 @@ public class EntitySquid extends EntityWaterAnimal { - } - - if (this.aH()) { -+ if (world.purpurConfig.squidsCanFly) setNoGravity(!inWater); // Purpur - if (this.bp < 3.1415927F) { - float f = this.bp / 3.1415927F; - -@@ -353,7 +359,7 @@ public class EntitySquid extends EntityWaterAnimal { - - if (i > 100) { - this.b.a(0.0F, 0.0F, 0.0F); -- } else if (this.b.getRandom().nextInt(50) == 0 || !this.b.inWater || !this.b.eK()) { -+ } else if (this.b.getRandom().nextInt(50) == 0 || !this.b.isInWater() || !this.b.eK()) { // Purpur - float f = this.b.getRandom().nextFloat() * 6.2831855F; - float f1 = MathHelper.cos(f) * 0.2F; - float f2 = -0.1F + this.b.getRandom().nextFloat() * 0.2F; -diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java -index a9f4732ece4764cabb1ae7b55fa9c273996f7d9d..9a18d3612d38cdd3d85cc69fba6df355b6cc6829 100644 ---- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java -+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java -@@ -937,10 +937,12 @@ public class PurpurWorldConfig { - public boolean squidRidable = false; - public boolean squidImmuneToEAR = true; - public double squidOffsetWaterCheck = 0.0D; -+ public boolean squidsCanFly = false; - private void squidSettings() { - squidRidable = getBoolean("mobs.squid.ridable", squidRidable); - squidImmuneToEAR = getBoolean("mobs.squid.immune-to-EAR", squidImmuneToEAR); - squidOffsetWaterCheck = getDouble("mobs.squid.water-offset-check", squidOffsetWaterCheck); -+ squidsCanFly = getBoolean("mobs.squid.can-fly", squidsCanFly); - } - - public boolean spiderRidable = false; diff --git a/patches/server-unmapped/0114-Infinity-bow-settings.patch b/patches/server-unmapped/0114-Infinity-bow-settings.patch deleted file mode 100644 index 51c938b3f..000000000 --- a/patches/server-unmapped/0114-Infinity-bow-settings.patch +++ /dev/null @@ -1,47 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: William Blake Galbreath -Date: Sun, 4 Oct 2020 19:08:53 -0500 -Subject: [PATCH] Infinity bow settings - - -diff --git a/src/main/java/net/minecraft/world/item/ItemBow.java b/src/main/java/net/minecraft/world/item/ItemBow.java -index 015f4d71f35a9d512814389b6e6cab74c0daf116..c7e20b25b4d09463fa54c66e62208e90515013e2 100644 ---- a/src/main/java/net/minecraft/world/item/ItemBow.java -+++ b/src/main/java/net/minecraft/world/item/ItemBow.java -@@ -35,7 +35,7 @@ public class ItemBow extends ItemProjectileWeapon implements ItemVanishable { - float f = a(j); - - if ((double) f >= 0.1D) { -- boolean flag1 = flag && itemstack1.getItem() == Items.ARROW; -+ boolean flag1 = flag && ((itemstack1.getItem() == Items.ARROW && world.purpurConfig.infinityWorksWithNormalArrows) || (itemstack1.getItem() == Items.TIPPED_ARROW && world.purpurConfig.infinityWorksWithTippedArrows) || (itemstack1.getItem() == Items.SPECTRAL_ARROW && world.purpurConfig.infinityWorksWithSpectralArrows)); // Purpur - - if (!world.isClientSide) { - ItemArrow itemarrow = (ItemArrow) ((ItemArrow) (itemstack1.getItem() instanceof ItemArrow ? itemstack1.getItem() : Items.ARROW)); -@@ -96,6 +96,7 @@ public class ItemBow extends ItemProjectileWeapon implements ItemVanishable { - entityhuman.inventory.f(itemstack1); - } - } -+ else if (!entityhuman.abilities.canInstantlyBuild) ((org.bukkit.entity.Player) entityhuman.getBukkitEntity()).updateInventory(); // Purpur - - entityhuman.b(StatisticList.ITEM_USED.b(this)); - } -diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java -index 9a18d3612d38cdd3d85cc69fba6df355b6cc6829..e982733732e3dfd9d34cf5d9e87a9caa3af2d6e8 100644 ---- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java -+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java -@@ -209,6 +209,15 @@ public class PurpurWorldConfig { - idleTimeoutUpdateTabList = getBoolean("gameplay-mechanics.player.idle-timeout.update-tab-list", idleTimeoutUpdateTabList); - } - -+ public boolean infinityWorksWithNormalArrows = true; -+ public boolean infinityWorksWithSpectralArrows = false; -+ public boolean infinityWorksWithTippedArrows = false; -+ private void infinityArrowsSettings() { -+ infinityWorksWithNormalArrows = getBoolean("gameplay-mechanics.infinity-bow.normal-arrows", infinityWorksWithNormalArrows); -+ infinityWorksWithSpectralArrows = getBoolean("gameplay-mechanics.infinity-bow.spectral-arrows", infinityWorksWithSpectralArrows); -+ infinityWorksWithTippedArrows = getBoolean("gameplay-mechanics.infinity-bow.tipped-arrows", infinityWorksWithTippedArrows); -+ } -+ - public int dragonFireballDespawnRate = -1; - public int eggDespawnRate = -1; - public int enderPearlDespawnRate = -1; diff --git a/patches/server-unmapped/0115-Stonecutter-damage.patch b/patches/server-unmapped/0115-Stonecutter-damage.patch deleted file mode 100644 index 0460bfaa6..000000000 --- a/patches/server-unmapped/0115-Stonecutter-damage.patch +++ /dev/null @@ -1,69 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: William Blake Galbreath -Date: Mon, 5 Oct 2020 12:15:14 -0500 -Subject: [PATCH] Stonecutter damage - - -diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index aeaac4221e1c235d89e872da4c1aaaa68ab70a48..5fd01caa85eedc2e703b76fd230762cc89fceb21 100644 ---- a/src/main/java/net/minecraft/world/entity/Entity.java -+++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -802,7 +802,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne - } - // CraftBukkit end - -- if (this.onGround && !this.bv()) { -+ if (this.onGround && (!this.bv() || (block == Blocks.STONECUTTER && world.purpurConfig.stonecutterDamage > 0.0F))) { // Purpur - block.stepOn(this.world, blockposition, this); - } - -diff --git a/src/main/java/net/minecraft/world/level/block/BlockStonecutter.java b/src/main/java/net/minecraft/world/level/block/BlockStonecutter.java -index 54c9586cd7f8c9691a1c7ded9c9c96b0f316b0b6..68c6f090a10564a790f3bf175e2378d1f7103b8e 100644 ---- a/src/main/java/net/minecraft/world/level/block/BlockStonecutter.java -+++ b/src/main/java/net/minecraft/world/level/block/BlockStonecutter.java -@@ -94,4 +94,16 @@ public class BlockStonecutter extends Block { - public boolean a(IBlockData iblockdata, IBlockAccess iblockaccess, BlockPosition blockposition, PathMode pathmode) { - return false; - } -+ -+ // Purpur start -+ @Override -+ public void stepOn(World world, BlockPosition pos, net.minecraft.world.entity.Entity entity) { -+ if (world.purpurConfig.stonecutterDamage > 0.0F && entity instanceof net.minecraft.world.entity.EntityLiving) { -+ org.bukkit.craftbukkit.event.CraftEventFactory.blockDamage = world.getWorld().getBlockAt(pos.getX(), pos.getY(), pos.getZ()); -+ entity.damageEntity(net.minecraft.world.damagesource.DamageSource.CACTUS, world.purpurConfig.stonecutterDamage); -+ org.bukkit.craftbukkit.event.CraftEventFactory.blockDamage = null; -+ } -+ super.stepOn(world, pos, entity); -+ } -+ // Purpur end - } -diff --git a/src/main/java/net/minecraft/world/level/pathfinder/PathfinderNormal.java b/src/main/java/net/minecraft/world/level/pathfinder/PathfinderNormal.java -index a0c7d3ab747ba1a3cf07e716f3591663a8a9e14b..1fb27ca3e769c34b98c9b2d973f4da16f17b022d 100644 ---- a/src/main/java/net/minecraft/world/level/pathfinder/PathfinderNormal.java -+++ b/src/main/java/net/minecraft/world/level/pathfinder/PathfinderNormal.java -@@ -490,7 +490,7 @@ public class PathfinderNormal extends PathfinderAbstract { - return PathType.DANGER_CACTUS; - } - -- if (iblockdata.a(Blocks.SWEET_BERRY_BUSH)) { -+ if (iblockdata.a(Blocks.SWEET_BERRY_BUSH) || iblockdata.a(Blocks.STONECUTTER)) { // Purpur - return PathType.DANGER_OTHER; - } - -diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java -index e982733732e3dfd9d34cf5d9e87a9caa3af2d6e8..11f699eb7d68013df708a874a214da6be3fe6773 100644 ---- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java -+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java -@@ -441,6 +441,11 @@ public class PurpurWorldConfig { - spawnerDeactivateByRedstone = getBoolean("blocks.spawner.deactivate-by-redstone", spawnerDeactivateByRedstone); - } - -+ public float stonecutterDamage = 0.0F; -+ private void stonecutterSettings() { -+ stonecutterDamage = (float) getDouble("blocks.stonecutter.damage", stonecutterDamage); -+ } -+ - public boolean turtleEggsBreakFromExpOrbs = true; - public boolean turtleEggsBreakFromItems = true; - public boolean turtleEggsBreakFromMinecarts = true; diff --git a/patches/server-unmapped/0116-Configurable-daylight-cycle.patch b/patches/server-unmapped/0116-Configurable-daylight-cycle.patch index c62ecb53f..e69de29bb 100644 --- a/patches/server-unmapped/0116-Configurable-daylight-cycle.patch +++ b/patches/server-unmapped/0116-Configurable-daylight-cycle.patch @@ -1,101 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: William Blake Galbreath -Date: Sat, 10 Oct 2020 14:29:55 -0500 -Subject: [PATCH] Configurable daylight cycle - - -diff --git a/src/main/java/net/minecraft/network/protocol/game/PacketPlayOutUpdateTime.java b/src/main/java/net/minecraft/network/protocol/game/PacketPlayOutUpdateTime.java -index 3086ee023685781d94e2fb99fc8dff5264f01165..74c1047305cac5673e274096709c757ede4605f4 100644 ---- a/src/main/java/net/minecraft/network/protocol/game/PacketPlayOutUpdateTime.java -+++ b/src/main/java/net/minecraft/network/protocol/game/PacketPlayOutUpdateTime.java -@@ -7,7 +7,7 @@ import net.minecraft.network.protocol.Packet; - public class PacketPlayOutUpdateTime implements Packet { - - private long a; private final void setWorldAge(final long age) { this.a = age; } private final long getWorldAge() { return this.a; } // Paper - OBFHELPER -- private long b; -+ private long b; public void setPlayerTime(long time) { this.b = time; } // Purpur - - public PacketPlayOutUpdateTime() {} - -diff --git a/src/main/java/net/minecraft/server/level/WorldServer.java b/src/main/java/net/minecraft/server/level/WorldServer.java -index 5567d12b2b74b0fcf17e600d2c7b8ab88c2f3b13..9276500e4cc2a0d2d374b3f1393410e8295b3b4d 100644 ---- a/src/main/java/net/minecraft/server/level/WorldServer.java -+++ b/src/main/java/net/minecraft/server/level/WorldServer.java -@@ -64,6 +64,7 @@ import net.minecraft.network.protocol.game.PacketPlayOutExplosion; - import net.minecraft.network.protocol.game.PacketPlayOutGameStateChange; - import net.minecraft.network.protocol.game.PacketPlayOutNamedSoundEffect; - import net.minecraft.network.protocol.game.PacketPlayOutSpawnPosition; -+import net.minecraft.network.protocol.game.PacketPlayOutUpdateTime; - import net.minecraft.network.protocol.game.PacketPlayOutWorldEvent; - import net.minecraft.network.protocol.game.PacketPlayOutWorldParticles; - import net.minecraft.resources.MinecraftKey; -@@ -212,6 +213,7 @@ public class WorldServer extends World implements GeneratorAccessSeed { - private final EnderDragonBattle dragonBattle; - private final StructureManager structureManager; - private final boolean Q; -+ private double fakeTime; // Purpur - - - // CraftBukkit start -@@ -401,6 +403,7 @@ public class WorldServer extends World implements GeneratorAccessSeed { - this.getServer().addWorld(this.getWorld()); // CraftBukkit - - this.asyncChunkTaskManager = new com.destroystokyo.paper.io.chunk.ChunkTaskManager(this); // Paper -+ this.fakeTime = this.worldDataServer.getDayTime(); // Purpur - } - - // CraftBukkit start -@@ -718,7 +721,21 @@ public class WorldServer extends World implements GeneratorAccessSeed { - this.nextTickListBlock.nextTick(); // Paper - this.nextTickListFluid.nextTick(); // Paper - this.worldDataServer.u().a(this.server, i); -- if (this.worldData.q().getBoolean(GameRules.DO_DAYLIGHT_CYCLE)) { -+ // Purpur start -+ WorldServer world = this.worldDataServer.world; -+ if (world.getGameRules().getBoolean(GameRules.DO_DAYLIGHT_CYCLE)) { -+ double incrementTimeBy = 12000.0D / (double) (world.isDay() ? world.purpurConfig.daytimeTicks : world.purpurConfig.nighttimeTicks); -+ if (incrementTimeBy != 1.0D) { -+ this.fakeTime += incrementTimeBy; -+ this.setDayTime(this.fakeTime); -+ PacketPlayOutUpdateTime packet = new PacketPlayOutUpdateTime(world.getTime(), world.getDayTime(), true); -+ for (EntityHuman entityhuman : world.players) { -+ EntityPlayer player = (EntityPlayer) entityhuman; -+ packet.setPlayerTime(player.getPlayerTime()); -+ player.playerConnection.sendPacket(packet); -+ } -+ } else -+ // Purpur end - this.setDayTime(this.worldData.getDayTime() + 1L); - } - -@@ -727,6 +744,12 @@ public class WorldServer extends World implements GeneratorAccessSeed { - - public void setDayTime(long i) { - this.worldDataServer.setDayTime(i); -+ // Purpur start -+ this.fakeTime = i; -+ } -+ public void setDayTime(double i) { -+ this.worldDataServer.setDayTime((long) i); -+ // Purpur end - } - - public void doMobSpawning(boolean flag, boolean flag1) { -diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java -index 11f699eb7d68013df708a874a214da6be3fe6773..b11a71a1dda78098f1995f289a1fb45c9a02eeb6 100644 ---- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java -+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java -@@ -150,6 +150,13 @@ public class PurpurWorldConfig { - } - } - -+ public int daytimeTicks = 12000; -+ public int nighttimeTicks = 12000; -+ private void daytimeCycleSettings() { -+ daytimeTicks = getInt("gameplay-mechanics.daylight-cycle-ticks.daytime", daytimeTicks); -+ nighttimeTicks = getInt("gameplay-mechanics.daylight-cycle-ticks.nighttime", nighttimeTicks); -+ } -+ - public int entityLifeSpan = 0; - private void entitySettings() { - entityLifeSpan = getInt("gameplay-mechanics.entity-lifespan", entityLifeSpan); diff --git a/patches/server/0108-Persistent-TileEntity-Lore-and-DisplayName.patch b/patches/server/0108-Persistent-TileEntity-Lore-and-DisplayName.patch new file mode 100644 index 000000000..e05379ba1 --- /dev/null +++ b/patches/server/0108-Persistent-TileEntity-Lore-and-DisplayName.patch @@ -0,0 +1,210 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jason Penilla <11360596+jpenilla@users.noreply.github.com> +Date: Wed, 30 Sep 2020 14:32:46 -0700 +Subject: [PATCH] Persistent TileEntity Lore and DisplayName + +Makes it so that when a TileEntity is placed in the world and then broken, +the dropped ItemStack retains any original custom display name/lore. + +diff --git a/src/main/java/net/minecraft/world/item/BlockItem.java b/src/main/java/net/minecraft/world/item/BlockItem.java +index 44b28773fe8e79931e738d493bd9405e0ee3dca9..d9114ee2ef4f1dee7ae018f932a7804a61a90ef6 100644 +--- a/src/main/java/net/minecraft/world/item/BlockItem.java ++++ b/src/main/java/net/minecraft/world/item/BlockItem.java +@@ -133,7 +133,24 @@ public class BlockItem extends Item { + } + + protected boolean updateCustomBlockEntityTag(BlockPos pos, Level world, @Nullable Player player, ItemStack stack, BlockState state) { +- return BlockItem.updateCustomBlockEntityTag(world, player, pos, stack); ++ // Purpur start ++ boolean handled = updateCustomBlockEntityTag(world, player, pos, stack); ++ if (world.purpurConfig.persistentTileEntityDisplayNames && stack.hasTag()) { ++ CompoundTag display = stack.getTagElement("display"); ++ if (display != null) { ++ BlockEntity blockEntity = world.getBlockEntity(pos); ++ if (blockEntity != null) { ++ if (display.contains("Name", 8)) { ++ blockEntity.setPersistentDisplayName(display.getString("Name")); ++ } ++ if (display.contains("Lore", 9)) { ++ blockEntity.setPersistentLore(display.getList("Lore", 8)); ++ } ++ } ++ } ++ } ++ return handled; ++ // Purpur end + } + + @Nullable +diff --git a/src/main/java/net/minecraft/world/level/block/Block.java b/src/main/java/net/minecraft/world/level/block/Block.java +index 878cdfc49253e7916d038495f79fec7cce75aa50..7e4db08e4cec4332c9cbcc5a7cdca3e78ac1495a 100644 +--- a/src/main/java/net/minecraft/world/level/block/Block.java ++++ b/src/main/java/net/minecraft/world/level/block/Block.java +@@ -20,6 +20,9 @@ import net.minecraft.core.IdMapper; + import net.minecraft.core.NonNullList; + import net.minecraft.core.Registry; + import net.minecraft.core.Vec3i; ++import net.minecraft.nbt.CompoundTag; ++import net.minecraft.nbt.ListTag; ++import net.minecraft.nbt.StringTag; + import net.minecraft.network.chat.Component; + import net.minecraft.network.chat.MutableComponent; + import net.minecraft.network.chat.TranslatableComponent; +@@ -28,6 +31,7 @@ import net.minecraft.stats.Stats; + import net.minecraft.tags.BlockTags; + import net.minecraft.tags.Tag; + import net.minecraft.util.Mth; ++import net.minecraft.world.Nameable; + import net.minecraft.world.damagesource.DamageSource; + import net.minecraft.world.entity.Entity; + import net.minecraft.world.entity.EntityType; +@@ -325,7 +329,7 @@ public class Block extends BlockBehaviour implements ItemLike { + public static void dropResources(BlockState state, LevelAccessor world, BlockPos pos, @Nullable BlockEntity blockEntity) { + if (world instanceof ServerLevel) { + Block.getDrops(state, (ServerLevel) world, pos, blockEntity).forEach((itemstack) -> { +- Block.popResource((Level) ((ServerLevel) world), pos, itemstack); ++ Block.popResource((Level) ((ServerLevel) world), pos, applyDisplayNameAndLoreFromTile(itemstack, blockEntity)); // Purpur + }); + state.spawnAfterBreak((ServerLevel) world, pos, ItemStack.EMPTY); + } +@@ -335,13 +339,53 @@ public class Block extends BlockBehaviour implements ItemLike { + public static void dropResources(BlockState state, Level world, BlockPos pos, @Nullable BlockEntity blockEntity, Entity entity, ItemStack stack) { + if (world instanceof ServerLevel) { + Block.getDrops(state, (ServerLevel) world, pos, blockEntity, entity, stack).forEach((itemstack1) -> { +- Block.popResource(world, pos, itemstack1); ++ Block.popResource(world, pos, applyDisplayNameAndLoreFromTile(stack, blockEntity)); // Purpur + }); + state.spawnAfterBreak((ServerLevel) world, pos, stack); + } + + } + ++ // Purpur start ++ private static ItemStack applyDisplayNameAndLoreFromTile(ItemStack stack, BlockEntity blockEntity) { ++ if (stack.getItem() instanceof BlockItem) { ++ if (blockEntity != null && blockEntity.getLevel() instanceof ServerLevel && blockEntity.getLevel().purpurConfig.persistentTileEntityDisplayNames) { ++ String name = blockEntity.getPersistentDisplayName(); ++ ListTag lore = blockEntity.getPersistentLore(); ++ if (blockEntity instanceof Nameable) { ++ Nameable namedTile = (Nameable) blockEntity; ++ if (namedTile.hasCustomName()) { ++ name = Component.Serializer.toJson(namedTile.getCustomName()); ++ } ++ } ++ ++ if (name != null || lore != null) { ++ CompoundTag display = stack.getTagElement("display"); ++ if (display == null) { ++ display = new CompoundTag(); ++ } ++ ++ if (name != null) { ++ display.put("Name", StringTag.valueOf(name)); ++ } ++ if (lore != null) { ++ display.put("Lore", lore); ++ } ++ ++ CompoundTag tag = stack.getTag(); ++ if (tag == null) { ++ tag = new CompoundTag(); ++ } ++ tag.put("display", display); ++ ++ stack.setTag(tag); ++ } ++ } ++ } ++ return stack; ++ } ++ // Purpur end ++ + public static void popResource(Level world, BlockPos pos, ItemStack stack) { + float f = EntityType.ITEM.getHeight() / 2.0F; + double d0 = (double) ((float) pos.getX() + 0.5F) + Mth.nextDouble(world.random, -0.25D, 0.25D); +diff --git a/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java +index c3a07ccccd5cc38552363c82398f432c8d624288..132c9e6a643995d9fde535a78d9edc9ee97e3a76 100644 +--- a/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java ++++ b/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java +@@ -5,6 +5,8 @@ import net.minecraft.CrashReportCategory; + import net.minecraft.core.BlockPos; + import net.minecraft.core.Registry; + import net.minecraft.nbt.CompoundTag; ++import net.minecraft.nbt.ListTag; ++import net.minecraft.nbt.StringTag; + import net.minecraft.network.protocol.game.ClientboundBlockEntityDataPacket; + import net.minecraft.resources.ResourceLocation; + import net.minecraft.world.level.Level; +@@ -87,10 +89,26 @@ public abstract class BlockEntity implements net.minecraft.server.KeyedObject { + if (persistentDataTag instanceof CompoundTag) { + this.persistentDataContainer.putAll((CompoundTag) persistentDataTag); + } ++ // Purpur start ++ if (nbt.contains("Purpur.persistentDisplayName")) { ++ this.persistentDisplayName = nbt.getString("Purpur.persistentDisplayName"); ++ } ++ if (nbt.contains("Purpur.persistentLore")) { ++ this.persistentLore = nbt.getList("Purpur.persistentLore", 8); ++ } ++ // Purpur end + } + // CraftBukkit end + + public CompoundTag save(CompoundTag nbt) { ++ // Purpur start ++ if (this.persistentDisplayName != null) { ++ nbt.put("Purpur.persistentDisplayName", StringTag.valueOf(this.persistentDisplayName)); ++ } ++ if (this.persistentLore != null) { ++ nbt.put("Purpur.persistentLore", this.persistentLore); ++ } ++ // Purpur end + return this.saveMetadata(nbt); + } + +@@ -243,4 +261,25 @@ public abstract class BlockEntity implements net.minecraft.server.KeyedObject { + return null; + } + // CraftBukkit end ++ ++ // Purpur start ++ private String persistentDisplayName = null; ++ private ListTag persistentLore = null; ++ ++ public void setPersistentDisplayName(String json) { ++ this.persistentDisplayName = json; ++ } ++ ++ public void setPersistentLore(ListTag lore) { ++ this.persistentLore = lore; ++ } ++ ++ public String getPersistentDisplayName() { ++ return this.persistentDisplayName; ++ } ++ ++ public ListTag getPersistentLore() { ++ return this.persistentLore; ++ } ++ // Purpur end + } +diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java +index a55906d57840a471078a411f706b0f353462b03f..1615b807510cf5150526362195cbadaba3289afa 100644 +--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java ++++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java +@@ -124,6 +124,7 @@ public class PurpurWorldConfig { + public boolean entitiesPickUpLootBypassMobGriefing = false; + public boolean entitiesCanUsePortals = true; + public boolean milkCuresBadOmen = true; ++ public boolean persistentTileEntityDisplayNames = false; + public double tridentLoyaltyVoidReturnHeight = 0.0D; + public double voidDamageHeight = -64.0D; + public double voidDamageDealt = 4.0D; +@@ -135,6 +136,7 @@ public class PurpurWorldConfig { + entitiesPickUpLootBypassMobGriefing = getBoolean("gameplay-mechanics.entities-pick-up-loot-bypass-mob-griefing", entitiesPickUpLootBypassMobGriefing); + entitiesCanUsePortals = getBoolean("gameplay-mechanics.entities-can-use-portals", entitiesCanUsePortals); + milkCuresBadOmen = getBoolean("gameplay-mechanics.milk-cures-bad-omen", milkCuresBadOmen); ++ persistentTileEntityDisplayNames = getBoolean("gameplay-mechanics.persistent-tileentity-display-names-and-lore", persistentTileEntityDisplayNames); + tridentLoyaltyVoidReturnHeight = getDouble("gameplay-mechanics.trident-loyalty-void-return-height", tridentLoyaltyVoidReturnHeight); + voidDamageHeight = getDouble("gameplay-mechanics.void-damage-height", voidDamageHeight); + voidDamageDealt = getDouble("gameplay-mechanics.void-damage-dealt", voidDamageDealt); diff --git a/patches/server-unmapped/0112-Add-predicate-to-recipe-s-ExactChoice-ingredient.patch b/patches/server/0109-Add-predicate-to-recipe-s-ExactChoice-ingredient.patch similarity index 52% rename from patches/server-unmapped/0112-Add-predicate-to-recipe-s-ExactChoice-ingredient.patch rename to patches/server/0109-Add-predicate-to-recipe-s-ExactChoice-ingredient.patch index 2e1d8f600..2c84a8f65 100644 --- a/patches/server-unmapped/0112-Add-predicate-to-recipe-s-ExactChoice-ingredient.patch +++ b/patches/server/0109-Add-predicate-to-recipe-s-ExactChoice-ingredient.patch @@ -4,20 +4,20 @@ Date: Sat, 3 Oct 2020 17:40:52 -0500 Subject: [PATCH] Add predicate to recipe's ExactChoice ingredient -diff --git a/src/main/java/net/minecraft/world/item/crafting/RecipeItemStack.java b/src/main/java/net/minecraft/world/item/crafting/RecipeItemStack.java -index 63274908bc7552321a4db3d4e0eec0f55ee34786..c7f6dc5a933873a6118a5674e4ce04cfa1664f60 100644 ---- a/src/main/java/net/minecraft/world/item/crafting/RecipeItemStack.java -+++ b/src/main/java/net/minecraft/world/item/crafting/RecipeItemStack.java -@@ -36,6 +36,7 @@ public final class RecipeItemStack implements Predicate { - public ItemStack[] choices; - private IntList d; +diff --git a/src/main/java/net/minecraft/world/item/crafting/Ingredient.java b/src/main/java/net/minecraft/world/item/crafting/Ingredient.java +index e10a7268274488c50c0e4b5a10f8fa5de7d500e5..52063c1b14618cf132dcc45b0503e1aec838ec96 100644 +--- a/src/main/java/net/minecraft/world/item/crafting/Ingredient.java ++++ b/src/main/java/net/minecraft/world/item/crafting/Ingredient.java +@@ -36,6 +36,7 @@ public final class Ingredient implements Predicate { + public ItemStack[] itemStacks; + private IntList stackingIds; public boolean exact; // CraftBukkit -+ public Predicate predicate; // Purpur ++ public Predicate predicate; - public RecipeItemStack(Stream stream) { - this.b = (RecipeItemStack.Provider[]) stream.toArray((i) -> { -@@ -62,6 +63,12 @@ public final class RecipeItemStack implements Predicate { - if (this.choices.length == 0) { + public Ingredient(Stream entries) { + this.values = (Ingredient.Value[]) entries.toArray((i) -> { +@@ -67,6 +68,12 @@ public final class Ingredient implements Predicate { + if (this.itemStacks.length == 0) { return itemstack.isEmpty(); } else { + // Purpur start @@ -26,16 +26,16 @@ index 63274908bc7552321a4db3d4e0eec0f55ee34786..c7f6dc5a933873a6118a5674e4ce04cf + } + // Purpur end + - ItemStack[] aitemstack = this.choices; + ItemStack[] aitemstack = this.itemStacks; int i = aitemstack.length; diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftRecipe.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftRecipe.java -index b7e8c3798628229be56289818caa3024014640d6..43c50c2c54444c67e4a875be4880afe97c32412c 100644 +index 10ace7bb17c36bfefc584a6322841ab6ea4c866f..a225ec89946cb4c9634a797c8568171cffe4410d 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftRecipe.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftRecipe.java @@ -22,6 +22,7 @@ public interface CraftRecipe extends Recipe { } else if (bukkit instanceof RecipeChoice.ExactChoice) { - stack = new RecipeItemStack(((RecipeChoice.ExactChoice) bukkit).getChoices().stream().map((mat) -> new net.minecraft.world.item.crafting.RecipeItemStack.StackProvider(CraftItemStack.asNMSCopy(mat)))); + stack = new Ingredient(((RecipeChoice.ExactChoice) bukkit).getChoices().stream().map((mat) -> new net.minecraft.world.item.crafting.Ingredient.ItemValue(CraftItemStack.asNMSCopy(mat)))); stack.exact = true; + stack.predicate = ((RecipeChoice.ExactChoice) bukkit).getPredicate(); // Purpur } else { diff --git a/patches/server/0110-Flying-squids-Oh-my.patch b/patches/server/0110-Flying-squids-Oh-my.patch new file mode 100644 index 000000000..0194e260f --- /dev/null +++ b/patches/server/0110-Flying-squids-Oh-my.patch @@ -0,0 +1,59 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: William Blake Galbreath +Date: Sun, 4 Oct 2020 12:00:42 -0500 +Subject: [PATCH] Flying squids! Oh my! + + +diff --git a/src/main/java/net/minecraft/world/entity/animal/Squid.java b/src/main/java/net/minecraft/world/entity/animal/Squid.java +index 2affff346a7fe81480e86cb61996039df0569853..be9b800d81b4d5faed7a3fb95d605bfd9e9afde6 100644 +--- a/src/main/java/net/minecraft/world/entity/animal/Squid.java ++++ b/src/main/java/net/minecraft/world/entity/animal/Squid.java +@@ -85,6 +85,11 @@ public class Squid extends WaterAnimal { + // Stops squids from floating just over the water + return this.getBoundingBox().deflate(0.001D).offsetY(level.purpurConfig.squidOffsetWaterCheck); + } ++ ++ @Override ++ public boolean isInWater() { ++ return this.wasTouchingWater || level.purpurConfig.squidsCanFly; ++ } + // Purpur end + + @Override +@@ -159,6 +164,7 @@ public class Squid extends WaterAnimal { + } + + if (this.isInWaterOrBubble()) { ++ if (level.purpurConfig.squidsCanFly) setNoGravity(!wasTouchingWater); // Purpur + if (this.tentacleMovement < 3.1415927F) { + float f = this.tentacleMovement / 3.1415927F; + +@@ -320,7 +326,7 @@ public class Squid extends WaterAnimal { + + if (i > 100) { + this.squid.setMovementVector(0.0F, 0.0F, 0.0F); +- } else if (this.squid.getRandom().nextInt(50) == 0 || !this.squid.wasTouchingWater || !this.squid.hasMovementVector()) { ++ } else if (this.squid.getRandom().nextInt(50) == 0 || !this.squid.isInWater() || !this.squid.hasMovementVector()) { // Purpur + float f = this.squid.getRandom().nextFloat() * 6.2831855F; + float f1 = Mth.cos(f) * 0.2F; + float f2 = -0.1F + this.squid.getRandom().nextFloat() * 0.2F; +diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java +index 1615b807510cf5150526362195cbadaba3289afa..03347dbf377458220d8ccc24b0993919562d352a 100644 +--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java ++++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java +@@ -1361,6 +1361,7 @@ public class PurpurWorldConfig { + public double squidMaxHealth = 10.0D; + public boolean squidImmuneToEAR = true; + public double squidOffsetWaterCheck = 0.0D; ++ public boolean squidsCanFly = false; + private void squidSettings() { + squidRidable = getBoolean("mobs.squid.ridable", squidRidable); + if (PurpurConfig.version < 10) { +@@ -1371,6 +1372,7 @@ public class PurpurWorldConfig { + squidMaxHealth = getDouble("mobs.squid.attributes.max_health", squidMaxHealth); + squidImmuneToEAR = getBoolean("mobs.squid.immune-to-EAR", squidImmuneToEAR); + squidOffsetWaterCheck = getDouble("mobs.squid.water-offset-check", squidOffsetWaterCheck); ++ squidsCanFly = getBoolean("mobs.squid.can-fly", squidsCanFly); + } + + public boolean spiderRidable = false; diff --git a/patches/server/0111-Infinity-bow-settings.patch b/patches/server/0111-Infinity-bow-settings.patch new file mode 100644 index 000000000..f90eb35c3 --- /dev/null +++ b/patches/server/0111-Infinity-bow-settings.patch @@ -0,0 +1,39 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: William Blake Galbreath +Date: Sun, 4 Oct 2020 19:08:53 -0500 +Subject: [PATCH] Infinity bow settings + + +diff --git a/src/main/java/net/minecraft/world/item/BowItem.java b/src/main/java/net/minecraft/world/item/BowItem.java +index afe33f20578177cb517e1c116e6319481642e66c..93c58f7ef7f00c7f843444ad6d00bd855a3987a4 100644 +--- a/src/main/java/net/minecraft/world/item/BowItem.java ++++ b/src/main/java/net/minecraft/world/item/BowItem.java +@@ -38,7 +38,7 @@ public class BowItem extends ProjectileWeaponItem implements Vanishable { + float f = BowItem.getPowerForTime(j); + + if ((double) f >= 0.1D) { +- boolean flag1 = flag && itemstack1.is(Items.ARROW); ++ boolean flag1 = flag && ((itemstack1.is(Items.ARROW) && world.purpurConfig.infinityWorksWithNormalArrows) || (itemstack1.is(Items.TIPPED_ARROW) && world.purpurConfig.infinityWorksWithTippedArrows) || (itemstack1.is(Items.SPECTRAL_ARROW) && world.purpurConfig.infinityWorksWithSpectralArrows)); // Purpur if (!world.isClientSide) { + + if (!world.isClientSide) { + ArrowItem itemarrow = (ArrowItem) (itemstack1.getItem() instanceof ArrowItem ? itemstack1.getItem() : Items.ARROW); +diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java +index 03347dbf377458220d8ccc24b0993919562d352a..7c2a081585b37346fa9ace6290352e5b58f1261c 100644 +--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java ++++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java +@@ -299,6 +299,15 @@ public class PurpurWorldConfig { + idleTimeoutUpdateTabList = getBoolean("gameplay-mechanics.player.idle-timeout.update-tab-list", idleTimeoutUpdateTabList); + } + ++ public boolean infinityWorksWithNormalArrows = true; ++ public boolean infinityWorksWithSpectralArrows = false; ++ public boolean infinityWorksWithTippedArrows = false; ++ private void infinityArrowsSettings() { ++ infinityWorksWithNormalArrows = getBoolean("gameplay-mechanics.infinity-bow.normal-arrows", infinityWorksWithNormalArrows); ++ infinityWorksWithSpectralArrows = getBoolean("gameplay-mechanics.infinity-bow.spectral-arrows", infinityWorksWithSpectralArrows); ++ infinityWorksWithTippedArrows = getBoolean("gameplay-mechanics.infinity-bow.tipped-arrows", infinityWorksWithTippedArrows); ++ } ++ + public int playerSpawnInvulnerableTicks = 60; + public boolean playerInvulnerableWhileAcceptingResourcePack = false; + private void playerInvulnerabilities() { diff --git a/patches/server/0112-Stonecutter-damage.patch b/patches/server/0112-Stonecutter-damage.patch new file mode 100644 index 000000000..76a398262 --- /dev/null +++ b/patches/server/0112-Stonecutter-damage.patch @@ -0,0 +1,78 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: William Blake Galbreath +Date: Mon, 5 Oct 2020 12:15:14 -0500 +Subject: [PATCH] Stonecutter damage + + +diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java +index 70d436a272d03d1f2eb754a83f1ea7e81d97ff3b..5ff219cefec41d87c98e0e33e94ad44b9ba52910 100644 +--- a/src/main/java/net/minecraft/world/entity/Entity.java ++++ b/src/main/java/net/minecraft/world/entity/Entity.java +@@ -897,7 +897,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n + } + // CraftBukkit end + +- if (this.onGround && !this.isSteppingCarefully()) { ++ if (this.onGround && (!this.isSteppingCarefully() || (block == Blocks.STONECUTTER && level.purpurConfig.stonecutterDamage > 0.0F))) { + block.stepOn(this.level, blockposition, iblockdata, this); + } + +diff --git a/src/main/java/net/minecraft/world/level/block/StonecutterBlock.java b/src/main/java/net/minecraft/world/level/block/StonecutterBlock.java +index e5c11ca529b524b444695f50e2648f0206ff34e1..65b1fd6ace11d4f82d54531869f00e92c19861a6 100644 +--- a/src/main/java/net/minecraft/world/level/block/StonecutterBlock.java ++++ b/src/main/java/net/minecraft/world/level/block/StonecutterBlock.java +@@ -93,4 +93,16 @@ public class StonecutterBlock extends Block { + public boolean isPathfindable(BlockState state, BlockGetter world, BlockPos pos, PathComputationType type) { + return false; + } ++ ++ // Purpur start ++ @Override ++ public void stepOn(Level level, BlockPos pos, BlockState state, net.minecraft.world.entity.Entity entity) { ++ if (level.purpurConfig.stonecutterDamage > 0.0F && entity instanceof net.minecraft.world.entity.EntityLiving) { ++ org.bukkit.craftbukkit.event.CraftEventFactory.blockDamage = level.getWorld().getBlockAt(pos.getX(), pos.getY(), pos.getZ()); ++ entity.hurt(net.minecraft.world.damagesource.DamageSource.CACTUS, level.purpurConfig.stonecutterDamage); ++ org.bukkit.craftbukkit.event.CraftEventFactory.blockDamage = null; ++ } ++ super.stepOn(level, pos, state, entity); ++ } ++ // Purpur end + } +diff --git a/src/main/java/net/minecraft/world/level/pathfinder/WalkNodeEvaluator.java b/src/main/java/net/minecraft/world/level/pathfinder/WalkNodeEvaluator.java +index 2ad5ff9a1d7de54e75436e99da8a73db9dc91bde..60605a8a021cc56f9c3ba22bc43c43c302fb1a70 100644 +--- a/src/main/java/net/minecraft/world/level/pathfinder/WalkNodeEvaluator.java ++++ b/src/main/java/net/minecraft/world/level/pathfinder/WalkNodeEvaluator.java +@@ -463,7 +463,7 @@ public class WalkNodeEvaluator extends NodeEvaluator { + return BlockPathTypes.DANGER_CACTUS; + } + +- if (blockState.is(Blocks.SWEET_BERRY_BUSH)) { ++ if (blockState.is(Blocks.SWEET_BERRY_BUSH) || blockState.is(Blocks.STONECUTTER)) { + return BlockPathTypes.DANGER_OTHER; + } + +@@ -495,7 +495,7 @@ public class WalkNodeEvaluator extends NodeEvaluator { + return BlockPathTypes.POWDER_SNOW; + } else if (blockState.is(Blocks.CACTUS)) { + return BlockPathTypes.DAMAGE_CACTUS; +- } else if (blockState.is(Blocks.SWEET_BERRY_BUSH)) { ++ } else if (blockState.is(Blocks.SWEET_BERRY_BUSH) || blockState.is(Blocks.STONECUTTER)) { + return BlockPathTypes.DAMAGE_OTHER; + } else if (blockState.is(Blocks.HONEY_BLOCK)) { + return BlockPathTypes.STICKY_HONEY; +diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java +index 7c2a081585b37346fa9ace6290352e5b58f1261c..192896f331967b057c56bd3deeca1c4f740f7dff 100644 +--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java ++++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java +@@ -1469,6 +1469,11 @@ public class PurpurWorldConfig { + spawnerDeactivateByRedstone = getBoolean("blocks.spawner.deactivate-by-redstone", spawnerDeactivateByRedstone); + } + ++ public float stonecutterDamage = 0.0F; ++ private void stonecutterSettings() { ++ stonecutterDamage = (float) getDouble("blocks.stonecutter.damage", stonecutterDamage); ++ } ++ + public boolean turtleRidable = false; + public boolean turtleRidableInWater = false; + public double turtleMaxHealth = 30.0D;