9
0
mirror of https://github.com/Xiao-MoMi/craft-engine.git synced 2025-12-26 10:29:20 +00:00

Merge branch 'Xiao-MoMi:dev' into dev

This commit is contained in:
jhqwqmc
2025-04-12 00:28:39 +08:00
committed by GitHub
6 changed files with 27 additions and 5 deletions

View File

@@ -153,18 +153,20 @@ image:
command: true
sign: true
# By intercepting packets, you are allowed to use <image:...> <shift:...> in other plugins
# Turning off some unused options would help reduce CPU usage on async threads
intercept-packets:
system-chat: true
tab-list: true
tab-list: true # Tab list header and footer
player-info: true # User list in tab
actionbar: true
title: true
bossbar: true
container: true
team: true
container: true # GUI
team: true # Team prefix, suffix and display name
scoreboard: true
entity-name: false
armor-stand: true
text-display: true
armor-stand: true # Legacy Holograms
text-display: true # Modern Holograms
emoji: {}

View File

@@ -37,4 +37,6 @@ public interface PacketIds {
int clientboundSetObjectivePacket();
int clientboundLevelChunkWithLightPacket();
int clientboundPlayerInfoUpdatePacket();
}

View File

@@ -94,4 +94,9 @@ public class PacketIds1_20 implements PacketIds {
public int clientboundLevelChunkWithLightPacket() {
return PacketIdFinder.clientboundByClazz(Reflections.clazz$ClientboundLevelChunkWithLightPacket);
}
@Override
public int clientboundPlayerInfoUpdatePacket() {
return PacketIdFinder.clientboundByClazz(Reflections.clazz$ClientboundPlayerInfoUpdatePacket);
}
}

View File

@@ -93,4 +93,9 @@ public class PacketIds1_20_5 implements PacketIds {
public int clientboundLevelChunkWithLightPacket() {
return PacketIdFinder.clientboundByName("minecraft:level_chunk_with_light");
}
@Override
public int clientboundPlayerInfoUpdatePacket() {
return PacketIdFinder.clientboundByName("minecraft:player_info_update");
}
}

View File

@@ -1745,6 +1745,12 @@ public class Reflections {
)
);
public static final Class<?> clazz$ClientboundPlayerInfoUpdatePacket = requireNonNull(
ReflectionUtils.getClazz(
BukkitReflectionUtils.assembleMCClass("network.protocol.game.ClientboundPlayerInfoUpdatePacket")
)
);
public static final Field field$ClientboundLevelChunkWithLightPacket$chunkData = requireNonNull(
ReflectionUtils.getDeclaredField(
clazz$ClientboundLevelChunkWithLightPacket, clazz$ClientboundLevelChunkPacketData, 0

View File

@@ -134,6 +134,7 @@ public class Config {
protected boolean image$intercept_packets$entity_name;
protected boolean image$intercept_packets$text_display;
protected boolean image$intercept_packets$armor_stand;
protected boolean image$intercept_packets$player_info;
public Config(CraftEngine plugin) {
this.plugin = plugin;
@@ -302,6 +303,7 @@ public class Config {
image$intercept_packets$entity_name = config.getBoolean("image.intercept-packets.entity-name", false);
image$intercept_packets$text_display = config.getBoolean("image.intercept-packets.text-display", true);
image$intercept_packets$armor_stand = config.getBoolean("image.intercept-packets.armor-stand", true);
image$intercept_packets$player_info = config.getBoolean("image.intercept-packets.player-info", true);
Class<?> modClazz = ReflectionUtils.getClazz(CraftEngine.MOD_CLASS);
if (modClazz != null) {