mirror of
https://github.com/ViaVersion/ViaBackwards.git
synced 2024-12-22 16:57:40 +01:00
Update entity types usage
This commit is contained in:
parent
e27d107ebc
commit
859a79d7da
@ -261,7 +261,7 @@ public class BlockItemPackets1_14 extends nl.matsv.viabackwards.api.rewriters.It
|
||||
EntityType entityType = wrapper.user().get(EntityTracker.class).get(getProtocol()).getEntityType(entityId);
|
||||
if (entityType == null) return;
|
||||
|
||||
if (entityType.isOrHasParent(Entity1_14Types.EntityType.ABSTRACT_HORSE)) {
|
||||
if (entityType.isOrHasParent(Entity1_14Types.ABSTRACT_HORSE)) {
|
||||
wrapper.setId(0x3F);
|
||||
wrapper.resetReader();
|
||||
wrapper.passthrough(Type.VAR_INT);
|
||||
|
@ -42,7 +42,7 @@ public class EntityPackets1_14 extends LegacyEntityRewriter<Protocol1_13_2To1_14
|
||||
super.addTrackedEntity(wrapper, entityId, type);
|
||||
|
||||
// Cache the position for every newly tracked entity
|
||||
if (type == Entity1_14Types.EntityType.PAINTING) {
|
||||
if (type == Entity1_14Types.PAINTING) {
|
||||
final Position position = wrapper.get(Type.POSITION, 0);
|
||||
positionHandler.cacheEntityPosition(wrapper, position.getX(), position.getY(), position.getZ(), true, false);
|
||||
} else if (wrapper.getId() != 0x25) { // ignore join game
|
||||
@ -65,7 +65,7 @@ public class EntityPackets1_14 extends LegacyEntityRewriter<Protocol1_13_2To1_14
|
||||
|
||||
EntityTracker.ProtocolEntityTracker tracker = getEntityTracker(wrapper.user());
|
||||
EntityType entityType = tracker.getEntityType(entityId);
|
||||
if (entityType != Entity1_14Types.EntityType.PLAYER) return;
|
||||
if (entityType != Entity1_14Types.PLAYER) return;
|
||||
|
||||
// Remove equipment, else the client will see ghost items
|
||||
for (int i = 0; i <= 5; i++) {
|
||||
@ -203,7 +203,7 @@ public class EntityPackets1_14 extends LegacyEntityRewriter<Protocol1_13_2To1_14
|
||||
@Override
|
||||
public void handle(PacketWrapper wrapper) throws Exception {
|
||||
int type = wrapper.get(Type.VAR_INT, 1);
|
||||
Entity1_14Types.EntityType entityType = Entity1_14Types.getTypeFromId(type);
|
||||
EntityType entityType = Entity1_14Types.getTypeFromId(type);
|
||||
addTrackedEntity(wrapper, wrapper.get(Type.VAR_INT, 0), entityType);
|
||||
|
||||
int oldId = typeMapping.get(type);
|
||||
@ -233,7 +233,7 @@ public class EntityPackets1_14 extends LegacyEntityRewriter<Protocol1_13_2To1_14
|
||||
map(Type.DOUBLE); // Needs to be mapped for the position cache
|
||||
map(Type.DOUBLE);
|
||||
map(Type.DOUBLE);
|
||||
handler(wrapper -> addTrackedEntity(wrapper, wrapper.get(Type.VAR_INT, 0), Entity1_14Types.EntityType.EXPERIENCE_ORB));
|
||||
handler(wrapper -> addTrackedEntity(wrapper, wrapper.get(Type.VAR_INT, 0), Entity1_14Types.EXPERIENCE_ORB));
|
||||
}
|
||||
});
|
||||
|
||||
@ -245,7 +245,7 @@ public class EntityPackets1_14 extends LegacyEntityRewriter<Protocol1_13_2To1_14
|
||||
map(Type.DOUBLE); // Needs to be mapped for the position cache
|
||||
map(Type.DOUBLE);
|
||||
map(Type.DOUBLE);
|
||||
handler(wrapper -> addTrackedEntity(wrapper, wrapper.get(Type.VAR_INT, 0), Entity1_14Types.EntityType.LIGHTNING_BOLT));
|
||||
handler(wrapper -> addTrackedEntity(wrapper, wrapper.get(Type.VAR_INT, 0), Entity1_14Types.LIGHTNING_BOLT));
|
||||
}
|
||||
});
|
||||
|
||||
@ -259,7 +259,7 @@ public class EntityPackets1_14 extends LegacyEntityRewriter<Protocol1_13_2To1_14
|
||||
map(Type.BYTE);
|
||||
|
||||
// Track entity
|
||||
handler(wrapper -> addTrackedEntity(wrapper, wrapper.get(Type.VAR_INT, 0), Entity1_14Types.EntityType.PAINTING));
|
||||
handler(wrapper -> addTrackedEntity(wrapper, wrapper.get(Type.VAR_INT, 0), Entity1_14Types.PAINTING));
|
||||
}
|
||||
});
|
||||
|
||||
@ -275,7 +275,7 @@ public class EntityPackets1_14 extends LegacyEntityRewriter<Protocol1_13_2To1_14
|
||||
map(Type.BYTE); // 6 - Pitch
|
||||
map(Types1_14.METADATA_LIST, Types1_13_2.METADATA_LIST); // 7 - Metadata
|
||||
|
||||
handler(getTrackerAndMetaHandler(Types1_13_2.METADATA_LIST, Entity1_14Types.EntityType.PLAYER));
|
||||
handler(getTrackerAndMetaHandler(Types1_13_2.METADATA_LIST, Entity1_14Types.PLAYER));
|
||||
handler(wrapper -> positionHandler.cacheEntityPosition(wrapper, true, false));
|
||||
}
|
||||
});
|
||||
@ -290,7 +290,7 @@ public class EntityPackets1_14 extends LegacyEntityRewriter<Protocol1_13_2To1_14
|
||||
map(Type.UNSIGNED_BYTE); // 1 - Gamemode
|
||||
map(Type.INT); // 2 - Dimension
|
||||
|
||||
handler(getTrackerHandler(Entity1_14Types.EntityType.PLAYER, Type.INT));
|
||||
handler(getTrackerHandler(Entity1_14Types.PLAYER, Type.INT));
|
||||
handler(getDimensionHandler(1));
|
||||
handler(new PacketHandler() {
|
||||
@Override
|
||||
@ -327,15 +327,15 @@ public class EntityPackets1_14 extends LegacyEntityRewriter<Protocol1_13_2To1_14
|
||||
|
||||
@Override
|
||||
protected void registerRewrites() {
|
||||
mapTypes(Entity1_14Types.EntityType.values(), Entity1_13Types.EntityType.class);
|
||||
mapTypes(Entity1_14Types.values(), Entity1_13Types.EntityType.class);
|
||||
|
||||
mapEntity(Entity1_14Types.EntityType.CAT, Entity1_14Types.EntityType.OCELOT).jsonName("Cat");
|
||||
mapEntity(Entity1_14Types.EntityType.TRADER_LLAMA, Entity1_14Types.EntityType.LLAMA).jsonName("Trader Llama");
|
||||
mapEntity(Entity1_14Types.EntityType.FOX, Entity1_14Types.EntityType.WOLF).jsonName("Fox");
|
||||
mapEntity(Entity1_14Types.EntityType.PANDA, Entity1_14Types.EntityType.POLAR_BEAR).jsonName("Panda");
|
||||
mapEntity(Entity1_14Types.EntityType.PILLAGER, Entity1_14Types.EntityType.VILLAGER).jsonName("Pillager");
|
||||
mapEntity(Entity1_14Types.EntityType.WANDERING_TRADER, Entity1_14Types.EntityType.VILLAGER).jsonName("Wandering Trader");
|
||||
mapEntity(Entity1_14Types.EntityType.RAVAGER, Entity1_14Types.EntityType.COW).jsonName("Ravager");
|
||||
mapEntity(Entity1_14Types.CAT, Entity1_14Types.OCELOT).jsonName("Cat");
|
||||
mapEntity(Entity1_14Types.TRADER_LLAMA, Entity1_14Types.LLAMA).jsonName("Trader Llama");
|
||||
mapEntity(Entity1_14Types.FOX, Entity1_14Types.WOLF).jsonName("Fox");
|
||||
mapEntity(Entity1_14Types.PANDA, Entity1_14Types.POLAR_BEAR).jsonName("Panda");
|
||||
mapEntity(Entity1_14Types.PILLAGER, Entity1_14Types.VILLAGER).jsonName("Pillager");
|
||||
mapEntity(Entity1_14Types.WANDERING_TRADER, Entity1_14Types.VILLAGER).jsonName("Wandering Trader");
|
||||
mapEntity(Entity1_14Types.RAVAGER, Entity1_14Types.COW).jsonName("Ravager");
|
||||
|
||||
registerMetaHandler().handle(e -> {
|
||||
Metadata meta = e.getData();
|
||||
@ -357,28 +357,28 @@ public class EntityPackets1_14 extends LegacyEntityRewriter<Protocol1_13_2To1_14
|
||||
return meta;
|
||||
});
|
||||
|
||||
registerMetaHandler().filter(Entity1_14Types.EntityType.PILLAGER, 15).removed();
|
||||
registerMetaHandler().filter(Entity1_14Types.PILLAGER, 15).removed();
|
||||
|
||||
registerMetaHandler().filter(Entity1_14Types.EntityType.FOX, 15).removed();
|
||||
registerMetaHandler().filter(Entity1_14Types.EntityType.FOX, 16).removed();
|
||||
registerMetaHandler().filter(Entity1_14Types.EntityType.FOX, 17).removed();
|
||||
registerMetaHandler().filter(Entity1_14Types.EntityType.FOX, 18).removed();
|
||||
registerMetaHandler().filter(Entity1_14Types.FOX, 15).removed();
|
||||
registerMetaHandler().filter(Entity1_14Types.FOX, 16).removed();
|
||||
registerMetaHandler().filter(Entity1_14Types.FOX, 17).removed();
|
||||
registerMetaHandler().filter(Entity1_14Types.FOX, 18).removed();
|
||||
|
||||
registerMetaHandler().filter(Entity1_14Types.EntityType.PANDA, 15).removed();
|
||||
registerMetaHandler().filter(Entity1_14Types.EntityType.PANDA, 16).removed();
|
||||
registerMetaHandler().filter(Entity1_14Types.EntityType.PANDA, 17).removed();
|
||||
registerMetaHandler().filter(Entity1_14Types.EntityType.PANDA, 18).removed();
|
||||
registerMetaHandler().filter(Entity1_14Types.EntityType.PANDA, 19).removed();
|
||||
registerMetaHandler().filter(Entity1_14Types.EntityType.PANDA, 20).removed();
|
||||
registerMetaHandler().filter(Entity1_14Types.PANDA, 15).removed();
|
||||
registerMetaHandler().filter(Entity1_14Types.PANDA, 16).removed();
|
||||
registerMetaHandler().filter(Entity1_14Types.PANDA, 17).removed();
|
||||
registerMetaHandler().filter(Entity1_14Types.PANDA, 18).removed();
|
||||
registerMetaHandler().filter(Entity1_14Types.PANDA, 19).removed();
|
||||
registerMetaHandler().filter(Entity1_14Types.PANDA, 20).removed();
|
||||
|
||||
registerMetaHandler().filter(Entity1_14Types.EntityType.CAT, 18).removed();
|
||||
registerMetaHandler().filter(Entity1_14Types.EntityType.CAT, 19).removed();
|
||||
registerMetaHandler().filter(Entity1_14Types.EntityType.CAT, 20).removed();
|
||||
registerMetaHandler().filter(Entity1_14Types.CAT, 18).removed();
|
||||
registerMetaHandler().filter(Entity1_14Types.CAT, 19).removed();
|
||||
registerMetaHandler().filter(Entity1_14Types.CAT, 20).removed();
|
||||
|
||||
registerMetaHandler().handle(e -> {
|
||||
EntityType type = e.getEntity().getType();
|
||||
Metadata meta = e.getData();
|
||||
if (type.isOrHasParent(Entity1_14Types.EntityType.ABSTRACT_ILLAGER_BASE) || type == Entity1_14Types.EntityType.RAVAGER || type == Entity1_14Types.EntityType.WITCH) {
|
||||
if (type.isOrHasParent(Entity1_14Types.ABSTRACT_ILLAGER_BASE) || type == Entity1_14Types.RAVAGER || type == Entity1_14Types.WITCH) {
|
||||
int index = e.getIndex();
|
||||
if (index == 14) {
|
||||
throw RemovedValueException.EX;
|
||||
@ -389,13 +389,13 @@ public class EntityPackets1_14 extends LegacyEntityRewriter<Protocol1_13_2To1_14
|
||||
return meta;
|
||||
});
|
||||
|
||||
registerMetaHandler().filter(Entity1_14Types.EntityType.AREA_EFFECT_CLOUD, 10).handle(e -> {
|
||||
registerMetaHandler().filter(Entity1_14Types.AREA_EFFECT_CLOUD, 10).handle(e -> {
|
||||
Metadata meta = e.getData();
|
||||
rewriteParticle((Particle) meta.getValue());
|
||||
return meta;
|
||||
});
|
||||
|
||||
registerMetaHandler().filter(Entity1_14Types.EntityType.FIREWORK_ROCKET, 8).handle(e -> {
|
||||
registerMetaHandler().filter(Entity1_14Types.FIREWORK_ROCKET, 8).handle(e -> {
|
||||
Metadata meta = e.getData();
|
||||
meta.setMetaType(MetaType1_13_2.VarInt);
|
||||
Integer value = (Integer) meta.getValue();
|
||||
@ -403,7 +403,7 @@ public class EntityPackets1_14 extends LegacyEntityRewriter<Protocol1_13_2To1_14
|
||||
return meta;
|
||||
});
|
||||
|
||||
registerMetaHandler().filter(Entity1_14Types.EntityType.ABSTRACT_ARROW, true).handle(e -> {
|
||||
registerMetaHandler().filter(Entity1_14Types.ABSTRACT_ARROW, true).handle(e -> {
|
||||
Metadata meta = e.getData();
|
||||
int index = e.getIndex();
|
||||
if (index == 9) {
|
||||
@ -414,7 +414,7 @@ public class EntityPackets1_14 extends LegacyEntityRewriter<Protocol1_13_2To1_14
|
||||
return meta;
|
||||
});
|
||||
|
||||
registerMetaHandler().filter(Entity1_14Types.EntityType.VILLAGER, 15).removed(); // Head shake timer
|
||||
registerMetaHandler().filter(Entity1_14Types.VILLAGER, 15).removed(); // Head shake timer
|
||||
|
||||
MetaHandler villagerDataHandler = e -> {
|
||||
Metadata meta = e.getData();
|
||||
@ -427,18 +427,18 @@ public class EntityPackets1_14 extends LegacyEntityRewriter<Protocol1_13_2To1_14
|
||||
return meta;
|
||||
};
|
||||
|
||||
registerMetaHandler().filter(Entity1_14Types.EntityType.ZOMBIE_VILLAGER, 18).handle(villagerDataHandler);
|
||||
registerMetaHandler().filter(Entity1_14Types.EntityType.VILLAGER, 16).handle(villagerDataHandler);
|
||||
registerMetaHandler().filter(Entity1_14Types.ZOMBIE_VILLAGER, 18).handle(villagerDataHandler);
|
||||
registerMetaHandler().filter(Entity1_14Types.VILLAGER, 16).handle(villagerDataHandler);
|
||||
|
||||
// Holding arms up - from bitfield into own boolean
|
||||
registerMetaHandler().filter(Entity1_14Types.EntityType.ABSTRACT_SKELETON, true, 13).handle(e -> {
|
||||
registerMetaHandler().filter(Entity1_14Types.ABSTRACT_SKELETON, true, 13).handle(e -> {
|
||||
byte value = (byte) e.getData().getValue();
|
||||
if ((value & 4) != 0) {
|
||||
e.createMeta(new Metadata(14, MetaType1_13_2.Boolean, true));
|
||||
}
|
||||
return e.getData();
|
||||
});
|
||||
registerMetaHandler().filter(Entity1_14Types.EntityType.ZOMBIE, true, 13).handle(e -> {
|
||||
registerMetaHandler().filter(Entity1_14Types.ZOMBIE, true, 13).handle(e -> {
|
||||
byte value = (byte) e.getData().getValue();
|
||||
if ((value & 4) != 0) {
|
||||
e.createMeta(new Metadata(16, MetaType1_13_2.Boolean, true));
|
||||
@ -446,7 +446,7 @@ public class EntityPackets1_14 extends LegacyEntityRewriter<Protocol1_13_2To1_14
|
||||
return e.getData();
|
||||
});
|
||||
|
||||
registerMetaHandler().filter(Entity1_14Types.EntityType.ZOMBIE, true).handle(e -> {
|
||||
registerMetaHandler().filter(Entity1_14Types.ZOMBIE, true).handle(e -> {
|
||||
Metadata meta = e.getData();
|
||||
int index = e.getIndex();
|
||||
if (index >= 16) {
|
||||
@ -456,7 +456,7 @@ public class EntityPackets1_14 extends LegacyEntityRewriter<Protocol1_13_2To1_14
|
||||
});
|
||||
|
||||
// Remove bed location
|
||||
registerMetaHandler().filter(Entity1_14Types.EntityType.LIVINGENTITY, true).handle(e -> {
|
||||
registerMetaHandler().filter(Entity1_14Types.LIVINGENTITY, true).handle(e -> {
|
||||
Metadata meta = e.getData();
|
||||
int index = e.getIndex();
|
||||
if (index == 12) {
|
||||
@ -502,7 +502,7 @@ public class EntityPackets1_14 extends LegacyEntityRewriter<Protocol1_13_2To1_14
|
||||
return meta;
|
||||
});
|
||||
|
||||
registerMetaHandler().filter(Entity1_14Types.EntityType.OCELOT, 13).handle(e -> {
|
||||
registerMetaHandler().filter(Entity1_14Types.OCELOT, 13).handle(e -> {
|
||||
Metadata meta = e.getData();
|
||||
meta.setId(15);
|
||||
meta.setMetaType(MetaType1_13_2.VarInt);
|
||||
@ -510,7 +510,7 @@ public class EntityPackets1_14 extends LegacyEntityRewriter<Protocol1_13_2To1_14
|
||||
return meta;
|
||||
});
|
||||
|
||||
registerMetaHandler().filter(Entity1_14Types.EntityType.CAT).handle(e -> {
|
||||
registerMetaHandler().filter(Entity1_14Types.CAT).handle(e -> {
|
||||
Metadata meta = e.getData();
|
||||
if (meta.getId() == 15) {
|
||||
meta.setValue(1);
|
||||
|
@ -6,7 +6,7 @@ public class EntityTypeMapping {
|
||||
|
||||
// There's only the bee, so not much to do here
|
||||
public static int getOldEntityId(int entityId) {
|
||||
if (entityId == 4) return Entity1_14Types.EntityType.PUFFERFISH.getId(); // Flying pufferfish!
|
||||
if (entityId == 4) return Entity1_14Types.PUFFERFISH.getId(); // Flying pufferfish!
|
||||
return entityId >= 5 ? entityId - 1 : entityId;
|
||||
}
|
||||
}
|
||||
|
@ -57,7 +57,7 @@ public class EntityPackets1_15 extends EntityRewriter<Protocol1_14_4To1_15> {
|
||||
}
|
||||
});
|
||||
|
||||
registerSpawnTrackerWithData(ClientboundPackets1_15.SPAWN_ENTITY, Entity1_15Types.EntityType.FALLING_BLOCK);
|
||||
registerSpawnTrackerWithData(ClientboundPackets1_15.SPAWN_ENTITY, Entity1_15Types.FALLING_BLOCK);
|
||||
|
||||
protocol.registerOutgoing(ClientboundPackets1_15.SPAWN_MOB, new PacketRemapper() {
|
||||
@Override
|
||||
@ -78,7 +78,7 @@ public class EntityPackets1_15 extends EntityRewriter<Protocol1_14_4To1_15> {
|
||||
|
||||
handler(wrapper -> {
|
||||
int type = wrapper.get(Type.VAR_INT, 1);
|
||||
Entity1_15Types.EntityType entityType = Entity1_15Types.getTypeFromId(type);
|
||||
EntityType entityType = Entity1_15Types.getTypeFromId(type);
|
||||
addTrackedEntity(wrapper, wrapper.get(Type.VAR_INT, 0), entityType);
|
||||
wrapper.set(Type.VAR_INT, 1, EntityTypeMapping.getOldEntityId(type));
|
||||
});
|
||||
@ -107,15 +107,15 @@ public class EntityPackets1_15 extends EntityRewriter<Protocol1_14_4To1_15> {
|
||||
map(Type.VAR_INT); // 5 - View Distance
|
||||
map(Type.BOOLEAN); // 6 - Reduce Debug Info
|
||||
|
||||
handler(getTrackerHandler(Entity1_15Types.EntityType.PLAYER, Type.INT));
|
||||
handler(getTrackerHandler(Entity1_15Types.PLAYER, Type.INT));
|
||||
|
||||
handler(wrapper -> wrapper.user().get(ImmediateRespawn.class).setImmediateRespawn(wrapper.read(Type.BOOLEAN)));
|
||||
}
|
||||
});
|
||||
|
||||
registerExtraTracker(ClientboundPackets1_15.SPAWN_EXPERIENCE_ORB, Entity1_15Types.EntityType.EXPERIENCE_ORB);
|
||||
registerExtraTracker(ClientboundPackets1_15.SPAWN_GLOBAL_ENTITY, Entity1_15Types.EntityType.LIGHTNING_BOLT);
|
||||
registerExtraTracker(ClientboundPackets1_15.SPAWN_PAINTING, Entity1_15Types.EntityType.PAINTING);
|
||||
registerExtraTracker(ClientboundPackets1_15.SPAWN_EXPERIENCE_ORB, Entity1_15Types.EXPERIENCE_ORB);
|
||||
registerExtraTracker(ClientboundPackets1_15.SPAWN_GLOBAL_ENTITY, Entity1_15Types.LIGHTNING_BOLT);
|
||||
registerExtraTracker(ClientboundPackets1_15.SPAWN_PAINTING, Entity1_15Types.PAINTING);
|
||||
|
||||
protocol.registerOutgoing(ClientboundPackets1_15.SPAWN_PLAYER, new PacketRemapper() {
|
||||
@Override
|
||||
@ -129,7 +129,7 @@ public class EntityPackets1_15 extends EntityRewriter<Protocol1_14_4To1_15> {
|
||||
map(Type.BYTE); // 6 - Pitch
|
||||
create(wrapper -> wrapper.write(Types1_14.METADATA_LIST, new ArrayList<>())); // Metadata is no longer sent in 1.15, so we have to send an empty one
|
||||
|
||||
handler(getTrackerHandler(Entity1_15Types.EntityType.PLAYER, Type.VAR_INT));
|
||||
handler(getTrackerHandler(Entity1_15Types.PLAYER, Type.VAR_INT));
|
||||
}
|
||||
});
|
||||
|
||||
@ -145,7 +145,7 @@ public class EntityPackets1_15 extends EntityRewriter<Protocol1_14_4To1_15> {
|
||||
handler(wrapper -> {
|
||||
int entityId = wrapper.get(Type.VAR_INT, 0);
|
||||
EntityType entityType = getEntityType(wrapper.user(), entityId);
|
||||
if (entityType != Entity1_15Types.EntityType.BEE) return;
|
||||
if (entityType != Entity1_15Types.BEE) return;
|
||||
|
||||
int size = wrapper.get(Type.INT, 0);
|
||||
int newSize = size;
|
||||
@ -197,7 +197,7 @@ public class EntityPackets1_15 extends EntityRewriter<Protocol1_14_4To1_15> {
|
||||
return meta;
|
||||
});
|
||||
|
||||
registerMetaHandler().filter(Entity1_15Types.EntityType.LIVINGENTITY, true).handle(e -> {
|
||||
registerMetaHandler().filter(Entity1_15Types.LIVINGENTITY, true).handle(e -> {
|
||||
int index = e.getIndex();
|
||||
if (index == 12) {
|
||||
throw RemovedValueException.EX;
|
||||
@ -207,25 +207,25 @@ public class EntityPackets1_15 extends EntityRewriter<Protocol1_14_4To1_15> {
|
||||
return e.getData();
|
||||
});
|
||||
|
||||
registerMetaHandler().filter(Entity1_15Types.EntityType.BEE, 15).removed();
|
||||
registerMetaHandler().filter(Entity1_15Types.EntityType.BEE, 16).removed();
|
||||
registerMetaHandler().filter(Entity1_15Types.BEE, 15).removed();
|
||||
registerMetaHandler().filter(Entity1_15Types.BEE, 16).removed();
|
||||
|
||||
mapEntity(Entity1_15Types.EntityType.BEE, Entity1_15Types.EntityType.PUFFERFISH).jsonName("Bee").spawnMetadata(storage -> {
|
||||
mapEntity(Entity1_15Types.BEE, Entity1_15Types.PUFFERFISH).jsonName("Bee").spawnMetadata(storage -> {
|
||||
storage.add(new Metadata(14, MetaType1_14.Boolean, false));
|
||||
storage.add(new Metadata(15, MetaType1_14.VarInt, 2));
|
||||
});
|
||||
|
||||
registerMetaHandler().filter(Entity1_15Types.EntityType.ENDERMAN, 16).removed();
|
||||
registerMetaHandler().filter(Entity1_15Types.EntityType.TRIDENT, 10).removed();
|
||||
registerMetaHandler().filter(Entity1_15Types.ENDERMAN, 16).removed();
|
||||
registerMetaHandler().filter(Entity1_15Types.TRIDENT, 10).removed();
|
||||
|
||||
registerMetaHandler().filter(Entity1_15Types.EntityType.WOLF).handle(e -> {
|
||||
registerMetaHandler().filter(Entity1_15Types.WOLF).handle(e -> {
|
||||
int index = e.getIndex();
|
||||
if (index >= 17) {
|
||||
e.getData().setId(index + 1); // redundant health removed in 1.15
|
||||
}
|
||||
return e.getData();
|
||||
});
|
||||
registerMetaHandler().filter(Entity1_15Types.EntityType.WOLF, 8).handle(e -> {
|
||||
registerMetaHandler().filter(Entity1_15Types.WOLF, 8).handle(e -> {
|
||||
e.createMeta(new Metadata(17/*WOLF_HEALTH*/, MetaType1_14.Float, e.getData().getValue()));
|
||||
return e.getData();
|
||||
});
|
||||
|
@ -20,11 +20,11 @@ public class EntityPackets1_14_1 extends LegacyEntityRewriter<Protocol1_14To1_14
|
||||
|
||||
@Override
|
||||
protected void registerPackets() {
|
||||
registerExtraTracker(ClientboundPackets1_14.SPAWN_EXPERIENCE_ORB, Entity1_14Types.EntityType.EXPERIENCE_ORB);
|
||||
registerExtraTracker(ClientboundPackets1_14.SPAWN_GLOBAL_ENTITY, Entity1_14Types.EntityType.LIGHTNING_BOLT);
|
||||
registerExtraTracker(ClientboundPackets1_14.SPAWN_PAINTING, Entity1_14Types.EntityType.PAINTING);
|
||||
registerExtraTracker(ClientboundPackets1_14.SPAWN_PLAYER, Entity1_14Types.EntityType.PLAYER);
|
||||
registerExtraTracker(ClientboundPackets1_14.JOIN_GAME, Entity1_14Types.EntityType.PLAYER, Type.INT);
|
||||
registerExtraTracker(ClientboundPackets1_14.SPAWN_EXPERIENCE_ORB, Entity1_14Types.EXPERIENCE_ORB);
|
||||
registerExtraTracker(ClientboundPackets1_14.SPAWN_GLOBAL_ENTITY, Entity1_14Types.LIGHTNING_BOLT);
|
||||
registerExtraTracker(ClientboundPackets1_14.SPAWN_PAINTING, Entity1_14Types.PAINTING);
|
||||
registerExtraTracker(ClientboundPackets1_14.SPAWN_PLAYER, Entity1_14Types.PLAYER);
|
||||
registerExtraTracker(ClientboundPackets1_14.JOIN_GAME, Entity1_14Types.PLAYER, Type.INT);
|
||||
registerEntityDestroy(ClientboundPackets1_14.DESTROY_ENTITIES);
|
||||
|
||||
protocol.registerOutgoing(ClientboundPackets1_14.SPAWN_ENTITY, new PacketRemapper() {
|
||||
@ -77,9 +77,9 @@ public class EntityPackets1_14_1 extends LegacyEntityRewriter<Protocol1_14To1_14
|
||||
|
||||
@Override
|
||||
protected void registerRewrites() {
|
||||
registerMetaHandler().filter(Entity1_14Types.EntityType.VILLAGER, 15).removed();
|
||||
registerMetaHandler().filter(Entity1_14Types.EntityType.VILLAGER, 16).handleIndexChange(15);
|
||||
registerMetaHandler().filter(Entity1_14Types.EntityType.WANDERING_TRADER, 15).removed();
|
||||
registerMetaHandler().filter(Entity1_14Types.VILLAGER, 15).removed();
|
||||
registerMetaHandler().filter(Entity1_14Types.VILLAGER, 16).handleIndexChange(15);
|
||||
registerMetaHandler().filter(Entity1_14Types.WANDERING_TRADER, 15).removed();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -58,7 +58,7 @@ public class EntityPackets1_16 extends EntityRewriter<Protocol1_15_2To1_16> {
|
||||
map(Type.INT); // 8 - Data
|
||||
handler(wrapper -> {
|
||||
EntityType entityType = getTypeFromId(wrapper.get(Type.VAR_INT, 1));
|
||||
if (entityType == Entity1_16Types.EntityType.LIGHTNING_BOLT) {
|
||||
if (entityType == Entity1_16Types.LIGHTNING_BOLT) {
|
||||
// Map to old weather entity packet
|
||||
wrapper.cancel();
|
||||
|
||||
@ -71,7 +71,7 @@ public class EntityPackets1_16 extends EntityRewriter<Protocol1_15_2To1_16> {
|
||||
spawnLightningPacket.send(Protocol1_15_2To1_16.class, true, true);
|
||||
}
|
||||
});
|
||||
handler(getSpawnTracketWithDataHandler(Entity1_16Types.EntityType.FALLING_BLOCK));
|
||||
handler(getSpawnTracketWithDataHandler(Entity1_16Types.FALLING_BLOCK));
|
||||
}
|
||||
});
|
||||
|
||||
@ -137,7 +137,7 @@ public class EntityPackets1_16 extends EntityRewriter<Protocol1_15_2To1_16> {
|
||||
handler(wrapper -> {
|
||||
ClientWorld clientChunks = wrapper.user().get(ClientWorld.class);
|
||||
clientChunks.setEnvironment(wrapper.get(Type.INT, 1));
|
||||
getEntityTracker(wrapper.user()).trackEntityType(wrapper.get(Type.INT, 0), Entity1_16Types.EntityType.PLAYER);
|
||||
getEntityTracker(wrapper.user()).trackEntityType(wrapper.get(Type.INT, 0), Entity1_16Types.PLAYER);
|
||||
|
||||
wrapper.write(Type.STRING, "default"); // Level type
|
||||
|
||||
@ -153,10 +153,10 @@ public class EntityPackets1_16 extends EntityRewriter<Protocol1_15_2To1_16> {
|
||||
}
|
||||
});
|
||||
|
||||
registerExtraTracker(ClientboundPackets1_16.SPAWN_EXPERIENCE_ORB, Entity1_16Types.EntityType.EXPERIENCE_ORB);
|
||||
registerExtraTracker(ClientboundPackets1_16.SPAWN_EXPERIENCE_ORB, Entity1_16Types.EXPERIENCE_ORB);
|
||||
// F Spawn Global Object, it is no longer with us :(
|
||||
registerExtraTracker(ClientboundPackets1_16.SPAWN_PAINTING, Entity1_16Types.EntityType.PAINTING);
|
||||
registerExtraTracker(ClientboundPackets1_16.SPAWN_PLAYER, Entity1_16Types.EntityType.PLAYER);
|
||||
registerExtraTracker(ClientboundPackets1_16.SPAWN_PAINTING, Entity1_16Types.PAINTING);
|
||||
registerExtraTracker(ClientboundPackets1_16.SPAWN_PLAYER, Entity1_16Types.PLAYER);
|
||||
registerEntityDestroy(ClientboundPackets1_16.DESTROY_ENTITIES);
|
||||
registerMetadataRewriter(ClientboundPackets1_16.ENTITY_METADATA, Types1_14.METADATA_LIST);
|
||||
|
||||
@ -243,35 +243,35 @@ public class EntityPackets1_16 extends EntityRewriter<Protocol1_15_2To1_16> {
|
||||
return meta;
|
||||
});
|
||||
|
||||
mapEntityDirect(Entity1_16Types.EntityType.ZOMBIFIED_PIGLIN, Entity1_15Types.EntityType.ZOMBIE_PIGMAN);
|
||||
mapTypes(Entity1_16Types.EntityType.values(), Entity1_15Types.EntityType.class);
|
||||
mapEntityDirect(Entity1_16Types.ZOMBIFIED_PIGLIN, Entity1_15Types.ZOMBIE_PIGMAN);
|
||||
mapTypes(Entity1_16Types.values(), Entity1_15Types.class);
|
||||
|
||||
mapEntity(Entity1_16Types.EntityType.HOGLIN, Entity1_16Types.EntityType.COW).jsonName("Hoglin");
|
||||
mapEntity(Entity1_16Types.EntityType.ZOGLIN, Entity1_16Types.EntityType.COW).jsonName("Zoglin");
|
||||
mapEntity(Entity1_16Types.EntityType.PIGLIN, Entity1_16Types.EntityType.ZOMBIFIED_PIGLIN).jsonName("Piglin");
|
||||
mapEntity(Entity1_16Types.EntityType.STRIDER, Entity1_16Types.EntityType.MAGMA_CUBE).jsonName("Strider");
|
||||
mapEntity(Entity1_16Types.HOGLIN, Entity1_16Types.COW).jsonName("Hoglin");
|
||||
mapEntity(Entity1_16Types.ZOGLIN, Entity1_16Types.COW).jsonName("Zoglin");
|
||||
mapEntity(Entity1_16Types.PIGLIN, Entity1_16Types.ZOMBIFIED_PIGLIN).jsonName("Piglin");
|
||||
mapEntity(Entity1_16Types.STRIDER, Entity1_16Types.MAGMA_CUBE).jsonName("Strider");
|
||||
|
||||
registerMetaHandler().filter(Entity1_16Types.EntityType.ZOGLIN, 16).removed();
|
||||
registerMetaHandler().filter(Entity1_16Types.EntityType.HOGLIN, 15).removed();
|
||||
registerMetaHandler().filter(Entity1_16Types.ZOGLIN, 16).removed();
|
||||
registerMetaHandler().filter(Entity1_16Types.HOGLIN, 15).removed();
|
||||
|
||||
registerMetaHandler().filter(Entity1_16Types.EntityType.PIGLIN, 16).removed();
|
||||
registerMetaHandler().filter(Entity1_16Types.EntityType.PIGLIN, 17).removed();
|
||||
registerMetaHandler().filter(Entity1_16Types.EntityType.PIGLIN, 18).removed();
|
||||
registerMetaHandler().filter(Entity1_16Types.PIGLIN, 16).removed();
|
||||
registerMetaHandler().filter(Entity1_16Types.PIGLIN, 17).removed();
|
||||
registerMetaHandler().filter(Entity1_16Types.PIGLIN, 18).removed();
|
||||
|
||||
registerMetaHandler().filter(Entity1_16Types.EntityType.STRIDER, 15).handle(meta -> {
|
||||
registerMetaHandler().filter(Entity1_16Types.STRIDER, 15).handle(meta -> {
|
||||
boolean baby = meta.getData().getCastedValue();
|
||||
meta.getData().setValue(baby ? 1 : 3);
|
||||
meta.getData().setMetaType(MetaType1_14.VarInt);
|
||||
return meta.getData();
|
||||
});
|
||||
registerMetaHandler().filter(Entity1_16Types.EntityType.STRIDER, 16).removed();
|
||||
registerMetaHandler().filter(Entity1_16Types.EntityType.STRIDER, 17).removed();
|
||||
registerMetaHandler().filter(Entity1_16Types.EntityType.STRIDER, 18).removed();
|
||||
registerMetaHandler().filter(Entity1_16Types.STRIDER, 16).removed();
|
||||
registerMetaHandler().filter(Entity1_16Types.STRIDER, 17).removed();
|
||||
registerMetaHandler().filter(Entity1_16Types.STRIDER, 18).removed();
|
||||
|
||||
registerMetaHandler().filter(Entity1_16Types.EntityType.FISHING_BOBBER, 8).removed();
|
||||
registerMetaHandler().filter(Entity1_16Types.FISHING_BOBBER, 8).removed();
|
||||
|
||||
registerMetaHandler().filter(Entity1_16Types.EntityType.ABSTRACT_ARROW, true, 8).removed();
|
||||
registerMetaHandler().filter(Entity1_16Types.EntityType.ABSTRACT_ARROW, true).handle(meta -> {
|
||||
registerMetaHandler().filter(Entity1_16Types.ABSTRACT_ARROW, true, 8).removed();
|
||||
registerMetaHandler().filter(Entity1_16Types.ABSTRACT_ARROW, true).handle(meta -> {
|
||||
if (meta.getIndex() >= 8) {
|
||||
meta.getData().setId(meta.getIndex() + 1);
|
||||
}
|
||||
|
@ -32,11 +32,11 @@ public class EntityPackets1_16_2 extends EntityRewriter<Protocol1_16_1To1_16_2>
|
||||
|
||||
@Override
|
||||
protected void registerPackets() {
|
||||
registerSpawnTrackerWithData(ClientboundPackets1_16_2.SPAWN_ENTITY, Entity1_16_2Types.EntityType.FALLING_BLOCK);
|
||||
registerSpawnTrackerWithData(ClientboundPackets1_16_2.SPAWN_ENTITY, Entity1_16_2Types.FALLING_BLOCK);
|
||||
registerSpawnTracker(ClientboundPackets1_16_2.SPAWN_MOB);
|
||||
registerExtraTracker(ClientboundPackets1_16_2.SPAWN_EXPERIENCE_ORB, Entity1_16_2Types.EntityType.EXPERIENCE_ORB);
|
||||
registerExtraTracker(ClientboundPackets1_16_2.SPAWN_PAINTING, Entity1_16_2Types.EntityType.PAINTING);
|
||||
registerExtraTracker(ClientboundPackets1_16_2.SPAWN_PLAYER, Entity1_16_2Types.EntityType.PLAYER);
|
||||
registerExtraTracker(ClientboundPackets1_16_2.SPAWN_EXPERIENCE_ORB, Entity1_16_2Types.EXPERIENCE_ORB);
|
||||
registerExtraTracker(ClientboundPackets1_16_2.SPAWN_PAINTING, Entity1_16_2Types.PAINTING);
|
||||
registerExtraTracker(ClientboundPackets1_16_2.SPAWN_PLAYER, Entity1_16_2Types.PLAYER);
|
||||
registerEntityDestroy(ClientboundPackets1_16_2.DESTROY_ENTITIES);
|
||||
registerMetadataRewriter(ClientboundPackets1_16_2.ENTITY_METADATA, Types1_14.METADATA_LIST);
|
||||
|
||||
@ -69,7 +69,7 @@ public class EntityPackets1_16_2 extends EntityRewriter<Protocol1_16_1To1_16_2>
|
||||
wrapper.write(Type.UNSIGNED_BYTE, (short) Math.max(maxPlayers, 255));
|
||||
});
|
||||
// ...
|
||||
handler(getTrackerHandler(Entity1_16_2Types.EntityType.PLAYER, Type.INT));
|
||||
handler(getTrackerHandler(Entity1_16_2Types.PLAYER, Type.INT));
|
||||
}
|
||||
});
|
||||
|
||||
@ -110,10 +110,10 @@ public class EntityPackets1_16_2 extends EntityRewriter<Protocol1_16_1To1_16_2>
|
||||
return meta;
|
||||
});
|
||||
|
||||
mapTypes(Entity1_16_2Types.EntityType.values(), Entity1_16Types.EntityType.class);
|
||||
mapEntity(Entity1_16_2Types.EntityType.PIGLIN_BRUTE, Entity1_16_2Types.EntityType.PIGLIN).jsonName("Piglin Brute");
|
||||
mapTypes(Entity1_16_2Types.values(), Entity1_16Types.class);
|
||||
mapEntity(Entity1_16_2Types.PIGLIN_BRUTE, Entity1_16_2Types.PIGLIN).jsonName("Piglin Brute");
|
||||
|
||||
registerMetaHandler().filter(Entity1_16_2Types.EntityType.ABSTRACT_PIGLIN, true).handle(meta -> {
|
||||
registerMetaHandler().filter(Entity1_16_2Types.ABSTRACT_PIGLIN, true).handle(meta -> {
|
||||
if (meta.getIndex() == 15) {
|
||||
meta.getData().setId(16);
|
||||
} else if (meta.getIndex() == 16) {
|
||||
|
@ -30,11 +30,11 @@ public class EntityPackets1_17 extends EntityRewriter<Protocol1_16_4To1_17> {
|
||||
|
||||
@Override
|
||||
protected void registerPackets() {
|
||||
registerSpawnTrackerWithData(ClientboundPackets1_17.SPAWN_ENTITY, Entity1_16_2Types.EntityType.FALLING_BLOCK);
|
||||
registerSpawnTrackerWithData(ClientboundPackets1_17.SPAWN_ENTITY, Entity1_16_2Types.FALLING_BLOCK);
|
||||
registerSpawnTracker(ClientboundPackets1_17.SPAWN_MOB);
|
||||
registerExtraTracker(ClientboundPackets1_17.SPAWN_EXPERIENCE_ORB, Entity1_16_2Types.EntityType.EXPERIENCE_ORB);
|
||||
registerExtraTracker(ClientboundPackets1_17.SPAWN_PAINTING, Entity1_16_2Types.EntityType.PAINTING);
|
||||
registerExtraTracker(ClientboundPackets1_17.SPAWN_PLAYER, Entity1_16_2Types.EntityType.PLAYER);
|
||||
registerExtraTracker(ClientboundPackets1_17.SPAWN_EXPERIENCE_ORB, Entity1_16_2Types.EXPERIENCE_ORB);
|
||||
registerExtraTracker(ClientboundPackets1_17.SPAWN_PAINTING, Entity1_16_2Types.PAINTING);
|
||||
registerExtraTracker(ClientboundPackets1_17.SPAWN_PLAYER, Entity1_16_2Types.PLAYER);
|
||||
registerEntityDestroy(ClientboundPackets1_17.DESTROY_ENTITIES);
|
||||
registerMetadataRewriter(ClientboundPackets1_17.ENTITY_METADATA, Types1_17.METADATA_LIST, Types1_14.METADATA_LIST);
|
||||
protocol.registerOutgoing(ClientboundPackets1_17.JOIN_GAME, new PacketRemapper() {
|
||||
@ -53,7 +53,7 @@ public class EntityPackets1_17 extends EntityRewriter<Protocol1_16_4To1_17> {
|
||||
wrapper.set(Type.BYTE, 0, (byte) 0);
|
||||
}
|
||||
});
|
||||
handler(getTrackerHandler(Entity1_16_2Types.EntityType.PLAYER, Type.INT));
|
||||
handler(getTrackerHandler(Entity1_16_2Types.PLAYER, Type.INT));
|
||||
handler(getWorldDataTracker(1));
|
||||
handler(wrapper -> {
|
||||
CompoundTag dimensionRegistry = wrapper.get(Type.NBT, 0).get("minecraft:dimension_type");
|
||||
@ -129,19 +129,19 @@ public class EntityPackets1_17 extends EntityRewriter<Protocol1_16_4To1_17> {
|
||||
return meta;
|
||||
});
|
||||
|
||||
mapTypes(Entity1_17Types.EntityType.values(), Entity1_16_2Types.EntityType.class);
|
||||
registerMetaHandler().filter(Entity1_17Types.EntityType.AXOLOTL, 17).removed();
|
||||
registerMetaHandler().filter(Entity1_17Types.EntityType.AXOLOTL, 18).removed();
|
||||
registerMetaHandler().filter(Entity1_17Types.EntityType.AXOLOTL, 19).removed();
|
||||
mapTypes(Entity1_17Types.values(), Entity1_16_2Types.class);
|
||||
registerMetaHandler().filter(Entity1_17Types.AXOLOTL, 17).removed();
|
||||
registerMetaHandler().filter(Entity1_17Types.AXOLOTL, 18).removed();
|
||||
registerMetaHandler().filter(Entity1_17Types.AXOLOTL, 19).removed();
|
||||
|
||||
registerMetaHandler().filter(Entity1_17Types.EntityType.GLOW_SQUID, 16).removed();
|
||||
registerMetaHandler().filter(Entity1_17Types.GLOW_SQUID, 16).removed();
|
||||
|
||||
mapEntity(Entity1_17Types.EntityType.AXOLOTL, Entity1_17Types.EntityType.TROPICAL_FISH).jsonName("Axolotl");
|
||||
mapEntity(Entity1_17Types.AXOLOTL, Entity1_17Types.TROPICAL_FISH).jsonName("Axolotl");
|
||||
|
||||
mapEntity(Entity1_17Types.EntityType.GLOW_SQUID, Entity1_17Types.EntityType.SQUID).jsonName("Glow Squid");
|
||||
mapEntity(Entity1_17Types.EntityType.GLOW_ITEM_FRAME, Entity1_17Types.EntityType.ITEM_FRAME);
|
||||
mapEntity(Entity1_17Types.GLOW_SQUID, Entity1_17Types.SQUID).jsonName("Glow Squid");
|
||||
mapEntity(Entity1_17Types.GLOW_ITEM_FRAME, Entity1_17Types.ITEM_FRAME);
|
||||
|
||||
registerMetaHandler().filter(Entity1_17Types.EntityType.SHULKER).handle(meta -> {
|
||||
registerMetaHandler().filter(Entity1_17Types.SHULKER).handle(meta -> {
|
||||
if (meta.getIndex() >= 17) {
|
||||
meta.getData().setId(meta.getIndex() + 1); // TODO Handle attachment pos?
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user