Mirror von
https://github.com/ViaVersion/ViaVersion.git
synchronisiert 2024-09-08 22:02:50 +02:00
Cleanup metadata
Dieser Commit ist enthalten in:
Ursprung
30bb91fc8a
Commit
42efc736c3
@ -0,0 +1,20 @@
|
|||||||
|
package us.myles.ViaVersion.api.minecraft.metadata;
|
||||||
|
|
||||||
|
import us.myles.ViaVersion.api.type.Type;
|
||||||
|
|
||||||
|
public interface MetaType {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the write/read type
|
||||||
|
*
|
||||||
|
* @return Type instance
|
||||||
|
*/
|
||||||
|
Type getType();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get type id from the specific MetaDataType
|
||||||
|
*
|
||||||
|
* @return Type id as an integer
|
||||||
|
*/
|
||||||
|
int getTypeID();
|
||||||
|
}
|
@ -2,13 +2,11 @@ package us.myles.ViaVersion.api.minecraft.metadata;
|
|||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import us.myles.ViaVersion.api.type.Type;
|
|
||||||
|
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
@Data
|
@Data
|
||||||
public class Metadata {
|
public class Metadata {
|
||||||
private int id;
|
private int id;
|
||||||
private int typeID;
|
private MetaType metaType;
|
||||||
private Type type;
|
|
||||||
private Object value;
|
private Object value;
|
||||||
}
|
}
|
||||||
|
@ -1,12 +1,13 @@
|
|||||||
package us.myles.ViaVersion.protocols.protocol1_9to1_8.metadata;
|
package us.myles.ViaVersion.api.minecraft.metadata.types;
|
||||||
|
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import us.myles.ViaVersion.api.minecraft.metadata.MetaType;
|
||||||
import us.myles.ViaVersion.api.type.Type;
|
import us.myles.ViaVersion.api.type.Type;
|
||||||
|
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
@Getter
|
@Getter
|
||||||
public enum MetadataTypes {
|
public enum MetaType1_8 implements MetaType {
|
||||||
Byte(0, Type.BYTE),
|
Byte(0, Type.BYTE),
|
||||||
Short(1, Type.SHORT),
|
Short(1, Type.SHORT),
|
||||||
Int(2, Type.INT),
|
Int(2, Type.INT),
|
||||||
@ -20,7 +21,7 @@ public enum MetadataTypes {
|
|||||||
private final int typeID;
|
private final int typeID;
|
||||||
private final Type type;
|
private final Type type;
|
||||||
|
|
||||||
public static MetadataTypes byId(int id) {
|
public static MetaType1_8 byId(int id) {
|
||||||
return values()[id];
|
return values()[id];
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,12 +1,13 @@
|
|||||||
package us.myles.ViaVersion.protocols.protocol1_9to1_8.metadata;
|
package us.myles.ViaVersion.api.minecraft.metadata.types;
|
||||||
|
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import us.myles.ViaVersion.api.minecraft.metadata.MetaType;
|
||||||
import us.myles.ViaVersion.api.type.Type;
|
import us.myles.ViaVersion.api.type.Type;
|
||||||
|
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
@Getter
|
@Getter
|
||||||
public enum NewType {
|
public enum MetaType1_9 implements MetaType {
|
||||||
Byte(0, Type.BYTE),
|
Byte(0, Type.BYTE),
|
||||||
VarInt(1, Type.VAR_INT),
|
VarInt(1, Type.VAR_INT),
|
||||||
Float(2, Type.FLOAT),
|
Float(2, Type.FLOAT),
|
||||||
@ -25,7 +26,7 @@ public enum NewType {
|
|||||||
private final int typeID;
|
private final int typeID;
|
||||||
private final Type type;
|
private final Type type;
|
||||||
|
|
||||||
public static NewType byId(int id) {
|
public static MetaType1_9 byId(int id) {
|
||||||
return values()[id];
|
return values()[id];
|
||||||
}
|
}
|
||||||
|
|
@ -3,8 +3,8 @@ package us.myles.ViaVersion.api.type.types.version;
|
|||||||
|
|
||||||
import io.netty.buffer.ByteBuf;
|
import io.netty.buffer.ByteBuf;
|
||||||
import us.myles.ViaVersion.api.minecraft.metadata.Metadata;
|
import us.myles.ViaVersion.api.minecraft.metadata.Metadata;
|
||||||
|
import us.myles.ViaVersion.api.minecraft.metadata.types.MetaType1_8;
|
||||||
import us.myles.ViaVersion.api.type.types.minecraft.MetaTypeTemplate;
|
import us.myles.ViaVersion.api.type.types.minecraft.MetaTypeTemplate;
|
||||||
import us.myles.ViaVersion.protocols.protocol1_9to1_8.metadata.MetadataTypes;
|
|
||||||
|
|
||||||
public class Metadata1_8Type extends MetaTypeTemplate {
|
public class Metadata1_8Type extends MetaTypeTemplate {
|
||||||
|
|
||||||
@ -13,15 +13,15 @@ public class Metadata1_8Type extends MetaTypeTemplate {
|
|||||||
byte item = buffer.readByte();
|
byte item = buffer.readByte();
|
||||||
if (item == 127) return null; // end of metadata
|
if (item == 127) return null; // end of metadata
|
||||||
int typeID = (item & 0xE0) >> 5;
|
int typeID = (item & 0xE0) >> 5;
|
||||||
MetadataTypes type = MetadataTypes.byId(typeID);
|
MetaType1_8 type = MetaType1_8.byId(typeID);
|
||||||
int id = item & 0x1F;
|
int id = item & 0x1F;
|
||||||
return new Metadata(id, typeID, type.getType(), type.getType().read(buffer));
|
return new Metadata(id, type, type.getType().read(buffer));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void write(ByteBuf buffer, Metadata meta) throws Exception {
|
public void write(ByteBuf buffer, Metadata meta) throws Exception {
|
||||||
byte item = (byte) (meta.getTypeID() << 5 | meta.getId() & 0x1F);
|
byte item = (byte) (meta.getMetaType().getTypeID() << 5 | meta.getId() & 0x1F);
|
||||||
buffer.writeByte(item);
|
buffer.writeByte(item);
|
||||||
meta.getType().write(buffer, meta.getValue());
|
meta.getMetaType().getType().write(buffer, meta.getValue());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,8 +2,8 @@ package us.myles.ViaVersion.api.type.types.version;
|
|||||||
|
|
||||||
import io.netty.buffer.ByteBuf;
|
import io.netty.buffer.ByteBuf;
|
||||||
import us.myles.ViaVersion.api.minecraft.metadata.Metadata;
|
import us.myles.ViaVersion.api.minecraft.metadata.Metadata;
|
||||||
|
import us.myles.ViaVersion.api.minecraft.metadata.types.MetaType1_9;
|
||||||
import us.myles.ViaVersion.api.type.types.minecraft.MetaTypeTemplate;
|
import us.myles.ViaVersion.api.type.types.minecraft.MetaTypeTemplate;
|
||||||
import us.myles.ViaVersion.protocols.protocol1_9to1_8.metadata.NewType;
|
|
||||||
|
|
||||||
public class Metadata1_9Type extends MetaTypeTemplate {
|
public class Metadata1_9Type extends MetaTypeTemplate {
|
||||||
|
|
||||||
@ -12,9 +12,9 @@ public class Metadata1_9Type extends MetaTypeTemplate {
|
|||||||
short index = buffer.readUnsignedByte();
|
short index = buffer.readUnsignedByte();
|
||||||
|
|
||||||
if (index == 0xff) return null; //End of metadata
|
if (index == 0xff) return null; //End of metadata
|
||||||
NewType type = NewType.byId(buffer.readByte());
|
MetaType1_9 type = MetaType1_9.byId(buffer.readByte());
|
||||||
|
|
||||||
return new Metadata(index, type.getTypeID(), type.getType(), type.getType().read(buffer));
|
return new Metadata(index, type, type.getType().read(buffer));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -23,8 +23,8 @@ public class Metadata1_9Type extends MetaTypeTemplate {
|
|||||||
buffer.writeByte(255);
|
buffer.writeByte(255);
|
||||||
} else {
|
} else {
|
||||||
buffer.writeByte(object.getId());
|
buffer.writeByte(object.getId());
|
||||||
buffer.writeByte(object.getTypeID());
|
buffer.writeByte(object.getMetaType().getTypeID());
|
||||||
object.getType().write(buffer, object.getValue());
|
object.getMetaType().getType().write(buffer, object.getValue());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,8 @@ package us.myles.ViaVersion.protocols.protocol1_9to1_8.metadata;
|
|||||||
import com.google.common.base.Optional;
|
import com.google.common.base.Optional;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import us.myles.ViaVersion.api.Pair;
|
import us.myles.ViaVersion.api.Pair;
|
||||||
|
import us.myles.ViaVersion.api.minecraft.metadata.types.MetaType1_8;
|
||||||
|
import us.myles.ViaVersion.api.minecraft.metadata.types.MetaType1_9;
|
||||||
import us.myles.ViaVersion.util.EntityUtil;
|
import us.myles.ViaVersion.util.EntityUtil;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
@ -13,132 +15,132 @@ import static us.myles.ViaVersion.util.EntityUtil.EntityType.*;
|
|||||||
public enum MetaIndex {
|
public enum MetaIndex {
|
||||||
|
|
||||||
// entity
|
// entity
|
||||||
ENTITY_STATUS(ENTITY, 0, Type.Byte, NewType.Byte),
|
ENTITY_STATUS(ENTITY, 0, MetaType1_8.Byte, MetaType1_9.Byte),
|
||||||
ENTITY_AIR(ENTITY, 1, Type.Short, NewType.VarInt),
|
ENTITY_AIR(ENTITY, 1, MetaType1_8.Short, MetaType1_9.VarInt),
|
||||||
ENTITY_NAMETAG(ENTITY, 2, Type.String, NewType.String), // in the entity class @ spigot 1.8.8, blame wiki.vg
|
ENTITY_NAMETAG(ENTITY, 2, MetaType1_8.String, MetaType1_9.String), // in the entity class @ spigot 1.8.8, blame wiki.vg
|
||||||
ENTITY_ALWAYS_SHOW_NAMETAG(ENTITY, 3, Type.Byte, NewType.Boolean), // in the entity class @ Spigot 1.8.8, blame wiki.vg
|
ENTITY_ALWAYS_SHOW_NAMETAG(ENTITY, 3, MetaType1_8.Byte, MetaType1_9.Boolean), // in the entity class @ Spigot 1.8.8, blame wiki.vg
|
||||||
ENTITY_SILENT(ENTITY, 4, Type.Byte, NewType.Boolean),
|
ENTITY_SILENT(ENTITY, 4, MetaType1_8.Byte, MetaType1_9.Boolean),
|
||||||
// living entity
|
// living entity
|
||||||
LIVINGENTITY_HEALTH(ENTITY_LIVING, 6, Type.Float, NewType.Float),
|
LIVINGENTITY_HEALTH(ENTITY_LIVING, 6, MetaType1_8.Float, MetaType1_9.Float),
|
||||||
LIVINGENTITY_POTION_EFFECT_COLOR(ENTITY_LIVING, 7, Type.Int, NewType.VarInt),
|
LIVINGENTITY_POTION_EFFECT_COLOR(ENTITY_LIVING, 7, MetaType1_8.Int, MetaType1_9.VarInt),
|
||||||
LIVINGENTITY_IS_POTION_AMBIENT(ENTITY_LIVING, 8, Type.Byte, NewType.Boolean),
|
LIVINGENTITY_IS_POTION_AMBIENT(ENTITY_LIVING, 8, MetaType1_8.Byte, MetaType1_9.Boolean),
|
||||||
LIVINGENTITY_NUMBER_OF_ARROWS_IN(ENTITY_LIVING, 9, Type.Byte, NewType.VarInt),
|
LIVINGENTITY_NUMBER_OF_ARROWS_IN(ENTITY_LIVING, 9, MetaType1_8.Byte, MetaType1_9.VarInt),
|
||||||
LIVINGENTITY_NO_AI(ENTITY_LIVING, 15, Type.Byte, 10, NewType.Byte), // in 1.9 this is combined with Left handed, oh.
|
LIVINGENTITY_NO_AI(ENTITY_LIVING, 15, MetaType1_8.Byte, 10, MetaType1_9.Byte), // in 1.9 this is combined with Left handed, oh.
|
||||||
// ageable
|
// ageable
|
||||||
AGEABLE_AGE(ENTITY_AGEABLE, 12, Type.Byte, 11, NewType.Boolean),
|
AGEABLE_AGE(ENTITY_AGEABLE, 12, MetaType1_8.Byte, 11, MetaType1_9.Boolean),
|
||||||
// armour stand
|
// armour stand
|
||||||
STAND_INFO(ARMOR_STAND, 10, Type.Byte, NewType.Byte),
|
STAND_INFO(ARMOR_STAND, 10, MetaType1_8.Byte, MetaType1_9.Byte),
|
||||||
STAND_HEAD_POS(ARMOR_STAND, 11, Type.Rotation, NewType.Vector3F),
|
STAND_HEAD_POS(ARMOR_STAND, 11, MetaType1_8.Rotation, MetaType1_9.Vector3F),
|
||||||
STAND_BODY_POS(ARMOR_STAND, 12, Type.Rotation, NewType.Vector3F),
|
STAND_BODY_POS(ARMOR_STAND, 12, MetaType1_8.Rotation, MetaType1_9.Vector3F),
|
||||||
STAND_LA_POS(ARMOR_STAND, 13, Type.Rotation, NewType.Vector3F),
|
STAND_LA_POS(ARMOR_STAND, 13, MetaType1_8.Rotation, MetaType1_9.Vector3F),
|
||||||
STAND_RA_POS(ARMOR_STAND, 14, Type.Rotation, NewType.Vector3F),
|
STAND_RA_POS(ARMOR_STAND, 14, MetaType1_8.Rotation, MetaType1_9.Vector3F),
|
||||||
STAND_LL_POS(ARMOR_STAND, 15, Type.Rotation, NewType.Vector3F),
|
STAND_LL_POS(ARMOR_STAND, 15, MetaType1_8.Rotation, MetaType1_9.Vector3F),
|
||||||
STAND_RL_POS(ARMOR_STAND, 16, Type.Rotation, NewType.Vector3F),
|
STAND_RL_POS(ARMOR_STAND, 16, MetaType1_8.Rotation, MetaType1_9.Vector3F),
|
||||||
// human, discountined?
|
// human, discountined?
|
||||||
PLAYER_SKIN_FLAGS(ENTITY_HUMAN, 10, Type.Byte, 12, NewType.Byte), // unsigned on 1.8
|
PLAYER_SKIN_FLAGS(ENTITY_HUMAN, 10, MetaType1_8.Byte, 12, MetaType1_9.Byte), // unsigned on 1.8
|
||||||
PLAYER_HUMAN_BYTE(ENTITY_HUMAN, 16, Type.Byte, NewType.Discontinued), // unused on 1.8
|
PLAYER_HUMAN_BYTE(ENTITY_HUMAN, 16, MetaType1_8.Byte, MetaType1_9.Discontinued), // unused on 1.8
|
||||||
PLAYER_ADDITIONAL_HEARTS(ENTITY_HUMAN, 17, Type.Float, 10, NewType.Float),
|
PLAYER_ADDITIONAL_HEARTS(ENTITY_HUMAN, 17, MetaType1_8.Float, 10, MetaType1_9.Float),
|
||||||
PLAYER_SCORE(ENTITY_HUMAN, 18, Type.Int, 11, NewType.VarInt),
|
PLAYER_SCORE(ENTITY_HUMAN, 18, MetaType1_8.Int, 11, MetaType1_9.VarInt),
|
||||||
PLAYER_HAND(ENTITY_HUMAN, -1, Type.NonExistent, 5, NewType.Byte), // new in 1.9
|
PLAYER_HAND(ENTITY_HUMAN, -1, MetaType1_8.NonExistent, 5, MetaType1_9.Byte), // new in 1.9
|
||||||
SOMETHING_ANTICHEAT_PLUGINS_FOR_SOME_REASON_USE(ENTITY_HUMAN, 11, Type.Byte, NewType.Discontinued), //For what we know, This doesn't exists. If you think it exists and knows what it does. Please tell us.
|
SOMETHING_ANTICHEAT_PLUGINS_FOR_SOME_REASON_USE(ENTITY_HUMAN, 11, MetaType1_8.Byte, MetaType1_9.Discontinued), //For what we know, This doesn't exists. If you think it exists and knows what it does. Please tell us.
|
||||||
// horse
|
// horse
|
||||||
HORSE_INFO(HORSE, 16, Type.Int, 12, NewType.Byte),
|
HORSE_INFO(HORSE, 16, MetaType1_8.Int, 12, MetaType1_9.Byte),
|
||||||
HORSE_TYPE(HORSE, 19, Type.Byte, 13, NewType.VarInt),
|
HORSE_TYPE(HORSE, 19, MetaType1_8.Byte, 13, MetaType1_9.VarInt),
|
||||||
HORSE_SUBTYPE(HORSE, 20, Type.Int, 14, NewType.VarInt),
|
HORSE_SUBTYPE(HORSE, 20, MetaType1_8.Int, 14, MetaType1_9.VarInt),
|
||||||
HORSE_OWNER(HORSE, 21, Type.String, 15, NewType.OptUUID),
|
HORSE_OWNER(HORSE, 21, MetaType1_8.String, 15, MetaType1_9.OptUUID),
|
||||||
HORSE_ARMOR(HORSE, 22, Type.Int, 16, NewType.VarInt),
|
HORSE_ARMOR(HORSE, 22, MetaType1_8.Int, 16, MetaType1_9.VarInt),
|
||||||
// bat
|
// bat
|
||||||
BAT_ISHANGING(BAT, 16, Type.Byte, 11, NewType.Byte),
|
BAT_ISHANGING(BAT, 16, MetaType1_8.Byte, 11, MetaType1_9.Byte),
|
||||||
// tameable
|
// tameable
|
||||||
TAMING_INFO(ENTITY_TAMEABLE_ANIMAL, 16, Type.Byte, 12, NewType.Byte),
|
TAMING_INFO(ENTITY_TAMEABLE_ANIMAL, 16, MetaType1_8.Byte, 12, MetaType1_9.Byte),
|
||||||
TAMING_OWNER(ENTITY_TAMEABLE_ANIMAL, 17, Type.String, 13, NewType.OptUUID),
|
TAMING_OWNER(ENTITY_TAMEABLE_ANIMAL, 17, MetaType1_8.String, 13, MetaType1_9.OptUUID),
|
||||||
// ocelot
|
// ocelot
|
||||||
OCELOT_TYPE(OCELOT, 18, Type.Byte, 14, NewType.VarInt),
|
OCELOT_TYPE(OCELOT, 18, MetaType1_8.Byte, 14, MetaType1_9.VarInt),
|
||||||
// wolf
|
// wolf
|
||||||
WOLF_HEALTH(WOLF, 18, Type.Float, 14, NewType.Float),
|
WOLF_HEALTH(WOLF, 18, MetaType1_8.Float, 14, MetaType1_9.Float),
|
||||||
WOLF_BEGGING(WOLF, 19, Type.Byte, 15, NewType.Boolean),
|
WOLF_BEGGING(WOLF, 19, MetaType1_8.Byte, 15, MetaType1_9.Boolean),
|
||||||
WOLF_COLLAR(WOLF, 20, Type.Byte, 16, NewType.VarInt),
|
WOLF_COLLAR(WOLF, 20, MetaType1_8.Byte, 16, MetaType1_9.VarInt),
|
||||||
// pig
|
// pig
|
||||||
PIG_SADDLE(PIG, 16, Type.Byte, 12, NewType.Boolean),
|
PIG_SADDLE(PIG, 16, MetaType1_8.Byte, 12, MetaType1_9.Boolean),
|
||||||
// rabbit
|
// rabbit
|
||||||
RABBIT_TYPE(RABBIT, 18, Type.Byte, 12, NewType.VarInt),
|
RABBIT_TYPE(RABBIT, 18, MetaType1_8.Byte, 12, MetaType1_9.VarInt),
|
||||||
// sheep
|
// sheep
|
||||||
SHEEP_COLOR(SHEEP, 16, Type.Byte, 12, NewType.Byte),
|
SHEEP_COLOR(SHEEP, 16, MetaType1_8.Byte, 12, MetaType1_9.Byte),
|
||||||
// villager
|
// villager
|
||||||
VILLAGER_PROFESSION(VILLAGER, 16, Type.Int, 12, NewType.VarInt),
|
VILLAGER_PROFESSION(VILLAGER, 16, MetaType1_8.Int, 12, MetaType1_9.VarInt),
|
||||||
// enderman
|
// enderman
|
||||||
ENDERMAN_BLOCK(ENDERMAN, 16, Type.Short, 11, NewType.BlockID), // special case
|
ENDERMAN_BLOCK(ENDERMAN, 16, MetaType1_8.Short, 11, MetaType1_9.BlockID), // special case
|
||||||
ENDERMAN_BLOCKDATA(ENDERMAN, 17, Type.Byte, 11, NewType.BlockID), // special case
|
ENDERMAN_BLOCKDATA(ENDERMAN, 17, MetaType1_8.Byte, 11, MetaType1_9.BlockID), // special case
|
||||||
ENDERMAN_ISSCREAMING(ENDERMAN, 18, Type.Byte, 12, NewType.Boolean),
|
ENDERMAN_ISSCREAMING(ENDERMAN, 18, MetaType1_8.Byte, 12, MetaType1_9.Boolean),
|
||||||
// zombie
|
// zombie
|
||||||
ZOMBIE_ISCHILD(ZOMBIE, 12, Type.Byte, 11, NewType.Boolean),
|
ZOMBIE_ISCHILD(ZOMBIE, 12, MetaType1_8.Byte, 11, MetaType1_9.Boolean),
|
||||||
ZOMBIE_ISVILLAGER(ZOMBIE, 13, Type.Byte, 12, NewType.VarInt),
|
ZOMBIE_ISVILLAGER(ZOMBIE, 13, MetaType1_8.Byte, 12, MetaType1_9.VarInt),
|
||||||
ZOMBIE_ISCONVERTING(ZOMBIE, 14, Type.Byte, 13, NewType.Boolean),
|
ZOMBIE_ISCONVERTING(ZOMBIE, 14, MetaType1_8.Byte, 13, MetaType1_9.Boolean),
|
||||||
// ZOMBIE_RISINGHANDS added in 1.9
|
// ZOMBIE_RISINGHANDS added in 1.9
|
||||||
// blaze
|
// blaze
|
||||||
BLAZE_ONFIRE(BLAZE, 16, Type.Byte, 11, NewType.Byte),
|
BLAZE_ONFIRE(BLAZE, 16, MetaType1_8.Byte, 11, MetaType1_9.Byte),
|
||||||
// spider
|
// spider
|
||||||
SPIDER_CIMBING(SPIDER, 16, Type.Byte, 11, NewType.Byte),
|
SPIDER_CIMBING(SPIDER, 16, MetaType1_8.Byte, 11, MetaType1_9.Byte),
|
||||||
// creeper
|
// creeper
|
||||||
CREEPER_FUSE(CREEPER, 16, Type.Byte, 11, NewType.VarInt), // -1 idle, 1 is fuse
|
CREEPER_FUSE(CREEPER, 16, MetaType1_8.Byte, 11, MetaType1_9.VarInt), // -1 idle, 1 is fuse
|
||||||
CREEPER_ISPOWERED(CREEPER, 17, Type.Byte, 12, NewType.Boolean),
|
CREEPER_ISPOWERED(CREEPER, 17, MetaType1_8.Byte, 12, MetaType1_9.Boolean),
|
||||||
CREEPER_ISIGNITED(CREEPER, 18, Type.Byte, 13, NewType.Boolean),
|
CREEPER_ISIGNITED(CREEPER, 18, MetaType1_8.Byte, 13, MetaType1_9.Boolean),
|
||||||
// ghast
|
// ghast
|
||||||
GHAST_ISATTACKING(GHAST, 16, Type.Byte, 11, NewType.Boolean),
|
GHAST_ISATTACKING(GHAST, 16, MetaType1_8.Byte, 11, MetaType1_9.Boolean),
|
||||||
// slime
|
// slime
|
||||||
SLIME_SIZE(SLIME, 16, Type.Byte, 11, NewType.VarInt),
|
SLIME_SIZE(SLIME, 16, MetaType1_8.Byte, 11, MetaType1_9.VarInt),
|
||||||
// skeleton
|
// skeleton
|
||||||
SKELETON_TYPE(SKELETON, 13, Type.Byte, 11, NewType.VarInt),
|
SKELETON_TYPE(SKELETON, 13, MetaType1_8.Byte, 11, MetaType1_9.VarInt),
|
||||||
// witch
|
// witch
|
||||||
WITCH_AGGRO(WITCH, 21, Type.Byte, 11, NewType.Boolean),
|
WITCH_AGGRO(WITCH, 21, MetaType1_8.Byte, 11, MetaType1_9.Boolean),
|
||||||
// iron golem
|
// iron golem
|
||||||
IRON_PLAYERMADE(IRON_GOLEM, 16, Type.Byte, 11, NewType.Byte),
|
IRON_PLAYERMADE(IRON_GOLEM, 16, MetaType1_8.Byte, 11, MetaType1_9.Byte),
|
||||||
// wither
|
// wither
|
||||||
WITHER_TARGET1(WITHER, 17, Type.Int, 11, NewType.VarInt),
|
WITHER_TARGET1(WITHER, 17, MetaType1_8.Int, 11, MetaType1_9.VarInt),
|
||||||
WITHER_TARGET2(WITHER, 18, Type.Int, 12, NewType.VarInt),
|
WITHER_TARGET2(WITHER, 18, MetaType1_8.Int, 12, MetaType1_9.VarInt),
|
||||||
WITHER_TARGET3(WITHER, 19, Type.Int, 13, NewType.VarInt),
|
WITHER_TARGET3(WITHER, 19, MetaType1_8.Int, 13, MetaType1_9.VarInt),
|
||||||
WITHER_INVULN_TIME(WITHER, 20, Type.Int, 14, NewType.VarInt),
|
WITHER_INVULN_TIME(WITHER, 20, MetaType1_8.Int, 14, MetaType1_9.VarInt),
|
||||||
WITHER_PROPERTIES(WITHER, 10, Type.Byte, NewType.Byte),
|
WITHER_PROPERTIES(WITHER, 10, MetaType1_8.Byte, MetaType1_9.Byte),
|
||||||
WITHER_UNKNOWN(WITHER, 11, Type.Byte, NewType.Discontinued),
|
WITHER_UNKNOWN(WITHER, 11, MetaType1_8.Byte, MetaType1_9.Discontinued),
|
||||||
// wither skull
|
// wither skull
|
||||||
WITHERSKULL_INVULN(WITHER_SKULL, 10, Type.Byte, 5, NewType.Boolean),
|
WITHERSKULL_INVULN(WITHER_SKULL, 10, MetaType1_8.Byte, 5, MetaType1_9.Boolean),
|
||||||
// guardian
|
// guardian
|
||||||
GUARDIAN_INFO(GUARDIAN, 16, Type.Int, 11, NewType.Byte),
|
GUARDIAN_INFO(GUARDIAN, 16, MetaType1_8.Int, 11, MetaType1_9.Byte),
|
||||||
GUARDIAN_TARGET(GUARDIAN, 17, Type.Int, 12, NewType.VarInt),
|
GUARDIAN_TARGET(GUARDIAN, 17, MetaType1_8.Int, 12, MetaType1_9.VarInt),
|
||||||
// boat
|
// boat
|
||||||
BOAT_SINCEHIT(BOAT, 17, Type.Int, 5, NewType.VarInt),
|
BOAT_SINCEHIT(BOAT, 17, MetaType1_8.Int, 5, MetaType1_9.VarInt),
|
||||||
BOAT_FORWARDDIR(BOAT, 18, Type.Int, 6, NewType.VarInt),
|
BOAT_FORWARDDIR(BOAT, 18, MetaType1_8.Int, 6, MetaType1_9.VarInt),
|
||||||
BOAT_DMGTAKEN(BOAT, 19, Type.Float, 7, NewType.Float),
|
BOAT_DMGTAKEN(BOAT, 19, MetaType1_8.Float, 7, MetaType1_9.Float),
|
||||||
// BOAT_TYPE in 1.9
|
// BOAT_TYPE in 1.9
|
||||||
// minecart
|
// minecart
|
||||||
MINECART_SHAKINGPOWER(MINECART_ABSTRACT, 17, Type.Int, 5, NewType.VarInt),
|
MINECART_SHAKINGPOWER(MINECART_ABSTRACT, 17, MetaType1_8.Int, 5, MetaType1_9.VarInt),
|
||||||
MINECART_SHAKINGDIRECTION(MINECART_ABSTRACT, 18, Type.Int, 6, NewType.VarInt),
|
MINECART_SHAKINGDIRECTION(MINECART_ABSTRACT, 18, MetaType1_8.Int, 6, MetaType1_9.VarInt),
|
||||||
MINECART_DAMAGETAKEN(MINECART_ABSTRACT, 19, Type.Float, 7, NewType.Float), // also shaking modifier :P
|
MINECART_DAMAGETAKEN(MINECART_ABSTRACT, 19, MetaType1_8.Float, 7, MetaType1_9.Float), // also shaking modifier :P
|
||||||
MINECART_BLOCK(MINECART_ABSTRACT, 20, Type.Int, 8, NewType.VarInt),
|
MINECART_BLOCK(MINECART_ABSTRACT, 20, MetaType1_8.Int, 8, MetaType1_9.VarInt),
|
||||||
MINECART_BLOCK_Y(MINECART_ABSTRACT, 21, Type.Int, 9, NewType.VarInt),
|
MINECART_BLOCK_Y(MINECART_ABSTRACT, 21, MetaType1_8.Int, 9, MetaType1_9.VarInt),
|
||||||
MINECART_SHOWBLOCK(MINECART_ABSTRACT, 22, Type.Byte, 10, NewType.Boolean),
|
MINECART_SHOWBLOCK(MINECART_ABSTRACT, 22, MetaType1_8.Byte, 10, MetaType1_9.Boolean),
|
||||||
// Command minecart (they are still broken)
|
// Command minecart (they are still broken)
|
||||||
MINECART_COMMANDBLOCK_COMMAND(MINECART_ABSTRACT, 23, Type.String, 11, NewType.String),
|
MINECART_COMMANDBLOCK_COMMAND(MINECART_ABSTRACT, 23, MetaType1_8.String, 11, MetaType1_9.String),
|
||||||
MINECART_COMMANDBLOCK_OUTPUT(MINECART_ABSTRACT, 24, Type.String, 12, NewType.Chat),
|
MINECART_COMMANDBLOCK_OUTPUT(MINECART_ABSTRACT, 24, MetaType1_8.String, 12, MetaType1_9.Chat),
|
||||||
// furnace cart
|
// furnace cart
|
||||||
FURNACECART_ISPOWERED(MINECART_ABSTRACT, 16, Type.Byte, 11, NewType.Boolean),
|
FURNACECART_ISPOWERED(MINECART_ABSTRACT, 16, MetaType1_8.Byte, 11, MetaType1_9.Boolean),
|
||||||
// item drop
|
// item drop
|
||||||
ITEM_ITEM(DROPPED_ITEM, 10, Type.Slot, 5, NewType.Slot),
|
ITEM_ITEM(DROPPED_ITEM, 10, MetaType1_8.Slot, 5, MetaType1_9.Slot),
|
||||||
// arrow
|
// arrow
|
||||||
ARROW_ISCRIT(ARROW, 16, Type.Byte, 5, NewType.Byte),
|
ARROW_ISCRIT(ARROW, 16, MetaType1_8.Byte, 5, MetaType1_9.Byte),
|
||||||
// firework
|
// firework
|
||||||
FIREWORK_INFO(FIREWORK, 8, Type.Slot, 5, NewType.Slot),
|
FIREWORK_INFO(FIREWORK, 8, MetaType1_8.Slot, 5, MetaType1_9.Slot),
|
||||||
// item frame
|
// item frame
|
||||||
ITEMFRAME_ITEM(ITEM_FRAME, 8, Type.Slot, 5, NewType.Slot),
|
ITEMFRAME_ITEM(ITEM_FRAME, 8, MetaType1_8.Slot, 5, MetaType1_9.Slot),
|
||||||
ITEMFRAME_ROTATION(ITEM_FRAME, 9, Type.Byte, 6, NewType.VarInt),
|
ITEMFRAME_ROTATION(ITEM_FRAME, 9, MetaType1_8.Byte, 6, MetaType1_9.VarInt),
|
||||||
// ender crystal
|
// ender crystal
|
||||||
ENDERCRYSTAL_HEALTH(ENDER_CRYSTAL, 8, Type.Int, NewType.Discontinued),
|
ENDERCRYSTAL_HEALTH(ENDER_CRYSTAL, 8, MetaType1_8.Int, MetaType1_9.Discontinued),
|
||||||
// Ender dragon boss bar issues
|
// Ender dragon boss bar issues
|
||||||
ENDERDRAGON_UNKNOWN(ENDER_DRAGON, 5, Type.Byte, NewType.Discontinued),
|
ENDERDRAGON_UNKNOWN(ENDER_DRAGON, 5, MetaType1_8.Byte, MetaType1_9.Discontinued),
|
||||||
ENDERDRAGON_NAME(ENDER_DRAGON, 10, Type.String, NewType.Discontinued),
|
ENDERDRAGON_NAME(ENDER_DRAGON, 10, MetaType1_8.String, MetaType1_9.Discontinued),
|
||||||
// Normal Ender dragon
|
// Normal Ender dragon
|
||||||
ENDERDRAGON_FLAG(ENDER_DRAGON, 15, Type.Byte, NewType.Discontinued),
|
ENDERDRAGON_FLAG(ENDER_DRAGON, 15, MetaType1_8.Byte, MetaType1_9.Discontinued),
|
||||||
ENDERDRAGON_PHASE(ENDER_DRAGON, 11, Type.Byte, NewType.VarInt);
|
ENDERDRAGON_PHASE(ENDER_DRAGON, 11, MetaType1_8.Byte, MetaType1_9.VarInt);
|
||||||
|
|
||||||
private static final HashMap<Pair<EntityUtil.EntityType, Integer>, MetaIndex> metadataRewrites = new HashMap<>();
|
private static final HashMap<Pair<EntityUtil.EntityType, Integer>, MetaIndex> metadataRewrites = new HashMap<>();
|
||||||
|
|
||||||
@ -149,11 +151,11 @@ public enum MetaIndex {
|
|||||||
|
|
||||||
private EntityUtil.EntityType clazz;
|
private EntityUtil.EntityType clazz;
|
||||||
private int newIndex;
|
private int newIndex;
|
||||||
private NewType newType;
|
private MetaType1_9 newType;
|
||||||
private Type oldType;
|
private MetaType1_8 oldType;
|
||||||
private int index;
|
private int index;
|
||||||
|
|
||||||
MetaIndex(EntityUtil.EntityType type, int index, Type oldType, NewType newType) {
|
MetaIndex(EntityUtil.EntityType type, int index, MetaType1_8 oldType, MetaType1_9 newType) {
|
||||||
this.clazz = type;
|
this.clazz = type;
|
||||||
this.index = index;
|
this.index = index;
|
||||||
this.newIndex = index;
|
this.newIndex = index;
|
||||||
@ -161,7 +163,7 @@ public enum MetaIndex {
|
|||||||
this.newType = newType;
|
this.newType = newType;
|
||||||
}
|
}
|
||||||
|
|
||||||
MetaIndex(EntityUtil.EntityType type, int index, Type oldType, int newIndex, NewType newType) {
|
MetaIndex(EntityUtil.EntityType type, int index, MetaType1_8 oldType, int newIndex, MetaType1_9 newType) {
|
||||||
this.clazz = type;
|
this.clazz = type;
|
||||||
this.index = index;
|
this.index = index;
|
||||||
this.oldType = oldType;
|
this.oldType = oldType;
|
||||||
|
@ -4,7 +4,10 @@ import us.myles.ViaVersion.api.Via;
|
|||||||
import us.myles.ViaVersion.api.minecraft.EulerAngle;
|
import us.myles.ViaVersion.api.minecraft.EulerAngle;
|
||||||
import us.myles.ViaVersion.api.minecraft.Vector;
|
import us.myles.ViaVersion.api.minecraft.Vector;
|
||||||
import us.myles.ViaVersion.api.minecraft.item.Item;
|
import us.myles.ViaVersion.api.minecraft.item.Item;
|
||||||
|
import us.myles.ViaVersion.api.minecraft.metadata.MetaType;
|
||||||
import us.myles.ViaVersion.api.minecraft.metadata.Metadata;
|
import us.myles.ViaVersion.api.minecraft.metadata.Metadata;
|
||||||
|
import us.myles.ViaVersion.api.minecraft.metadata.types.MetaType1_8;
|
||||||
|
import us.myles.ViaVersion.api.minecraft.metadata.types.MetaType1_9;
|
||||||
import us.myles.ViaVersion.protocols.protocol1_9to1_8.ItemRewriter;
|
import us.myles.ViaVersion.protocols.protocol1_9to1_8.ItemRewriter;
|
||||||
import us.myles.ViaVersion.protocols.protocol1_9to1_8.Protocol1_9TO1_8;
|
import us.myles.ViaVersion.protocols.protocol1_9to1_8.Protocol1_9TO1_8;
|
||||||
import us.myles.ViaVersion.util.EntityUtil;
|
import us.myles.ViaVersion.util.EntityUtil;
|
||||||
@ -21,20 +24,19 @@ public class MetadataRewriter {
|
|||||||
MetaIndex metaIndex = MetaIndex.searchIndex(type, entry.getId());
|
MetaIndex metaIndex = MetaIndex.searchIndex(type, entry.getId());
|
||||||
try {
|
try {
|
||||||
if (metaIndex != null) {
|
if (metaIndex != null) {
|
||||||
if (metaIndex.getNewType() != NewType.Discontinued) {
|
if (metaIndex.getNewType() != MetaType1_9.Discontinued) {
|
||||||
if (metaIndex.getNewType() != NewType.BlockID || id != -1 && data == -1 || id == -1 && data != -1) { // block ID is only written if we have both parts
|
if (metaIndex.getNewType() != MetaType1_9.BlockID || id != -1 && data == -1 || id == -1 && data != -1) { // block ID is only written if we have both parts
|
||||||
entry.setId(metaIndex.getNewIndex());
|
entry.setId(metaIndex.getNewIndex());
|
||||||
entry.setTypeID(metaIndex.getNewType().getTypeID());
|
entry.setMetaType(metaIndex.getNewType());
|
||||||
}
|
}
|
||||||
Object value = entry.getValue();
|
Object value = entry.getValue();
|
||||||
switch (metaIndex.getNewType()) {
|
switch (metaIndex.getNewType()) {
|
||||||
case Byte:
|
case Byte:
|
||||||
entry.setType(us.myles.ViaVersion.api.type.Type.BYTE);
|
|
||||||
// convert from int, byte
|
// convert from int, byte
|
||||||
if (metaIndex.getOldType() == Type.Byte) {
|
if (metaIndex.getOldType() == MetaType1_8.Byte) {
|
||||||
entry.setValue(value);
|
entry.setValue(value);
|
||||||
}
|
}
|
||||||
if (metaIndex.getOldType() == Type.Int) {
|
if (metaIndex.getOldType() == MetaType1_8.Int) {
|
||||||
entry.setValue(((Integer) value).byteValue());
|
entry.setValue(((Integer) value).byteValue());
|
||||||
}
|
}
|
||||||
// After writing the last one
|
// After writing the last one
|
||||||
@ -44,13 +46,12 @@ public class MetadataRewriter {
|
|||||||
val = 1;
|
val = 1;
|
||||||
}
|
}
|
||||||
int newIndex = MetaIndex.PLAYER_HAND.getNewIndex();
|
int newIndex = MetaIndex.PLAYER_HAND.getNewIndex();
|
||||||
int typeID = MetaIndex.PLAYER_HAND.getNewType().getTypeID();
|
MetaType metaType = MetaIndex.PLAYER_HAND.getNewType();
|
||||||
Metadata metadata = new Metadata(newIndex, typeID, us.myles.ViaVersion.api.type.Type.BYTE, val);
|
Metadata metadata = new Metadata(newIndex, metaType, val);
|
||||||
list.add(metadata);
|
list.add(metadata);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case OptUUID:
|
case OptUUID:
|
||||||
entry.setType(us.myles.ViaVersion.api.type.Type.OPTIONAL_UUID);
|
|
||||||
String owner = (String) value;
|
String owner = (String) value;
|
||||||
UUID toWrite = null;
|
UUID toWrite = null;
|
||||||
if (owner.length() != 0) {
|
if (owner.length() != 0) {
|
||||||
@ -62,12 +63,11 @@ public class MetadataRewriter {
|
|||||||
entry.setValue(toWrite);
|
entry.setValue(toWrite);
|
||||||
break;
|
break;
|
||||||
case BlockID:
|
case BlockID:
|
||||||
entry.setType(us.myles.ViaVersion.api.type.Type.VAR_INT);
|
|
||||||
// if we have both sources :))
|
// if we have both sources :))
|
||||||
if (metaIndex.getOldType() == Type.Byte) {
|
if (metaIndex.getOldType() == MetaType1_8.Byte) {
|
||||||
data = (Byte) value;
|
data = (Byte) value;
|
||||||
}
|
}
|
||||||
if (metaIndex.getOldType() == Type.Short) {
|
if (metaIndex.getOldType() == MetaType1_8.Short) {
|
||||||
id = (Short) value;
|
id = (Short) value;
|
||||||
}
|
}
|
||||||
if (id != -1 && data != -1) {
|
if (id != -1 && data != -1) {
|
||||||
@ -80,50 +80,42 @@ public class MetadataRewriter {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case VarInt:
|
case VarInt:
|
||||||
entry.setType(us.myles.ViaVersion.api.type.Type.VAR_INT);
|
|
||||||
// convert from int, short, byte
|
// convert from int, short, byte
|
||||||
if (metaIndex.getOldType() == Type.Byte) {
|
if (metaIndex.getOldType() == MetaType1_8.Byte) {
|
||||||
entry.setValue(((Byte) value).intValue());
|
entry.setValue(((Byte) value).intValue());
|
||||||
}
|
}
|
||||||
if (metaIndex.getOldType() == Type.Short) {
|
if (metaIndex.getOldType() == MetaType1_8.Short) {
|
||||||
entry.setValue(((Short) value).intValue());
|
entry.setValue(((Short) value).intValue());
|
||||||
}
|
}
|
||||||
if (metaIndex.getOldType() == Type.Int) {
|
if (metaIndex.getOldType() == MetaType1_8.Int) {
|
||||||
entry.setValue(value);
|
entry.setValue(value);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case Float:
|
case Float:
|
||||||
entry.setType(us.myles.ViaVersion.api.type.Type.FLOAT);
|
|
||||||
entry.setValue(value);
|
entry.setValue(value);
|
||||||
break;
|
break;
|
||||||
case String:
|
case String:
|
||||||
entry.setType(us.myles.ViaVersion.api.type.Type.STRING);
|
|
||||||
entry.setValue(value);
|
entry.setValue(value);
|
||||||
break;
|
break;
|
||||||
case Boolean:
|
case Boolean:
|
||||||
entry.setType(us.myles.ViaVersion.api.type.Type.BOOLEAN);
|
|
||||||
if (metaIndex == MetaIndex.AGEABLE_AGE)
|
if (metaIndex == MetaIndex.AGEABLE_AGE)
|
||||||
entry.setValue((Byte) value < 0);
|
entry.setValue((Byte) value < 0);
|
||||||
else
|
else
|
||||||
entry.setValue((Byte) value != 0);
|
entry.setValue((Byte) value != 0);
|
||||||
break;
|
break;
|
||||||
case Slot:
|
case Slot:
|
||||||
entry.setType(us.myles.ViaVersion.api.type.Type.ITEM);
|
|
||||||
entry.setValue(value);
|
entry.setValue(value);
|
||||||
ItemRewriter.toClient((Item) entry.getValue());
|
ItemRewriter.toClient((Item) entry.getValue());
|
||||||
break;
|
break;
|
||||||
case Position:
|
case Position:
|
||||||
entry.setType(us.myles.ViaVersion.api.type.Type.VECTOR);
|
|
||||||
Vector vector = (Vector) value;
|
Vector vector = (Vector) value;
|
||||||
entry.setValue(vector);
|
entry.setValue(vector);
|
||||||
break;
|
break;
|
||||||
case Vector3F:
|
case Vector3F:
|
||||||
entry.setType(us.myles.ViaVersion.api.type.Type.ROTATION);
|
|
||||||
EulerAngle angle = (EulerAngle) value;
|
EulerAngle angle = (EulerAngle) value;
|
||||||
entry.setValue(angle);
|
entry.setValue(angle);
|
||||||
break;
|
break;
|
||||||
case Chat:
|
case Chat:
|
||||||
entry.setType(us.myles.ViaVersion.api.type.Type.STRING);
|
|
||||||
value = Protocol1_9TO1_8.fixJson((String) value);
|
value = Protocol1_9TO1_8.fixJson((String) value);
|
||||||
entry.setValue(value);
|
entry.setValue(value);
|
||||||
break;
|
break;
|
||||||
|
@ -1,23 +0,0 @@
|
|||||||
package us.myles.ViaVersion.protocols.protocol1_9to1_8.metadata;
|
|
||||||
|
|
||||||
import lombok.Getter;
|
|
||||||
import lombok.RequiredArgsConstructor;
|
|
||||||
|
|
||||||
@RequiredArgsConstructor
|
|
||||||
@Getter
|
|
||||||
public enum Type {
|
|
||||||
Byte(0),
|
|
||||||
Short(1),
|
|
||||||
Int(2),
|
|
||||||
Float(3),
|
|
||||||
String(4),
|
|
||||||
Slot(5),
|
|
||||||
Position(6),
|
|
||||||
Rotation(7),
|
|
||||||
NonExistent(-1);
|
|
||||||
private final int typeID;
|
|
||||||
|
|
||||||
public static Type byId(int id) {
|
|
||||||
return values()[id];
|
|
||||||
}
|
|
||||||
}
|
|
@ -3,6 +3,7 @@ package us.myles.ViaVersion.protocols.protocol1_9to1_8.packets;
|
|||||||
import us.myles.ViaVersion.api.PacketWrapper;
|
import us.myles.ViaVersion.api.PacketWrapper;
|
||||||
import us.myles.ViaVersion.api.minecraft.item.Item;
|
import us.myles.ViaVersion.api.minecraft.item.Item;
|
||||||
import us.myles.ViaVersion.api.minecraft.metadata.Metadata;
|
import us.myles.ViaVersion.api.minecraft.metadata.Metadata;
|
||||||
|
import us.myles.ViaVersion.api.minecraft.metadata.types.MetaType1_9;
|
||||||
import us.myles.ViaVersion.api.protocol.Protocol;
|
import us.myles.ViaVersion.api.protocol.Protocol;
|
||||||
import us.myles.ViaVersion.api.remapper.PacketHandler;
|
import us.myles.ViaVersion.api.remapper.PacketHandler;
|
||||||
import us.myles.ViaVersion.api.remapper.PacketRemapper;
|
import us.myles.ViaVersion.api.remapper.PacketRemapper;
|
||||||
@ -15,7 +16,6 @@ import us.myles.ViaVersion.packets.State;
|
|||||||
import us.myles.ViaVersion.protocols.protocol1_9to1_8.ItemRewriter;
|
import us.myles.ViaVersion.protocols.protocol1_9to1_8.ItemRewriter;
|
||||||
import us.myles.ViaVersion.protocols.protocol1_9to1_8.Protocol1_9TO1_8;
|
import us.myles.ViaVersion.protocols.protocol1_9to1_8.Protocol1_9TO1_8;
|
||||||
import us.myles.ViaVersion.protocols.protocol1_9to1_8.metadata.MetadataRewriter;
|
import us.myles.ViaVersion.protocols.protocol1_9to1_8.metadata.MetadataRewriter;
|
||||||
import us.myles.ViaVersion.protocols.protocol1_9to1_8.metadata.NewType;
|
|
||||||
import us.myles.ViaVersion.protocols.protocol1_9to1_8.storage.EntityTracker;
|
import us.myles.ViaVersion.protocols.protocol1_9to1_8.storage.EntityTracker;
|
||||||
import us.myles.ViaVersion.util.EntityUtil;
|
import us.myles.ViaVersion.util.EntityUtil;
|
||||||
|
|
||||||
@ -105,7 +105,7 @@ public class SpawnPackets {
|
|||||||
Item item = new Item((short) 373, (byte) 1, (short) data, null); // Potion
|
Item item = new Item((short) 373, (byte) 1, (short) data, null); // Potion
|
||||||
ItemRewriter.toClient(item); // Rewrite so that it gets the right nbt
|
ItemRewriter.toClient(item); // Rewrite so that it gets the right nbt
|
||||||
// TEMP FIX FOR POTIONS UNTIL WE FIGURE OUT HOW TO TRANSFORM SENT PACKETS
|
// TEMP FIX FOR POTIONS UNTIL WE FIGURE OUT HOW TO TRANSFORM SENT PACKETS
|
||||||
Metadata potion = new Metadata(5, NewType.Slot.getTypeID(), Type.ITEM, item);
|
Metadata potion = new Metadata(5, MetaType1_9.Slot, item);
|
||||||
meta.add(potion);
|
meta.add(potion);
|
||||||
wrapper.write(Types1_9.METADATA_LIST, meta);
|
wrapper.write(Types1_9.METADATA_LIST, meta);
|
||||||
}
|
}
|
||||||
|
@ -16,13 +16,13 @@ import us.myles.ViaVersion.api.data.UserConnection;
|
|||||||
import us.myles.ViaVersion.api.minecraft.Position;
|
import us.myles.ViaVersion.api.minecraft.Position;
|
||||||
import us.myles.ViaVersion.api.minecraft.item.Item;
|
import us.myles.ViaVersion.api.minecraft.item.Item;
|
||||||
import us.myles.ViaVersion.api.minecraft.metadata.Metadata;
|
import us.myles.ViaVersion.api.minecraft.metadata.Metadata;
|
||||||
|
import us.myles.ViaVersion.api.minecraft.metadata.types.MetaType1_9;
|
||||||
import us.myles.ViaVersion.api.type.Type;
|
import us.myles.ViaVersion.api.type.Type;
|
||||||
import us.myles.ViaVersion.api.type.types.version.Types1_9;
|
import us.myles.ViaVersion.api.type.types.version.Types1_9;
|
||||||
import us.myles.ViaVersion.protocols.base.ProtocolInfo;
|
import us.myles.ViaVersion.protocols.base.ProtocolInfo;
|
||||||
import us.myles.ViaVersion.protocols.protocol1_9to1_8.Protocol1_9TO1_8;
|
import us.myles.ViaVersion.protocols.protocol1_9to1_8.Protocol1_9TO1_8;
|
||||||
import us.myles.ViaVersion.protocols.protocol1_9to1_8.chat.GameMode;
|
import us.myles.ViaVersion.protocols.protocol1_9to1_8.chat.GameMode;
|
||||||
import us.myles.ViaVersion.protocols.protocol1_9to1_8.metadata.MetadataRewriter;
|
import us.myles.ViaVersion.protocols.protocol1_9to1_8.metadata.MetadataRewriter;
|
||||||
import us.myles.ViaVersion.protocols.protocol1_9to1_8.metadata.NewType;
|
|
||||||
import us.myles.ViaVersion.util.EntityUtil;
|
import us.myles.ViaVersion.util.EntityUtil;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
@ -137,7 +137,7 @@ public class EntityTracker extends StoredObject {
|
|||||||
|
|
||||||
if (type == EntityUtil.EntityType.SKELETON) {
|
if (type == EntityUtil.EntityType.SKELETON) {
|
||||||
if ((getMetaByIndex(metadataList, 12)) == null) {
|
if ((getMetaByIndex(metadataList, 12)) == null) {
|
||||||
metadataList.add(new Metadata(12, NewType.Boolean.getTypeID(), Type.BOOLEAN, true));
|
metadataList.add(new Metadata(12, MetaType1_9.Boolean, true));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,8 +3,7 @@ package us.myles.ViaVersion.protocols.protocolsnapshotto1_10;
|
|||||||
import com.google.common.base.Optional;
|
import com.google.common.base.Optional;
|
||||||
import us.myles.ViaVersion.api.Via;
|
import us.myles.ViaVersion.api.Via;
|
||||||
import us.myles.ViaVersion.api.minecraft.metadata.Metadata;
|
import us.myles.ViaVersion.api.minecraft.metadata.Metadata;
|
||||||
import us.myles.ViaVersion.api.type.Type;
|
import us.myles.ViaVersion.api.minecraft.metadata.types.MetaType1_9;
|
||||||
import us.myles.ViaVersion.protocols.protocol1_9to1_8.metadata.NewType;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -41,7 +40,7 @@ public class MetadataRewriter {
|
|||||||
if (options.isPresent()) {
|
if (options.isPresent()) {
|
||||||
int value = (int) options.get().getValue();
|
int value = (int) options.get().getValue();
|
||||||
if (value > 0 && value < 6) {
|
if (value > 0 && value < 6) {
|
||||||
metadata.add(new Metadata(16, NewType.VarInt.getTypeID(), Type.VAR_INT, value - 1)); // Add profession type to new metadata
|
metadata.add(new Metadata(16, MetaType1_9.VarInt, value - 1)); // Add profession type to new metadata
|
||||||
return 27;
|
return 27;
|
||||||
}
|
}
|
||||||
if (value == 6) {
|
if (value == 6) {
|
||||||
@ -90,8 +89,7 @@ public class MetadataRewriter {
|
|||||||
if (type == 4 || type == 68) { // Guardians
|
if (type == 4 || type == 68) { // Guardians
|
||||||
int oldid = metadata.getId();
|
int oldid = metadata.getId();
|
||||||
if (oldid == 12) {
|
if (oldid == 12) {
|
||||||
metadata.setType(Type.BOOLEAN);
|
metadata.setMetaType(MetaType1_9.Boolean);
|
||||||
metadata.setTypeID(NewType.Boolean.getTypeID());
|
|
||||||
boolean val = (((byte) metadata.getValue()) & 0x02) == 0x02;
|
boolean val = (((byte) metadata.getValue()) & 0x02) == 0x02;
|
||||||
metadata.setValue(val);
|
metadata.setValue(val);
|
||||||
}
|
}
|
||||||
@ -144,9 +142,9 @@ public class MetadataRewriter {
|
|||||||
// Chested Horse
|
// Chested Horse
|
||||||
if (metadata.getId() == 13) {
|
if (metadata.getId() == 13) {
|
||||||
if ((((byte) metadata.getValue()) & 0x08) == 0x08) {
|
if ((((byte) metadata.getValue()) & 0x08) == 0x08) {
|
||||||
metadatas.add(new Metadata(15, NewType.Boolean.getTypeID(), Type.BOOLEAN, true));
|
metadatas.add(new Metadata(15, MetaType1_9.Boolean, true));
|
||||||
} else {
|
} else {
|
||||||
metadatas.add(new Metadata(15, NewType.Boolean.getTypeID(), Type.BOOLEAN, false));
|
metadatas.add(new Metadata(15, MetaType1_9.Boolean, false));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
7
pom.xml
7
pom.xml
@ -114,6 +114,13 @@
|
|||||||
<artifactId>bungeecord-chat</artifactId>
|
<artifactId>bungeecord-chat</artifactId>
|
||||||
<version>1.10-SNAPSHOT</version>
|
<version>1.10-SNAPSHOT</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<!-- Guava magic -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.google.guava</groupId>
|
||||||
|
<artifactId>guava</artifactId>
|
||||||
|
<version>19.0</version>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren