3
0
Mirror von https://github.com/ViaVersion/ViaBackwards.git synchronisiert 2024-12-27 00:22:53 +01:00

Rewrite entity types

Dieser Commit ist enthalten in:
Matsv 2019-01-19 14:04:11 +01:00
Ursprung 3cd91d87a4
Commit 87f217ca37
2 geänderte Dateien mit 149 neuen und 129 gelöschten Zeilen

Datei anzeigen

@ -30,172 +30,174 @@ public class EntityType1_13 {
@AllArgsConstructor @AllArgsConstructor
@Getter @Getter
public enum EntityType implements AbstractEntityType { public enum EntityType implements AbstractEntityType {
ENTITY(-1),
AREA_EFFECT_CLOUD(0, ENTITY),
ENDER_CRYSTAL(16, ENTITY),
EVOCATION_FANGS(20, ENTITY),
XP_ORB(22, ENTITY),
EYE_OF_ENDER_SIGNAL(23, ENTITY),
FALLING_BLOCK(24, ENTITY),
FIREWORKS_ROCKET(25, ENTITY),
ITEM(32, ENTITY),
LLAMA_SPIT(37, ENTITY),
TNT(55, ENTITY),
SHULKER_BULLET(60, ENTITY),
FISHING_BOBBER(93, ENTITY),
LIVINGENTITY(-1, ENTITY), ENTITY(-1), // abm
ARMOR_STAND(1, LIVINGENTITY),
PLAYER(92, LIVINGENTITY),
ABSTRACT_INSENTIENT(-1, LIVINGENTITY), AREA_EFFECT_CLOUD(0, ENTITY), // abk
ENDER_DRAGON(17, ABSTRACT_INSENTIENT), ENDER_CRYSTAL(16, ENTITY), // aho
EVOCATION_FANGS(20, ENTITY), // ala
XP_ORB(22, ENTITY), // abs
EYE_OF_ENDER_SIGNAL(23, ENTITY), // alb
FALLING_BLOCK(24, ENTITY), // aix
FIREWORKS_ROCKET(25, ENTITY), // alc
ITEM(32, ENTITY), // aiy
LLAMA_SPIT(37, ENTITY), // ale
TNT(55, ENTITY), // aiz
SHULKER_BULLET(60, ENTITY), // alh
FISHING_BOBBER(93, ENTITY), // ais
ABSTRACT_CREATURE(-1, ABSTRACT_INSENTIENT), LIVINGENTITY(-1, ENTITY), // abv
ARMOR_STAND(1, LIVINGENTITY), // ail
PLAYER(92, LIVINGENTITY), // aks
ABSTRACT_AGEABLE(-1, ABSTRACT_CREATURE), ABSTRACT_INSENTIENT(-1, LIVINGENTITY), // abw
VILLAGER(79, ABSTRACT_AGEABLE), ENDER_DRAGON(17, ABSTRACT_INSENTIENT), // ahp
ABSTRACT_CREATURE(-1, ABSTRACT_INSENTIENT), // acd
ABSTRACT_AGEABLE(-1, ABSTRACT_CREATURE), // abj
VILLAGER(79, ABSTRACT_AGEABLE), // akn
// Animals // Animals
ABSTRACT_ANIMAL(-1, ABSTRACT_AGEABLE), ABSTRACT_ANIMAL(-1, ABSTRACT_AGEABLE), // agd
CHICKEN(7, ABSTRACT_ANIMAL), CHICKEN(7, ABSTRACT_ANIMAL), // age
COW(9, ABSTRACT_ANIMAL), COW(9, ABSTRACT_ANIMAL), // agg
MOOSHROOM(47, COW), MOOSHROOM(47, COW), // agi
PIG(51, ABSTRACT_ANIMAL), PIG(51, ABSTRACT_ANIMAL), // agl
POLAR_BEAR(54, ABSTRACT_ANIMAL), POLAR_BEAR(54, ABSTRACT_ANIMAL), // agm
RABBIT(56, ABSTRACT_ANIMAL), RABBIT(56, ABSTRACT_ANIMAL), // ago
SHEEP(58, ABSTRACT_ANIMAL), SHEEP(58, ABSTRACT_ANIMAL), // agq
TURTLE(73, ABSTRACT_ANIMAL), TURTLE(73, ABSTRACT_ANIMAL), // agv
ABSTRACT_TAMEABLE_ANIMAL(-1, ABSTRACT_ANIMAL), ABSTRACT_TAMEABLE_ANIMAL(-1, ABSTRACT_ANIMAL), // acg
OCELOT(48, ABSTRACT_TAMEABLE_ANIMAL), OCELOT(48, ABSTRACT_TAMEABLE_ANIMAL), // agj
WOLF(86, ABSTRACT_TAMEABLE_ANIMAL), WOLF(86, ABSTRACT_TAMEABLE_ANIMAL), // agy
ABSTRACT_PARROT(-1, ABSTRACT_TAMEABLE_ANIMAL), ABSTRACT_PARROT(-1, ABSTRACT_TAMEABLE_ANIMAL), // agr
PARROT(50, ABSTRACT_PARROT), PARROT(50, ABSTRACT_PARROT), // agk
// Horses // Horses
ABSTRACT_HORSE(-1, ABSTRACT_ANIMAL), ABSTRACT_HORSE(-1, ABSTRACT_ANIMAL), // aha
CHESTED_HORSE(-1, ABSTRACT_HORSE), CHESTED_HORSE(-1, ABSTRACT_HORSE), // agz
DONKEY(11, CHESTED_HORSE), DONKEY(11, CHESTED_HORSE), // ahb
MULE(46, CHESTED_HORSE), MULE(46, CHESTED_HORSE), // ahf
LLAMA(36, CHESTED_HORSE), LLAMA(36, CHESTED_HORSE), // ahe
HORSE(29, ABSTRACT_HORSE), HORSE(29, ABSTRACT_HORSE), // ahc
SKELETON_HORSE(63, ABSTRACT_HORSE), SKELETON_HORSE(63, ABSTRACT_HORSE), // ahg
ZOMBIE_HORSE(88, ABSTRACT_HORSE), ZOMBIE_HORSE(88, ABSTRACT_HORSE), // ahi
// Golem // Golem
ABSTRACT_GOLEM(-1, ABSTRACT_CREATURE), ABSTRACT_GOLEM(-1, ABSTRACT_CREATURE), // agc
SNOWMAN(66, ABSTRACT_GOLEM), SNOWMAN(66, ABSTRACT_GOLEM), // ags
VILLAGER_GOLEM(80, ABSTRACT_GOLEM), VILLAGER_GOLEM(80, ABSTRACT_GOLEM), // agw
SHULKER(59, ABSTRACT_GOLEM), SHULKER(59, ABSTRACT_GOLEM), // ajx
// Fish // Fish
ABSTRACT_FISHES(-1, ABSTRACT_CREATURE), ABSTRACT_FISHES(-1, ABSTRACT_CREATURE), // agb
COD_MOB(8, ABSTRACT_FISHES), COD_MOB(8, ABSTRACT_FISHES), // agf
PUFFER_FISH(52, ABSTRACT_FISHES), PUFFER_FISH(52, ABSTRACT_FISHES), // agn
SALMON_MOB(57, ABSTRACT_FISHES), SALMON_MOB(57, ABSTRACT_FISHES), // agp
TROPICAL_FISH(72, ABSTRACT_FISHES), TROPICAL_FISH(72, ABSTRACT_FISHES), // agu
// Monsters // Monsters
ABSTRACT_MONSTER(-1, ABSTRACT_CREATURE), ABSTRACT_MONSTER(-1, ABSTRACT_CREATURE), // ajs
BLAZE(4, ABSTRACT_MONSTER), BLAZE(4, ABSTRACT_MONSTER), // ajd
CREEPER(10, ABSTRACT_MONSTER), CREEPER(10, ABSTRACT_MONSTER), // ajf
ENDERMITE(19, ABSTRACT_MONSTER), ENDERMITE(19, ABSTRACT_MONSTER), // ajj
ENDERMAN(18, ABSTRACT_MONSTER), ENDERMAN(18, ABSTRACT_MONSTER), // aji
GIANT(27, ABSTRACT_MONSTER), GIANT(27, ABSTRACT_MONSTER), // ajn
SILVERFISH(61, ABSTRACT_MONSTER), SILVERFISH(61, ABSTRACT_MONSTER), // ajy
VEX(78, ABSTRACT_MONSTER), VEX(78, ABSTRACT_MONSTER), // ake
WITCH(82, ABSTRACT_MONSTER), WITCH(82, ABSTRACT_MONSTER), // akg
WITHER(83, ABSTRACT_MONSTER), WITHER(83, ABSTRACT_MONSTER), // aij
// Illagers // Illagers
ABSTRACT_ILLAGER_BASE(-1, ABSTRACT_MONSTER), ABSTRACT_ILLAGER_BASE(-1, ABSTRACT_MONSTER), // ajb
ABSTRACT_EVO_ILLU_ILLAGER(-1, ABSTRACT_ILLAGER_BASE), ABSTRACT_EVO_ILLU_ILLAGER(-1, ABSTRACT_ILLAGER_BASE), // akb
EVOCATION_ILLAGER(21, ABSTRACT_EVO_ILLU_ILLAGER), EVOCATION_ILLAGER(21, ABSTRACT_EVO_ILLU_ILLAGER), // ajl
ILLUSION_ILLAGER(31, ABSTRACT_EVO_ILLU_ILLAGER), ILLUSION_ILLAGER(31, ABSTRACT_EVO_ILLU_ILLAGER), // ajq
VINDICATION_ILLAGER(81, ABSTRACT_ILLAGER_BASE), VINDICATION_ILLAGER(81, ABSTRACT_ILLAGER_BASE), // akf
// Skeletons // Skeletons
ABSTRACT_SKELETON(-1, ABSTRACT_MONSTER), ABSTRACT_SKELETON(-1, ABSTRACT_MONSTER), // ajc
SKELETON(62, ABSTRACT_SKELETON), SKELETON(62, ABSTRACT_SKELETON), // ajz
STRAY(71, ABSTRACT_SKELETON), STRAY(71, ABSTRACT_SKELETON), // akd
WITHER_SKELETON(84, ABSTRACT_SKELETON), WITHER_SKELETON(84, ABSTRACT_SKELETON), // akh
// Guardians // Guardians
GUARDIAN(28, ABSTRACT_MONSTER), GUARDIAN(28, ABSTRACT_MONSTER), // ajo
ELDER_GUARDIAN(15, GUARDIAN), ELDER_GUARDIAN(15, GUARDIAN), // ajh
// Spiders // Spiders
SPIDER(69, ABSTRACT_MONSTER), SPIDER(69, ABSTRACT_MONSTER), // akc
CAVE_SPIDER(6, SPIDER), CAVE_SPIDER(6, SPIDER), // aje
// Zombies - META CHECKED // Zombies - META CHECKED
ZOMBIE(87, ABSTRACT_MONSTER), ZOMBIE(87, ABSTRACT_MONSTER), // aki
DROWNED(14, ZOMBIE), DROWNED(14, ZOMBIE), // ajg
HUSK(30, ZOMBIE), HUSK(30, ZOMBIE), // ajp
ZOMBIE_PIGMAN(53, ZOMBIE), ZOMBIE_PIGMAN(53, ZOMBIE), // aju
ZOMBIE_VILLAGER(89, ZOMBIE), ZOMBIE_VILLAGER(89, ZOMBIE), // akj
// Flying entities // Flying entities
ABSTRACT_FLYING(-1, ABSTRACT_INSENTIENT), ABSTRACT_FLYING(-1, ABSTRACT_INSENTIENT), // abt
GHAST(26, ABSTRACT_FLYING), GHAST(26, ABSTRACT_FLYING), // ajm
PHANTOM(90, ABSTRACT_FLYING), PHANTOM(90, ABSTRACT_FLYING), // ajt
ABSTRACT_AMBIENT(-1, ABSTRACT_INSENTIENT), ABSTRACT_AMBIENT(-1, ABSTRACT_INSENTIENT), // afy
BAT(3, ABSTRACT_AMBIENT), BAT(3, ABSTRACT_AMBIENT), // afz
ABSTRACT_WATERMOB(-1, ABSTRACT_INSENTIENT), ABSTRACT_WATERMOB(-1, ABSTRACT_INSENTIENT), // agx
SQUID(70, ABSTRACT_WATERMOB), SQUID(70, ABSTRACT_WATERMOB), // agt
DOLPHIN(12, ABSTRACT_WATERMOB), // ajq
// Slimes // Slimes
SLIME(64, ABSTRACT_INSENTIENT), SLIME(64, ABSTRACT_INSENTIENT), // aka
MAGMA_CUBE(38, SLIME), MAGMA_CUBE(38, SLIME), // ajr
// Hangable objects // Hangable objects
ABSTRACT_HANGING(-1, ENTITY), ABSTRACT_HANGING(-1, ENTITY), // aim
LEASH_KNOT(35, ABSTRACT_HANGING), LEASH_KNOT(35, ABSTRACT_HANGING), // aio
ITEM_FRAME(33, ABSTRACT_HANGING), ITEM_FRAME(33, ABSTRACT_HANGING), // ain
PAINTING(49, ABSTRACT_HANGING), PAINTING(49, ABSTRACT_HANGING), // aiq
ABSTRACT_LIGHTNING(-1, ENTITY), ABSTRACT_LIGHTNING(-1, ENTITY), // aiu
LIGHTNING_BOLT(91, ABSTRACT_LIGHTNING), LIGHTNING_BOLT(91, ABSTRACT_LIGHTNING), // aiv
// Arrows // Arrows
ABSTRACT_ARROW(-1, ENTITY), ABSTRACT_ARROW(-1, ENTITY), // akw
ARROW(2, ABSTRACT_ARROW), ARROW(2, ABSTRACT_ARROW), // aky
SPECTRAL_ARROW(68, ABSTRACT_ARROW), SPECTRAL_ARROW(68, ABSTRACT_ARROW), // alk
TRIDENT(94, ABSTRACT_ARROW), TRIDENT(94, ABSTRACT_ARROW), // alq
// Fireballs // Fireballs
ABSTRACT_FIREBALL(-1, ENTITY), ABSTRACT_FIREBALL(-1, ENTITY), // akx
DRAGON_FIREBALL(13, ABSTRACT_FIREBALL), DRAGON_FIREBALL(13, ABSTRACT_FIREBALL), // akz
FIREBALL(34, ABSTRACT_FIREBALL), FIREBALL(34, ABSTRACT_FIREBALL), // ald
SMALL_FIREBALL(65, ABSTRACT_FIREBALL), SMALL_FIREBALL(65, ABSTRACT_FIREBALL), // ali
WITHER_SKULL(85, ABSTRACT_FIREBALL), WITHER_SKULL(85, ABSTRACT_FIREBALL), // alr
// Projectiles // Projectiles
PROJECTILE_ABSTRACT(-1, ENTITY), PROJECTILE_ABSTRACT(-1, ENTITY), // all
SNOWBALL(67, PROJECTILE_ABSTRACT), SNOWBALL(67, PROJECTILE_ABSTRACT), // alj
ENDER_PEARL(75, PROJECTILE_ABSTRACT), ENDER_PEARL(75, PROJECTILE_ABSTRACT), // aln
EGG(74, PROJECTILE_ABSTRACT), EGG(74, PROJECTILE_ABSTRACT), // alm
POTION(77, PROJECTILE_ABSTRACT), POTION(77, PROJECTILE_ABSTRACT), // alp
XP_BOTTLE(76, PROJECTILE_ABSTRACT), XP_BOTTLE(76, PROJECTILE_ABSTRACT), // alo
// Vehicles // Vehicles
MINECART_ABSTRACT(-1, ENTITY), MINECART_ABSTRACT(-1, ENTITY), // alt
CHESTED_MINECART_ABSTRACT(-1, MINECART_ABSTRACT), CHESTED_MINECART_ABSTRACT(-1, MINECART_ABSTRACT), // alu
CHEST_MINECART(40, CHESTED_MINECART_ABSTRACT), CHEST_MINECART(40, CHESTED_MINECART_ABSTRACT), // alx
HOPPER_MINECART(43, CHESTED_MINECART_ABSTRACT), HOPPER_MINECART(43, CHESTED_MINECART_ABSTRACT), // ama
MINECART(39, MINECART_ABSTRACT), MINECART(39, MINECART_ABSTRACT), // alw
FURNACE_MINECART(42, MINECART_ABSTRACT), FURNACE_MINECART(42, MINECART_ABSTRACT), // alz
COMMANDBLOCK_MINECART(41, MINECART_ABSTRACT), COMMANDBLOCK_MINECART(41, MINECART_ABSTRACT), // aly
TNT_MINECART(45, MINECART_ABSTRACT), TNT_MINECART(45, MINECART_ABSTRACT), // amc
SPAWNER_MINECART(44, MINECART_ABSTRACT), SPAWNER_MINECART(44, MINECART_ABSTRACT), // amb
BOAT(5, ENTITY); BOAT(5, ENTITY); // alv
private final int id; private final int id;

Datei anzeigen

@ -5,6 +5,7 @@ import nl.matsv.viabackwards.api.entities.storage.EntityData;
import nl.matsv.viabackwards.api.entities.storage.MetaStorage; import nl.matsv.viabackwards.api.entities.storage.MetaStorage;
import nl.matsv.viabackwards.api.entities.types.AbstractEntityType; import nl.matsv.viabackwards.api.entities.types.AbstractEntityType;
import nl.matsv.viabackwards.api.entities.types.EntityType1_13; import nl.matsv.viabackwards.api.entities.types.EntityType1_13;
import nl.matsv.viabackwards.api.entities.types.EntityType1_13.EntityType;
import nl.matsv.viabackwards.api.rewriters.EntityRewriter; import nl.matsv.viabackwards.api.rewriters.EntityRewriter;
import nl.matsv.viabackwards.protocol.protocol1_12_2to1_13.Protocol1_12_2To1_13; import nl.matsv.viabackwards.protocol.protocol1_12_2to1_13.Protocol1_12_2To1_13;
import nl.matsv.viabackwards.protocol.protocol1_12_2to1_13.data.EntityTypeMapping; import nl.matsv.viabackwards.protocol.protocol1_12_2to1_13.data.EntityTypeMapping;
@ -44,7 +45,7 @@ public class EntityPackets1_13 extends EntityRewriter<Protocol1_12_2To1_13> {
@Override @Override
public void handle(PacketWrapper wrapper) throws Exception { public void handle(PacketWrapper wrapper) throws Exception {
byte type = wrapper.get(Type.BYTE, 0); byte type = wrapper.get(Type.BYTE, 0);
EntityType1_13.EntityType entityType = EntityType1_13.getTypeFromId(type, true); EntityType entityType = EntityType1_13.getTypeFromId(type, true);
if (entityType == null) { if (entityType == null) {
ViaBackwards.getPlatform().getLogger().warning("Could not find 1.13 entity type " + type); ViaBackwards.getPlatform().getLogger().warning("Could not find 1.13 entity type " + type);
return; return;
@ -96,7 +97,7 @@ public class EntityPackets1_13 extends EntityRewriter<Protocol1_12_2To1_13> {
addTrackedEntity( addTrackedEntity(
wrapper.user(), wrapper.user(),
wrapper.get(Type.VAR_INT, 0), wrapper.get(Type.VAR_INT, 0),
EntityType1_13.EntityType.XP_ORB EntityType.XP_ORB
); );
} }
}); });
@ -115,7 +116,7 @@ public class EntityPackets1_13 extends EntityRewriter<Protocol1_12_2To1_13> {
addTrackedEntity( addTrackedEntity(
wrapper.user(), wrapper.user(),
wrapper.get(Type.VAR_INT, 0), wrapper.get(Type.VAR_INT, 0),
EntityType1_13.EntityType.LIGHTNING_BOLT EntityType.LIGHTNING_BOLT
); );
} }
}); });
@ -144,7 +145,7 @@ public class EntityPackets1_13 extends EntityRewriter<Protocol1_12_2To1_13> {
@Override @Override
public void handle(PacketWrapper wrapper) throws Exception { public void handle(PacketWrapper wrapper) throws Exception {
int type = wrapper.get(Type.VAR_INT, 1); int type = wrapper.get(Type.VAR_INT, 1);
EntityType1_13.EntityType entityType = EntityType1_13.getTypeFromId(type, false); EntityType entityType = EntityType1_13.getTypeFromId(type, false);
addTrackedEntity( addTrackedEntity(
wrapper.user(), wrapper.user(),
wrapper.get(Type.VAR_INT, 0), wrapper.get(Type.VAR_INT, 0),
@ -213,7 +214,7 @@ public class EntityPackets1_13 extends EntityRewriter<Protocol1_12_2To1_13> {
addTrackedEntity( addTrackedEntity(
wrapper.user(), wrapper.user(),
wrapper.get(Type.VAR_INT, 0), wrapper.get(Type.VAR_INT, 0),
EntityType1_13.EntityType.PLAYER EntityType.PLAYER
); );
} }
}); });
@ -248,7 +249,7 @@ public class EntityPackets1_13 extends EntityRewriter<Protocol1_12_2To1_13> {
addTrackedEntity( addTrackedEntity(
wrapper.user(), wrapper.user(),
wrapper.get(Type.VAR_INT, 0), wrapper.get(Type.VAR_INT, 0),
EntityType1_13.EntityType.PAINTING EntityType.PAINTING
); );
} }
}); });
@ -334,8 +335,26 @@ public class EntityPackets1_13 extends EntityRewriter<Protocol1_12_2To1_13> {
@Override @Override
protected void registerRewrites() { protected void registerRewrites() {
// Rewrite new Entity 'drowned'
regEntType(EntityType.DROWNED, EntityType.ZOMBIE_VILLAGER).mobName("Drowned");
// Rewrite types // Fishy
regEntType(EntityType.COD_MOB, EntityType.SQUID).mobName("Cod");
regEntType(EntityType.SALMON_MOB, EntityType.SQUID).mobName("Salmon");
regEntType(EntityType.PUFFER_FISH, EntityType.SQUID).mobName("Puffer Fish");
regEntType(EntityType.TROPICAL_FISH, EntityType.SQUID).mobName("Tropical Fish");
// Phantom
regEntType(EntityType.PHANTOM, EntityType.PARROT).mobName("Phantom");
// Dolphin
regEntType(EntityType.DOLPHIN, EntityType.SQUID).mobName("Dolphin");
// Turtle
regEntType(EntityType.TURTLE, EntityType.OCELOT).mobName("Turtle");
// Rewrite Meta types
this.registerMetaHandler().handle(e -> { this.registerMetaHandler().handle(e -> {
Metadata meta = e.getData(); Metadata meta = e.getData();
int typeId = meta.getMetaType().getTypeID(); int typeId = meta.getMetaType().getTypeID();
@ -364,7 +383,6 @@ public class EntityPackets1_13 extends EntityRewriter<Protocol1_12_2To1_13> {
return e.getData(); return e.getData();
}); });
// TODO Remove everything for now // TODO Remove everything for now
this.registerMetaHandler().removed(); this.registerMetaHandler().removed();