Fix item projectile hierarchy in 1.14+ (#4034)

This commit is contained in:
EnZaXD 2024-07-22 17:44:07 +02:00 committed by GitHub
parent 35fa7e78a0
commit b5a06181d4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
11 changed files with 61 additions and 55 deletions

View File

@ -51,11 +51,12 @@ public enum EntityTypes1_14 implements EntityType {
// Projectiles // Projectiles
PROJECTILE(ENTITY, null), // Not actually its own abstract type, but useful for categorizing PROJECTILE(ENTITY, null), // Not actually its own abstract type, but useful for categorizing
SNOWBALL(PROJECTILE), ITEM_PROJECTILE(PROJECTILE, null),
ENDER_PEARL(PROJECTILE), SNOWBALL(ITEM_PROJECTILE),
EGG(PROJECTILE), ENDER_PEARL(ITEM_PROJECTILE),
EGG(ITEM_PROJECTILE),
POTION(PROJECTILE), POTION(PROJECTILE),
EXPERIENCE_BOTTLE(PROJECTILE), EXPERIENCE_BOTTLE(ITEM_PROJECTILE),
FIREWORK_ROCKET(PROJECTILE), FIREWORK_ROCKET(PROJECTILE),
LLAMA_SPIT(PROJECTILE), LLAMA_SPIT(PROJECTILE),
SHULKER_BULLET(PROJECTILE), SHULKER_BULLET(PROJECTILE),

View File

@ -51,11 +51,12 @@ public enum EntityTypes1_15 implements EntityType {
// Projectiles // Projectiles
PROJECTILE(ENTITY, null), // Not actually its own abstract type, but useful for categorizing PROJECTILE(ENTITY, null), // Not actually its own abstract type, but useful for categorizing
SNOWBALL(PROJECTILE), ITEM_PROJECTILE(PROJECTILE, null),
ENDER_PEARL(PROJECTILE), SNOWBALL(ITEM_PROJECTILE),
EGG(PROJECTILE), ENDER_PEARL(ITEM_PROJECTILE),
EGG(ITEM_PROJECTILE),
POTION(PROJECTILE), POTION(PROJECTILE),
EXPERIENCE_BOTTLE(PROJECTILE), EXPERIENCE_BOTTLE(ITEM_PROJECTILE),
FIREWORK_ROCKET(PROJECTILE), FIREWORK_ROCKET(PROJECTILE),
LLAMA_SPIT(PROJECTILE), LLAMA_SPIT(PROJECTILE),
SHULKER_BULLET(PROJECTILE), SHULKER_BULLET(PROJECTILE),

View File

@ -51,11 +51,12 @@ public enum EntityTypes1_16 implements EntityType {
// Projectiles // Projectiles
PROJECTILE(ENTITY, null), // Not actually its own abstract type, but useful for categorizing PROJECTILE(ENTITY, null), // Not actually its own abstract type, but useful for categorizing
SNOWBALL(PROJECTILE), ITEM_PROJECTILE(PROJECTILE, null),
ENDER_PEARL(PROJECTILE), SNOWBALL(ITEM_PROJECTILE),
EGG(PROJECTILE), ENDER_PEARL(ITEM_PROJECTILE),
POTION(PROJECTILE), EGG(ITEM_PROJECTILE),
EXPERIENCE_BOTTLE(PROJECTILE), POTION(ITEM_PROJECTILE),
EXPERIENCE_BOTTLE(ITEM_PROJECTILE),
FIREWORK_ROCKET(PROJECTILE), FIREWORK_ROCKET(PROJECTILE),
LLAMA_SPIT(PROJECTILE), LLAMA_SPIT(PROJECTILE),
SHULKER_BULLET(PROJECTILE), SHULKER_BULLET(PROJECTILE),

View File

@ -51,11 +51,12 @@ public enum EntityTypes1_16_2 implements EntityType {
// Projectiles // Projectiles
PROJECTILE(ENTITY, null), // Not actually its own abstract type, but useful for categorizing PROJECTILE(ENTITY, null), // Not actually its own abstract type, but useful for categorizing
SNOWBALL(PROJECTILE), ITEM_PROJECTILE(PROJECTILE, null),
ENDER_PEARL(PROJECTILE), SNOWBALL(ITEM_PROJECTILE),
EGG(PROJECTILE), ENDER_PEARL(ITEM_PROJECTILE),
POTION(PROJECTILE), EGG(ITEM_PROJECTILE),
EXPERIENCE_BOTTLE(PROJECTILE), POTION(ITEM_PROJECTILE),
EXPERIENCE_BOTTLE(ITEM_PROJECTILE),
FIREWORK_ROCKET(PROJECTILE), FIREWORK_ROCKET(PROJECTILE),
LLAMA_SPIT(PROJECTILE), LLAMA_SPIT(PROJECTILE),
SHULKER_BULLET(PROJECTILE), SHULKER_BULLET(PROJECTILE),

View File

@ -53,11 +53,12 @@ public enum EntityTypes1_17 implements EntityType {
// Projectiles // Projectiles
PROJECTILE(ENTITY, null), // Not actually its own abstract type, but useful for categorizing PROJECTILE(ENTITY, null), // Not actually its own abstract type, but useful for categorizing
SNOWBALL(PROJECTILE), ITEM_PROJECTILE(PROJECTILE, null),
ENDER_PEARL(PROJECTILE), SNOWBALL(ITEM_PROJECTILE),
EGG(PROJECTILE), ENDER_PEARL(ITEM_PROJECTILE),
POTION(PROJECTILE), EGG(ITEM_PROJECTILE),
EXPERIENCE_BOTTLE(PROJECTILE), POTION(ITEM_PROJECTILE),
EXPERIENCE_BOTTLE(ITEM_PROJECTILE),
FIREWORK_ROCKET(PROJECTILE), FIREWORK_ROCKET(PROJECTILE),
LLAMA_SPIT(PROJECTILE), LLAMA_SPIT(PROJECTILE),
SHULKER_BULLET(PROJECTILE), SHULKER_BULLET(PROJECTILE),

View File

@ -53,11 +53,12 @@ public enum EntityTypes1_19 implements EntityType {
// Projectiles // Projectiles
PROJECTILE(ENTITY, null), // Not actually its own abstract type, but useful for categorizing PROJECTILE(ENTITY, null), // Not actually its own abstract type, but useful for categorizing
SNOWBALL(PROJECTILE), ITEM_PROJECTILE(PROJECTILE, null),
ENDER_PEARL(PROJECTILE), SNOWBALL(ITEM_PROJECTILE),
EGG(PROJECTILE), ENDER_PEARL(ITEM_PROJECTILE),
POTION(PROJECTILE), EGG(ITEM_PROJECTILE),
EXPERIENCE_BOTTLE(PROJECTILE), POTION(ITEM_PROJECTILE),
EXPERIENCE_BOTTLE(ITEM_PROJECTILE),
FIREWORK_ROCKET(PROJECTILE), FIREWORK_ROCKET(PROJECTILE),
LLAMA_SPIT(PROJECTILE), LLAMA_SPIT(PROJECTILE),
SHULKER_BULLET(PROJECTILE), SHULKER_BULLET(PROJECTILE),

View File

@ -53,11 +53,12 @@ public enum EntityTypes1_19_3 implements EntityType {
// Projectiles // Projectiles
PROJECTILE(ENTITY, null), // Not actually its own abstract type, but useful for categorizing PROJECTILE(ENTITY, null), // Not actually its own abstract type, but useful for categorizing
SNOWBALL(PROJECTILE), ITEM_PROJECTILE(PROJECTILE, null),
ENDER_PEARL(PROJECTILE), SNOWBALL(ITEM_PROJECTILE),
EGG(PROJECTILE), ENDER_PEARL(ITEM_PROJECTILE),
POTION(PROJECTILE), EGG(ITEM_PROJECTILE),
EXPERIENCE_BOTTLE(PROJECTILE), POTION(ITEM_PROJECTILE),
EXPERIENCE_BOTTLE(ITEM_PROJECTILE),
FIREWORK_ROCKET(PROJECTILE), FIREWORK_ROCKET(PROJECTILE),
LLAMA_SPIT(PROJECTILE), LLAMA_SPIT(PROJECTILE),
SHULKER_BULLET(PROJECTILE), SHULKER_BULLET(PROJECTILE),

View File

@ -59,11 +59,12 @@ public enum EntityTypes1_19_4 implements EntityType {
// Projectiles // Projectiles
PROJECTILE(ENTITY, null), // Not actually its own abstract type, but useful for categorizing PROJECTILE(ENTITY, null), // Not actually its own abstract type, but useful for categorizing
SNOWBALL(PROJECTILE), ITEM_PROJECTILE(PROJECTILE, null),
ENDER_PEARL(PROJECTILE), SNOWBALL(ITEM_PROJECTILE),
EGG(PROJECTILE), ENDER_PEARL(ITEM_PROJECTILE),
POTION(PROJECTILE), EGG(ITEM_PROJECTILE),
EXPERIENCE_BOTTLE(PROJECTILE), POTION(ITEM_PROJECTILE),
EXPERIENCE_BOTTLE(ITEM_PROJECTILE),
FIREWORK_ROCKET(PROJECTILE), FIREWORK_ROCKET(PROJECTILE),
LLAMA_SPIT(PROJECTILE), LLAMA_SPIT(PROJECTILE),
SHULKER_BULLET(PROJECTILE), SHULKER_BULLET(PROJECTILE),

View File

@ -59,11 +59,12 @@ public enum EntityTypes1_20_3 implements EntityType {
// Projectiles // Projectiles
PROJECTILE(ENTITY, null), // Not actually its own abstract type, but useful for categorizing PROJECTILE(ENTITY, null), // Not actually its own abstract type, but useful for categorizing
SNOWBALL(PROJECTILE), ITEM_PROJECTILE(PROJECTILE, null),
ENDER_PEARL(PROJECTILE), SNOWBALL(ITEM_PROJECTILE),
EGG(PROJECTILE), ENDER_PEARL(ITEM_PROJECTILE),
POTION(PROJECTILE), EGG(ITEM_PROJECTILE),
EXPERIENCE_BOTTLE(PROJECTILE), POTION(ITEM_PROJECTILE),
EXPERIENCE_BOTTLE(ITEM_PROJECTILE),
FIREWORK_ROCKET(PROJECTILE), FIREWORK_ROCKET(PROJECTILE),
LLAMA_SPIT(PROJECTILE), LLAMA_SPIT(PROJECTILE),
SHULKER_BULLET(PROJECTILE), SHULKER_BULLET(PROJECTILE),

View File

@ -59,12 +59,13 @@ public enum EntityTypes1_20_5 implements EntityType {
GLOW_ITEM_FRAME(ITEM_FRAME), GLOW_ITEM_FRAME(ITEM_FRAME),
// Projectiles // Projectiles
PROJECTILE(ENTITY, null), // Not actually its own abstract type, but useful for categorizing PROJECTILE(ENTITY, null),
SNOWBALL(PROJECTILE), ITEM_PROJECTILE(PROJECTILE, null),
ENDER_PEARL(PROJECTILE), SNOWBALL(ITEM_PROJECTILE),
EGG(PROJECTILE), ENDER_PEARL(ITEM_PROJECTILE),
POTION(PROJECTILE), EGG(ITEM_PROJECTILE),
EXPERIENCE_BOTTLE(PROJECTILE), POTION(ITEM_PROJECTILE),
EXPERIENCE_BOTTLE(ITEM_PROJECTILE),
FIREWORK_ROCKET(PROJECTILE), FIREWORK_ROCKET(PROJECTILE),
LLAMA_SPIT(PROJECTILE), LLAMA_SPIT(PROJECTILE),
SHULKER_BULLET(PROJECTILE), SHULKER_BULLET(PROJECTILE),

View File

@ -474,17 +474,13 @@ public final class EntityPacketRewriter1_20_5 extends EntityRewriter<Clientbound
} }
}); });
final EntityDataHandler emptyItemHandler = (event, data) -> { filter().type(EntityTypes1_20_5.ITEM_PROJECTILE).index(8).handler((event, data) -> {
final Item item = data.value(); final Item item = data.value();
if (item == null || item.isEmpty()) { if (item == null || item.isEmpty()) {
// The item is used for particles or projectile display and can no longer be empty // The item is used for particles or projectile display and can no longer be empty
event.cancel(); event.cancel();
} }
}; });
filter().type(EntityTypes1_20_5.EGG).index(8).handler(emptyItemHandler);
filter().type(EntityTypes1_20_5.SNOWBALL).index(8).handler(emptyItemHandler);
filter().type(EntityTypes1_20_5.ENDER_PEARL).index(8).handler(emptyItemHandler);
filter().type(EntityTypes1_20_5.EXPERIENCE_BOTTLE).index(8).handler(emptyItemHandler);
} }
private void addColor(@Nullable final EntityData particleMeta, final int color) { private void addColor(@Nullable final EntityData particleMeta, final int color) {