From c06f539f46549ee8aaf63e6f2e113b8eb4d97228 Mon Sep 17 00:00:00 2001 From: Dreeam <61569423+Dreeam-qwq@users.noreply.github.com> Date: Mon, 25 Mar 2024 11:17:56 -0400 Subject: [PATCH] Fix build --- .gitignore | 7 +- ...-Add-config-for-unsafe-teleportation.patch | 4 +- .../0023-Kaiiju-Async-path-processing.patch | 151 ++++++++++++++++++ 3 files changed, 157 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index 213ad1e..ab0cb4c 100644 --- a/.gitignore +++ b/.gitignore @@ -33,7 +33,6 @@ target/ dependency-reduced-pom.xml # various other potential build files -build/ bin/ dist/ manifest.mf @@ -51,8 +50,10 @@ manifest.mf # other stuff run/ +# Luminol build-data/ -Hearse-API -Hearse-Server +Luminol-API +Luminol-Server +paper-api-generator *.jar /patches2/todo/ \ No newline at end of file diff --git a/patches/server/0005-Add-config-for-unsafe-teleportation.patch b/patches/server/0005-Add-config-for-unsafe-teleportation.patch index 00c60dd..601cf2e 100644 --- a/patches/server/0005-Add-config-for-unsafe-teleportation.patch +++ b/patches/server/0005-Add-config-for-unsafe-teleportation.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Add config for unsafe teleportation diff --git a/src/main/java/me/earthme/luminol/config/modules/fixes/UnsafeTeleportationConfig.java b/src/main/java/me/earthme/luminol/config/modules/fixes/UnsafeTeleportationConfig.java new file mode 100644 -index 0000000000000000000000000000000000000000..cb2fef0d808e2fc2950eded5b39651c66fff9103 +index 0000000000000000000000000000000000000000..1b0de6f0ccab72c409a63dc1904829008e30328e --- /dev/null +++ b/src/main/java/me/earthme/luminol/config/modules/fixes/UnsafeTeleportationConfig.java @@ -0,0 +1,20 @@ @@ -17,7 +17,7 @@ index 0000000000000000000000000000000000000000..cb2fef0d808e2fc2950eded5b39651c6 +import me.earthme.luminol.config.IConfigModule; + +public class UnsafeTeleportationConfig implements IConfigModule { -+ @ConfigInfo(baseName = "enabled",comment = "If you want to use sand duping,please turn on this") ++ @ConfigInfo(baseName = "enabled", comments = "If you want to use sand duping,please turn on this") + public static boolean enabled = false; + + @Override diff --git a/patches/server/0023-Kaiiju-Async-path-processing.patch b/patches/server/0023-Kaiiju-Async-path-processing.patch index d886d4a..d2675d4 100644 --- a/patches/server/0023-Kaiiju-Async-path-processing.patch +++ b/patches/server/0023-Kaiiju-Async-path-processing.patch @@ -704,6 +704,89 @@ index 98bf17441da3169d49de55fe89d79ebe250a2b7e..74162661e5757bb2c732361042b5dd2c private boolean tryComputePath(Mob entity, WalkTarget walkTarget, long time) { BlockPos blockPos = walkTarget.getTarget().currentBlockPosition(); +diff --git a/src/main/java/net/minecraft/world/entity/ai/behavior/SetClosestHomeAsWalkTarget.java b/src/main/java/net/minecraft/world/entity/ai/behavior/SetClosestHomeAsWalkTarget.java +index 271efbb027f6f5d69ac5bc5dc51102a1eb00ab31..cd2a3edc03301286114834e721f5441e7b70474a 100644 +--- a/src/main/java/net/minecraft/world/entity/ai/behavior/SetClosestHomeAsWalkTarget.java ++++ b/src/main/java/net/minecraft/world/entity/ai/behavior/SetClosestHomeAsWalkTarget.java +@@ -57,6 +57,26 @@ public class SetClosestHomeAsWalkTarget { + Set, BlockPos>> set = poiManager.findAllWithType((poiType) -> { + return poiType.is(PoiTypes.HOME); + }, predicate, entity.blockPosition(), 48, PoiManager.Occupancy.ANY).collect(Collectors.toSet()); ++ // Kaiiju start - petal - Async path processing ++ if (me.earthme.luminol.config.modules.optimizations.AsyncPathProcessingConfig.asyncPathProcessing) { ++ // await on path async ++ Path possiblePath = AcquirePoi.findPathToPois(entity, set); ++ ++ // wait on the path to be processed ++ dev.kaiijumc.kaiiju.path.AsyncPathProcessor.awaitProcessing(entity, possiblePath, path -> { ++ if (path == null || !path.canReach() || mutableInt.getValue() < 5) { // read canReach check ++ long2LongMap.long2LongEntrySet().removeIf((entry) -> entry.getLongValue() < mutableLong.getValue()); ++ return; ++ } ++ BlockPos blockPos = path.getTarget(); ++ Optional> optional2 = poiManager.getType(blockPos); ++ if (optional2.isPresent()) { ++ walkTarget.set(new WalkTarget(blockPos, speed, 1)); ++ DebugPackets.sendPoiTicketCountPacket(world, blockPos); ++ } ++ }); ++ } else { ++ // Kaiiju end + Path path = AcquirePoi.findPathToPois(entity, set); + if (path != null && path.canReach()) { + BlockPos blockPos = path.getTarget(); +@@ -70,6 +90,7 @@ public class SetClosestHomeAsWalkTarget { + return entry.getLongValue() < mutableLong.getValue(); + }); + } ++ } // Kaiiju - async path processing + + return true; + } else { +diff --git a/src/main/java/net/minecraft/world/entity/ai/goal/DoorInteractGoal.java b/src/main/java/net/minecraft/world/entity/ai/goal/DoorInteractGoal.java +index 6771f2dc974317b6b152288bf41d1a95bc78a8e4..7a641747b17164b09bb8483cda7f69d11741a94a 100644 +--- a/src/main/java/net/minecraft/world/entity/ai/goal/DoorInteractGoal.java ++++ b/src/main/java/net/minecraft/world/entity/ai/goal/DoorInteractGoal.java +@@ -57,7 +57,7 @@ public abstract class DoorInteractGoal extends Goal { + } else { + GroundPathNavigation groundPathNavigation = (GroundPathNavigation)this.mob.getNavigation(); + Path path = groundPathNavigation.getPath(); +- if (path != null && !path.isDone() && groundPathNavigation.canOpenDoors()) { ++ if (path != null && path.isProcessed() && !path.isDone() && groundPathNavigation.canOpenDoors()) { // Kaiiju - async pathfinding - ensure path is processed + for(int i = 0; i < Math.min(path.getNextNodeIndex() + 2, path.getNodeCount()); ++i) { + Node node = path.getNode(i); + this.doorPos = new BlockPos(node.x, node.y + 1, node.z); +diff --git a/src/main/java/net/minecraft/world/entity/ai/navigation/AmphibiousPathNavigation.java b/src/main/java/net/minecraft/world/entity/ai/navigation/AmphibiousPathNavigation.java +index 9d3b32c852d660356e0f16d4cc10072b1c603e64..2e64fe17fb3ee1925db1fdb34dedba356aea070b 100644 +--- a/src/main/java/net/minecraft/world/entity/ai/navigation/AmphibiousPathNavigation.java ++++ b/src/main/java/net/minecraft/world/entity/ai/navigation/AmphibiousPathNavigation.java +@@ -12,10 +12,26 @@ public class AmphibiousPathNavigation extends PathNavigation { + super(mob, world); + } + ++ // Kaiiju start - petal - async path processing ++ private static final dev.kaiijumc.kaiiju.path.NodeEvaluatorGenerator nodeEvaluatorGenerator = (dev.kaiijumc.kaiiju.path.NodeEvaluatorFeatures nodeEvaluatorFeatures) -> { ++ AmphibiousNodeEvaluator nodeEvaluator = new AmphibiousNodeEvaluator(false); ++ nodeEvaluator.setCanPassDoors(nodeEvaluatorFeatures.canPassDoors()); ++ nodeEvaluator.setCanFloat(nodeEvaluatorFeatures.canFloat()); ++ nodeEvaluator.setCanWalkOverFences(nodeEvaluatorFeatures.canWalkOverFences()); ++ nodeEvaluator.setCanOpenDoors(nodeEvaluatorFeatures.canOpenDoors()); ++ return nodeEvaluator; ++ }; ++ // Kaiiju end ++ + @Override + protected PathFinder createPathFinder(int range) { + this.nodeEvaluator = new AmphibiousNodeEvaluator(false); + this.nodeEvaluator.setCanPassDoors(true); ++ // Kaiiju start - petal - async path processing ++ if (me.earthme.luminol.config.modules.optimizations.AsyncPathProcessingConfig.asyncPathProcessing) ++ return new PathFinder(this.nodeEvaluator, range, nodeEvaluatorGenerator); ++ else ++ // Kaiiju end + return new PathFinder(this.nodeEvaluator, range); + } + diff --git a/src/main/java/net/minecraft/world/entity/ai/navigation/FlyingPathNavigation.java b/src/main/java/net/minecraft/world/entity/ai/navigation/FlyingPathNavigation.java index e35c38feb62c3345d82636081decc09db9f061ab..70f4104f8e49fd6b7df531673f3e1da123783409 100644 --- a/src/main/java/net/minecraft/world/entity/ai/navigation/FlyingPathNavigation.java @@ -855,6 +938,37 @@ index 089baec30e0c16149b147a501d68958663519b96..f6484fefd28a028fbcd1a54d93c8607b Node node = this.path.getEndNode(); Vec3 vec3 = new Vec3(((double)node.x + this.mob.getX()) / 2.0D, ((double)node.y + this.mob.getY()) / 2.0D, ((double)node.z + this.mob.getZ()) / 2.0D); return pos.closerToCenterThan(vec3, (double)(this.path.getNodeCount() - this.path.getNextNodeIndex())); +diff --git a/src/main/java/net/minecraft/world/entity/ai/navigation/WaterBoundPathNavigation.java b/src/main/java/net/minecraft/world/entity/ai/navigation/WaterBoundPathNavigation.java +index ee8543afbbd681bf327a353530a7a635aa5ef592..238b5f2dc5487dcf675152b8c19a40a6e16958dc 100644 +--- a/src/main/java/net/minecraft/world/entity/ai/navigation/WaterBoundPathNavigation.java ++++ b/src/main/java/net/minecraft/world/entity/ai/navigation/WaterBoundPathNavigation.java +@@ -15,10 +15,26 @@ public class WaterBoundPathNavigation extends PathNavigation { + super(entity, world); + } + ++ // Kaiiju start - petal - async path processing ++ private static final dev.kaiijumc.kaiiju.path.NodeEvaluatorGenerator nodeEvaluatorGenerator = (dev.kaiijumc.kaiiju.path.NodeEvaluatorFeatures nodeEvaluatorFeatures) -> { ++ SwimNodeEvaluator nodeEvaluator = new SwimNodeEvaluator(nodeEvaluatorFeatures.allowBreaching()); ++ nodeEvaluator.setCanPassDoors(nodeEvaluatorFeatures.canPassDoors()); ++ nodeEvaluator.setCanFloat(nodeEvaluatorFeatures.canFloat()); ++ nodeEvaluator.setCanWalkOverFences(nodeEvaluatorFeatures.canWalkOverFences()); ++ nodeEvaluator.setCanOpenDoors(nodeEvaluatorFeatures.canOpenDoors()); ++ return nodeEvaluator; ++ }; ++ // Kaiiju end ++ + @Override + protected PathFinder createPathFinder(int range) { + this.allowBreaching = this.mob.getType() == EntityType.DOLPHIN; + this.nodeEvaluator = new SwimNodeEvaluator(this.allowBreaching); ++ // Kaiiju start - async path processing ++ if (me.earthme.luminol.config.modules.optimizations.AsyncPathProcessingConfig.asyncPathProcessing) ++ return new PathFinder(this.nodeEvaluator, range, nodeEvaluatorGenerator); ++ else ++ // Kaiiju end + return new PathFinder(this.nodeEvaluator, range); + } + diff --git a/src/main/java/net/minecraft/world/entity/ai/sensing/NearestBedSensor.java b/src/main/java/net/minecraft/world/entity/ai/sensing/NearestBedSensor.java index 8db20db72cd51046213625fac46c35854c59ec5d..afa5d36f5f9e6f3a44a1e92f98a1d83c3af4d277 100644 --- a/src/main/java/net/minecraft/world/entity/ai/sensing/NearestBedSensor.java @@ -1022,6 +1136,30 @@ index 937f81a859953498abe73bea560c86e6560e1c33..7aadd36f0fe986635b495ab8c1426644 return new PathFinder(this.nodeEvaluator, range) { @Override protected float distance(Node a, Node b) { +diff --git a/src/main/java/net/minecraft/world/level/block/ShulkerBoxBlock.java b/src/main/java/net/minecraft/world/level/block/ShulkerBoxBlock.java +index 42407c5c0c09cd9d19bc7af92af8868bb038c686..39ed19562210f1329b22c630e667578473cda7cb 100644 +--- a/src/main/java/net/minecraft/world/level/block/ShulkerBoxBlock.java ++++ b/src/main/java/net/minecraft/world/level/block/ShulkerBoxBlock.java +@@ -254,6 +254,7 @@ public class ShulkerBoxBlock extends BaseEntityBlock { + + @Override + public VoxelShape getShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext context) { ++ if (Thread.currentThread().getName().contains("petal-path-processor")) return Shapes.block(); // Kaiiju - async pathfinding - we cannot get block entities + BlockEntity blockEntity = world.getBlockEntity(pos); + return blockEntity instanceof ShulkerBoxBlockEntity ? Shapes.create(((ShulkerBoxBlockEntity)blockEntity).getBoundingBox(state)) : Shapes.block(); + } +diff --git a/src/main/java/net/minecraft/world/level/block/piston/MovingPistonBlock.java b/src/main/java/net/minecraft/world/level/block/piston/MovingPistonBlock.java +index d3d1ad7901411574b85b0febd1c7ddaa8ad7c9f4..850065df2b95b0967660f246cd007bf9f53e26df 100644 +--- a/src/main/java/net/minecraft/world/level/block/piston/MovingPistonBlock.java ++++ b/src/main/java/net/minecraft/world/level/block/piston/MovingPistonBlock.java +@@ -110,6 +110,7 @@ public class MovingPistonBlock extends BaseEntityBlock { + + @Override + public VoxelShape getCollisionShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext context) { ++ if (Thread.currentThread().getName().contains("petal-path-processor")) return Shapes.empty(); // Kaiiju - async pathfinding - we cannot get block entities + PistonMovingBlockEntity pistonMovingBlockEntity = this.getBlockEntity(world, pos); + return pistonMovingBlockEntity != null ? pistonMovingBlockEntity.getCollisionShape(world, pos) : Shapes.empty(); + } diff --git a/src/main/java/net/minecraft/world/level/pathfinder/Path.java b/src/main/java/net/minecraft/world/level/pathfinder/Path.java index 3049edb5a8b5967e5242a3896b23665888eb3472..0da9acd785cf785d82be7aab0a1e2bfd70c62998 100644 --- a/src/main/java/net/minecraft/world/level/pathfinder/Path.java @@ -1163,3 +1301,16 @@ index 8aa4ac3a6affbe888d6084a27b668c58dfda6c79..d8f443af840b1a4b1d2868fefd87d70d return best; // Paper end - Perf: remove streams and optimize collection } +diff --git a/src/main/java/net/minecraft/world/level/pathfinder/SwimNodeEvaluator.java b/src/main/java/net/minecraft/world/level/pathfinder/SwimNodeEvaluator.java +index 0e2b14e7dfedf209d63279c81723fd7955122d78..079b278e2e262af433bb5bd0c12b3d8db4fa12fc 100644 +--- a/src/main/java/net/minecraft/world/level/pathfinder/SwimNodeEvaluator.java ++++ b/src/main/java/net/minecraft/world/level/pathfinder/SwimNodeEvaluator.java +@@ -16,7 +16,7 @@ import net.minecraft.world.level.block.state.BlockState; + import net.minecraft.world.level.material.FluidState; + + public class SwimNodeEvaluator extends NodeEvaluator { +- private final boolean allowBreaching; ++ public final boolean allowBreaching; // Kaiiju - make this public + private final Long2ObjectMap pathTypesByPosCache = new Long2ObjectOpenHashMap<>(); + + public SwimNodeEvaluator(boolean canJumpOutOfWater) {