diff --git a/patches/server/0021-Make-EntityCollisionContext-a-live-representation.patch b/patches/server/0021-Make-EntityCollisionContext-a-live-representation.patch new file mode 100644 index 000000000..f30e97225 --- /dev/null +++ b/patches/server/0021-Make-EntityCollisionContext-a-live-representation.patch @@ -0,0 +1,105 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Paul Sauve +Date: Sun, 9 May 2021 18:35:05 -0500 +Subject: [PATCH] Make EntityCollisionContext a live representation + +While Context is in the name, it is not used as a context. Instead it is +always created, use temporarily, then thrown away. This means having a +lot of fields to initialize and make space for is useless. I cannot find +anywhere in the codebase where this is used as a context which may be +saved for later, so this should be safe assuming plugins don't use it +for some strange reason. + +diff --git a/src/main/java/net/minecraft/world/phys/shapes/EntityCollisionContext.java b/src/main/java/net/minecraft/world/phys/shapes/EntityCollisionContext.java +index 88a4a72bb390947dc17e5da09a99b2d1b3ac4621..284c76ddb9724b44bb2e93f590685c728e843e6d 100644 +--- a/src/main/java/net/minecraft/world/phys/shapes/EntityCollisionContext.java ++++ b/src/main/java/net/minecraft/world/phys/shapes/EntityCollisionContext.java +@@ -17,50 +17,69 @@ public class EntityCollisionContext implements CollisionContext { + return defaultValue; + } + }; +- private final boolean descending; +- private final double entityBottom; +- private final ItemStack heldItem; +- private final Predicate canStandOnFluid; ++ // Pufferfish start - remove these and pray no plugin uses them ++ // private final boolean descending; ++ // private final double entityBottom; ++ // private final ItemStack heldItem; ++ // private final Predicate canStandOnFluid; ++ // Pufferfish end + @Nullable + private final Entity entity; + + protected EntityCollisionContext(boolean descending, double minY, ItemStack heldItem, Predicate walkOnFluidPredicate, @Nullable Entity entity) { +- this.descending = descending; +- this.entityBottom = minY; +- this.heldItem = heldItem; +- this.canStandOnFluid = walkOnFluidPredicate; ++ // Pufferfish start - remove these ++ // this.descending = descending; ++ // this.entityBottom = minY; ++ // this.heldItem = heldItem; ++ // this.canStandOnFluid = walkOnFluidPredicate; ++ // Pufferfish end + this.entity = entity; + } + + @Deprecated + protected EntityCollisionContext(Entity entity) { +- this( +- entity.isDescending(), +- entity.getY(), +- entity instanceof LivingEntity ? ((LivingEntity)entity).getMainHandItem() : ItemStack.EMPTY, +- entity instanceof LivingEntity ? ((LivingEntity)entity)::canStandOnFluid : fluidState -> false, +- entity +- ); ++ // Pufferfish start - remove this ++ // this( ++ // entity.isDescending(), ++ // entity.getY(), ++ // entity instanceof LivingEntity ? ((LivingEntity)entity).getMainHandItem() : ItemStack.EMPTY, ++ // entity instanceof LivingEntity ? ((LivingEntity)entity)::canStandOnFluid : fluidState -> false, ++ // entity ++ // ); ++ // Pufferfish end ++ this.entity = entity; + } + + @Override + public boolean isHoldingItem(Item item) { +- return this.heldItem.is(item); ++ // Pufferfish start ++ Entity entity = this.entity; ++ if (entity instanceof LivingEntity livingEntity) { ++ return livingEntity.getMainHandItem().is(item); ++ } ++ return ItemStack.EMPTY.is(item); ++ // Pufferfish end + } + + @Override + public boolean canStandOnFluid(FluidState stateAbove, FluidState state) { +- return this.canStandOnFluid.test(state) && !stateAbove.getType().isSame(state.getType()); ++ // Pufferfish start ++ Entity entity = this.entity; ++ if (entity instanceof LivingEntity livingEntity) { ++ return livingEntity.canStandOnFluid(state) && !stateAbove.getType().isSame(state.getType()); ++ } ++ return false; ++ // Pufferfish end + } + + @Override + public boolean isDescending() { +- return this.descending; ++ return this.entity != null && this.entity.isDescending(); // Pufferfish + } + + @Override + public boolean isAbove(VoxelShape shape, BlockPos pos, boolean defaultValue) { +- return this.entityBottom > (double)pos.getY() + shape.max(Direction.Axis.Y) - 1.0E-5F; ++ return (this.entity == null ? -Double.MAX_VALUE : entity.getY()) > (double)pos.getY() + shape.max(Direction.Axis.Y) - 1.0E-5F; // Pufferfish + } + + @Nullable diff --git a/patches/server/0021-Better-checking-for-useless-move-packets.patch b/patches/server/0022-Better-checking-for-useless-move-packets.patch similarity index 100% rename from patches/server/0021-Better-checking-for-useless-move-packets.patch rename to patches/server/0022-Better-checking-for-useless-move-packets.patch diff --git a/patches/server/0022-Remove-streams-and-iterators-from-range-check.patch b/patches/server/0023-Remove-streams-and-iterators-from-range-check.patch similarity index 100% rename from patches/server/0022-Remove-streams-and-iterators-from-range-check.patch rename to patches/server/0023-Remove-streams-and-iterators-from-range-check.patch diff --git a/patches/server/0023-Skip-cloning-loot-parameters.patch b/patches/server/0024-Skip-cloning-loot-parameters.patch similarity index 100% rename from patches/server/0023-Skip-cloning-loot-parameters.patch rename to patches/server/0024-Skip-cloning-loot-parameters.patch diff --git a/patches/server/0024-Fix-Paper-6045-block-goal-shouldn-t-load-chunks.patch b/patches/server/0025-Fix-Paper-6045-block-goal-shouldn-t-load-chunks.patch similarity index 100% rename from patches/server/0024-Fix-Paper-6045-block-goal-shouldn-t-load-chunks.patch rename to patches/server/0025-Fix-Paper-6045-block-goal-shouldn-t-load-chunks.patch diff --git a/patches/server/0025-Reduce-entity-allocations.patch b/patches/server/0026-Reduce-entity-allocations.patch similarity index 100% rename from patches/server/0025-Reduce-entity-allocations.patch rename to patches/server/0026-Reduce-entity-allocations.patch diff --git a/patches/server/0026-Remove-lambda-from-ticking-guard.patch b/patches/server/0027-Remove-lambda-from-ticking-guard.patch similarity index 100% rename from patches/server/0026-Remove-lambda-from-ticking-guard.patch rename to patches/server/0027-Remove-lambda-from-ticking-guard.patch diff --git a/patches/server/0027-Reduce-entity-fluid-lookups-if-no-fluids.patch b/patches/server/0028-Reduce-entity-fluid-lookups-if-no-fluids.patch similarity index 100% rename from patches/server/0027-Reduce-entity-fluid-lookups-if-no-fluids.patch rename to patches/server/0028-Reduce-entity-fluid-lookups-if-no-fluids.patch diff --git a/patches/server/0028-Throttle-goal-selector-during-inactive-ticking.patch b/patches/server/0029-Throttle-goal-selector-during-inactive-ticking.patch similarity index 100% rename from patches/server/0028-Throttle-goal-selector-during-inactive-ticking.patch rename to patches/server/0029-Throttle-goal-selector-during-inactive-ticking.patch diff --git a/patches/server/0029-Entity-TTL.patch b/patches/server/0030-Entity-TTL.patch similarity index 100% rename from patches/server/0029-Entity-TTL.patch rename to patches/server/0030-Entity-TTL.patch diff --git a/patches/server/0030-Option-to-disable-end-crystal-dragon-respawning.patch b/patches/server/0031-Option-to-disable-end-crystal-dragon-respawning.patch similarity index 100% rename from patches/server/0030-Option-to-disable-end-crystal-dragon-respawning.patch rename to patches/server/0031-Option-to-disable-end-crystal-dragon-respawning.patch diff --git a/patches/server/0031-TPS-catchup.patch b/patches/server/0032-TPS-catchup.patch similarity index 100% rename from patches/server/0031-TPS-catchup.patch rename to patches/server/0032-TPS-catchup.patch