Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 79dbac2a8e | |||
| 4d3e3ac832 | |||
| d985a9ca33 |
@@ -66,6 +66,8 @@ jobs:
|
||||
body: |
|
||||
📦Version: `${{ env.mcversion }}` | Commit ${{ env.commit_id }} [](https://github.com/LuminolMC/${{ env.project_id }}/releases/download/${{ env.tag }}/${{ env.jar }})
|
||||
This release is automatically compiled by GitHub Actions
|
||||
### Branch Info
|
||||
${{ github.ref_name }}
|
||||
### Commit Message
|
||||
${{ env.commit_msg }}
|
||||
artifacts: ${{ env.jar_dir }}
|
||||
|
||||
+1
-1
@@ -4,7 +4,7 @@ mcVersion=1.21.8
|
||||
release=2
|
||||
# 0 for skip release, 1 for pre-release, 2 for release
|
||||
|
||||
luminolRef=fa4e778f2ab92b0ccef57fad830660766b3f2f18
|
||||
luminolRef=e7176d188b9e4d3b1f258d56cda91e2d008282f4
|
||||
|
||||
org.gradle.configuration-cache=true
|
||||
org.gradle.caching=true
|
||||
|
||||
+2
-2
@@ -5,7 +5,7 @@ Subject: [PATCH] Add config to enable cross region damage trace
|
||||
|
||||
|
||||
diff --git a/net/minecraft/server/level/ServerPlayer.java b/net/minecraft/server/level/ServerPlayer.java
|
||||
index 11e6197dec541b28733715f0d7eaa4c7b834d632..6b7c92fdf562dfa46eee8e8acbc82b02fc3226c5 100644
|
||||
index 11e6197dec541b28733715f0d7eaa4c7b834d632..de1263404395c28209234a556347284fa557f81c 100644
|
||||
--- a/net/minecraft/server/level/ServerPlayer.java
|
||||
+++ b/net/minecraft/server/level/ServerPlayer.java
|
||||
@@ -1345,6 +1345,13 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc
|
||||
@@ -40,7 +40,7 @@ index 11e6197dec541b28733715f0d7eaa4c7b834d632..6b7c92fdf562dfa46eee8e8acbc82b02
|
||||
+ } catch (Throwable ex) {
|
||||
+ LOGGER.error(ex.getMessage(), ex);
|
||||
+ }
|
||||
+ }, null, 1L );
|
||||
+ }, null, 1L);
|
||||
+ }
|
||||
+ // Luminol End - Cross Region Damage trace
|
||||
+
|
||||
|
||||
+2
-2
@@ -20,10 +20,10 @@ index e05f75b6bbd48d6fb7379926d68d5f8ed6014be9..af895859057ca303177ec3c8a07cf753
|
||||
DefaultGameModeCommands.register(this.dispatcher);
|
||||
//DialogCommand.register(this.dispatcher, context); // Folia - region threading - TODO
|
||||
diff --git a/net/minecraft/server/MinecraftServer.java b/net/minecraft/server/MinecraftServer.java
|
||||
index 100e8fdc52c201d386e3c779d19f6b5abde39820..d08a5b553f4e5932d960fbcdeb6a43419730e32a 100644
|
||||
index 75027e73859c955a54034640f905cb5d91a6a2f4..b4b3ff86f7c4afb94fc4da5133746391a078a7fb 100644
|
||||
--- a/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/net/minecraft/server/MinecraftServer.java
|
||||
@@ -2352,6 +2352,16 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
@@ -2353,6 +2353,16 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
return this.reloadResources(selectedIds, io.papermc.paper.event.server.ServerResourcesReloadedEvent.Cause.PLUGIN);
|
||||
}
|
||||
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Helvetica Volubi <suisuroru@blue-millennium.fun>
|
||||
Date: Thu, 4 Sep 2025 02:14:16 +0800
|
||||
Subject: [PATCH] Add config to enable function command
|
||||
|
||||
|
||||
diff --git a/net/minecraft/commands/Commands.java b/net/minecraft/commands/Commands.java
|
||||
index af895859057ca303177ec3c8a07cf7534e62cca6..e0e9fcf3224f55f2ef31c8afca3154a5992f761b 100644
|
||||
--- a/net/minecraft/commands/Commands.java
|
||||
+++ b/net/minecraft/commands/Commands.java
|
||||
@@ -206,7 +206,9 @@ public class Commands {
|
||||
FillCommand.register(this.dispatcher, context);
|
||||
FillBiomeCommand.register(this.dispatcher, context);
|
||||
ForceLoadCommand.register(this.dispatcher);
|
||||
- //FunctionCommand.register(this.dispatcher); // Folia - region threading - TODO
|
||||
+ if (fun.bm.lophine.config.modules.experiment.CommandConfig.function) {
|
||||
+ FunctionCommand.register(this.dispatcher); // Folia - region threading - TODO
|
||||
+ }
|
||||
GameModeCommand.register(this.dispatcher);
|
||||
GameRuleCommand.register(this.dispatcher, context);
|
||||
GiveCommand.register(this.dispatcher, context);
|
||||
+2
-2
@@ -97,10 +97,10 @@ index c485d5b3ba95f2a969bdf0dab9654ac284976f8d..b957585cf7cf7f845e20f59c7b355722
|
||||
this.scheduler.regionFailed(this, false, thr);
|
||||
// regionFailed will schedule a shutdown, so we should avoid letting this region tick further
|
||||
diff --git a/net/minecraft/commands/Commands.java b/net/minecraft/commands/Commands.java
|
||||
index af895859057ca303177ec3c8a07cf7534e62cca6..94a3cea5d42b1f98bbde22ef514f8f7dbd64ba58 100644
|
||||
index e0e9fcf3224f55f2ef31c8afca3154a5992f761b..a5b59eb79c014ef7a48ff305ed554fc33a184d87 100644
|
||||
--- a/net/minecraft/commands/Commands.java
|
||||
+++ b/net/minecraft/commands/Commands.java
|
||||
@@ -245,7 +245,11 @@ public class Commands {
|
||||
@@ -247,7 +247,11 @@ public class Commands {
|
||||
TeleportCommand.register(this.dispatcher);
|
||||
TellRawCommand.register(this.dispatcher, context);
|
||||
//TestCommand.register(this.dispatcher, context); // Folia - region threading
|
||||
+9
-9
@@ -1,20 +1,20 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Helvetica Volubi <suisuroru@blue-millennium.fun>
|
||||
Date: Mon, 7 Jul 2025 18:19:00 +0800
|
||||
Subject: [PATCH] Add config to enable unsafe waypoint bar
|
||||
Subject: [PATCH] Add config to enable waypoint command & bar
|
||||
|
||||
|
||||
diff --git a/net/minecraft/commands/Commands.java b/net/minecraft/commands/Commands.java
|
||||
index 94a3cea5d42b1f98bbde22ef514f8f7dbd64ba58..e311977fca4d0ba6e3efd4a41b2732cf5e7b4b9c 100644
|
||||
index a5b59eb79c014ef7a48ff305ed554fc33a184d87..e8c7cc10f10fc013100fa66f3489ac98b3a29227 100644
|
||||
--- a/net/minecraft/commands/Commands.java
|
||||
+++ b/net/minecraft/commands/Commands.java
|
||||
@@ -253,7 +253,11 @@ public class Commands {
|
||||
@@ -255,7 +255,11 @@ public class Commands {
|
||||
TimeCommand.register(this.dispatcher);
|
||||
TitleCommand.register(this.dispatcher, context);
|
||||
//TriggerCommand.register(this.dispatcher); // Folia - region threading - TODO later
|
||||
- //WaypointCommand.register(this.dispatcher, context); // Folia - region threading - TODO later
|
||||
+ // Lophine start - unsafe waypoint bar
|
||||
+ if (fun.bm.lophine.config.modules.experiment.WaypointConfig.forceEnableWaypointUnsafe) {
|
||||
+ if (fun.bm.lophine.config.modules.experiment.CommandConfig.waypoint) {
|
||||
+ WaypointCommand.register(this.dispatcher, context); // Folia - region threading - TODO later
|
||||
+ }
|
||||
+ // Lophine end - unsafe waypoint bar
|
||||
@@ -22,7 +22,7 @@ index 94a3cea5d42b1f98bbde22ef514f8f7dbd64ba58..e311977fca4d0ba6e3efd4a41b2732cf
|
||||
WorldBorderCommand.register(this.dispatcher);
|
||||
if (JvmProfiler.INSTANCE.isAvailable()) {
|
||||
diff --git a/net/minecraft/server/waypoints/ServerWaypointManager.java b/net/minecraft/server/waypoints/ServerWaypointManager.java
|
||||
index 0f8cacbb8fe55a60e2f0c98bf36c005b29f41a4b..36e9b027ce5213f8914728293633e78e9905c1b2 100644
|
||||
index 0f8cacbb8fe55a60e2f0c98bf36c005b29f41a4b..52fd730998535ea071bfc99b7cc2c254b9b656d7 100644
|
||||
--- a/net/minecraft/server/waypoints/ServerWaypointManager.java
|
||||
+++ b/net/minecraft/server/waypoints/ServerWaypointManager.java
|
||||
@@ -22,7 +22,14 @@ public class ServerWaypointManager implements WaypointManager<WaypointTransmitte
|
||||
@@ -31,7 +31,7 @@ index 0f8cacbb8fe55a60e2f0c98bf36c005b29f41a4b..36e9b027ce5213f8914728293633e78e
|
||||
public void trackWaypoint(WaypointTransmitter waypoint) {
|
||||
- // Folia - region threading
|
||||
+ // Lophine start - unsafe waypoint bar
|
||||
+ if (!fun.bm.lophine.config.modules.experiment.WaypointConfig.forceEnableWaypointUnsafe) return;
|
||||
+ if (!fun.bm.lophine.config.modules.experiment.CommandConfig.waypoint) return;
|
||||
+ this.waypoints.add(waypoint);
|
||||
+
|
||||
+ for (ServerPlayer serverPlayer : this.players) {
|
||||
@@ -46,7 +46,7 @@ index 0f8cacbb8fe55a60e2f0c98bf36c005b29f41a4b..36e9b027ce5213f8914728293633e78e
|
||||
public void addPlayer(ServerPlayer player) {
|
||||
// Folia - region threading
|
||||
+ // Lophine start - unsafe waypoint bar
|
||||
+ if (!fun.bm.lophine.config.modules.experiment.WaypointConfig.forceEnableWaypointUnsafe) return;
|
||||
+ if (!fun.bm.lophine.config.modules.experiment.CommandConfig.waypoint) return;
|
||||
+ this.players.add(player);
|
||||
+
|
||||
+ for (WaypointTransmitter waypointTransmitter : this.waypoints) {
|
||||
@@ -62,7 +62,7 @@ index 0f8cacbb8fe55a60e2f0c98bf36c005b29f41a4b..36e9b027ce5213f8914728293633e78e
|
||||
public void updatePlayer(ServerPlayer player) {
|
||||
// Folia - region threading
|
||||
+ // Lophine start - unsafe waypoint bar
|
||||
+ if (!fun.bm.lophine.config.modules.experiment.WaypointConfig.forceEnableWaypointUnsafe) return;
|
||||
+ if (!fun.bm.lophine.config.modules.experiment.CommandConfig.waypoint) return;
|
||||
+ Map<WaypointTransmitter, WaypointTransmitter.Connection> map = this.connections.row(player);
|
||||
+ SetView<WaypointTransmitter> set = Sets.difference(this.waypoints, map.keySet());
|
||||
+
|
||||
@@ -79,7 +79,7 @@ index 0f8cacbb8fe55a60e2f0c98bf36c005b29f41a4b..36e9b027ce5213f8914728293633e78e
|
||||
public void removePlayer(ServerPlayer player) {
|
||||
// Folia - region threading
|
||||
+ // Lophine start - unsafe waypoint bar
|
||||
+ if (!fun.bm.lophine.config.modules.experiment.WaypointConfig.forceEnableWaypointUnsafe) return;
|
||||
+ if (!fun.bm.lophine.config.modules.experiment.CommandConfig.waypoint) return;
|
||||
+ this.connections.row(player).values().removeIf(connection -> {
|
||||
+ connection.disconnect();
|
||||
+ return true;
|
||||
+2
-2
@@ -58,7 +58,7 @@ index fb263fa1f30a7dfcb7ec2656abfb38e5fe88eac9..56fd1ed7ccaf96e7eedea60fbdbf7f93
|
||||
};
|
||||
}
|
||||
diff --git a/net/minecraft/server/MinecraftServer.java b/net/minecraft/server/MinecraftServer.java
|
||||
index a0f1db50adf5163a671d3d9e9df7adb7de4250c6..af13707933af14171447d5ab6faacb64ddf194a7 100644
|
||||
index b156b5c635f931a3d4abc0584591f90476d011a6..0b7c014114f1f8648824fe7c9b75fde3ea79162a 100644
|
||||
--- a/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/net/minecraft/server/MinecraftServer.java
|
||||
@@ -305,6 +305,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
@@ -69,7 +69,7 @@ index a0f1db50adf5163a671d3d9e9df7adb7de4250c6..af13707933af14171447d5ab6faacb64
|
||||
|
||||
@Override
|
||||
public <V> CompletableFuture<V> submit(java.util.function.Supplier<V> task) {
|
||||
@@ -2226,9 +2227,16 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
@@ -2227,9 +2228,16 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
return false;
|
||||
}
|
||||
|
||||
+2
-2
@@ -446,7 +446,7 @@ index 10b2cc20bbf3b70e4e09dbbe14b90506e6366158..1535bb8cec8692e8d26eaff090288f1b
|
||||
}
|
||||
|
||||
diff --git a/net/minecraft/world/level/block/entity/HopperBlockEntity.java b/net/minecraft/world/level/block/entity/HopperBlockEntity.java
|
||||
index accbf3256db42b1ce15ea022fcfe1c61e8cb1c7a..8b7d885ae0ec48039dc1573a5227c322454e46ab 100644
|
||||
index 4b634dbb45dfb0823e7b21cf2354f89e5a6331e9..ef32bf1351aa28953bfc625d7a7d5175181a7acc 100644
|
||||
--- a/net/minecraft/world/level/block/entity/HopperBlockEntity.java
|
||||
+++ b/net/minecraft/world/level/block/entity/HopperBlockEntity.java
|
||||
@@ -145,7 +145,7 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen
|
||||
@@ -458,7 +458,7 @@ index accbf3256db42b1ce15ea022fcfe1c61e8cb1c7a..8b7d885ae0ec48039dc1573a5227c322
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -759,9 +759,9 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen
|
||||
@@ -770,9 +770,9 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen
|
||||
if (item.isEmpty()) {
|
||||
// Spigot start - SPIGOT-6693, SimpleContainer#setItem
|
||||
ItemStack leftover = ItemStack.EMPTY; // Paper - Make hoppers respect inventory max stack size
|
||||
+1
-1
@@ -5,7 +5,7 @@ Subject: [PATCH] Spawn invulnerable time
|
||||
|
||||
|
||||
diff --git a/net/minecraft/server/level/ServerPlayer.java b/net/minecraft/server/level/ServerPlayer.java
|
||||
index 6b7c92fdf562dfa46eee8e8acbc82b02fc3226c5..c29e9c6cb2513fe4b01a619e16433893efb44e6f 100644
|
||||
index de1263404395c28209234a556347284fa557f81c..44f0e3a675c612e9ca2bc40cc3898bdbca0f6718 100644
|
||||
--- a/net/minecraft/server/level/ServerPlayer.java
|
||||
+++ b/net/minecraft/server/level/ServerPlayer.java
|
||||
@@ -232,6 +232,7 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc
|
||||
+19
-19
@@ -33,7 +33,7 @@ index 66ec0424a46dcd49cf44467357d80b1a2d84d3b2..04ae8de63af0a8abe578f14c8ef85fd4
|
||||
private DisconnectionDetails disconnectionDetails;
|
||||
private boolean encrypted;
|
||||
diff --git a/net/minecraft/server/MinecraftServer.java b/net/minecraft/server/MinecraftServer.java
|
||||
index af13707933af14171447d5ab6faacb64ddf194a7..e5e3a9c6443019d31496b1cf2154f5c3eaf6f972 100644
|
||||
index 0b7c014114f1f8648824fe7c9b75fde3ea79162a..55d3b9a612943fda29716b9e7969b82e43947669 100644
|
||||
--- a/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/net/minecraft/server/MinecraftServer.java
|
||||
@@ -348,6 +348,8 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
@@ -53,7 +53,7 @@ index af13707933af14171447d5ab6faacb64ddf194a7..e5e3a9c6443019d31496b1cf2154f5c3
|
||||
// CraftBukkit start
|
||||
if (this.server != null) {
|
||||
if (false) this.server.spark.disable(); // Paper - spark // Luminol - Force disable builtin spark
|
||||
@@ -1588,7 +1591,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
@@ -1589,7 +1592,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
int i = this.pauseWhileEmptySeconds() * 20;
|
||||
this.removeDisabledPluginsBlockingSleep(); // Paper - API to allow/disallow tick sleeping
|
||||
if (false && i > 0) { // Folia - region threading - this is complicated to implement, and even if done correctly is messy
|
||||
@@ -62,7 +62,7 @@ index af13707933af14171447d5ab6faacb64ddf194a7..e5e3a9c6443019d31496b1cf2154f5c3
|
||||
this.emptyTicks++;
|
||||
} else {
|
||||
this.emptyTicks = 0;
|
||||
@@ -1912,6 +1915,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
@@ -1913,6 +1916,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
|
||||
public void tickConnection() {
|
||||
this.getConnection().tick();
|
||||
@@ -70,7 +70,7 @@ index af13707933af14171447d5ab6faacb64ddf194a7..e5e3a9c6443019d31496b1cf2154f5c3
|
||||
}
|
||||
|
||||
private void synchronizeTime(ServerLevel level) {
|
||||
@@ -2990,6 +2994,16 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
@@ -2991,6 +2995,16 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -319,7 +319,7 @@ index 576dde41a4b48aac9079cca902f4371a31470af3..952b92c55d7192791a19ecebe80894f6
|
||||
ServerLevel.this.updateSleepingPlayerList();
|
||||
}
|
||||
diff --git a/net/minecraft/server/level/ServerPlayer.java b/net/minecraft/server/level/ServerPlayer.java
|
||||
index c29e9c6cb2513fe4b01a619e16433893efb44e6f..ff803b5f73f7d2cfe9351add12c3fde69a1642b1 100644
|
||||
index 44f0e3a675c612e9ca2bc40cc3898bdbca0f6718..4b2dba8b30b72fb3acc00957b3e19d6fc178c99e 100644
|
||||
--- a/net/minecraft/server/level/ServerPlayer.java
|
||||
+++ b/net/minecraft/server/level/ServerPlayer.java
|
||||
@@ -219,7 +219,7 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc
|
||||
@@ -516,35 +516,35 @@ index cb863a36fc67e993956ec3be655e6e4b9764c051..908ec29a6e285122d1a8a43dc547b74a
|
||||
|
||||
public boolean canBypassPlayerLimit(GameProfile profile) {
|
||||
diff --git a/net/minecraft/server/waypoints/ServerWaypointManager.java b/net/minecraft/server/waypoints/ServerWaypointManager.java
|
||||
index 36e9b027ce5213f8914728293633e78e9905c1b2..a8c2a93cc12bd5aa6760bed91baa680f3801ee5e 100644
|
||||
index 52fd730998535ea071bfc99b7cc2c254b9b656d7..0abf6f0265fcb916f2c2c76fb1313bd13444f4ad 100644
|
||||
--- a/net/minecraft/server/waypoints/ServerWaypointManager.java
|
||||
+++ b/net/minecraft/server/waypoints/ServerWaypointManager.java
|
||||
@@ -22,6 +22,11 @@ public class ServerWaypointManager implements WaypointManager<WaypointTransmitte
|
||||
|
||||
@Override
|
||||
@@ -24,6 +24,11 @@ public class ServerWaypointManager implements WaypointManager<WaypointTransmitte
|
||||
public void trackWaypoint(WaypointTransmitter waypoint) {
|
||||
// Lophine start - unsafe waypoint bar
|
||||
if (!fun.bm.lophine.config.modules.experiment.CommandConfig.waypoint) return;
|
||||
+ // Leaves start - fakeplayer
|
||||
+ if (waypoint instanceof org.leavesmc.leaves.bot.ServerBot bot && !bot.getConfigValue(org.leavesmc.leaves.bot.agent.Configs.ENABLE_LOCATOR_BAR)) {
|
||||
+ return;
|
||||
+ }
|
||||
+ // Leaves end - fakeplayer
|
||||
// Lophine start - unsafe waypoint bar
|
||||
if (!fun.bm.lophine.config.modules.experiment.WaypointConfig.forceEnableWaypointUnsafe) return;
|
||||
this.waypoints.add(waypoint);
|
||||
@@ -57,6 +62,11 @@ public class ServerWaypointManager implements WaypointManager<WaypointTransmitte
|
||||
|
||||
public void addPlayer(ServerPlayer player) {
|
||||
for (ServerPlayer serverPlayer : this.players) {
|
||||
@@ -59,6 +64,11 @@ public class ServerWaypointManager implements WaypointManager<WaypointTransmitte
|
||||
// Folia - region threading
|
||||
// Lophine start - unsafe waypoint bar
|
||||
if (!fun.bm.lophine.config.modules.experiment.CommandConfig.waypoint) return;
|
||||
+ // Leaves start - fakeplayer
|
||||
+ if (player instanceof org.leavesmc.leaves.bot.ServerBot) {
|
||||
+ return;
|
||||
+ }
|
||||
+ // Leaves end - fakeplayer
|
||||
// Lophine start - unsafe waypoint bar
|
||||
if (!fun.bm.lophine.config.modules.experiment.WaypointConfig.forceEnableWaypointUnsafe) return;
|
||||
this.players.add(player);
|
||||
|
||||
for (WaypointTransmitter waypointTransmitter : this.waypoints) {
|
||||
diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java
|
||||
index ee4a459700d75676eae3422d4a0e10be73c45871..16c323ead67a9a4ef48d25670b89297a15457849 100644
|
||||
index bfd29fc6a5af3cd28a462ce97bbc04634402b74c..319789f635b8b6bba2e8843c7fb38ef1fdf51677 100644
|
||||
--- a/net/minecraft/world/entity/Entity.java
|
||||
+++ b/net/minecraft/world/entity/Entity.java
|
||||
@@ -1225,7 +1225,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
@@ -566,7 +566,7 @@ index ee4a459700d75676eae3422d4a0e10be73c45871..16c323ead67a9a4ef48d25670b89297a
|
||||
final boolean yZero = movement.y == 0.0;
|
||||
final boolean zZero = movement.z == 0.0;
|
||||
diff --git a/net/minecraft/world/entity/LivingEntity.java b/net/minecraft/world/entity/LivingEntity.java
|
||||
index a8348a073682eec31990e9ab963b11ad32cf8bf8..8ce6f3f1a931628e018ce9a2e0c404b8c8a4d992 100644
|
||||
index f4f4f886b6558d39d292a45665953f497f84be53..12466e0294123a5922ee7694984d4d277a390ddd 100644
|
||||
--- a/net/minecraft/world/entity/LivingEntity.java
|
||||
+++ b/net/minecraft/world/entity/LivingEntity.java
|
||||
@@ -3212,7 +3212,7 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin
|
||||
@@ -578,7 +578,7 @@ index a8348a073682eec31990e9ab963b11ad32cf8bf8..8ce6f3f1a931628e018ce9a2e0c404b8
|
||||
this.setSpeed(this.getRiddenSpeed(player));
|
||||
this.travel(riddenInput);
|
||||
} else {
|
||||
@@ -4046,7 +4046,7 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin
|
||||
@@ -4062,7 +4062,7 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin
|
||||
// Paper start - lag compensate eating
|
||||
// we add 1 to the expected time to avoid lag compensating when we should not
|
||||
final boolean shouldLagCompensate = this.useItem.has(DataComponents.FOOD) && this.eatStartTime != -1 && (System.nanoTime() - this.eatStartTime) > ((1L + this.totalEatTimeTicks) * 50L * (1000L * 1000L));
|
||||
@@ -587,7 +587,7 @@ index a8348a073682eec31990e9ab963b11ad32cf8bf8..8ce6f3f1a931628e018ce9a2e0c404b8
|
||||
this.useItemRemaining = 0;
|
||||
// Paper end - lag compensate eating
|
||||
this.completeUsingItem();
|
||||
@@ -4223,6 +4223,23 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin
|
||||
@@ -4239,6 +4239,23 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin
|
||||
this.stopUsingItem();
|
||||
}
|
||||
|
||||
+13
@@ -3,6 +3,7 @@ package fun.bm.lophine.config.modules.experiment;
|
||||
import me.earthme.luminol.config.IConfigModule;
|
||||
import me.earthme.luminol.config.flags.ConfigClassInfo;
|
||||
import me.earthme.luminol.config.flags.ConfigInfo;
|
||||
import me.earthme.luminol.config.flags.TransformedConfig;
|
||||
import me.earthme.luminol.enums.EnumConfigCategory;
|
||||
|
||||
@ConfigClassInfo(configAttribution = EnumConfigCategory.EXPERIMENT, mainName = "command")
|
||||
@@ -17,4 +18,16 @@ public class CommandConfig implements IConfigModule {
|
||||
Allow to use datapack command
|
||||
--- datapack hot-update unsupported, please restart server""")
|
||||
public static boolean datapack = false;
|
||||
|
||||
@ConfigInfo(baseName = "function_command_enabled", comments =
|
||||
"""
|
||||
Allow to use function command""")
|
||||
public static boolean function = false;
|
||||
|
||||
@TransformedConfig(name = "enable-waypoint", category = {"experiment", "waypoint bar"})
|
||||
@TransformedConfig(name = "enable-waypoint", category = {"experiment", "waypoint_bar"})
|
||||
@ConfigInfo(baseName = "waypoint_command_enabled", comments = """
|
||||
Allow to use waypoint command
|
||||
""")
|
||||
public static boolean waypoint = false;
|
||||
}
|
||||
-16
@@ -1,16 +0,0 @@
|
||||
package fun.bm.lophine.config.modules.experiment;
|
||||
|
||||
import me.earthme.luminol.config.IConfigModule;
|
||||
import me.earthme.luminol.config.flags.ConfigClassInfo;
|
||||
import me.earthme.luminol.config.flags.ConfigInfo;
|
||||
import me.earthme.luminol.config.flags.TransformedConfig;
|
||||
import me.earthme.luminol.enums.EnumConfigCategory;
|
||||
|
||||
@ConfigClassInfo(configAttribution = EnumConfigCategory.EXPERIMENT, mainName = "waypoint_bar")
|
||||
public class WaypointConfig implements IConfigModule {
|
||||
@TransformedConfig(name = "enable-waypoint", category = {"experiment", "waypoint bar"})
|
||||
@ConfigInfo(baseName = "enabled", comments =
|
||||
"""
|
||||
Enable waypoint bar unsafe""")
|
||||
public static boolean forceEnableWaypointUnsafe = false;
|
||||
}
|
||||
+4
-4
@@ -10,15 +10,15 @@ import java.util.List;
|
||||
|
||||
@ConfigClassInfo(configAttribution = EnumConfigCategory.FUNCTION, mainName = "survux-protocol")
|
||||
public class SurvuxProtocolConfig implements IConfigModule {
|
||||
@TransformedConfig(name = "entity-protocol", category = {"misc", "survux-protocol"})
|
||||
@TransformedConfig(name = "entity-protocol", category = {"misc", "survux-protocol"})
|
||||
@ConfigInfo(baseName = "entity-protocol")
|
||||
public static boolean entityProtocol = false;
|
||||
|
||||
@TransformedConfig(name = "hud-logger-protocol", category = {"misc", "survux-protocol"})
|
||||
@TransformedConfig(name = "hud-logger-protocol", category = {"misc", "survux-protocol"})
|
||||
@ConfigInfo(baseName = "hud-logger-protocol")
|
||||
public static boolean hudLoggerProtocol = false;
|
||||
|
||||
@TransformedConfig(name = "hud-metadata-protocol", category = {"misc", "survux-protocol"})
|
||||
@TransformedConfig(name = "hud-metadata-protocol", category = {"misc", "survux-protocol"})
|
||||
@ConfigInfo(baseName = "hud-metadata-protocol")
|
||||
public static boolean hudMetadataProtocol = false;
|
||||
|
||||
@@ -26,7 +26,7 @@ public class SurvuxProtocolConfig implements IConfigModule {
|
||||
@ConfigInfo(baseName = "hud-metadata-share-seed")
|
||||
public static boolean hudMetadataShareSeed = false;
|
||||
|
||||
@TransformedConfig(name ="structure-protocol", category = {"misc", "survux-protocol"})
|
||||
@TransformedConfig(name = "structure-protocol", category = {"misc", "survux-protocol"})
|
||||
@ConfigInfo(baseName = "structure-protocol")
|
||||
public static boolean structureProtocol = false;
|
||||
|
||||
|
||||
@@ -50,6 +50,7 @@ import static net.kyori.adventure.text.Component.text;
|
||||
|
||||
public class BotCommand extends Command {
|
||||
private static final Logger LOGGER = LogUtils.getLogger();
|
||||
|
||||
public BotCommand() {
|
||||
super("bot");
|
||||
this.setPermission("lophine.bot");
|
||||
@@ -115,8 +116,8 @@ public class BotCommand extends Command {
|
||||
String fullName = BotUtil.getFullName(botName);
|
||||
if (this.canCreate(sender, fullName)) {
|
||||
BotCreateState.Builder builder = BotCreateState.builder(botName, Bukkit.getWorlds().getFirst().getSpawnLocation())
|
||||
.createReason(BotCreateEvent.CreateReason.COMMAND)
|
||||
.creator(sender);
|
||||
.createReason(BotCreateEvent.CreateReason.COMMAND)
|
||||
.creator(sender);
|
||||
|
||||
if (args.length >= 3) {
|
||||
builder.skinName(args[2]);
|
||||
@@ -154,7 +155,7 @@ public class BotCommand extends Command {
|
||||
String botName = args[1];
|
||||
BotList botList = BotList.INSTANCE;
|
||||
ServerBot bot = botList.getBotByName(BotUtil.getFullName(botName));
|
||||
|
||||
|
||||
if (bot == null) {
|
||||
sender.sendMessage(text("This fakeplayer is not in server", NamedTextColor.RED));
|
||||
return true;
|
||||
@@ -223,7 +224,7 @@ public class BotCommand extends Command {
|
||||
|
||||
private boolean handleList(CommandSender sender, String[] args) {
|
||||
BotList botList = BotList.INSTANCE;
|
||||
|
||||
|
||||
if (args.length < 2) {
|
||||
Map<World, List<String>> botMap = new HashMap<>();
|
||||
for (World world : Bukkit.getWorlds()) {
|
||||
@@ -265,7 +266,7 @@ public class BotCommand extends Command {
|
||||
sender.sendMessage(text("Bot action feature is disabled!", NamedTextColor.RED));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
if (args.length < 3) {
|
||||
sender.sendMessage(text("Use /bot action <name> <action> to make fakeplayer do action", NamedTextColor.RED));
|
||||
return true;
|
||||
@@ -336,7 +337,7 @@ public class BotCommand extends Command {
|
||||
for (int i = 0; i < bot.getBotActions().size(); i++) {
|
||||
ServerBotAction<?> action = bot.getBotActions().get(i);
|
||||
BotActionStopEvent event = new BotActionStopEvent(
|
||||
bot.getBukkitEntity(), action.getName(), action.getUUID(), BotActionStopEvent.Reason.COMMAND, sender
|
||||
bot.getBukkitEntity(), action.getName(), action.getUUID(), BotActionStopEvent.Reason.COMMAND, sender
|
||||
);
|
||||
event.callEvent();
|
||||
if (!event.isCancelled()) {
|
||||
@@ -357,7 +358,7 @@ public class BotCommand extends Command {
|
||||
|
||||
ServerBotAction<?> action = bot.getBotActions().get(i);
|
||||
BotActionStopEvent event = new BotActionStopEvent(
|
||||
bot.getBukkitEntity(), action.getName(), action.getUUID(), BotActionStopEvent.Reason.COMMAND, sender
|
||||
bot.getBukkitEntity(), action.getName(), action.getUUID(), BotActionStopEvent.Reason.COMMAND, sender
|
||||
);
|
||||
event.callEvent();
|
||||
if (!event.isCancelled()) {
|
||||
@@ -375,7 +376,7 @@ public class BotCommand extends Command {
|
||||
sender.sendMessage(text("Bot config feature is disabled!", NamedTextColor.RED));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
if (args.length < 3) {
|
||||
sender.sendMessage(text("Use /bot config <name> <config> to modify fakeplayer's config", NamedTextColor.RED));
|
||||
return true;
|
||||
@@ -421,7 +422,7 @@ public class BotCommand extends Command {
|
||||
sender.sendMessage(text("Bot save/load feature is disabled!", NamedTextColor.RED));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
if (args.length < 2) {
|
||||
sender.sendMessage(text("Use /bot save <name> to save a fakeplayer", NamedTextColor.RED));
|
||||
return true;
|
||||
@@ -446,7 +447,7 @@ public class BotCommand extends Command {
|
||||
sender.sendMessage(text("Bot save/load feature is disabled!", NamedTextColor.RED));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
if (args.length < 2) {
|
||||
sender.sendMessage(text("Use /bot load <name> to load a fakeplayer", NamedTextColor.RED));
|
||||
return true;
|
||||
|
||||
@@ -33,7 +33,8 @@ import org.leavesmc.leaves.plugin.MinecraftInternalPlugin;
|
||||
import java.util.Objects;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
public record BotCreateState(String realName, String name, String skinName, String[] skin, Location location, BotCreateEvent.CreateReason createReason, CommandSender creator) {
|
||||
public record BotCreateState(String realName, String name, String skinName, String[] skin, Location location,
|
||||
BotCreateEvent.CreateReason createReason, CommandSender creator) {
|
||||
|
||||
private static final MinecraftServer server = MinecraftServer.getServer();
|
||||
|
||||
@@ -117,25 +118,25 @@ public record BotCreateState(String realName, String name, String skinName, Stri
|
||||
|
||||
public void spawnWithSkin(Consumer<Bot> consumer) {
|
||||
Bukkit.getRegionScheduler().execute(
|
||||
MinecraftInternalPlugin.INSTANCE,
|
||||
location.getWorld(),
|
||||
location.getBlockX() >> 4,
|
||||
location.getBlockZ() >> 4,
|
||||
() -> {
|
||||
this.mojangAPISkin();
|
||||
Bukkit.getRegionScheduler().execute(
|
||||
MinecraftInternalPlugin.INSTANCE,
|
||||
location.getWorld(),
|
||||
location.getBlockX() >> 4,
|
||||
location.getBlockZ() >> 4,
|
||||
() -> {
|
||||
CraftBot bot = this.spawn();
|
||||
if (bot != null && consumer != null) {
|
||||
consumer.accept(bot);
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
MinecraftInternalPlugin.INSTANCE,
|
||||
location.getWorld(),
|
||||
location.getBlockX() >> 4,
|
||||
location.getBlockZ() >> 4,
|
||||
() -> {
|
||||
this.mojangAPISkin();
|
||||
Bukkit.getRegionScheduler().execute(
|
||||
MinecraftInternalPlugin.INSTANCE,
|
||||
location.getWorld(),
|
||||
location.getBlockX() >> 4,
|
||||
location.getBlockZ() >> 4,
|
||||
() -> {
|
||||
CraftBot bot = this.spawn();
|
||||
if (bot != null && consumer != null) {
|
||||
consumer.accept(bot);
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -38,9 +38,9 @@ public class BotInventoryContainer extends Inventory {
|
||||
customData.putBoolean("Leaves.Gui.Placeholder", true);
|
||||
|
||||
DataComponentPatch patch = DataComponentPatch.builder()
|
||||
.set(DataComponents.CUSTOM_NAME, Component.empty())
|
||||
.set(DataComponents.CUSTOM_DATA, CustomData.of(customData))
|
||||
.build();
|
||||
.set(DataComponents.CUSTOM_NAME, Component.empty())
|
||||
.set(DataComponents.CUSTOM_DATA, CustomData.of(customData))
|
||||
.build();
|
||||
|
||||
button = new ItemStack(Items.STRUCTURE_VOID);
|
||||
button.applyComponents(patch);
|
||||
|
||||
@@ -49,13 +49,7 @@ import org.jetbrains.annotations.Nullable;
|
||||
import org.leavesmc.leaves.event.bot.*;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
|
||||
public class BotList {
|
||||
@@ -189,8 +183,8 @@ public class BotList {
|
||||
bot.renderData();
|
||||
bot.initInventoryMenu();
|
||||
botsNameByWorldUuid
|
||||
.computeIfAbsent(bot.level().uuid.toString(), (k) -> new HashSet<>())
|
||||
.add(bot.getBukkitEntity().getRealName());
|
||||
.computeIfAbsent(bot.level().uuid.toString(), (k) -> new HashSet<>())
|
||||
.add(bot.getBukkitEntity().getRealName());
|
||||
BotList.LOGGER.info("{}[{}] logged in with entity id {} at ([{}]{}, {}, {})", bot.getName().getString(), "Local", bot.getId(), bot.level().serverLevelData.getLevelName(), bot.getX(), bot.getY(), bot.getZ());
|
||||
return bot;
|
||||
}
|
||||
@@ -253,11 +247,11 @@ public class BotList {
|
||||
level.removePlayerImmediately(bot, Entity.RemovalReason.UNLOADED_WITH_PLAYER);
|
||||
} else {
|
||||
io.papermc.paper.threadedregions.RegionizedServer.getInstance().taskQueue.queueTickTaskQueue(
|
||||
level, chunkX, chunkZ, () -> {
|
||||
level.removePlayerImmediately(bot, Entity.RemovalReason.UNLOADED_WITH_PLAYER);
|
||||
});
|
||||
level, chunkX, chunkZ, () -> {
|
||||
level.removePlayerImmediately(bot, Entity.RemovalReason.UNLOADED_WITH_PLAYER);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
this.bots.remove(bot);
|
||||
this.botsByName.remove(bot.getScoreboardName().toLowerCase(Locale.ROOT));
|
||||
|
||||
@@ -314,8 +308,8 @@ public class BotList {
|
||||
continue;
|
||||
}
|
||||
this.botsNameByWorldUuid
|
||||
.computeIfAbsent(levelUuid.toString(), (k) -> new HashSet<>())
|
||||
.add(realName);
|
||||
.computeIfAbsent(levelUuid.toString(), (k) -> new HashSet<>())
|
||||
.add(realName);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -335,11 +329,11 @@ public class BotList {
|
||||
String prevUuid = bot.level().uuid.toString();
|
||||
String newUuid = level.uuid.toString();
|
||||
this.botsNameByWorldUuid
|
||||
.computeIfAbsent(newUuid, (k) -> new HashSet<>())
|
||||
.add(bot.getBukkitEntity().getRealName());
|
||||
.computeIfAbsent(newUuid, (k) -> new HashSet<>())
|
||||
.add(bot.getBukkitEntity().getRealName());
|
||||
this.botsNameByWorldUuid
|
||||
.computeIfAbsent(prevUuid, (k) -> new HashSet<>())
|
||||
.remove(bot.getBukkitEntity().getRealName());
|
||||
.computeIfAbsent(prevUuid, (k) -> new HashSet<>())
|
||||
.remove(bot.getBukkitEntity().getRealName());
|
||||
}
|
||||
|
||||
public void networkTick() {
|
||||
|
||||
@@ -45,9 +45,9 @@ public class MojangAPI {
|
||||
public static String[] pullFromAPI(String name) {
|
||||
try {
|
||||
String uuid = JsonParser.parseReader(new InputStreamReader(URI.create("https://api.mojang.com/users/profiles/minecraft/" + name).toURL().openStream()))
|
||||
.getAsJsonObject().get("id").getAsString();
|
||||
.getAsJsonObject().get("id").getAsString();
|
||||
JsonObject property = JsonParser.parseReader(new InputStreamReader(URI.create("https://sessionserver.mojang.com/session/minecraft/profile/" + uuid + "?unsigned=false").toURL().openStream()))
|
||||
.getAsJsonObject().get("properties").getAsJsonArray().get(0).getAsJsonObject();
|
||||
.getAsJsonObject().get("properties").getAsJsonArray().get(0).getAsJsonObject();
|
||||
return new String[]{property.get("value").getAsString(), property.get("signature").getAsString()};
|
||||
} catch (IOException | IllegalStateException | IllegalArgumentException e) {
|
||||
return null;
|
||||
|
||||
@@ -62,11 +62,7 @@ import net.minecraft.world.level.gameevent.GameEvent;
|
||||
import net.minecraft.world.level.portal.TeleportTransition;
|
||||
import net.minecraft.world.level.storage.ValueInput;
|
||||
import net.minecraft.world.level.storage.ValueOutput;
|
||||
import net.minecraft.world.phys.AABB;
|
||||
import net.minecraft.world.phys.BlockHitResult;
|
||||
import net.minecraft.world.phys.EntityHitResult;
|
||||
import net.minecraft.world.phys.HitResult;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
import net.minecraft.world.phys.*;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.command.CommandSender;
|
||||
@@ -83,13 +79,7 @@ import org.leavesmc.leaves.plugin.MinecraftInternalPlugin;
|
||||
import org.leavesmc.leaves.util.MathUtils;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.UUID;
|
||||
import java.util.*;
|
||||
import java.util.function.Predicate;
|
||||
|
||||
public class ServerBot extends ServerPlayer {
|
||||
@@ -175,15 +165,15 @@ public class ServerBot extends ServerPlayer {
|
||||
|
||||
Input input = this.getLastClientInput();
|
||||
this.setLastClientInput(
|
||||
new Input(
|
||||
this.zza > 0,
|
||||
this.zza < 0,
|
||||
this.xxa > 0,
|
||||
this.xxa < 0,
|
||||
input.jump(),
|
||||
input.shift(),
|
||||
input.sprint()
|
||||
)
|
||||
new Input(
|
||||
this.zza > 0,
|
||||
this.zza < 0,
|
||||
this.xxa > 0,
|
||||
this.xxa < 0,
|
||||
input.jump(),
|
||||
input.shift(),
|
||||
input.sprint()
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -226,11 +216,11 @@ public class ServerBot extends ServerPlayer {
|
||||
if (this.getConfigValue(Configs.TICK_TYPE) == TickType.NETWORK) {
|
||||
try {
|
||||
Bukkit.getRegionScheduler().execute(
|
||||
MinecraftInternalPlugin.INSTANCE,
|
||||
this.level().getWorld(),
|
||||
this.getBlockX() >> 4,
|
||||
this.getBlockZ() >> 4,
|
||||
this::runAction
|
||||
MinecraftInternalPlugin.INSTANCE,
|
||||
this.level().getWorld(),
|
||||
this.getBlockX() >> 4,
|
||||
this.getBlockZ() >> 4,
|
||||
this::runAction
|
||||
);
|
||||
} catch (Exception e) {
|
||||
this.runAction();
|
||||
@@ -495,7 +485,7 @@ public class ServerBot extends ServerPlayer {
|
||||
|
||||
public void renderData() {
|
||||
this.getServer().getPlayerList().getPlayers().forEach(
|
||||
player -> this.sendFakeDataIfNeed(player, false)
|
||||
player -> this.sendFakeDataIfNeed(player, false)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -21,12 +21,7 @@ import org.jetbrains.annotations.Contract;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.leavesmc.leaves.bot.ServerBot;
|
||||
import org.leavesmc.leaves.bot.agent.configs.AlwaysSendDataConfig;
|
||||
import org.leavesmc.leaves.bot.agent.configs.LocatorBarConfig;
|
||||
import org.leavesmc.leaves.bot.agent.configs.SimulationDistanceConfig;
|
||||
import org.leavesmc.leaves.bot.agent.configs.SkipSleepConfig;
|
||||
import org.leavesmc.leaves.bot.agent.configs.SpawnPhantomConfig;
|
||||
import org.leavesmc.leaves.bot.agent.configs.TickTypeConfig;
|
||||
import org.leavesmc.leaves.bot.agent.configs.*;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
|
||||
+2
-2
@@ -60,8 +60,8 @@ public class ServerBreakBlockAction extends ServerTimerBotAction<ServerBreakBloc
|
||||
if (!iblockdata.isAir()) {
|
||||
bot.swing(InteractionHand.MAIN_HAND);
|
||||
EnchantmentHelper.onHitBlock(
|
||||
bot.level(), bot.getMainHandItem(), bot, bot, EquipmentSlot.MAINHAND, Vec3.atCenterOf(pos), iblockdata,
|
||||
item -> bot.onEquippedItemBroken(item, EquipmentSlot.MAINHAND)
|
||||
bot.level(), bot.getMainHandItem(), bot, bot, EquipmentSlot.MAINHAND, Vec3.atCenterOf(pos), iblockdata,
|
||||
item -> bot.onEquippedItemBroken(item, EquipmentSlot.MAINHAND)
|
||||
);
|
||||
iblockdata.attack(bot.level(), pos, bot);
|
||||
float f = iblockdata.getDestroyProgress(bot, bot.level(), pos);
|
||||
|
||||
+5
-5
@@ -46,8 +46,8 @@ public class ServerLookAction extends ServerBotAction<ServerLookAction> {
|
||||
public ServerLookAction() {
|
||||
super("look", CommandArgument.of(CommandArgumentType.STRING, CommandArgumentType.DOUBLE, CommandArgumentType.DOUBLE), ServerLookAction::new);
|
||||
this.setSuggestion(0, (sender, arg) -> sender instanceof Player player ?
|
||||
Pair.of(Stream.concat(Arrays.stream(MinecraftServer.getServer().getPlayerNames()), Stream.of(DF.format(player.getX()))).toList(), "<Player>|<X>") :
|
||||
Pair.of(Stream.concat(Arrays.stream(MinecraftServer.getServer().getPlayerNames()), Stream.of("0")).toList(), "<Player>|<X>")
|
||||
Pair.of(Stream.concat(Arrays.stream(MinecraftServer.getServer().getPlayerNames()), Stream.of(DF.format(player.getX()))).toList(), "<Player>|<X>") :
|
||||
Pair.of(Stream.concat(Arrays.stream(MinecraftServer.getServer().getPlayerNames()), Stream.of("0")).toList(), "<Player>|<X>")
|
||||
);
|
||||
this.setSuggestion(1, (sender, arg) -> sender instanceof Player player ? Pair.of(List.of(DF.format(player.getY())), "<Y>") : Pair.of(List.of("0"), "<Y>"));
|
||||
this.setSuggestion(2, (sender, arg) -> sender instanceof Player player ? Pair.of(List.of(DF.format(player.getZ())), "<Z>") : Pair.of(List.of("0"), "<Z>"));
|
||||
@@ -72,9 +72,9 @@ public class ServerLookAction extends ServerBotAction<ServerLookAction> {
|
||||
public void load(@NotNull CompoundTag nbt) {
|
||||
super.load(nbt);
|
||||
this.setPos(new Vector(
|
||||
nbt.getDouble("x").orElse(0.0),
|
||||
nbt.getDouble("y").orElse(0.0),
|
||||
nbt.getDouble("z").orElse(0.0)
|
||||
nbt.getDouble("x").orElse(0.0),
|
||||
nbt.getDouble("y").orElse(0.0),
|
||||
nbt.getDouble("z").orElse(0.0)
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
+6
-6
@@ -39,11 +39,11 @@ public class ServerMountAction extends ServerBotAction<ServerMountAction> {
|
||||
public boolean doTick(@NotNull ServerBot bot) {
|
||||
Location center = bot.getBukkitEntity().getLocation();
|
||||
List<Vehicle> vehicles = center.getNearbyEntitiesByType(
|
||||
Vehicle.class,
|
||||
3,
|
||||
vehicle -> manhattanDistance(bot, ((CraftEntity) vehicle).getHandle()) <= 2
|
||||
Vehicle.class,
|
||||
3,
|
||||
vehicle -> manhattanDistance(bot, ((CraftEntity) vehicle).getHandle()) <= 2
|
||||
).stream().sorted(Comparator.comparingDouble(
|
||||
(vehicle) -> center.distanceSquared(vehicle.getLocation())
|
||||
(vehicle) -> center.distanceSquared(vehicle.getLocation())
|
||||
)).toList();
|
||||
|
||||
for (Vehicle vehicle : vehicles) {
|
||||
@@ -62,7 +62,7 @@ public class ServerMountAction extends ServerBotAction<ServerMountAction> {
|
||||
|
||||
private double manhattanDistance(@NotNull Entity entity1, @NotNull Entity entity2) {
|
||||
return Math.abs(entity1.getX() - entity2.getX()) +
|
||||
Math.abs(entity1.getY() - entity2.getY()) +
|
||||
Math.abs(entity1.getZ() - entity2.getZ());
|
||||
Math.abs(entity1.getY() - entity2.getY()) +
|
||||
Math.abs(entity1.getZ() - entity2.getZ());
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -34,8 +34,8 @@ import java.util.List;
|
||||
public class ServerMoveAction extends ServerStateBotAction<ServerMoveAction> {
|
||||
|
||||
private static final Pair<List<String>, String> suggestions = Pair.of(
|
||||
Arrays.stream(MoveDirection.values()).map((it) -> it.name).toList(),
|
||||
"<Direction>"
|
||||
Arrays.stream(MoveDirection.values()).map((it) -> it.name).toList(),
|
||||
"<Direction>"
|
||||
);
|
||||
private MoveDirection direction = MoveDirection.FORWARD;
|
||||
|
||||
|
||||
+1
-1
@@ -124,7 +124,7 @@ public abstract class ServerUseBotAction<T extends ServerUseBotAction<T>> extend
|
||||
super.load(nbt);
|
||||
this.useTickTimeout = nbt.getInt("useTick").orElseThrow();
|
||||
this.alreadyUsedTick = nbt.getInt("alreadyUsedTick").orElseGet(
|
||||
() -> this.useTickTimeout - nbt.getInt("tickToRelease").orElseThrow()
|
||||
() -> this.useTickTimeout - nbt.getInt("tickToRelease").orElseThrow()
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
+3
-2
@@ -17,10 +17,11 @@
|
||||
|
||||
package org.leavesmc.leaves.bot.agent.configs;
|
||||
|
||||
import fun.bm.lophine.config.modules.experiment.CommandConfig;
|
||||
import fun.bm.lophine.config.modules.function.FakeplayerConfig;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.server.waypoints.ServerWaypointManager;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import fun.bm.lophine.config.modules.function.FakeplayerConfig;
|
||||
import org.leavesmc.leaves.bot.agent.AbstractBotConfig;
|
||||
import org.leavesmc.leaves.command.CommandArgument;
|
||||
import org.leavesmc.leaves.command.CommandArgumentType;
|
||||
@@ -35,7 +36,7 @@ public class LocatorBarConfig extends AbstractBotConfig<Boolean> {
|
||||
|
||||
public LocatorBarConfig() {
|
||||
super(NAME, CommandArgument.of(CommandArgumentType.BOOLEAN).setSuggestion(0, List.of("true", "false")));
|
||||
this.value = FakeplayerConfig.enableLocatorBar;
|
||||
this.value = FakeplayerConfig.enableLocatorBar && CommandConfig.waypoint;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+2
-2
@@ -50,8 +50,8 @@ public class SpawnPhantomConfig extends AbstractBotConfig<Boolean> {
|
||||
@Override
|
||||
public List<String> getMessage() {
|
||||
return List.of(
|
||||
bot.getScoreboardName() + "'s spawn_phantom: " + this.getValue(),
|
||||
bot.getScoreboardName() + "'s not_sleeping_ticks: " + bot.notSleepTicks
|
||||
bot.getScoreboardName() + "'s spawn_phantom: " + this.getValue(),
|
||||
bot.getScoreboardName() + "'s not_sleeping_ticks: " + bot.notSleepTicks
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -59,7 +59,8 @@ public class CraftBot extends CraftPlayer implements Bot {
|
||||
public <T extends BotAction<T>> void addAction(@NotNull T action) {
|
||||
switch (action) {
|
||||
case CraftBotAction act -> this.getHandle().addBotAction(act.getHandle(), null);
|
||||
default -> throw new IllegalArgumentException("Action " + action.getClass().getName() + " is not a valid BotAction type!");
|
||||
default ->
|
||||
throw new IllegalArgumentException("Action " + action.getClass().getName() + " is not a valid BotAction type!");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,3 @@
|
||||
package org.leavesmc.leaves.entity.bot;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
/*
|
||||
* This file is part of Leaves (https://github.com/LeavesMC/Leaves)
|
||||
*
|
||||
@@ -19,6 +15,10 @@ import net.minecraft.server.MinecraftServer;
|
||||
* along with Leaves. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package org.leavesmc.leaves.entity.bot;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import org.bukkit.Location;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
+17
-26
@@ -29,6 +29,7 @@ import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.util.RandomSource;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.entity.LivingEntity;
|
||||
import net.minecraft.world.level.block.entity.BlockEntity;
|
||||
import org.leavesmc.leaves.protocol.core.LeavesCustomPayload;
|
||||
import org.leavesmc.leaves.protocol.core.LeavesProtocol;
|
||||
@@ -101,37 +102,27 @@ public class ServuxEntityDataProtocol implements LeavesProtocol {
|
||||
}
|
||||
|
||||
public static void onBlockEntityRequest(ServerPlayer player, BlockPos pos) {
|
||||
io.papermc.paper.threadedregions.RegionizedServer.getInstance().taskQueue.queueTickTaskQueue(
|
||||
player.level(),
|
||||
ca.spottedleaf.moonrise.common.util.CoordinateUtils.getChunkX(player.position()),
|
||||
ca.spottedleaf.moonrise.common.util.CoordinateUtils.getChunkZ(player.position()),
|
||||
() -> {
|
||||
BlockEntity be = player.level().getBlockEntity(pos);
|
||||
CompoundTag nbt = be != null ? be.saveWithFullMetadata(player.registryAccess()) : new CompoundTag();
|
||||
player.getBukkitEntity().taskScheduler.schedule((LivingEntity nmsEntity) -> {
|
||||
BlockEntity be = nmsEntity.level().getBlockEntity(pos);
|
||||
CompoundTag nbt = be != null ? be.saveWithFullMetadata(nmsEntity.registryAccess()) : new CompoundTag();
|
||||
|
||||
EntityDataPayload payload = new EntityDataPayload(EntityDataPayloadType.PACKET_S2C_BLOCK_NBT_RESPONSE_SIMPLE);
|
||||
payload.pos = pos.immutable();
|
||||
payload.nbt.merge(nbt);
|
||||
sendPacket(player, payload);
|
||||
}
|
||||
);
|
||||
EntityDataPayload payload = new EntityDataPayload(EntityDataPayloadType.PACKET_S2C_BLOCK_NBT_RESPONSE_SIMPLE);
|
||||
payload.pos = pos.immutable();
|
||||
payload.nbt.merge(nbt);
|
||||
sendPacket((ServerPlayer) nmsEntity, payload);
|
||||
}, null, 1L);
|
||||
}
|
||||
|
||||
public static void onEntityRequest(ServerPlayer player, int entityId) {
|
||||
io.papermc.paper.threadedregions.RegionizedServer.getInstance().taskQueue.queueTickTaskQueue(
|
||||
player.level(),
|
||||
ca.spottedleaf.moonrise.common.util.CoordinateUtils.getChunkX(player.position()),
|
||||
ca.spottedleaf.moonrise.common.util.CoordinateUtils.getChunkZ(player.position()),
|
||||
() -> {
|
||||
Entity entity = player.level().getEntity(entityId);
|
||||
CompoundTag nbt = TagUtil.saveEntityWithoutId(entity);
|
||||
player.getBukkitEntity().taskScheduler.schedule((LivingEntity nmsEntity) -> {
|
||||
Entity entity = nmsEntity.level().getEntity(entityId);
|
||||
CompoundTag nbt = TagUtil.saveEntityWithoutId(entity);
|
||||
|
||||
EntityDataPayload payload = new EntityDataPayload(EntityDataPayloadType.PACKET_S2C_ENTITY_NBT_RESPONSE_SIMPLE);
|
||||
payload.entityId = entityId;
|
||||
payload.nbt.merge(nbt);
|
||||
sendPacket(player, payload);
|
||||
}
|
||||
);
|
||||
EntityDataPayload payload = new EntityDataPayload(EntityDataPayloadType.PACKET_S2C_ENTITY_NBT_RESPONSE_SIMPLE);
|
||||
payload.entityId = entityId;
|
||||
payload.nbt.merge(nbt);
|
||||
sendPacket((ServerPlayer) nmsEntity, payload);
|
||||
}, null, 1L);
|
||||
}
|
||||
|
||||
public static void sendPacket(ServerPlayer player, EntityDataPayload payload) {
|
||||
|
||||
+34
-42
@@ -29,6 +29,7 @@ import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.server.ServerTickRateManager;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.util.StringRepresentable;
|
||||
import net.minecraft.world.entity.LivingEntity;
|
||||
import net.minecraft.world.entity.MobCategory;
|
||||
import net.minecraft.world.level.NaturalSpawner;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -114,28 +115,23 @@ public abstract class DataLogger<T extends Tag> {
|
||||
}
|
||||
|
||||
private TickData build(MinecraftServer server, ServuxHudDataProtocol protocol, ServerPlayer player) {
|
||||
io.papermc.paper.threadedregions.RegionizedServer.getInstance().taskQueue.queueTickTaskQueue(
|
||||
player.level(),
|
||||
ca.spottedleaf.moonrise.common.util.CoordinateUtils.getChunkX(player.position()),
|
||||
ca.spottedleaf.moonrise.common.util.CoordinateUtils.getChunkZ(player.position()),
|
||||
() -> {
|
||||
ServerTickRateManager tickManager = server.tickRateManager();
|
||||
boolean frozen = tickManager.isFrozen();
|
||||
boolean sprinting = tickManager.isSprinting();
|
||||
io.papermc.paper.threadedregions.TickData.TickReportData tickData = TickRegionScheduler.getCurrentRegion().getData().getRegionSchedulingHandle().getTickReport5s(System.nanoTime());
|
||||
final double tps = tickData.tpsData().segmentAll().average();
|
||||
final double mspt = tickData.timePerTickData().segmentAll().average() / 1.0E6;
|
||||
player.getBukkitEntity().taskScheduler.schedule((LivingEntity nmsEntity) -> {
|
||||
ServerTickRateManager tickManager = server.tickRateManager();
|
||||
boolean frozen = tickManager.isFrozen();
|
||||
boolean sprinting = tickManager.isSprinting();
|
||||
io.papermc.paper.threadedregions.TickData.TickReportData tickData = TickRegionScheduler.getCurrentRegion().getData().getRegionSchedulingHandle().getTickReport5s(System.nanoTime());
|
||||
final double tps = tickData.tpsData().segmentAll().average();
|
||||
final double mspt = tickData.timePerTickData().segmentAll().average() / 1.0E6;
|
||||
|
||||
TickData tk = new TickData(
|
||||
mspt, tps,
|
||||
tickManager.getRemainingSprintTicks(),
|
||||
frozen, sprinting,
|
||||
tickManager.isSteppingForward()
|
||||
);
|
||||
Tag ret = TickData.CODEC.encodeStart(server.registryAccess().createSerializationContext(NbtOps.INSTANCE), tk).getOrThrow();
|
||||
protocol.applyData(Type.TPS, player, ret);
|
||||
}
|
||||
);
|
||||
TickData tk = new TickData(
|
||||
mspt, tps,
|
||||
tickManager.getRemainingSprintTicks(),
|
||||
frozen, sprinting,
|
||||
tickManager.isSteppingForward()
|
||||
);
|
||||
Tag ret = TickData.CODEC.encodeStart(server.registryAccess().createSerializationContext(NbtOps.INSTANCE), tk).getOrThrow();
|
||||
protocol.applyData(Type.TPS, (ServerPlayer) nmsEntity, ret);
|
||||
}, null, 1L);
|
||||
|
||||
return null;
|
||||
}
|
||||
@@ -152,30 +148,26 @@ public abstract class DataLogger<T extends Tag> {
|
||||
@Override
|
||||
public CompoundTag getResult(MinecraftServer server, ServuxHudDataProtocol protocol, ServerPlayer player) {
|
||||
CompoundTag nbt = new CompoundTag();
|
||||
io.papermc.paper.threadedregions.RegionizedServer.getInstance().taskQueue.queueTickTaskQueue(
|
||||
player.level(),
|
||||
ca.spottedleaf.moonrise.common.util.CoordinateUtils.getChunkX(player.position()),
|
||||
ca.spottedleaf.moonrise.common.util.CoordinateUtils.getChunkZ(player.position()),
|
||||
() -> {
|
||||
final RegionizedWorldData data = player.level().getCurrentWorldData();
|
||||
if (data == null) return;
|
||||
player.getBukkitEntity().taskScheduler.schedule((LivingEntity nmsEntity) -> {
|
||||
final RegionizedWorldData data = nmsEntity.level().getCurrentWorldData();
|
||||
if (data == null) return;
|
||||
|
||||
final NaturalSpawner.SpawnState info = data.lastSpawnState;
|
||||
if (info == null) return;
|
||||
final NaturalSpawner.SpawnState info = data.lastSpawnState;
|
||||
if (info == null) return;
|
||||
|
||||
int chunks = info.getSpawnableChunkCount();
|
||||
Object2IntMap<MobCategory> counts = info.getMobCategoryCounts();
|
||||
MobCapData mobCapData = new MobCapData(new ArrayList<>(), player.level().getGameTime());
|
||||
for (MobCategory category : MobCategory.values()) {
|
||||
mobCapData.data().add(new MobCapData.Cap(counts.getOrDefault(category, 0), NaturalSpawner.globalLimitForCategory(player.level(), category, chunks)));
|
||||
}
|
||||
int chunks = info.getSpawnableChunkCount();
|
||||
Object2IntMap<MobCategory> counts = info.getMobCategoryCounts();
|
||||
MobCapData mobCapData = new MobCapData(new ArrayList<>(), nmsEntity.level().getGameTime());
|
||||
for (MobCategory category : MobCategory.values()) {
|
||||
mobCapData.data().add(new MobCapData.Cap(counts.getOrDefault(category, 0), NaturalSpawner.globalLimitForCategory(player.level(), category, chunks)));
|
||||
}
|
||||
|
||||
try {
|
||||
nbt.put(player.level().dimension().location().toString(), MobCapData.CODEC.encodeStart(player.level().registryAccess().createSerializationContext(NbtOps.INSTANCE), mobCapData).getPartialOrThrow());
|
||||
protocol.applyData(Type.MOB_CAPS, player, nbt);
|
||||
} catch (Exception ignored) {
|
||||
}
|
||||
});
|
||||
try {
|
||||
nbt.put(nmsEntity.level().dimension().location().toString(), MobCapData.CODEC.encodeStart(player.level().registryAccess().createSerializationContext(NbtOps.INSTANCE), mobCapData).getPartialOrThrow());
|
||||
protocol.applyData(Type.MOB_CAPS, (ServerPlayer) nmsEntity, nbt);
|
||||
} catch (Exception ignored) {
|
||||
}
|
||||
}, null, 1L);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user