diff --git a/bukkit/src/main/java/net/momirealms/craftengine/bukkit/plugin/network/PacketConsumers.java b/bukkit/src/main/java/net/momirealms/craftengine/bukkit/plugin/network/PacketConsumers.java index ea715b3b9..4fa8930ef 100644 --- a/bukkit/src/main/java/net/momirealms/craftengine/bukkit/plugin/network/PacketConsumers.java +++ b/bukkit/src/main/java/net/momirealms/craftengine/bukkit/plugin/network/PacketConsumers.java @@ -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); + } }); }; } diff --git a/bukkit/src/main/java/net/momirealms/craftengine/bukkit/plugin/reflection/minecraft/MEntityTypes.java b/bukkit/src/main/java/net/momirealms/craftengine/bukkit/plugin/reflection/minecraft/MEntityTypes.java index 4c9156c18..ee4129d3d 100644 --- a/bukkit/src/main/java/net/momirealms/craftengine/bukkit/plugin/reflection/minecraft/MEntityTypes.java +++ b/bukkit/src/main/java/net/momirealms/craftengine/bukkit/plugin/reflection/minecraft/MEntityTypes.java @@ -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); } diff --git a/common-files/src/main/resources/config.yml b/common-files/src/main/resources/config.yml index add038568..6ab72512a 100644 --- a/common-files/src/main/resources/config.yml +++ b/common-files/src/main/resources/config.yml @@ -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 diff --git a/core/src/main/java/net/momirealms/craftengine/core/plugin/config/Config.java b/core/src/main/java/net/momirealms/craftengine/core/plugin/config/Config.java index eb0e3bb77..36f245033 100644 --- a/core/src/main/java/net/momirealms/craftengine/core/plugin/config/Config.java +++ b/core/src/main/java/net/momirealms/craftengine/core/plugin/config/Config.java @@ -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) {