public static EntityType getTypeFromId(int typeID, boolean isObject) { Optional<EntityType> type; if (isObject) type = ObjectType.getPCEntity(typeID); else type = EntityType.findById(typeID); if (!type.isPresent()) { if (!Via.getConfig().isSuppressMetadataErrors()) ViaBackwards.getPlatform().getLogger().severe("[EntityType1_10] Could not find type id " + typeID + " isObject=" + isObject); return EntityType.ENTITY; // Fall back to the basic ENTITY } return type.get(); }
public static EntityType getTypeFromId(int typeID, boolean isObject) throws Exception { Optional<EntityType> type; if (isObject) type = ObjectType.getPCEntity(typeID); else type = EntityType.findById(typeID); if (!type.isPresent()) { if (!Via.getConfig().isSuppressMetadataErrors()) ViaBackwards.getPlatform().getLogger().severe("[EntityType1_12] Could not find type id " + typeID + " isObject=" + isObject); return EntityType.ENTITY; // Fall back to the basic ENTITY } return type.get(); }
public static EntityType getTypeFromId(int typeID, boolean isObject) throws Exception { Optional<EntityType> type; if (isObject) type = ObjectType.getPCEntity(typeID); else type = EntityType.findById(typeID); if (!type.isPresent()) { if (!Via.getConfig().isSuppressMetadataErrors()) ViaBackwards.getPlatform().getLogger().severe("[EntityType1_11] Could not find type id " + typeID + " isObject=" + isObject); return EntityType.ENTITY; // Fall back to the basic ENTITY } return type.get(); }
public static void handleMetadata(int entityId, Entity1_12Types.EntityType type, List<Metadata> metadatas, UserConnection connection) { for (Metadata metadata : new ArrayList<>(metadatas)) { try { if (metadata.getValue() instanceof Item) { // Apply rewrite BedRewriter.toClientItem((Item) metadata.getValue()); } // Evocation Illager aggressive property became 13 if (type.is(Entity1_12Types.EntityType.EVOCATION_ILLAGER)) { if (metadata.getId() == 12) { metadata.setId(13); } } } catch (Exception e) { metadatas.remove(metadata); if (!Via.getConfig().isSuppressMetadataErrors() || Via.getManager().isDebug()) { Via.getPlatform().getLogger().warning("An error occurred with entity metadata handler"); Via.getPlatform().getLogger().warning("Metadata: " + metadata); e.printStackTrace(); } } } } }
if (!Via.getConfig().isSuppressMetadataErrors() || Via.getManager().isDebug()) { Via.getPlatform().getLogger().warning("An error occurred with entity type rewriter"); Via.getPlatform().getLogger().warning("Metadata: " + metadata);
protected MetaStorage handleMeta(UserConnection user, int entityId, MetaStorage storage) throws Exception { Optional<EntityTracker.StoredEntity> optEntity = getEntityTracker(user).getEntity(entityId); if (!optEntity.isPresent()) { if (!Via.getConfig().isSuppressMetadataErrors()) ViaBackwards.getPlatform().getLogger().warning("Metadata for entity id: " + entityId + " not sent because the entity doesn't exist. " + storage); throw new CancelException();
public static void handleMetadata(int entityId, Entity1_13Types.EntityType type, List<Metadata> metadatas, UserConnection connection) { for (Metadata metadata : new ArrayList<>(metadatas)) { try { // 1.13 changed item to flat item (no data) if (metadata.getMetaType() == MetaType1_13.Slot) { InventoryPackets.toClient((Item) metadata.getValue()); } else if (metadata.getMetaType() == MetaType1_13.BlockID) { // Convert to new block id int data = (int) metadata.getValue(); metadata.setValue(Protocol1_13_1To1_13.getNewBlockStateId(data)); } if (type == null) continue; if (type.isOrHasParent(Entity1_13Types.EntityType.MINECART_ABSTRACT) && metadata.getId() == 9) { // New block format int data = (int) metadata.getValue(); metadata.setValue(Protocol1_13_1To1_13.getNewBlockStateId(data)); } if (type.isOrHasParent(EntityType.ABSTRACT_ARROW) && metadata.getId() >= 7) { metadata.setId(metadata.getId() + 1); // New shooter UUID } } catch (Exception e) { metadatas.remove(metadata); if (!Via.getConfig().isSuppressMetadataErrors() || Via.getManager().isDebug()) { Via.getPlatform().getLogger().warning("An error occurred with entity metadata handler"); Via.getPlatform().getLogger().warning("Metadata: " + metadata); e.printStackTrace(); } } } }
if (!Via.getConfig().isSuppressMetadataErrors() || Via.getManager().isDebug()) { Logger log = Via.getPlatform().getLogger();
if (!Via.getConfig().isSuppressMetadataErrors() || Via.getManager().isDebug()) { Via.getPlatform().getLogger().warning("An error occurred with entity metadata handler"); Via.getPlatform().getLogger().warning("Metadata: " + metadata);
if (!Via.getConfig().isSuppressMetadataErrors() || Via.getManager().isDebug()) { Via.getPlatform().getLogger().warning("An error occurred with entity metadata handler"); Via.getPlatform().getLogger().warning("Metadata: " + metadata);