Search in sources :

Example 1 with LongMeta

use of org.dragonet.common.data.entity.meta.type.LongMeta in project DragonProxy by DragonetMC.

the class EntityMetaData method setGenericFlag.

public void setGenericFlag(int flagId, boolean value) {
    long flag = 0;
    if (!map.containsKey(Constants.DATA_FLAGS)) {
        map.put(Constants.DATA_FLAGS, new LongMeta(0L));
    } else {
        flag = ((LongMeta) map.get(Constants.DATA_FLAGS)).data;
    }
    boolean currValue = ((flag >> flagId) & 0b1) > 0;
    if (currValue != value) {
        flag ^= (1L << flagId);
    }
    ((LongMeta) map.get(Constants.DATA_FLAGS)).data = flag;
}
Also used : LongMeta(org.dragonet.common.data.entity.meta.type.LongMeta)

Example 2 with LongMeta

use of org.dragonet.common.data.entity.meta.type.LongMeta in project DragonProxy by DragonetMC.

the class EntityMetaData method createDefault.

public static EntityMetaData createDefault() {
    EntityMetaData data = new EntityMetaData();
    data.setGenericFlag(Constants.DATA_FLAG_BREATHING, true);
    data.setGenericFlag(Constants.DATA_FLAG_AFFECTED_BY_GRAVITY, true);
    data.setGenericFlag(Constants.DATA_FLAG_HAS_COLLISION, true);
    data.setGenericFlag(Constants.DATA_FLAG_CAN_CLIMB, true);
    data.set(Constants.DATA_AIR, new ShortMeta((short) 400));
    data.set(Constants.DATA_MAX_AIR, new ShortMeta((short) 400));
    // data.set(Constants.DATA_NAMETAG, new ByteArrayMeta(""));
    data.set(Constants.DATA_LEAD_HOLDER_EID, new LongMeta(-1L));
    data.set(Constants.DATA_SCALE, new FloatMeta(1.0f));
    // data.set(Constants.DATA_BED_POSITION, new BlockPositionMeta(new BlockPosition(0, 0, 0)));
    return data;
}
Also used : LongMeta(org.dragonet.common.data.entity.meta.type.LongMeta) FloatMeta(org.dragonet.common.data.entity.meta.type.FloatMeta) ShortMeta(org.dragonet.common.data.entity.meta.type.ShortMeta)

Aggregations

LongMeta (org.dragonet.common.data.entity.meta.type.LongMeta)2 FloatMeta (org.dragonet.common.data.entity.meta.type.FloatMeta)1 ShortMeta (org.dragonet.common.data.entity.meta.type.ShortMeta)1