9
0
mirror of https://github.com/Xiao-MoMi/craft-engine.git synced 2026-01-06 15:52:03 +00:00

Merge branch 'Xiao-MoMi:dev' into dev

This commit is contained in:
jhqwqmc
2025-06-22 03:57:01 +08:00
committed by GitHub
4 changed files with 28 additions and 16 deletions

View File

@@ -128,16 +128,18 @@ public class PacketConsumers {
ADD_ENTITY_HANDLERS[MEntityTypes.ITEM$registryId] = simpleAddEntityHandler(CommonItemPacketHandler.INSTANCE);
ADD_ENTITY_HANDLERS[MEntityTypes.ITEM_FRAME$registryId] = simpleAddEntityHandler(CommonItemPacketHandler.INSTANCE);
ADD_ENTITY_HANDLERS[MEntityTypes.GLOW_ITEM_FRAME$registryId] = simpleAddEntityHandler(CommonItemPacketHandler.INSTANCE);
ADD_ENTITY_HANDLERS[MEntityTypes.FIREBALL$registryId] = createOptionalCustomProjectileEntityHandler();
ADD_ENTITY_HANDLERS[MEntityTypes.EYE_OF_ENDER$registryId] = createOptionalCustomProjectileEntityHandler();
ADD_ENTITY_HANDLERS[MEntityTypes.FIREWORK_ROCKET$registryId] = createOptionalCustomProjectileEntityHandler();
ADD_ENTITY_HANDLERS[MEntityTypes.SMALL_FIREBALL$registryId] = createOptionalCustomProjectileEntityHandler();
ADD_ENTITY_HANDLERS[MEntityTypes.EGG$registryId] = createOptionalCustomProjectileEntityHandler();
ADD_ENTITY_HANDLERS[MEntityTypes.ENDER_PEARL$registryId] = createOptionalCustomProjectileEntityHandler();
ADD_ENTITY_HANDLERS[MEntityTypes.EXPERIENCE_BOTTLE$registryId] = createOptionalCustomProjectileEntityHandler();
ADD_ENTITY_HANDLERS[MEntityTypes.SNOWBALL$registryId] = createOptionalCustomProjectileEntityHandler();
ADD_ENTITY_HANDLERS[MEntityTypes.POTION$registryId] = createOptionalCustomProjectileEntityHandler();
ADD_ENTITY_HANDLERS[MEntityTypes.TRIDENT$registryId] = createOptionalCustomProjectileEntityHandler();
ADD_ENTITY_HANDLERS[MEntityTypes.FIREBALL$registryId] = createOptionalCustomProjectileEntityHandler(true);
ADD_ENTITY_HANDLERS[MEntityTypes.EYE_OF_ENDER$registryId] = createOptionalCustomProjectileEntityHandler(true);
ADD_ENTITY_HANDLERS[MEntityTypes.FIREWORK_ROCKET$registryId] = createOptionalCustomProjectileEntityHandler(true);
ADD_ENTITY_HANDLERS[MEntityTypes.SMALL_FIREBALL$registryId] = createOptionalCustomProjectileEntityHandler(true);
ADD_ENTITY_HANDLERS[MEntityTypes.EGG$registryId] = createOptionalCustomProjectileEntityHandler(true);
ADD_ENTITY_HANDLERS[MEntityTypes.ENDER_PEARL$registryId] = createOptionalCustomProjectileEntityHandler(true);
ADD_ENTITY_HANDLERS[MEntityTypes.EXPERIENCE_BOTTLE$registryId] = createOptionalCustomProjectileEntityHandler(true);
ADD_ENTITY_HANDLERS[MEntityTypes.SNOWBALL$registryId] = createOptionalCustomProjectileEntityHandler(true);
ADD_ENTITY_HANDLERS[MEntityTypes.POTION$registryId] = createOptionalCustomProjectileEntityHandler(true);
ADD_ENTITY_HANDLERS[MEntityTypes.TRIDENT$registryId] = createOptionalCustomProjectileEntityHandler(false);
ADD_ENTITY_HANDLERS[MEntityTypes.ARROW$registryId] = createOptionalCustomProjectileEntityHandler(false);
ADD_ENTITY_HANDLERS[MEntityTypes.SPECTRAL_ARROW$registryId] = createOptionalCustomProjectileEntityHandler(false);
if (VersionHelper.isOrAbove1_20_5()) {
ADD_ENTITY_HANDLERS[MEntityTypes.OMINOUS_ITEM_SPAWNER$registryId] = simpleAddEntityHandler(CommonItemPacketHandler.INSTANCE);
}
@@ -187,7 +189,7 @@ public class PacketConsumers {
};
}
private static BukkitNetworkManager.Handlers createOptionalCustomProjectileEntityHandler() {
private static BukkitNetworkManager.Handlers createOptionalCustomProjectileEntityHandler(boolean fallback) {
return (user, event) -> {
FriendlyByteBuf buf = event.getBuffer();
int id = buf.readVarInt();
@@ -196,7 +198,9 @@ public class PacketConsumers {
handler.convertAddCustomProjectilePacket(buf, event);
user.entityPacketHandlers().put(id, handler);
}, () -> {
user.entityPacketHandlers().put(id, CommonItemPacketHandler.INSTANCE);
if (fallback) {
user.entityPacketHandlers().put(id, CommonItemPacketHandler.INSTANCE);
}
});
};
}

View File

@@ -25,6 +25,10 @@ public final class MEntityTypes {
public static final int OAK_BOAT$registryId;
public static final Object TRIDENT;
public static final int TRIDENT$registryId;
public static final Object ARROW;
public static final int ARROW$registryId;
public static final Object SPECTRAL_ARROW;
public static final int SPECTRAL_ARROW$registryId;
public static final Object SNOWBALL;
public static final int SNOWBALL$registryId;
public static final Object FIREBALL;
@@ -116,6 +120,10 @@ public final class MEntityTypes {
HAPPY_GHAST$registryId = getRegistryId(HAPPY_GHAST);
PLAYER = getById("player");
PLAYER$registryId = getRegistryId(PLAYER);
ARROW = getById("arrow");
ARROW$registryId = getRegistryId(ARROW);
SPECTRAL_ARROW = getById("spectral_arrow");
SPECTRAL_ARROW$registryId = getRegistryId(SPECTRAL_ARROW);
} catch (ReflectiveOperationException e) {
throw new ReflectionInitException("Failed to init EntityTypes", e);
}

View File

@@ -69,7 +69,7 @@ resource-pack:
- CustomNameplates/resourcepack.zip
exclude-file-extensions: ["md", "psd", "bbmodel", "db", "ini"]
# Exclude the shaders when generating the resource pack
exclude-shaders: false
exclude-core-shaders: false
delivery:
# Send the resource pack on joining the server
send-on-join: true

View File

@@ -60,7 +60,7 @@ public class Config {
protected boolean resource_pack$protection$crash_tools$method_3;
protected boolean resource_pack$validate$enable;
protected boolean resource_pack$exclude_shaders;
protected boolean resource_pack$exclude_core_shaders;
protected boolean resource_pack$protection$obfuscation$enable;
protected long resource_pack$protection$obfuscation$seed;
@@ -263,7 +263,7 @@ public class Config {
resource_pack$protection$obfuscation$resource_location$bypass_sounds = config.getStringList("resource-pack.protection.obfuscation.resource-location.bypass-sounds");
resource_pack$protection$obfuscation$resource_location$bypass_equipments = config.getStringList("resource-pack.protection.obfuscation.resource-location.bypass-equipments");
resource_pack$validate$enable = config.getBoolean("resource-pack.validate.enable", true);
resource_pack$exclude_shaders = config.getBoolean("resource-pack.exclude-shaders", false);
resource_pack$exclude_core_shaders = config.getBoolean("resource-pack.exclude-core-shaders", false);
try {
resource_pack$duplicated_files_handler = config.getMapList("resource-pack.duplicated-files-handler").stream().map(it -> {
@@ -739,7 +739,7 @@ public class Config {
}
public static boolean excludeShaders() {
return instance.resource_pack$exclude_shaders;
return instance.resource_pack$exclude_core_shaders;
}
public YamlDocument loadOrCreateYamlData(String fileName) {