From 989d44ebe3ab2c8db2cd9c1cdaadbd291cc887ef Mon Sep 17 00:00:00 2001 From: kickash32 Date: Sat, 27 Jun 2020 11:41:45 -0400 Subject: [PATCH 1/7] organize patches --- ...Allow-disabling-armour-stand-ticking.patch | 278 ------------------ ...ets-from-world-player-list-not-serve.patch | 0 ...ro-tick-instant-grow-farms-MC-113809.patch | 0 ...-Fix-spawn-radius-being-treated-as-0.patch | 0 .../0429-Seed-based-feature-search.patch | 0 ...-Villager-AI-optimizations-DROP-1.16.patch | 0 6 files changed, 278 deletions(-) delete mode 100644 removed/1.16/0274-Allow-disabling-armour-stand-ticking.patch rename removed/1.16/{ => No longer Needed}/0276-Send-nearby-packets-from-world-player-list-not-serve.patch (100%) rename removed/1.16/{ => No longer Needed}/0401-Fix-zero-tick-instant-grow-farms-MC-113809.patch (100%) rename removed/1.16/{ => No longer Needed}/0412-Fix-spawn-radius-being-treated-as-0.patch (100%) rename removed/1.16/{ => No longer Needed}/0429-Seed-based-feature-search.patch (100%) rename removed/1.16/{ => No longer Needed}/0468-Port-20w15a-Villager-AI-optimizations-DROP-1.16.patch (100%) diff --git a/removed/1.16/0274-Allow-disabling-armour-stand-ticking.patch b/removed/1.16/0274-Allow-disabling-armour-stand-ticking.patch deleted file mode 100644 index dca49d7957..0000000000 --- a/removed/1.16/0274-Allow-disabling-armour-stand-ticking.patch +++ /dev/null @@ -1,278 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: kashike -Date: Wed, 15 Aug 2018 01:26:09 -0700 -Subject: [PATCH] Allow disabling armour stand ticking - - -diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index eaaa51e4bf761f41fd516402ce1ad0f903c6ab71..bc3df01aab3e79be9c2836820e0eacc69ea6c1f4 100644 ---- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -@@ -393,4 +393,10 @@ public class PaperWorldConfig { - private void armorStandEntityLookups() { - armorStandEntityLookups = getBoolean("armor-stands-do-collision-entity-lookups", true); - } -+ -+ public boolean armorStandTick = true; -+ private void armorStandTick() { -+ this.armorStandTick = this.getBoolean("armor-stands-tick", this.armorStandTick); -+ log("ArmorStand ticking is " + (this.armorStandTick ? "enabled" : "disabled") + " by default"); -+ } - } -diff --git a/src/main/java/net/minecraft/server/EntityArmorStand.java b/src/main/java/net/minecraft/server/EntityArmorStand.java -index 61d7d507aaac3e7e5a885387ae89c67dfb1c9844..42b9a339e9c35db596ec78881c32c801c2d739f4 100644 ---- a/src/main/java/net/minecraft/server/EntityArmorStand.java -+++ b/src/main/java/net/minecraft/server/EntityArmorStand.java -@@ -44,6 +44,12 @@ public class EntityArmorStand extends EntityLiving { - public Vector3f leftLegPose; - public Vector3f rightLegPose; - public boolean canMove = true; // Paper -+ // Paper start - Allow ArmorStands not to tick -+ public boolean canTick = true; -+ public boolean canTickSetByAPI = false; -+ private boolean noTickPoseDirty = false; -+ private boolean noTickEquipmentDirty = false; -+ // Paper end - - public EntityArmorStand(EntityTypes entitytypes, World world) { - super(entitytypes, world); -@@ -55,6 +61,7 @@ public class EntityArmorStand extends EntityLiving { - this.rightArmPose = EntityArmorStand.bu; - this.leftLegPose = EntityArmorStand.bv; - this.rightLegPose = EntityArmorStand.bw; -+ if (world != null) this.canTick = world.paperConfig.armorStandTick; // Paper - armour stand ticking - this.H = 0.0F; - } - -@@ -135,6 +142,7 @@ public class EntityArmorStand extends EntityLiving { - this.armorItems.set(enumitemslot.b(), itemstack); - } - -+ this.noTickEquipmentDirty = true; // Paper - Allow equipment to be updated even when tick disabled - } - - @Override -@@ -215,6 +223,7 @@ public class EntityArmorStand extends EntityLiving { - } - - nbttagcompound.set("Pose", this.B()); -+ if (this.canTickSetByAPI) nbttagcompound.setBoolean("Paper.CanTickOverride", this.canTick); // Paper - persist no tick setting - } - - @Override -@@ -246,6 +255,12 @@ public class EntityArmorStand extends EntityLiving { - this.setBasePlate(nbttagcompound.getBoolean("NoBasePlate")); - this.setMarker(nbttagcompound.getBoolean("Marker")); - this.noclip = !this.A(); -+ // Paper start - persist no tick -+ if (nbttagcompound.hasKey("Paper.CanTickOverride")) { -+ this.canTick = nbttagcompound.getBoolean("Paper.CanTickOverride"); -+ this.canTickSetByAPI = true; -+ } -+ // Paper end - NBTTagCompound nbttagcompound1 = nbttagcompound.getCompound("Pose"); - - this.g(nbttagcompound1); -@@ -600,7 +615,29 @@ public class EntityArmorStand extends EntityLiving { - - @Override - public void tick() { -+ // Paper start -+ if (!this.canTick) { -+ if (this.noTickPoseDirty) { -+ this.noTickPoseDirty = false; -+ this.updatePose(); -+ } -+ -+ if (this.noTickEquipmentDirty) { -+ this.noTickEquipmentDirty = false; -+ this.updateEntityEquipment(); -+ } -+ -+ return; -+ } -+ // Paper end -+ - super.tick(); -+ // Paper start - Split into separate method -+ updatePose(); -+ } -+ -+ public void updatePose() { -+ // Paper end - Vector3f vector3f = (Vector3f) this.datawatcher.get(EntityArmorStand.c); - - if (!this.headPose.equals(vector3f)) { -@@ -723,31 +760,37 @@ public class EntityArmorStand extends EntityLiving { - public void setHeadPose(Vector3f vector3f) { - this.headPose = vector3f; - this.datawatcher.set(EntityArmorStand.c, vector3f); -+ this.noTickPoseDirty = true; // Paper - Allow updates when not ticking - } - - public void setBodyPose(Vector3f vector3f) { - this.bodyPose = vector3f; - this.datawatcher.set(EntityArmorStand.d, vector3f); -+ this.noTickPoseDirty = true; // Paper - Allow updates when not ticking - } - - public void setLeftArmPose(Vector3f vector3f) { - this.leftArmPose = vector3f; - this.datawatcher.set(EntityArmorStand.e, vector3f); -+ this.noTickPoseDirty = true; // Paper - Allow updates when not ticking - } - - public void setRightArmPose(Vector3f vector3f) { - this.rightArmPose = vector3f; - this.datawatcher.set(EntityArmorStand.f, vector3f); -+ this.noTickPoseDirty = true; // Paper - Allow updates when not ticking - } - - public void setLeftLegPose(Vector3f vector3f) { - this.leftLegPose = vector3f; - this.datawatcher.set(EntityArmorStand.g, vector3f); -+ this.noTickPoseDirty = true; // Paper - Allow updates when not ticking - } - - public void setRightLegPose(Vector3f vector3f) { - this.rightLegPose = vector3f; - this.datawatcher.set(EntityArmorStand.bp, vector3f); -+ this.noTickPoseDirty = true; // Paper - Allow updates when not ticking - } - - public Vector3f r() { -diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java -index a4051c1f0cdcf179e7afe60d301982412da7ed64..990aea604d02db723193722ed692c3a3725f987d 100644 ---- a/src/main/java/net/minecraft/server/EntityLiving.java -+++ b/src/main/java/net/minecraft/server/EntityLiving.java -@@ -2329,52 +2329,7 @@ public abstract class EntityLiving extends Entity { - } - } - -- EnumItemSlot[] aenumitemslot = EnumItemSlot.values(); -- int k = aenumitemslot.length; -- -- for (int l = 0; l < k; ++l) { -- EnumItemSlot enumitemslot = aenumitemslot[l]; -- ItemStack itemstack; -- -- switch (enumitemslot.a()) { -- case HAND: -- itemstack = (ItemStack) this.bu.get(enumitemslot.b()); -- break; -- case ARMOR: -- itemstack = (ItemStack) this.bv.get(enumitemslot.b()); -- break; -- default: -- continue; -- } -- -- ItemStack itemstack1 = this.getEquipment(enumitemslot); -- -- if (!ItemStack.matches(itemstack1, itemstack)) { -- // Paper start - PlayerArmorChangeEvent -- if (this instanceof EntityPlayer && enumitemslot.getType() == EnumItemSlot.Function.ARMOR) { -- final org.bukkit.inventory.ItemStack oldItem = CraftItemStack.asBukkitCopy(itemstack); -- final org.bukkit.inventory.ItemStack newItem = CraftItemStack.asBukkitCopy(itemstack1); -- new PlayerArmorChangeEvent((Player) this.getBukkitEntity(), PlayerArmorChangeEvent.SlotType.valueOf(enumitemslot.name()), oldItem, newItem).callEvent(); -- } -- // Paper end -- ((WorldServer) this.world).getChunkProvider().broadcast(this, new PacketPlayOutEntityEquipment(this.getId(), enumitemslot, itemstack1)); -- if (!itemstack.isEmpty()) { -- this.getAttributeMap().a(itemstack.a(enumitemslot)); -- } -- -- if (!itemstack1.isEmpty()) { -- this.getAttributeMap().b(itemstack1.a(enumitemslot)); -- } -- -- switch (enumitemslot.a()) { -- case HAND: -- this.bu.set(enumitemslot.b(), itemstack1.cloneItemStack()); -- break; -- case ARMOR: -- this.bv.set(enumitemslot.b(), itemstack1.cloneItemStack()); -- } -- } -- } -+ updateEntityEquipment(); // Paper - split into own method - - if (this.ticksLived % 20 == 0) { - this.getCombatTracker().g(); -@@ -2475,6 +2430,55 @@ public abstract class EntityLiving extends Entity { - } - } - -+ // Paper start - split into own method from above -+ public void updateEntityEquipment() { -+ EnumItemSlot[] aenumitemslot = EnumItemSlot.values(); -+ int k = aenumitemslot.length; -+ for (int l = 0; l < k; ++l) { -+ EnumItemSlot enumitemslot = aenumitemslot[l]; -+ ItemStack itemstack; -+ -+ switch (enumitemslot.a()) { -+ case HAND: -+ itemstack = (ItemStack) this.bu.get(enumitemslot.b()); -+ break; -+ case ARMOR: -+ itemstack = (ItemStack) this.bv.get(enumitemslot.b()); -+ break; -+ default: -+ continue; -+ } -+ -+ ItemStack itemstack1 = this.getEquipment(enumitemslot); -+ -+ if (!ItemStack.matches(itemstack1, itemstack)) { -+ // Paper start - PlayerArmorChangeEvent -+ if (this instanceof EntityPlayer && enumitemslot.getType() == EnumItemSlot.Function.ARMOR) { -+ final org.bukkit.inventory.ItemStack oldItem = CraftItemStack.asBukkitCopy(itemstack); -+ final org.bukkit.inventory.ItemStack newItem = CraftItemStack.asBukkitCopy(itemstack1); -+ new PlayerArmorChangeEvent((Player) this.getBukkitEntity(), PlayerArmorChangeEvent.SlotType.valueOf(enumitemslot.name()), oldItem, newItem).callEvent(); -+ } -+ // Paper end -+ ((WorldServer) this.world).getChunkProvider().broadcast(this, new PacketPlayOutEntityEquipment(this.getId(), enumitemslot, itemstack1)); -+ if (!itemstack.isEmpty()) { -+ this.getAttributeMap().a(itemstack.a(enumitemslot)); -+ } -+ -+ if (!itemstack1.isEmpty()) { -+ this.getAttributeMap().b(itemstack1.a(enumitemslot)); -+ } -+ -+ switch (enumitemslot.a()) { -+ case HAND: -+ this.bu.set(enumitemslot.b(), itemstack1.cloneItemStack()); -+ break; -+ case ARMOR: -+ this.bv.set(enumitemslot.b(), itemstack1.cloneItemStack()); -+ } -+ } -+ } -+ } -+ - protected float f(float f, float f1) { - float f2 = MathHelper.g(f - this.aI); - -diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftArmorStand.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftArmorStand.java -index d1d689e5d78c569313c4059c4652724605dc07d2..ac105270d5c7e2070f52782fc7dbdcd381db33a5 100644 ---- a/src/main/java/org/bukkit/craftbukkit/entity/CraftArmorStand.java -+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftArmorStand.java -@@ -297,5 +297,16 @@ public class CraftArmorStand extends CraftLivingEntity implements ArmorStand { - public boolean isSlotDisabled(org.bukkit.inventory.EquipmentSlot slot) { - return getHandle().isSlotDisabled(org.bukkit.craftbukkit.CraftEquipmentSlot.getNMS(slot)); - } -+ -+ @Override -+ public boolean canTick() { -+ return this.getHandle().canTick; -+ } -+ -+ @Override -+ public void setCanTick(final boolean tick) { -+ this.getHandle().canTick = tick; -+ this.getHandle().canTickSetByAPI = true; -+ } - // Paper end - } diff --git a/removed/1.16/0276-Send-nearby-packets-from-world-player-list-not-serve.patch b/removed/1.16/No longer Needed/0276-Send-nearby-packets-from-world-player-list-not-serve.patch similarity index 100% rename from removed/1.16/0276-Send-nearby-packets-from-world-player-list-not-serve.patch rename to removed/1.16/No longer Needed/0276-Send-nearby-packets-from-world-player-list-not-serve.patch diff --git a/removed/1.16/0401-Fix-zero-tick-instant-grow-farms-MC-113809.patch b/removed/1.16/No longer Needed/0401-Fix-zero-tick-instant-grow-farms-MC-113809.patch similarity index 100% rename from removed/1.16/0401-Fix-zero-tick-instant-grow-farms-MC-113809.patch rename to removed/1.16/No longer Needed/0401-Fix-zero-tick-instant-grow-farms-MC-113809.patch diff --git a/removed/1.16/0412-Fix-spawn-radius-being-treated-as-0.patch b/removed/1.16/No longer Needed/0412-Fix-spawn-radius-being-treated-as-0.patch similarity index 100% rename from removed/1.16/0412-Fix-spawn-radius-being-treated-as-0.patch rename to removed/1.16/No longer Needed/0412-Fix-spawn-radius-being-treated-as-0.patch diff --git a/removed/1.16/0429-Seed-based-feature-search.patch b/removed/1.16/No longer Needed/0429-Seed-based-feature-search.patch similarity index 100% rename from removed/1.16/0429-Seed-based-feature-search.patch rename to removed/1.16/No longer Needed/0429-Seed-based-feature-search.patch diff --git a/removed/1.16/0468-Port-20w15a-Villager-AI-optimizations-DROP-1.16.patch b/removed/1.16/No longer Needed/0468-Port-20w15a-Villager-AI-optimizations-DROP-1.16.patch similarity index 100% rename from removed/1.16/0468-Port-20w15a-Villager-AI-optimizations-DROP-1.16.patch rename to removed/1.16/No longer Needed/0468-Port-20w15a-Villager-AI-optimizations-DROP-1.16.patch From 52f850363902fee93f1cb8272a78aa6155d67ca6 Mon Sep 17 00:00:00 2001 From: kickash32 Date: Sat, 27 Jun 2020 12:44:50 -0400 Subject: [PATCH 2/7] someone left this in? --- scripts/importmcdev.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/scripts/importmcdev.sh b/scripts/importmcdev.sh index 06ad7ab9b9..269f68bcd4 100755 --- a/scripts/importmcdev.sh +++ b/scripts/importmcdev.sh @@ -94,7 +94,6 @@ done # import FileName -import VoxelShapeSpliterator ######################################################## ######################################################## From 501c1c78006ba7bac39ad3ba81c7944ec7dd520a Mon Sep 17 00:00:00 2001 From: kickash32 Date: Sat, 27 Jun 2020 14:35:52 -0400 Subject: [PATCH 3/7] port 4 patches --- ...mit-lightning-strike-effect-distance.patch | 93 +++++++++++++ ...22-Add-permission-for-command-blocks.patch | 79 +++++++++++ ...sure-Entity-AABB-s-are-never-invalid.patch | 129 ++++++++++++++++++ ...WorldBorder-collision-checks-and-air.patch | 63 +++++++++ 4 files changed, 364 insertions(+) create mode 100644 Spigot-Server-Patches/0521-Limit-lightning-strike-effect-distance.patch create mode 100644 Spigot-Server-Patches/0522-Add-permission-for-command-blocks.patch create mode 100644 Spigot-Server-Patches/0523-Ensure-Entity-AABB-s-are-never-invalid.patch create mode 100644 Spigot-Server-Patches/0524-Optimize-WorldBorder-collision-checks-and-air.patch diff --git a/Spigot-Server-Patches/0521-Limit-lightning-strike-effect-distance.patch b/Spigot-Server-Patches/0521-Limit-lightning-strike-effect-distance.patch new file mode 100644 index 0000000000..537284d2e1 --- /dev/null +++ b/Spigot-Server-Patches/0521-Limit-lightning-strike-effect-distance.patch @@ -0,0 +1,93 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: kickash32 +Date: Sat, 27 Jun 2020 12:37:58 -0400 +Subject: [PATCH] Limit lightning strike effect distance + + +diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +index 0f4fca90fd6c3788a5762c96c344899cb1665466..4a59d42b778e681e93f1243ecd16c5cf46160b97 100644 +--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java ++++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +@@ -1,11 +1,5 @@ + package com.destroystokyo.paper; + +-import java.util.Arrays; +-import java.util.EnumMap; +-import java.util.HashMap; +-import java.util.List; +-import java.util.Map; +- + import com.destroystokyo.paper.antixray.ChunkPacketBlockControllerAntiXray.EngineMode; + import org.bukkit.Bukkit; + import org.bukkit.Material; +@@ -13,6 +7,12 @@ import org.bukkit.configuration.ConfigurationSection; + import org.bukkit.configuration.file.YamlConfiguration; + import org.spigotmc.SpigotWorldConfig; + ++import java.util.Arrays; ++import java.util.EnumMap; ++import java.util.HashMap; ++import java.util.List; ++import java.util.Map; ++ + import static com.destroystokyo.paper.PaperConfig.log; + import static com.destroystokyo.paper.PaperConfig.logError; + +@@ -648,4 +648,26 @@ public class PaperWorldConfig { + delayChunkUnloadsBy *= 20; + } + } ++ ++ public double sqrMaxThunderDistance; ++ public double sqrMaxLightningImpactSoundDistance; ++ public double maxLightningFlashDistance; ++ private void lightningStrikeDistanceLimit() { ++ sqrMaxThunderDistance = getInt("lightning-strike-distance-limit.sound", -1); ++ if (sqrMaxThunderDistance > 0) { ++ sqrMaxThunderDistance *= sqrMaxThunderDistance; ++ } ++ ++ sqrMaxLightningImpactSoundDistance = getInt("lightning-strike-distance-limit.impact-sound", -1); ++ if (sqrMaxLightningImpactSoundDistance < 0) { ++ sqrMaxLightningImpactSoundDistance = 32 * 32; //Vanilla value ++ } else { ++ sqrMaxLightningImpactSoundDistance *= sqrMaxLightningImpactSoundDistance; ++ } ++ ++ maxLightningFlashDistance = getInt("lightning-strike-distance-limit.flash", -1); ++ if (maxLightningFlashDistance < 0) { ++ maxLightningFlashDistance = 512; // Vanilla value ++ } ++ } + } +diff --git a/src/main/java/net/minecraft/server/EntityLightning.java b/src/main/java/net/minecraft/server/EntityLightning.java +index 6f979e5f1f1567b140e9689298aff85de34f7413..ebcb9f48f47d1ab1e972bed1bc7cb0ee305a29f2 100644 +--- a/src/main/java/net/minecraft/server/EntityLightning.java ++++ b/src/main/java/net/minecraft/server/EntityLightning.java +@@ -56,6 +56,17 @@ public class EntityLightning extends Entity { + double deltaX = this.locX() - player.locX(); + double deltaZ = this.locZ() - player.locZ(); + double distanceSquared = deltaX * deltaX + deltaZ * deltaZ; ++ // Paper start - Limit lightning strike effect distance ++ if (distanceSquared <= this.world.paperConfig.sqrMaxLightningImpactSoundDistance) { ++ player.playerConnection.sendPacket(new PacketPlayOutNamedSoundEffect(SoundEffects.ENTITY_LIGHTNING_BOLT_IMPACT, ++ SoundCategory.WEATHER, this.locX(), this.locY(), this.locZ(), 2.0f, 0.5F + this.random.nextFloat() * 0.2F)); ++ } ++ ++ if (world.paperConfig.sqrMaxThunderDistance != -1 && distanceSquared >= world.paperConfig.sqrMaxThunderDistance) { ++ continue; ++ } ++ ++ // Paper end + if (distanceSquared > viewDistance * viewDistance) { + double deltaLength = Math.sqrt(distanceSquared); + double relativeX = player.locX() + (deltaX / deltaLength) * viewDistance; +@@ -66,7 +77,7 @@ public class EntityLightning extends Entity { + } + } + // CraftBukkit end +- this.world.playSound((EntityHuman) null, this.locX(), this.locY(), this.locZ(), SoundEffects.ENTITY_LIGHTNING_BOLT_IMPACT, SoundCategory.WEATHER, 2.0F, 0.5F + this.random.nextFloat() * 0.2F); ++// this.world.playSound((EntityHuman) null, this.locX(), this.locY(), this.locZ(), SoundEffects.ENTITY_LIGHTNING_BOLT_IMPACT, SoundCategory.WEATHER, 2.0F, 0.5F + this.random.nextFloat() * 0.2F); // Paper + } + + --this.lifeTicks; diff --git a/Spigot-Server-Patches/0522-Add-permission-for-command-blocks.patch b/Spigot-Server-Patches/0522-Add-permission-for-command-blocks.patch new file mode 100644 index 0000000000..c551f07021 --- /dev/null +++ b/Spigot-Server-Patches/0522-Add-permission-for-command-blocks.patch @@ -0,0 +1,79 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: kickash32 +Date: Sat, 27 Jun 2020 13:15:53 -0400 +Subject: [PATCH] Add permission for command blocks + + +diff --git a/src/main/java/net/minecraft/server/BlockCommand.java b/src/main/java/net/minecraft/server/BlockCommand.java +index dd7066d1a72f5c6f54c1f40a7b694deb827410dc..6b353a99c04e0312f520f8559c05ddaf51c26aaf 100644 +--- a/src/main/java/net/minecraft/server/BlockCommand.java ++++ b/src/main/java/net/minecraft/server/BlockCommand.java +@@ -105,7 +105,7 @@ public class BlockCommand extends BlockTileEntity { + public EnumInteractionResult interact(IBlockData iblockdata, World world, BlockPosition blockposition, EntityHuman entityhuman, EnumHand enumhand, MovingObjectPositionBlock movingobjectpositionblock) { + TileEntity tileentity = world.getTileEntity(blockposition); + +- if (tileentity instanceof TileEntityCommand && entityhuman.isCreativeAndOp()) { ++ if (tileentity instanceof TileEntityCommand && (entityhuman.isCreativeAndOp() || (entityhuman.isCreative() && entityhuman.getBukkitEntity().hasPermission("minecraft.commandblock")))) { // Paper - command block permission + entityhuman.a((TileEntityCommand) tileentity); + return EnumInteractionResult.a(world.isClientSide); + } else { +diff --git a/src/main/java/net/minecraft/server/CommandBlockListenerAbstract.java b/src/main/java/net/minecraft/server/CommandBlockListenerAbstract.java +index 7e13b1cf6d92c3e0f2dab1ba1d42bd4f250e256c..3820acd65f3cd488dba964e6d9c458852570f4a0 100644 +--- a/src/main/java/net/minecraft/server/CommandBlockListenerAbstract.java ++++ b/src/main/java/net/minecraft/server/CommandBlockListenerAbstract.java +@@ -179,7 +179,7 @@ public abstract class CommandBlockListenerAbstract implements ICommandListener { + } + + public EnumInteractionResult a(EntityHuman entityhuman) { +- if (!entityhuman.isCreativeAndOp()) { ++ if (!entityhuman.isCreativeAndOp() && !entityhuman.isCreative() && !entityhuman.getBukkitEntity().hasPermission("minecraft.commandblock")) { // Paper - command block permission + return EnumInteractionResult.PASS; + } else { + if (entityhuman.getWorld().isClientSide) { +diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java +index eeb870107031b38e25b5fb85ea731a7db1d6c2d1..103bda41422f0db700b150116c1417736823e763 100644 +--- a/src/main/java/net/minecraft/server/PlayerConnection.java ++++ b/src/main/java/net/minecraft/server/PlayerConnection.java +@@ -613,7 +613,7 @@ public class PlayerConnection implements PacketListenerPlayIn { + PlayerConnectionUtils.ensureMainThread(packetplayinsetcommandblock, this, this.player.getWorldServer()); + if (!this.minecraftServer.getEnableCommandBlock()) { + this.player.sendMessage(new ChatMessage("advMode.notEnabled"), SystemUtils.b); +- } else if (!this.player.isCreativeAndOp()) { ++ } else if (!this.player.isCreativeAndOp() && !this.player.isCreative() && !this.player.getBukkitEntity().hasPermission("minecraft.commandblock")) { // Paper - command block permission + this.player.sendMessage(new ChatMessage("advMode.notAllowed"), SystemUtils.b); + } else { + CommandBlockListenerAbstract commandblocklistenerabstract = null; +@@ -676,7 +676,7 @@ public class PlayerConnection implements PacketListenerPlayIn { + PlayerConnectionUtils.ensureMainThread(packetplayinsetcommandminecart, this, this.player.getWorldServer()); + if (!this.minecraftServer.getEnableCommandBlock()) { + this.player.sendMessage(new ChatMessage("advMode.notEnabled"), SystemUtils.b); +- } else if (!this.player.isCreativeAndOp()) { ++ } else if (!this.player.isCreativeAndOp() && !this.player.isCreative() && !this.player.getBukkitEntity().hasPermission("minecraft.commandblock")) { // Paper - command block permission + this.player.sendMessage(new ChatMessage("advMode.notAllowed"), SystemUtils.b); + } else { + CommandBlockListenerAbstract commandblocklistenerabstract = packetplayinsetcommandminecart.a(this.player.world); +diff --git a/src/main/java/net/minecraft/server/PlayerInteractManager.java b/src/main/java/net/minecraft/server/PlayerInteractManager.java +index 734855c1db3215d90b2743988f64af68aacb388e..6d192b27440ddfd34555005dafefbce6bbb67236 100644 +--- a/src/main/java/net/minecraft/server/PlayerInteractManager.java ++++ b/src/main/java/net/minecraft/server/PlayerInteractManager.java +@@ -353,7 +353,7 @@ public class PlayerInteractManager { + TileEntity tileentity = this.world.getTileEntity(blockposition); + Block block = iblockdata.getBlock(); + +- if ((block instanceof BlockCommand || block instanceof BlockStructure || block instanceof BlockJigsaw) && !this.player.isCreativeAndOp()) { ++ if ((block instanceof BlockCommand || block instanceof BlockStructure || block instanceof BlockJigsaw) && !this.player.isCreativeAndOp() && !(block instanceof BlockCommand && (this.player.isCreative() && this.player.getBukkitEntity().hasPermission("minecraft.commandblock")))) { // Paper - command block permission + this.world.notify(blockposition, iblockdata, iblockdata, 3); + return false; + } else if (this.player.a((World) this.world, blockposition, this.gamemode)) { +diff --git a/src/main/java/org/bukkit/craftbukkit/util/permissions/CraftDefaultPermissions.java b/src/main/java/org/bukkit/craftbukkit/util/permissions/CraftDefaultPermissions.java +index 525ebf961e5da0687183a5e2ead23ed92cbd9d79..a4a809f302c5ff9c76cde5fc0add2ceec1bdf9b5 100644 +--- a/src/main/java/org/bukkit/craftbukkit/util/permissions/CraftDefaultPermissions.java ++++ b/src/main/java/org/bukkit/craftbukkit/util/permissions/CraftDefaultPermissions.java +@@ -16,6 +16,7 @@ public final class CraftDefaultPermissions { + DefaultPermissions.registerPermission(ROOT + ".nbt.copy", "Gives the user the ability to copy NBT in creative", org.bukkit.permissions.PermissionDefault.TRUE, parent); + DefaultPermissions.registerPermission(ROOT + ".debugstick", "Gives the user the ability to use the debug stick in creative", org.bukkit.permissions.PermissionDefault.OP, parent); + DefaultPermissions.registerPermission(ROOT + ".debugstick.always", "Gives the user the ability to use the debug stick in all game modes", org.bukkit.permissions.PermissionDefault.FALSE, parent); ++ DefaultPermissions.registerPermission(ROOT + ".commandblock", "Gives the user the ability to use command blocks.", org.bukkit.permissions.PermissionDefault.OP, parent); // Paper + // Spigot end + parent.recalculatePermissibles(); + } diff --git a/Spigot-Server-Patches/0523-Ensure-Entity-AABB-s-are-never-invalid.patch b/Spigot-Server-Patches/0523-Ensure-Entity-AABB-s-are-never-invalid.patch new file mode 100644 index 0000000000..6972f06be5 --- /dev/null +++ b/Spigot-Server-Patches/0523-Ensure-Entity-AABB-s-are-never-invalid.patch @@ -0,0 +1,129 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: kickash32 +Date: Sat, 27 Jun 2020 13:32:39 -0400 +Subject: [PATCH] Ensure Entity AABB's are never invalid + + +diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java +index b11383b35662b1e59b89e916e55340cee2726944..2aa40f2a41e21526eb86acd903de024665109ab6 100644 +--- a/src/main/java/net/minecraft/server/Entity.java ++++ b/src/main/java/net/minecraft/server/Entity.java +@@ -1,53 +1,54 @@ + package net.minecraft.server; + ++import co.aikar.timings.MinecraftTimings; ++import co.aikar.timings.Timing; + import com.google.common.collect.Iterables; + import com.google.common.collect.Lists; + import com.google.common.collect.Sets; + import it.unimi.dsi.fastutil.objects.Object2DoubleArrayMap; + import it.unimi.dsi.fastutil.objects.Object2DoubleMap; +-import java.util.Arrays; +-import java.util.Collection; +-import java.util.Collections; +-import java.util.Iterator; +-import java.util.List; +-import java.util.Locale; +-import java.util.Optional; +-import java.util.Random; +-import java.util.Set; +-import java.util.UUID; +-import java.util.concurrent.atomic.AtomicInteger; +-import java.util.stream.Stream; +-import javax.annotation.Nullable; + import org.apache.logging.log4j.LogManager; + import org.apache.logging.log4j.Logger; +- +-// CraftBukkit start + import org.bukkit.Bukkit; + import org.bukkit.Server; + import org.bukkit.block.BlockFace; + import org.bukkit.command.CommandSender; +-import org.bukkit.entity.Hanging; +-import org.bukkit.entity.LivingEntity; +-import org.bukkit.entity.Vehicle; +-import co.aikar.timings.MinecraftTimings; // Paper +-import co.aikar.timings.Timing; // Paper +-import org.bukkit.event.entity.EntityCombustByEntityEvent; +-import org.bukkit.event.hanging.HangingBreakByEntityEvent; +-import org.bukkit.event.vehicle.VehicleBlockCollisionEvent; +-import org.bukkit.event.vehicle.VehicleEnterEvent; +-import org.bukkit.event.vehicle.VehicleExitEvent; + import org.bukkit.craftbukkit.CraftWorld; + import org.bukkit.craftbukkit.entity.CraftEntity; + import org.bukkit.craftbukkit.entity.CraftPlayer; + import org.bukkit.craftbukkit.event.CraftEventFactory; ++import org.bukkit.entity.Hanging; ++import org.bukkit.entity.LivingEntity; + import org.bukkit.entity.Pose; ++import org.bukkit.entity.Vehicle; + import org.bukkit.event.entity.EntityAirChangeEvent; ++import org.bukkit.event.entity.EntityCombustByEntityEvent; + import org.bukkit.event.entity.EntityCombustEvent; + import org.bukkit.event.entity.EntityDropItemEvent; + import org.bukkit.event.entity.EntityPortalEvent; + import org.bukkit.event.entity.EntityPoseChangeEvent; ++import org.bukkit.event.hanging.HangingBreakByEntityEvent; + import org.bukkit.event.player.PlayerTeleportEvent; ++import org.bukkit.event.vehicle.VehicleBlockCollisionEvent; ++import org.bukkit.event.vehicle.VehicleEnterEvent; ++import org.bukkit.event.vehicle.VehicleExitEvent; + import org.bukkit.plugin.PluginManager; ++ ++import javax.annotation.Nullable; ++import java.util.Arrays; ++import java.util.Collection; ++import java.util.Collections; ++import java.util.Iterator; ++import java.util.List; ++import java.util.Locale; ++import java.util.Optional; ++import java.util.Random; ++import java.util.Set; ++import java.util.UUID; ++import java.util.concurrent.atomic.AtomicInteger; ++import java.util.stream.Stream; ++ ++// CraftBukkit start + // CraftBukkit end + + public abstract class Entity implements INamableTileEntity, ICommandListener, KeyedObject { // Paper +@@ -425,10 +426,12 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke + + public void setPosition(double d0, double d1, double d2) { + this.setPositionRaw(d0, d1, d2); +- float f = this.size.width / 2.0F; +- float f1 = this.size.height; ++ // Paper start - move into setPositionRaw ++ //float f = this.size.width / 2.0F; ++ //float f1 = this.size.height; + +- this.a(new AxisAlignedBB(d0 - (double) f, d1, d2 - (double) f, d0 + (double) f, d1 + (double) f1, d2 + (double) f)); ++ //this.a(new AxisAlignedBB(d0 - (double) f, d1, d2 - (double) f, d0 + (double) f, d1 + (double) f1, d2 + (double) f)); ++ // Paper end + if (valid) ((WorldServer) world).chunkCheck(this); // CraftBukkit + } + +@@ -2901,6 +2904,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke + return new AxisAlignedBB(vec3d, vec3d1); + } + ++ public final void setBoundingBox(AxisAlignedBB axisalignedbb) { a(axisalignedbb); } // Paper - OBFHELPER + public void a(AxisAlignedBB axisalignedbb) { + // CraftBukkit start - block invalid bounding boxes + double minX = axisalignedbb.minX, +@@ -3339,6 +3343,14 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke + } + + public void setPositionRaw(double d0, double d1, double d2) { ++ // Paper start - never allow AABB to become desynced from position ++ // hanging has its own special logic ++ if (!(this instanceof EntityHanging) && (this.loc.x != d0 || this.loc.y != d1 || this.loc.z != d2)) { ++ float f = this.size.width / 2.0F; ++ float f1 = this.size.height; ++ this.setBoundingBox(new AxisAlignedBB(d0 - (double) f, d1, d2 - (double) f, d0 + (double) f, d1 + (double) f1, d2 + (double) f)); ++ } ++ // Paper end + if (this.loc.x != d0 || this.loc.y != d1 || this.loc.z != d2) { + this.loc = new Vec3D(d0, d1, d2); + int i = MathHelper.floor(d0); diff --git a/Spigot-Server-Patches/0524-Optimize-WorldBorder-collision-checks-and-air.patch b/Spigot-Server-Patches/0524-Optimize-WorldBorder-collision-checks-and-air.patch new file mode 100644 index 0000000000..8cf756dfec --- /dev/null +++ b/Spigot-Server-Patches/0524-Optimize-WorldBorder-collision-checks-and-air.patch @@ -0,0 +1,63 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: kickash32 +Date: Sat, 27 Jun 2020 14:23:16 -0400 +Subject: [PATCH] Optimize WorldBorder collision checks and air + + +diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java +index 2aa40f2a41e21526eb86acd903de024665109ab6..38887c1b7849926fab0a3b2db0e7b81388364172 100644 +--- a/src/main/java/net/minecraft/server/Entity.java ++++ b/src/main/java/net/minecraft/server/Entity.java +@@ -854,7 +854,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke + AxisAlignedBB axisalignedbb = this.getBoundingBox(); + VoxelShapeCollision voxelshapecollision = VoxelShapeCollision.a(this); + VoxelShape voxelshape = this.world.getWorldBorder().c(); +- Stream stream = VoxelShapes.c(voxelshape, VoxelShapes.a(axisalignedbb.shrink(1.0E-7D)), OperatorBoolean.AND) ? Stream.empty() : Stream.of(voxelshape); ++ Stream stream = !this.world.getWorldBorder().isInBounds(axisalignedbb) ? Stream.empty() : Stream.of(voxelshape); // Paper + Stream stream1 = this.world.c(this, axisalignedbb.b(vec3d), (entity) -> { + return true; + }); +diff --git a/src/main/java/net/minecraft/server/VoxelShapeSpliterator.java b/src/main/java/net/minecraft/server/VoxelShapeSpliterator.java +index ed0f3ddbcb7d6ce8a59ae3829f4cb11ae75046cb..e841611bb7c36dffec44bb9e74a0a9657a113263 100644 +--- a/src/main/java/net/minecraft/server/VoxelShapeSpliterator.java ++++ b/src/main/java/net/minecraft/server/VoxelShapeSpliterator.java +@@ -128,10 +128,10 @@ public class VoxelShapeSpliterator extends AbstractSpliterator { + AxisAlignedBB axisalignedbb = this.a.getBoundingBox(); + + if (!a(worldborder, axisalignedbb)) { +- VoxelShape voxelshape = worldborder.c(); +- +- if (!b(voxelshape, axisalignedbb) && a(voxelshape, axisalignedbb)) { +- consumer.accept(voxelshape); ++ // Paper start ++ if (worldborder.isInBounds(axisalignedbb.shrink(1.0E-7D)) && !worldborder.isInBounds(axisalignedbb.grow(1.0E-7D))) { ++ consumer.accept(worldborder.asVoxelShape()); ++ // Paper end + return true; + } + } +diff --git a/src/main/java/net/minecraft/server/VoxelShapes.java b/src/main/java/net/minecraft/server/VoxelShapes.java +index aeee4f11828e54ff9e873e452e19299822b1ec86..1fa7061f7adb539b6786fa11a0090f2c188ba9f2 100644 +--- a/src/main/java/net/minecraft/server/VoxelShapes.java ++++ b/src/main/java/net/minecraft/server/VoxelShapes.java +@@ -242,7 +242,7 @@ public final class VoxelShapes { + IBlockData iblockdata = iworldreader.getTypeIfLoaded(blockposition_mutableblockposition); // Paper + if (iblockdata == null) return 0.0D; // Paper + +- if ((k2 != 1 || iblockdata.d()) && (k2 != 2 || iblockdata.a(Blocks.MOVING_PISTON))) { ++ if (!iblockdata.isAir() && (k2 != 1 || iblockdata.d()) && (k2 != 2 || iblockdata.a(Blocks.MOVING_PISTON))) { // Paper + d0 = iblockdata.b((IBlockAccess) iworldreader, blockposition_mutableblockposition, voxelshapecollision).a(enumdirection_enumaxis2, axisalignedbb.d((double) (-blockposition_mutableblockposition.getX()), (double) (-blockposition_mutableblockposition.getY()), (double) (-blockposition_mutableblockposition.getZ())), d0); + if (Math.abs(d0) < 1.0E-7D) { + return 0.0D; +diff --git a/src/main/java/net/minecraft/server/WorldBorder.java b/src/main/java/net/minecraft/server/WorldBorder.java +index 0ef92a320d132b443e76276b2c34a4626cf187db..b651eb87bb23deeb2a3f4a1c626ddde9b11a7b9e 100644 +--- a/src/main/java/net/minecraft/server/WorldBorder.java ++++ b/src/main/java/net/minecraft/server/WorldBorder.java +@@ -42,6 +42,7 @@ public class WorldBorder { + return (double) chunkcoordintpair.f() > this.e() && (double) chunkcoordintpair.d() < this.g() && (double) chunkcoordintpair.g() > this.f() && (double) chunkcoordintpair.e() < this.h(); + } + ++ public final boolean isInBounds(AxisAlignedBB aabb) { return this.a(aabb); } // Paper - OBFHELPER + public boolean a(AxisAlignedBB axisalignedbb) { + return axisalignedbb.maxX > this.e() && axisalignedbb.minX < this.g() && axisalignedbb.maxZ > this.f() && axisalignedbb.minZ < this.h(); + } From 2192ff1bf72c94b1b7edd2bc2b357b5a46ecbd2d Mon Sep 17 00:00:00 2001 From: kickash32 Date: Sat, 27 Jun 2020 14:38:26 -0400 Subject: [PATCH 4/7] fix headers --- .../0521-Limit-lightning-strike-effect-distance.patch | 6 +++--- .../0522-Add-permission-for-command-blocks.patch | 4 ++-- .../0523-Ensure-Entity-AABB-s-are-never-invalid.patch | 4 ++-- ...0524-Optimize-WorldBorder-collision-checks-and-air.patch | 4 ++-- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Spigot-Server-Patches/0521-Limit-lightning-strike-effect-distance.patch b/Spigot-Server-Patches/0521-Limit-lightning-strike-effect-distance.patch index 537284d2e1..bf393f3268 100644 --- a/Spigot-Server-Patches/0521-Limit-lightning-strike-effect-distance.patch +++ b/Spigot-Server-Patches/0521-Limit-lightning-strike-effect-distance.patch @@ -1,7 +1,7 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: kickash32 -Date: Sat, 27 Jun 2020 12:37:58 -0400 -Subject: [PATCH] Limit lightning strike effect distance +From: Aikar +Date: Mon, 17 Sep 2018 23:05:31 -0400 +Subject: [PATCH] Support Overriding World Seeds diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java diff --git a/Spigot-Server-Patches/0522-Add-permission-for-command-blocks.patch b/Spigot-Server-Patches/0522-Add-permission-for-command-blocks.patch index c551f07021..62c5a9bc12 100644 --- a/Spigot-Server-Patches/0522-Add-permission-for-command-blocks.patch +++ b/Spigot-Server-Patches/0522-Add-permission-for-command-blocks.patch @@ -1,6 +1,6 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: kickash32 -Date: Sat, 27 Jun 2020 13:15:53 -0400 +From: Mariell Hoversholm +Date: Sat, 16 May 2020 10:05:30 +0200 Subject: [PATCH] Add permission for command blocks diff --git a/Spigot-Server-Patches/0523-Ensure-Entity-AABB-s-are-never-invalid.patch b/Spigot-Server-Patches/0523-Ensure-Entity-AABB-s-are-never-invalid.patch index 6972f06be5..ddd6881757 100644 --- a/Spigot-Server-Patches/0523-Ensure-Entity-AABB-s-are-never-invalid.patch +++ b/Spigot-Server-Patches/0523-Ensure-Entity-AABB-s-are-never-invalid.patch @@ -1,6 +1,6 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: kickash32 -Date: Sat, 27 Jun 2020 13:32:39 -0400 +From: Aikar +Date: Sun, 10 May 2020 22:12:46 -0400 Subject: [PATCH] Ensure Entity AABB's are never invalid diff --git a/Spigot-Server-Patches/0524-Optimize-WorldBorder-collision-checks-and-air.patch b/Spigot-Server-Patches/0524-Optimize-WorldBorder-collision-checks-and-air.patch index 8cf756dfec..7aa9002a7b 100644 --- a/Spigot-Server-Patches/0524-Optimize-WorldBorder-collision-checks-and-air.patch +++ b/Spigot-Server-Patches/0524-Optimize-WorldBorder-collision-checks-and-air.patch @@ -1,6 +1,6 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: kickash32 -Date: Sat, 27 Jun 2020 14:23:16 -0400 +From: Spottedleaf +Date: Sun, 10 May 2020 22:49:05 -0400 Subject: [PATCH] Optimize WorldBorder collision checks and air From 5958abd63f978ab897253b0595a1e60c4a3fbcd7 Mon Sep 17 00:00:00 2001 From: kickash32 Date: Sat, 27 Jun 2020 14:40:54 -0400 Subject: [PATCH 5/7] delete ported patches --- ...mit-lightning-strike-effect-distance.patch | 83 ------------------- ...sure-Entity-AABB-s-are-never-invalid.patch | 55 ------------ ...WorldBorder-collision-checks-and-air.patch | 61 -------------- ...24-Add-permission-for-command-blocks.patch | 79 ------------------ 4 files changed, 278 deletions(-) delete mode 100644 removed/1.16/0311-Limit-lightning-strike-effect-distance.patch delete mode 100644 removed/1.16/0513-Ensure-Entity-AABB-s-are-never-invalid.patch delete mode 100644 removed/1.16/0516-Optimize-WorldBorder-collision-checks-and-air.patch delete mode 100644 removed/1.16/0524-Add-permission-for-command-blocks.patch diff --git a/removed/1.16/0311-Limit-lightning-strike-effect-distance.patch b/removed/1.16/0311-Limit-lightning-strike-effect-distance.patch deleted file mode 100644 index 417f5f6430..0000000000 --- a/removed/1.16/0311-Limit-lightning-strike-effect-distance.patch +++ /dev/null @@ -1,83 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Trigary -Date: Fri, 14 Sep 2018 17:42:08 +0200 -Subject: [PATCH] Limit lightning strike effect distance - - -diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index 487b0d5cd608e84a793eba5fdbd50a9f3d95c79b..b8789c8ecc5a6e4117bb7ce0d5487a6e5774b67f 100644 ---- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -@@ -242,6 +242,28 @@ public class PaperWorldConfig { - } - } - -+ public double sqrMaxThunderDistance; -+ public double sqrMaxLightningImpactSoundDistance; -+ public double maxLightningFlashDistance; -+ private void lightningStrikeDistanceLimit() { -+ sqrMaxThunderDistance = getInt("lightning-strike-distance-limit.sound", -1); -+ if (sqrMaxThunderDistance > 0) { -+ sqrMaxThunderDistance *= sqrMaxThunderDistance; -+ } -+ -+ sqrMaxLightningImpactSoundDistance = getInt("lightning-strike-distance-limit.impact-sound", -1); -+ if (sqrMaxLightningImpactSoundDistance < 0) { -+ sqrMaxLightningImpactSoundDistance = 32 * 32; //Vanilla value -+ } else { -+ sqrMaxLightningImpactSoundDistance *= sqrMaxLightningImpactSoundDistance; -+ } -+ -+ maxLightningFlashDistance = getInt("lightning-strike-distance-limit.flash", -1); -+ if (maxLightningFlashDistance < 0) { -+ maxLightningFlashDistance = 512; // Vanilla value -+ } -+ } -+ - public int fixedInhabitedTime; - private void fixedInhabitedTime() { - if (PaperConfig.version < 16) { -diff --git a/src/main/java/net/minecraft/server/EntityLightning.java b/src/main/java/net/minecraft/server/EntityLightning.java -index 7c518983a9c21a9b221e1fa1b0baa3d5c9ccadbf..bdb534deb47a945d5cbfad688eeab5e3388a4df5 100644 ---- a/src/main/java/net/minecraft/server/EntityLightning.java -+++ b/src/main/java/net/minecraft/server/EntityLightning.java -@@ -64,6 +64,17 @@ public class EntityLightning extends Entity { - double deltaX = this.locX() - player.locX(); - double deltaZ = this.locZ() - player.locZ(); - double distanceSquared = deltaX * deltaX + deltaZ * deltaZ; -+ // Paper start - Limit lightning strike effect distance -+ if (distanceSquared <= this.world.paperConfig.sqrMaxLightningImpactSoundDistance) { -+ player.playerConnection.sendPacket(new PacketPlayOutNamedSoundEffect(SoundEffects.ENTITY_LIGHTNING_BOLT_IMPACT, -+ SoundCategory.WEATHER, this.locX(), this.locY(), this.locZ(), 2.0f, 0.5F + this.random.nextFloat() * 0.2F)); -+ } -+ -+ if (world.paperConfig.sqrMaxThunderDistance != -1 && distanceSquared >= world.paperConfig.sqrMaxThunderDistance) { -+ continue; -+ } -+ -+ // Paper end - if (distanceSquared > viewDistance * viewDistance) { - double deltaLength = Math.sqrt(distanceSquared); - double relativeX = player.locX() + (deltaX / deltaLength) * viewDistance; -@@ -74,7 +85,7 @@ public class EntityLightning extends Entity { - } - } - // CraftBukkit end -- this.world.playSound((EntityHuman) null, this.locX(), this.locY(), this.locZ(), SoundEffects.ENTITY_LIGHTNING_BOLT_IMPACT, SoundCategory.WEATHER, 2.0F, 0.5F + this.random.nextFloat() * 0.2F); -+ //this.world.playSound((EntityHuman) null, this.locX(), this.locY(), this.locZ(), SoundEffects.ENTITY_LIGHTNING_BOLT_IMPACT, SoundCategory.WEATHER, 2.0F, 0.5F + this.random.nextFloat() * 0.2F); // Paper - Limit lightning strike effect distance (the packet is now sent from inside the loop) - } - - --this.lifeTicks; -diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java -index 6e878c9b9dee511812df5ea2491d953f677c3f58..271a1ef3d0aae7c1d0b373963504e70f2843cd24 100644 ---- a/src/main/java/net/minecraft/server/WorldServer.java -+++ b/src/main/java/net/minecraft/server/WorldServer.java -@@ -1276,7 +1276,7 @@ public class WorldServer extends World { - } - // CraftBukkit end - this.globalEntityList.add(entitylightning); -- this.server.getPlayerList().sendPacketNearby((EntityHuman) null, entitylightning.locX(), entitylightning.locY(), entitylightning.locZ(), 512.0D, this, new PacketPlayOutSpawnEntityWeather(entitylightning)); // Paper - use world instead of dimension -+ this.server.getPlayerList().sendPacketNearby((EntityHuman) null, entitylightning.locX(), entitylightning.locY(), entitylightning.locZ(), paperConfig.maxLightningFlashDistance, this, new PacketPlayOutSpawnEntityWeather(entitylightning)); // Paper - use world instead of dimension, limit lightning strike effect distance - } - - @Override diff --git a/removed/1.16/0513-Ensure-Entity-AABB-s-are-never-invalid.patch b/removed/1.16/0513-Ensure-Entity-AABB-s-are-never-invalid.patch deleted file mode 100644 index ed3bac4005..0000000000 --- a/removed/1.16/0513-Ensure-Entity-AABB-s-are-never-invalid.patch +++ /dev/null @@ -1,55 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Aikar -Date: Sun, 10 May 2020 22:12:46 -0400 -Subject: [PATCH] Ensure Entity AABB's are never invalid - -If anything used setPositionRaw, it left potential for an AABB -to be left stale at their old location, which could cause massive -AABB boxes if movement ever then got called on the new position. - -This guarantees any time we set the entities position, we also -update their AABB. - -diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index b176dc26d15065aebc91c75e8a96745f589c0b87..c81b9d814d50a026872d2711f76649c00d65888b 100644 ---- a/src/main/java/net/minecraft/server/Entity.java -+++ b/src/main/java/net/minecraft/server/Entity.java -@@ -416,10 +416,11 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke - - public void setPosition(double d0, double d1, double d2) { - this.setPositionRaw(d0, d1, d2); -- float f = this.size.width / 2.0F; -- float f1 = this.size.height; -- -- this.a(new AxisAlignedBB(d0 - (double) f, d1, d2 - (double) f, d0 + (double) f, d1 + (double) f1, d2 + (double) f)); -+ // Paper start - move into setPositionRaw -+ //float f = this.size.width / 2.0F; -+ //float f1 = this.size.height; -+ //this.a(new AxisAlignedBB(d0 - (double) f, d1, d2 - (double) f, d0 + (double) f, d1 + (double) f1, d2 + (double) f)); -+ // Paper end - if (valid) ((WorldServer) world).chunkCheck(this); // CraftBukkit - } - -@@ -2981,6 +2982,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke - return new AxisAlignedBB(vec3d, vec3d1); - } - -+ public final void setBoundingBox(AxisAlignedBB axisalignedbb) { a(axisalignedbb); } // Paper - OBFHELPER - public void a(AxisAlignedBB axisalignedbb) { - // CraftBukkit start - block invalid bounding boxes - double minX = axisalignedbb.minX, -@@ -3439,6 +3441,14 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke - } - - public void setPositionRaw(double d0, double d1, double d2) { -+ // Paper start - never allow AABB to become desynced from position -+ // hanging has its own special logic -+ if (!(this instanceof EntityHanging) && (locX != d0 || locY != d1 || locZ != d2)) { -+ float f = this.size.width / 2.0F; -+ float f1 = this.size.height; -+ this.setBoundingBox(new AxisAlignedBB(d0 - (double) f, d1, d2 - (double) f, d0 + (double) f, d1 + (double) f1, d2 + (double) f)); -+ } -+ // Paper end - this.locX = d0; - this.locY = d1; - this.locZ = d2; diff --git a/removed/1.16/0516-Optimize-WorldBorder-collision-checks-and-air.patch b/removed/1.16/0516-Optimize-WorldBorder-collision-checks-and-air.patch deleted file mode 100644 index 25658a705b..0000000000 --- a/removed/1.16/0516-Optimize-WorldBorder-collision-checks-and-air.patch +++ /dev/null @@ -1,61 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Spottedleaf -Date: Sun, 10 May 2020 22:49:05 -0400 -Subject: [PATCH] Optimize WorldBorder collision checks and air - - -diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index c81b9d814d50a026872d2711f76649c00d65888b..e0ab058bf947ea10b37eadf6122292e708bd3809 100644 ---- a/src/main/java/net/minecraft/server/Entity.java -+++ b/src/main/java/net/minecraft/server/Entity.java -@@ -845,7 +845,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke - AxisAlignedBB axisalignedbb = this.getBoundingBox(); - VoxelShapeCollision voxelshapecollision = VoxelShapeCollision.a(this); - VoxelShape voxelshape = this.world.getWorldBorder().a(); -- Stream stream = VoxelShapes.c(voxelshape, VoxelShapes.a(axisalignedbb.shrink(1.0E-7D)), OperatorBoolean.AND) ? Stream.empty() : Stream.of(voxelshape); -+ Stream stream = !this.world.getWorldBorder().isInBounds(axisalignedbb) ? Stream.empty() : Stream.of(this.world.getWorldBorder().a()); // Paper - Stream stream1 = this.world.b(this, axisalignedbb.a(vec3d), (Set) ImmutableSet.of()); - StreamAccumulator streamaccumulator = new StreamAccumulator<>(Stream.concat(stream1, stream)); - Vec3D vec3d1 = vec3d.g() == 0.0D ? vec3d : a(this, vec3d, axisalignedbb, this.world, voxelshapecollision, streamaccumulator); -diff --git a/src/main/java/net/minecraft/server/ICollisionAccess.java b/src/main/java/net/minecraft/server/ICollisionAccess.java -index 5a21205a49606b294de4cd27b60438c6a5b3c526..63dd5e98b6af1d9a9fa9d01621ce5bc33c0d7502 100644 ---- a/src/main/java/net/minecraft/server/ICollisionAccess.java -+++ b/src/main/java/net/minecraft/server/ICollisionAccess.java -@@ -95,12 +95,12 @@ public interface ICollisionAccess extends IBlockAccess { - if (true) { //public boolean tryAdvance(Consumer consumer) {*/ // Paper - if (entity != null) { - // Paper end -- VoxelShape voxelshape1 = ICollisionAccess.this.getWorldBorder().a(); -- boolean flag = VoxelShapes.c(voxelshape1, VoxelShapes.a(entity.getBoundingBox().shrink(1.0E-7D)), OperatorBoolean.AND); -- boolean flag1 = VoxelShapes.c(voxelshape1, VoxelShapes.a(entity.getBoundingBox().g(1.0E-7D)), OperatorBoolean.AND); -+ //VoxelShape voxelshape1 = ICollisionAccess.this.getWorldBorder().a(); // Paper - only make if collides -+ boolean flag = !ICollisionAccess.this.getWorldBorder().isInBounds(entity.getBoundingBox().shrink(1.0E-7D)); // Paper -+ boolean flag1 = !ICollisionAccess.this.getWorldBorder().isInBounds(entity.getBoundingBox().g(1.0E-7D)); // Paper - - if (!flag && flag1) { -- collisions.add(voxelshape1);// Paper -+ collisions.add(ICollisionAccess.this.getWorldBorder().a());// Paper - if (returnFast) return collisions; - } - } -@@ -133,7 +133,7 @@ public interface ICollisionAccess extends IBlockAccess { - //IBlockData iblockdata = iblockaccess.getType(blockposition_mutableblockposition); // moved up - // Paper end - -- if ((j2 != 1 || iblockdata.f()) && (j2 != 2 || iblockdata.getBlock() == Blocks.MOVING_PISTON)) { -+ if (!iblockdata.isAir() && (j2 != 1 || iblockdata.f()) && (j2 != 2 || iblockdata.getBlock() == Blocks.MOVING_PISTON)) { // Paper - fast track air - VoxelShape voxelshape2 = iblockdata.b((IBlockAccess) ICollisionAccess.this, blockposition_mutableblockposition, voxelshapecollision); - - // Paper start - Lithium Collision Optimizations -diff --git a/src/main/java/net/minecraft/server/WorldBorder.java b/src/main/java/net/minecraft/server/WorldBorder.java -index 4c20db5a3f9e159997a9851691aca421241d6d95..535d08ffb1d20570b19307c8619cfd39b4541356 100644 ---- a/src/main/java/net/minecraft/server/WorldBorder.java -+++ b/src/main/java/net/minecraft/server/WorldBorder.java -@@ -40,6 +40,7 @@ public class WorldBorder { - return (double) chunkcoordintpair.f() > this.c() && (double) chunkcoordintpair.d() < this.e() && (double) chunkcoordintpair.g() > this.d() && (double) chunkcoordintpair.e() < this.f(); - } - -+ public final boolean isInBounds(AxisAlignedBB aabb) { return this.a(aabb); } // Paper - OBFHELPER - public boolean a(AxisAlignedBB axisalignedbb) { - return axisalignedbb.maxX > this.c() && axisalignedbb.minX < this.e() && axisalignedbb.maxZ > this.d() && axisalignedbb.minZ < this.f(); - } diff --git a/removed/1.16/0524-Add-permission-for-command-blocks.patch b/removed/1.16/0524-Add-permission-for-command-blocks.patch deleted file mode 100644 index 0a39da8a7c..0000000000 --- a/removed/1.16/0524-Add-permission-for-command-blocks.patch +++ /dev/null @@ -1,79 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Mariell Hoversholm -Date: Sat, 16 May 2020 10:05:30 +0200 -Subject: [PATCH] Add permission for command blocks - - -diff --git a/src/main/java/net/minecraft/server/BlockCommand.java b/src/main/java/net/minecraft/server/BlockCommand.java -index d0f75c8f93d3ceb1ee358baeb51f64e7e575bbc0..48cc48bd999c02268fa3270401c0df77a327ab13 100644 ---- a/src/main/java/net/minecraft/server/BlockCommand.java -+++ b/src/main/java/net/minecraft/server/BlockCommand.java -@@ -110,7 +110,7 @@ public class BlockCommand extends BlockTileEntity { - public EnumInteractionResult interact(IBlockData iblockdata, World world, BlockPosition blockposition, EntityHuman entityhuman, EnumHand enumhand, MovingObjectPositionBlock movingobjectpositionblock) { - TileEntity tileentity = world.getTileEntity(blockposition); - -- if (tileentity instanceof TileEntityCommand && entityhuman.isCreativeAndOp()) { -+ if (tileentity instanceof TileEntityCommand && (entityhuman.isCreativeAndOp() || (entityhuman.isCreative() && entityhuman.getBukkitEntity().hasPermission("minecraft.commandblock")))) { // Paper - command block permission - entityhuman.a((TileEntityCommand) tileentity); - return EnumInteractionResult.SUCCESS; - } else { -diff --git a/src/main/java/net/minecraft/server/CommandBlockListenerAbstract.java b/src/main/java/net/minecraft/server/CommandBlockListenerAbstract.java -index ef2a496eda45ae5ee8fe52ef09e77c2906069d2e..6a0d70033b4eec384795b5cccd76bce2265ffbfc 100644 ---- a/src/main/java/net/minecraft/server/CommandBlockListenerAbstract.java -+++ b/src/main/java/net/minecraft/server/CommandBlockListenerAbstract.java -@@ -178,7 +178,7 @@ public abstract class CommandBlockListenerAbstract implements ICommandListener { - } - - public boolean a(EntityHuman entityhuman) { -- if (!entityhuman.isCreativeAndOp()) { -+ if (!entityhuman.isCreativeAndOp() && !entityhuman.isCreative() && !entityhuman.getBukkitEntity().hasPermission("minecraft.commandblock")) { // Paper - command block permission - return false; - } else { - if (entityhuman.getWorld().isClientSide) { -diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index 1f9d231fb93e30286205f7a0a4c898a0e153bd95..d52fbda79fe1c52d3ddb53c0f1c1f521d7620702 100644 ---- a/src/main/java/net/minecraft/server/PlayerConnection.java -+++ b/src/main/java/net/minecraft/server/PlayerConnection.java -@@ -612,7 +612,7 @@ public class PlayerConnection implements PacketListenerPlayIn { - PlayerConnectionUtils.ensureMainThread(packetplayinsetcommandblock, this, this.player.getWorldServer()); - if (!this.minecraftServer.getEnableCommandBlock()) { - this.player.sendMessage(new ChatMessage("advMode.notEnabled", new Object[0])); -- } else if (!this.player.isCreativeAndOp()) { -+ } else if (!this.player.isCreativeAndOp() && !this.player.isCreative() && !this.player.getBukkitEntity().hasPermission("minecraft.commandblock")) { // Paper - command block permission - this.player.sendMessage(new ChatMessage("advMode.notAllowed", new Object[0])); - } else { - CommandBlockListenerAbstract commandblocklistenerabstract = null; -@@ -675,7 +675,7 @@ public class PlayerConnection implements PacketListenerPlayIn { - PlayerConnectionUtils.ensureMainThread(packetplayinsetcommandminecart, this, this.player.getWorldServer()); - if (!this.minecraftServer.getEnableCommandBlock()) { - this.player.sendMessage(new ChatMessage("advMode.notEnabled", new Object[0])); -- } else if (!this.player.isCreativeAndOp()) { -+ } else if (!this.player.isCreativeAndOp() && !this.player.isCreative() && !this.player.getBukkitEntity().hasPermission("minecraft.commandblock")) { // Paper - command block permission - this.player.sendMessage(new ChatMessage("advMode.notAllowed", new Object[0])); - } else { - CommandBlockListenerAbstract commandblocklistenerabstract = packetplayinsetcommandminecart.a(this.player.world); -diff --git a/src/main/java/net/minecraft/server/PlayerInteractManager.java b/src/main/java/net/minecraft/server/PlayerInteractManager.java -index f11ef84df85c1e7ada9c62247b7882f19ae32089..6df8434612d4afe411b2c435f4c847b9183570f8 100644 ---- a/src/main/java/net/minecraft/server/PlayerInteractManager.java -+++ b/src/main/java/net/minecraft/server/PlayerInteractManager.java -@@ -350,7 +350,7 @@ public class PlayerInteractManager { - TileEntity tileentity = this.world.getTileEntity(blockposition); - Block block = iblockdata.getBlock(); - -- if ((block instanceof BlockCommand || block instanceof BlockStructure || block instanceof BlockJigsaw) && !this.player.isCreativeAndOp()) { -+ if ((block instanceof BlockCommand || block instanceof BlockStructure || block instanceof BlockJigsaw) && !this.player.isCreativeAndOp() && !(block instanceof BlockCommand && (this.player.isCreative() && this.player.getBukkitEntity().hasPermission("minecraft.commandblock")))) { // Paper - command block permission - this.world.notify(blockposition, iblockdata, iblockdata, 3); - return false; - } else if (this.player.a((World) this.world, blockposition, this.gamemode)) { -diff --git a/src/main/java/org/bukkit/craftbukkit/util/permissions/CraftDefaultPermissions.java b/src/main/java/org/bukkit/craftbukkit/util/permissions/CraftDefaultPermissions.java -index 525ebf961e5da0687183a5e2ead23ed92cbd9d79..a4a809f302c5ff9c76cde5fc0add2ceec1bdf9b5 100644 ---- a/src/main/java/org/bukkit/craftbukkit/util/permissions/CraftDefaultPermissions.java -+++ b/src/main/java/org/bukkit/craftbukkit/util/permissions/CraftDefaultPermissions.java -@@ -16,6 +16,7 @@ public final class CraftDefaultPermissions { - DefaultPermissions.registerPermission(ROOT + ".nbt.copy", "Gives the user the ability to copy NBT in creative", org.bukkit.permissions.PermissionDefault.TRUE, parent); - DefaultPermissions.registerPermission(ROOT + ".debugstick", "Gives the user the ability to use the debug stick in creative", org.bukkit.permissions.PermissionDefault.OP, parent); - DefaultPermissions.registerPermission(ROOT + ".debugstick.always", "Gives the user the ability to use the debug stick in all game modes", org.bukkit.permissions.PermissionDefault.FALSE, parent); -+ DefaultPermissions.registerPermission(ROOT + ".commandblock", "Gives the user the ability to use command blocks.", org.bukkit.permissions.PermissionDefault.OP, parent); // Paper - // Spigot end - parent.recalculatePermissibles(); - } From 527dd9f1850c635a2d1c36713ed13f1038e82a64 Mon Sep 17 00:00:00 2001 From: kickash32 Date: Sat, 27 Jun 2020 15:02:40 -0400 Subject: [PATCH 6/7] fixup --- ...mit-lightning-strike-effect-distance.patch | 31 ++----------------- 1 file changed, 3 insertions(+), 28 deletions(-) diff --git a/Spigot-Server-Patches/0521-Limit-lightning-strike-effect-distance.patch b/Spigot-Server-Patches/0521-Limit-lightning-strike-effect-distance.patch index bf393f3268..ec643279e8 100644 --- a/Spigot-Server-Patches/0521-Limit-lightning-strike-effect-distance.patch +++ b/Spigot-Server-Patches/0521-Limit-lightning-strike-effect-distance.patch @@ -1,38 +1,13 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Aikar -Date: Mon, 17 Sep 2018 23:05:31 -0400 -Subject: [PATCH] Support Overriding World Seeds +From: Trigary +Date: Fri, 14 Sep 2018 17:42:08 +0200 +Subject: [PATCH] Limit lightning strike effect distance diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java index 0f4fca90fd6c3788a5762c96c344899cb1665466..4a59d42b778e681e93f1243ecd16c5cf46160b97 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -@@ -1,11 +1,5 @@ - package com.destroystokyo.paper; - --import java.util.Arrays; --import java.util.EnumMap; --import java.util.HashMap; --import java.util.List; --import java.util.Map; -- - import com.destroystokyo.paper.antixray.ChunkPacketBlockControllerAntiXray.EngineMode; - import org.bukkit.Bukkit; - import org.bukkit.Material; -@@ -13,6 +7,12 @@ import org.bukkit.configuration.ConfigurationSection; - import org.bukkit.configuration.file.YamlConfiguration; - import org.spigotmc.SpigotWorldConfig; - -+import java.util.Arrays; -+import java.util.EnumMap; -+import java.util.HashMap; -+import java.util.List; -+import java.util.Map; -+ - import static com.destroystokyo.paper.PaperConfig.log; - import static com.destroystokyo.paper.PaperConfig.logError; - @@ -648,4 +648,26 @@ public class PaperWorldConfig { delayChunkUnloadsBy *= 20; } From e94688ca39b5f80a5ac8b65b88da2c675abeff4e Mon Sep 17 00:00:00 2001 From: Omer Uddin Date: Sat, 27 Jun 2020 16:00:08 -0400 Subject: [PATCH 7/7] Fix comment mistake --- .../0521-Limit-lightning-strike-effect-distance.patch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Spigot-Server-Patches/0521-Limit-lightning-strike-effect-distance.patch b/Spigot-Server-Patches/0521-Limit-lightning-strike-effect-distance.patch index ec643279e8..01281d012f 100644 --- a/Spigot-Server-Patches/0521-Limit-lightning-strike-effect-distance.patch +++ b/Spigot-Server-Patches/0521-Limit-lightning-strike-effect-distance.patch @@ -62,7 +62,7 @@ index 6f979e5f1f1567b140e9689298aff85de34f7413..ebcb9f48f47d1ab1e972bed1bc7cb0ee } // CraftBukkit end - this.world.playSound((EntityHuman) null, this.locX(), this.locY(), this.locZ(), SoundEffects.ENTITY_LIGHTNING_BOLT_IMPACT, SoundCategory.WEATHER, 2.0F, 0.5F + this.random.nextFloat() * 0.2F); -+// this.world.playSound((EntityHuman) null, this.locX(), this.locY(), this.locZ(), SoundEffects.ENTITY_LIGHTNING_BOLT_IMPACT, SoundCategory.WEATHER, 2.0F, 0.5F + this.random.nextFloat() * 0.2F); // Paper ++// this.world.playSound((EntityHuman) null, this.locX(), this.locY(), this.locZ(), SoundEffects.ENTITY_LIGHTNING_BOLT_IMPACT, SoundCategory.WEATHER, 2.0F, 0.5F + this.random.nextFloat() * 0.2F); // Paper - Limit lightning strike effect distance (the packet is now sent from inside the loop) } --this.lifeTicks;