IEntityType -> EntityType

This commit is contained in:
Gerrygames 2019-05-13 12:04:03 +02:00
parent 2442520ef3
commit e8f8473e1c
8 changed files with 43 additions and 43 deletions

View File

@ -29,28 +29,28 @@ public class Entity1_10Types {
@AllArgsConstructor
@Getter
public enum EntityType implements IEntityType {
public enum EntityType implements us.myles.ViaVersion.api.entities.EntityType {
ENTITY(-1),
DROPPED_ITEM(1, EntityType.ENTITY),
EXPERIENCE_ORB(2, EntityType.ENTITY),
LEASH_HITCH(8, EntityType.ENTITY), // Actually entity hanging but it doesn't make a lot of difference for metadata
PAINTING(9, EntityType.ENTITY), // Actually entity hanging but it doesn't make a lot of difference for metadata
ARROW(10, EntityType.ENTITY),
SNOWBALL(11, EntityType.ENTITY), // Actually EntityProjectile
FIREBALL(12, EntityType.ENTITY),
SMALL_FIREBALL(13, EntityType.ENTITY),
ENDER_PEARL(14, EntityType.ENTITY), // Actually EntityProjectile
ENDER_SIGNAL(15, EntityType.ENTITY),
THROWN_EXP_BOTTLE(17, EntityType.ENTITY),
ITEM_FRAME(18, EntityType.ENTITY), // Actually EntityHanging
WITHER_SKULL(19, EntityType.ENTITY),
PRIMED_TNT(20, EntityType.ENTITY),
FALLING_BLOCK(21, EntityType.ENTITY),
FIREWORK(22, EntityType.ENTITY),
TIPPED_ARROW(23, EntityType.ARROW),
SPECTRAL_ARROW(24, EntityType.ARROW),
SHULKER_BULLET(25, EntityType.ENTITY),
DRAGON_FIREBALL(26, EntityType.FIREBALL),
DROPPED_ITEM(1, ENTITY),
EXPERIENCE_ORB(2, ENTITY),
LEASH_HITCH(8, ENTITY), // Actually entity hanging but it doesn't make a lot of difference for metadata
PAINTING(9, ENTITY), // Actually entity hanging but it doesn't make a lot of difference for metadata
ARROW(10, ENTITY),
SNOWBALL(11, ENTITY), // Actually EntityProjectile
FIREBALL(12, ENTITY),
SMALL_FIREBALL(13, ENTITY),
ENDER_PEARL(14, ENTITY), // Actually EntityProjectile
ENDER_SIGNAL(15, ENTITY),
THROWN_EXP_BOTTLE(17, ENTITY),
ITEM_FRAME(18, ENTITY), // Actually EntityHanging
WITHER_SKULL(19, ENTITY),
PRIMED_TNT(20, ENTITY),
FALLING_BLOCK(21, ENTITY),
FIREWORK(22, ENTITY),
TIPPED_ARROW(23, ARROW),
SPECTRAL_ARROW(24, ARROW),
SHULKER_BULLET(25, ENTITY),
DRAGON_FIREBALL(26, FIREBALL),
ENTITY_LIVING(-1, ENTITY),
ENTITY_INSENTIENT(-1, ENTITY_LIVING),
@ -58,7 +58,7 @@ public class Entity1_10Types {
ENTITY_TAMEABLE_ANIMAL(-1, ENTITY_AGEABLE),
ENTITY_HUMAN(-1, ENTITY_LIVING),
ARMOR_STAND(30, EntityType.ENTITY_LIVING),
ARMOR_STAND(30, ENTITY_LIVING),
// Vehicles
MINECART_ABSTRACT(-1, ENTITY),
@ -91,7 +91,7 @@ public class Entity1_10Types {
ENDERMITE(67, ENTITY_INSENTIENT),
GUARDIAN(68, ENTITY_INSENTIENT),
IRON_GOLEM(99, ENTITY_INSENTIENT), // moved up to avoid illegal forward references
SHULKER(69, EntityType.IRON_GOLEM),
SHULKER(69, IRON_GOLEM),
PIG(90, ENTITY_AGEABLE),
SHEEP(91, ENTITY_AGEABLE),
COW(92, ENTITY_AGEABLE),
@ -99,7 +99,7 @@ public class Entity1_10Types {
SQUID(94, ENTITY_INSENTIENT),
WOLF(95, ENTITY_TAMEABLE_ANIMAL),
MUSHROOM_COW(96, COW),
SNOWMAN(97, EntityType.IRON_GOLEM),
SNOWMAN(97, IRON_GOLEM),
OCELOT(98, ENTITY_TAMEABLE_ANIMAL),
HORSE(100, ENTITY_AGEABLE),
RABBIT(101, ENTITY_AGEABLE),

View File

@ -28,7 +28,7 @@ public class Entity1_11Types {
@AllArgsConstructor
@Getter
public enum EntityType implements IEntityType {
public enum EntityType implements us.myles.ViaVersion.api.entities.EntityType {
ENTITY(-1),
DROPPED_ITEM(1, ENTITY),
EXPERIENCE_ORB(2, ENTITY),
@ -103,10 +103,10 @@ public class Entity1_11Types {
ENDERMITE(67, ENTITY_INSENTIENT),
GUARDIAN(68, ENTITY_INSENTIENT),
ELDER_GUARDIAN(4, EntityType.GUARDIAN), // Moved down to avoid illegal forward reference
ELDER_GUARDIAN(4, GUARDIAN), // Moved down to avoid illegal forward reference
IRON_GOLEM(99, ENTITY_INSENTIENT), // moved up to avoid illegal forward references
SHULKER(69, EntityType.IRON_GOLEM),
SHULKER(69, IRON_GOLEM),
PIG(90, ENTITY_AGEABLE),
SHEEP(91, ENTITY_AGEABLE),
COW(92, ENTITY_AGEABLE),
@ -114,7 +114,7 @@ public class Entity1_11Types {
SQUID(94, ENTITY_INSENTIENT),
WOLF(95, ENTITY_TAMEABLE_ANIMAL),
MUSHROOM_COW(96, COW),
SNOWMAN(97, EntityType.IRON_GOLEM),
SNOWMAN(97, IRON_GOLEM),
OCELOT(98, ENTITY_TAMEABLE_ANIMAL),
ABSTRACT_HORSE(-1, ENTITY_AGEABLE),

View File

@ -38,7 +38,7 @@ public class Entity1_12Types {
@AllArgsConstructor
@Getter
public enum EntityType implements IEntityType {
public enum EntityType implements us.myles.ViaVersion.api.entities.EntityType {
ENTITY(-1),
DROPPED_ITEM(1, ENTITY),
EXPERIENCE_ORB(2, ENTITY),
@ -115,10 +115,10 @@ public class Entity1_12Types {
ENDERMITE(67, ENTITY_INSENTIENT),
GUARDIAN(68, ENTITY_INSENTIENT),
ELDER_GUARDIAN(4, EntityType.GUARDIAN), // Moved down to avoid illegal forward reference
ELDER_GUARDIAN(4, GUARDIAN), // Moved down to avoid illegal forward reference
IRON_GOLEM(99, ENTITY_INSENTIENT), // moved up to avoid illegal forward references
SHULKER(69, EntityType.IRON_GOLEM),
SHULKER(69, IRON_GOLEM),
PIG(90, ENTITY_AGEABLE),
SHEEP(91, ENTITY_AGEABLE),
COW(92, ENTITY_AGEABLE),
@ -126,7 +126,7 @@ public class Entity1_12Types {
SQUID(94, ENTITY_INSENTIENT),
WOLF(95, ENTITY_TAMEABLE_ANIMAL),
MUSHROOM_COW(96, COW),
SNOWMAN(97, EntityType.IRON_GOLEM),
SNOWMAN(97, IRON_GOLEM),
OCELOT(98, ENTITY_TAMEABLE_ANIMAL),
PARROT(105, ENTITY_TAMEABLE_ANIMAL),

View File

@ -29,7 +29,7 @@ public class Entity1_13Types {
@AllArgsConstructor
@Getter
public enum EntityType implements IEntityType {
public enum EntityType implements us.myles.ViaVersion.api.entities.EntityType {
// Auto generated
ENTITY(-1), // abm

View File

@ -11,11 +11,11 @@ import java.util.Map;
public class Entity1_14Types {
public static EntityType getTypeFromId(int typeID) {
Optional<EntityType> type = EntityType.findById(typeID);
Optional<EntityType> type = Entity1_14Types.EntityType.findById(typeID);
if (!type.isPresent()) {
Via.getPlatform().getLogger().severe("Could not find type id " + typeID);
return EntityType.ENTITY; // Fall back to the basic ENTITY
return Entity1_14Types.EntityType.ENTITY; // Fall back to the basic ENTITY
}
return type.get();
@ -23,7 +23,7 @@ public class Entity1_14Types {
@AllArgsConstructor
@Getter
public enum EntityType implements IEntityType {
public enum EntityType implements us.myles.ViaVersion.api.entities.EntityType {
// Auto generated
ENTITY(-1),
@ -210,7 +210,7 @@ public class Entity1_14Types {
}
static {
for (EntityType type : EntityType.values()) {
for (EntityType type : Entity1_14Types.EntityType.values()) {
TYPES.put(type.id, type);
}
}

View File

@ -1,9 +1,9 @@
package us.myles.ViaVersion.api.entities;
public interface IEntityType {
public interface EntityType {
int getId();
IEntityType getParent();
EntityType getParent();
}

View File

@ -2,7 +2,7 @@ package us.myles.ViaVersion.api.rewriters;
import us.myles.ViaVersion.api.Via;
import us.myles.ViaVersion.api.data.UserConnection;
import us.myles.ViaVersion.api.entities.IEntityType;
import us.myles.ViaVersion.api.entities.EntityType;
import us.myles.ViaVersion.api.minecraft.metadata.Metadata;
import java.util.ArrayList;
@ -12,7 +12,7 @@ import java.util.List;
import java.util.Map;
import java.util.logging.Logger;
public abstract class MetadataRewriter<T extends IEntityType> {
public abstract class MetadataRewriter<T extends EntityType> {
public final void handleMetadata(int entityId, T type, List<Metadata> metadatas, UserConnection connection) {
Map<Integer, Metadata> metadataMap = new HashMap<>(metadatas.size());

View File

@ -6,12 +6,12 @@ import lombok.Setter;
import us.myles.ViaVersion.api.data.ExternalJoinGameListener;
import us.myles.ViaVersion.api.data.StoredObject;
import us.myles.ViaVersion.api.data.UserConnection;
import us.myles.ViaVersion.api.entities.IEntityType;
import us.myles.ViaVersion.api.entities.EntityType;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
public abstract class EntityTracker<T extends IEntityType> extends StoredObject implements ExternalJoinGameListener {
public abstract class EntityTracker<T extends EntityType> extends StoredObject implements ExternalJoinGameListener {
private final Map<Integer, T> clientEntityTypes = new ConcurrentHashMap<>();
@Getter
@Setter