Skip to content

Commit 7f97ae8

Browse files
committed
Cancel more new entity data types directly
Be more lenient with plugins sending data for entities that don't exist...
1 parent 4dd4b2f commit 7f97ae8

File tree

4 files changed

+6
-2
lines changed

4 files changed

+6
-2
lines changed

common/src/main/java/com/viaversion/viabackwards/protocol/v1_19_4to1_19_3/rewriter/EntityPacketRewriter1_19_4.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,7 @@ public void registerRewrites() {
220220
filter().handler((event, data) -> {
221221
int id = data.dataType().typeId();
222222
if (id >= 25) { // Sniffer state, Vector3f, Quaternion types
223+
event.cancel();
223224
return;
224225
} else if (id >= 15) { // Optional block state - just map down to block state
225226
id--;

common/src/main/java/com/viaversion/viabackwards/protocol/v1_20_2to1_20/rewriter/EntityPacketRewriter1_20_2.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ public void register() {
198198

199199
@Override
200200
protected void registerRewrites() {
201-
filter().handler((event, data) -> data.setDataType(Types1_20.ENTITY_DATA_TYPES.byId(data.dataType().typeId())));
201+
filter().mapDataType(Types1_20.ENTITY_DATA_TYPES::byId);
202202
registerEntityDataTypeHandler(Types1_20.ENTITY_DATA_TYPES.itemType, Types1_20.ENTITY_DATA_TYPES.blockStateType, Types1_20.ENTITY_DATA_TYPES.optionalBlockStateType, Types1_20.ENTITY_DATA_TYPES.particleType, null, null);
203203
registerBlockStateHandler(EntityTypes1_19_4.ABSTRACT_MINECART, 11);
204204

common/src/main/java/com/viaversion/viabackwards/protocol/v1_20_5to1_20_3/rewriter/EntityPacketRewriter1_20_5.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -419,6 +419,9 @@ protected void registerRewrites() {
419419
}
420420
data.setTypeAndValue(Types1_20_3.ENTITY_DATA_TYPES.varIntType, removeAlpha(color));
421421
return;
422+
} else if (typeId == Types1_20_5.ENTITY_DATA_TYPES.armadilloState.typeId() || typeId == Types1_20_5.ENTITY_DATA_TYPES.wolfVariantType.typeId()) {
423+
event.cancel();
424+
return;
422425
}
423426

424427
int id = typeId;

common/src/main/java/com/viaversion/viabackwards/protocol/v1_20to1_19_4/rewriter/EntityPacketRewriter1_20.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ public void register() {
122122

123123
@Override
124124
protected void registerRewrites() {
125-
filter().handler((event, data) -> data.setDataType(Types1_19_4.ENTITY_DATA_TYPES.byId(data.dataType().typeId())));
125+
filter().mapDataType(Types1_19_4.ENTITY_DATA_TYPES::byId);
126126
registerEntityDataTypeHandler(Types1_19_4.ENTITY_DATA_TYPES.itemType, Types1_19_4.ENTITY_DATA_TYPES.blockStateType, Types1_19_4.ENTITY_DATA_TYPES.optionalBlockStateType,
127127
Types1_19_4.ENTITY_DATA_TYPES.particleType, Types1_19_4.ENTITY_DATA_TYPES.componentType, Types1_19_4.ENTITY_DATA_TYPES.optionalComponentType);
128128
registerBlockStateHandler(EntityTypes1_19_4.ABSTRACT_MINECART, 11);

0 commit comments

Comments
 (0)