Skip to content

Commit

Permalink
Handle unknown entity types correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
FlorianMichael committed Dec 16, 2024
1 parent 657dcaa commit bc7b33f
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 5 deletions.
4 changes: 2 additions & 2 deletions build-logic/src/main/groovy/vr.base-conventions.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ base {
}

dependencies {
compileOnly "com.viaversion:viaversion:5.0.4-SNAPSHOT"
compileOnly "com.viaversion:viabackwards:5.0.4-SNAPSHOT"
compileOnly "com.viaversion:viaversion:5.2.1-SNAPSHOT"
compileOnly "com.viaversion:viabackwards:5.2.1-SNAPSHOT"
}

publishing {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,9 @@ public void register() {
handler(wrapper -> {
final int entityId = wrapper.get(Types.VAR_INT, 0);
final EntityTypes1_8.EntityType type = EntityTypes1_8.getTypeFromId(wrapper.get(Types.BYTE, 0), true);
if (type == null) {
return;
}

int x = wrapper.get(Types.INT, 0);
int y = wrapper.get(Types.INT, 1);
Expand Down Expand Up @@ -184,7 +187,7 @@ public void register() {
hologram.setPosition(x / 32.0, y / 32.0, z / 32.0);
hologram.setRotation(yaw * 360f / 256, pitch * 360f / 256);
hologram.setHeadYaw(yaw * 360f / 256);
} else if (type != null && type.isOrHasParent(EntityTypes1_8.EntityType.FALLING_BLOCK)) {
} else if (type.isOrHasParent(EntityTypes1_8.EntityType.FALLING_BLOCK)) {
int blockId = data & 0xFFF;
int blockData = data >> 12 & 0xF;
final IdAndData replace = protocol.getItemRewriter().handleBlock(blockId, blockData);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ public void register() {
final EntityTypes1_9.EntityType type = EntityTypes1_9.getTypeFromId(entityType, true);

// Cancel new entities which can't be handled properly
if (type == EntityTypes1_9.EntityType.AREA_EFFECT_CLOUD || type == EntityTypes1_9.EntityType.SPECTRAL_ARROW || type == EntityTypes1_9.EntityType.DRAGON_FIREBALL) {
if (type == null || type == EntityTypes1_9.EntityType.AREA_EFFECT_CLOUD || type == EntityTypes1_9.EntityType.SPECTRAL_ARROW || type == EntityTypes1_9.EntityType.DRAGON_FIREBALL) {
wrapper.cancel();
return;
}
Expand Down
2 changes: 1 addition & 1 deletion fabric/src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
},
"depends": {
"viafabric": ">=0.4.14",
"viabackwards": ">=5.0.4"
"viabackwards": ">=5.2.1-SNAPSHOT"
},
"custom": {
"modmenu:api": true,
Expand Down

0 comments on commit bc7b33f

Please sign in to comment.