Merge pull request #38 from fantasyorg/master
feat(meta): add TntMeta class and register in MetaConverterRegistry
This commit is contained in:
commit
9dec1374d6
2 changed files with 33 additions and 1 deletions
|
@ -154,6 +154,7 @@ final class MetaConverterRegistry {
|
||||||
put(TADPOLE, LivingEntityMeta.class, LivingEntityMeta::new); // TODO: Implement
|
put(TADPOLE, LivingEntityMeta.class, LivingEntityMeta::new); // TODO: Implement
|
||||||
put(TEXT_DISPLAY, TextDisplayMeta.class, TextDisplayMeta::new);
|
put(TEXT_DISPLAY, TextDisplayMeta.class, TextDisplayMeta::new);
|
||||||
put(THROWN_EXP_BOTTLE, ThrownExpBottleMeta.class, ThrownExpBottleMeta::new);
|
put(THROWN_EXP_BOTTLE, ThrownExpBottleMeta.class, ThrownExpBottleMeta::new);
|
||||||
|
put(TNT, TntMeta.class, TntMeta::new);
|
||||||
put(TNT_MINECART, TntMinecartMeta.class, TntMinecartMeta::new);
|
put(TNT_MINECART, TntMinecartMeta.class, TntMinecartMeta::new);
|
||||||
put(TRADER_LLAMA, TraderLlamaMeta.class, TraderLlamaMeta::new);
|
put(TRADER_LLAMA, TraderLlamaMeta.class, TraderLlamaMeta::new);
|
||||||
put(TRIDENT, ThrownTridentMeta.class, ThrownTridentMeta::new);
|
put(TRIDENT, ThrownTridentMeta.class, ThrownTridentMeta::new);
|
||||||
|
@ -190,4 +191,4 @@ final class MetaConverterRegistry {
|
||||||
return converters.getOrDefault(entityType, EntityMeta::new);
|
return converters.getOrDefault(entityType, EntityMeta::new);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
31
api/src/main/java/me/tofaa/entitylib/meta/other/TntMeta.java
Normal file
31
api/src/main/java/me/tofaa/entitylib/meta/other/TntMeta.java
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
package me.tofaa.entitylib.meta.other;
|
||||||
|
|
||||||
|
import com.github.retrooper.packetevents.protocol.entity.data.EntityDataTypes;
|
||||||
|
import com.github.retrooper.packetevents.protocol.world.states.type.StateTypes;
|
||||||
|
import me.tofaa.entitylib.meta.EntityMeta;
|
||||||
|
import me.tofaa.entitylib.meta.Metadata;
|
||||||
|
|
||||||
|
public class TntMeta extends EntityMeta {
|
||||||
|
public static final byte OFFSET = EntityMeta.MAX_OFFSET;
|
||||||
|
public static final byte MAX_OFFSET = OFFSET + 2;
|
||||||
|
|
||||||
|
public TntMeta(int entityId, Metadata metadata) {
|
||||||
|
super(entityId, metadata);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getFuseTime() {
|
||||||
|
return super.metadata.getIndex(OFFSET, 80);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFuseTime(int value) {
|
||||||
|
super.metadata.setIndex(OFFSET, EntityDataTypes.INT, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getBlockData() {
|
||||||
|
return super.metadata.getIndex(offset(OFFSET, 1), StateTypes.TNT.createBlockState().getGlobalId());
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBlockData(int blockData) {
|
||||||
|
super.metadata.setIndex(offset(OFFSET, 1), EntityDataTypes.BLOCK_STATE, blockData);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue