Skip to content

Commit bc7b33f

Browse files
Handle unknown entity types correctly
1 parent 657dcaa commit bc7b33f

File tree

4 files changed

+8
-5
lines changed

4 files changed

+8
-5
lines changed

build-logic/src/main/groovy/vr.base-conventions.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ base {
2222
}
2323

2424
dependencies {
25-
compileOnly "com.viaversion:viaversion:5.0.4-SNAPSHOT"
26-
compileOnly "com.viaversion:viabackwards:5.0.4-SNAPSHOT"
25+
compileOnly "com.viaversion:viaversion:5.2.1-SNAPSHOT"
26+
compileOnly "com.viaversion:viabackwards:5.2.1-SNAPSHOT"
2727
}
2828

2929
publishing {

common/src/main/java/com/viaversion/viarewind/protocol/v1_8to1_7_6_10/rewriter/EntityPacketRewriter1_8.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,9 @@ public void register() {
146146
handler(wrapper -> {
147147
final int entityId = wrapper.get(Types.VAR_INT, 0);
148148
final EntityTypes1_8.EntityType type = EntityTypes1_8.getTypeFromId(wrapper.get(Types.BYTE, 0), true);
149+
if (type == null) {
150+
return;
151+
}
149152

150153
int x = wrapper.get(Types.INT, 0);
151154
int y = wrapper.get(Types.INT, 1);
@@ -184,7 +187,7 @@ public void register() {
184187
hologram.setPosition(x / 32.0, y / 32.0, z / 32.0);
185188
hologram.setRotation(yaw * 360f / 256, pitch * 360f / 256);
186189
hologram.setHeadYaw(yaw * 360f / 256);
187-
} else if (type != null && type.isOrHasParent(EntityTypes1_8.EntityType.FALLING_BLOCK)) {
190+
} else if (type.isOrHasParent(EntityTypes1_8.EntityType.FALLING_BLOCK)) {
188191
int blockId = data & 0xFFF;
189192
int blockData = data >> 12 & 0xF;
190193
final IdAndData replace = protocol.getItemRewriter().handleBlock(blockId, blockData);

common/src/main/java/com/viaversion/viarewind/protocol/v1_9to1_8/rewriter/EntityPacketRewriter1_9.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ public void register() {
100100
final EntityTypes1_9.EntityType type = EntityTypes1_9.getTypeFromId(entityType, true);
101101

102102
// Cancel new entities which can't be handled properly
103-
if (type == EntityTypes1_9.EntityType.AREA_EFFECT_CLOUD || type == EntityTypes1_9.EntityType.SPECTRAL_ARROW || type == EntityTypes1_9.EntityType.DRAGON_FIREBALL) {
103+
if (type == null || type == EntityTypes1_9.EntityType.AREA_EFFECT_CLOUD || type == EntityTypes1_9.EntityType.SPECTRAL_ARROW || type == EntityTypes1_9.EntityType.DRAGON_FIREBALL) {
104104
wrapper.cancel();
105105
return;
106106
}

fabric/src/main/resources/fabric.mod.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
},
2525
"depends": {
2626
"viafabric": ">=0.4.14",
27-
"viabackwards": ">=5.0.4"
27+
"viabackwards": ">=5.2.1-SNAPSHOT"
2828
},
2929
"custom": {
3030
"modmenu:api": true,

0 commit comments

Comments
 (0)