feat(meta): add TntMeta class and register in MetaConverterRegistry
This commit is contained in:
parent
a4ce05886d
commit
7ea339a69e
2 changed files with 32 additions and 0 deletions
|
@ -148,6 +148,7 @@ final class MetaConverterRegistry {
|
|||
put(TEXT_DISPLAY, TextDisplayMeta.class, TextDisplayMeta::new);
|
||||
put(THROWN_EXP_BOTTLE, ThrownExpBottleMeta.class, ThrownExpBottleMeta::new);
|
||||
put(ENDER_PEARL, ThrownEnderPearlMeta.class, ThrownEnderPearlMeta::new);
|
||||
put(TNT, TntMeta.class, TntMeta::new);
|
||||
put(TNT_MINECART, TntMinecartMeta.class, TntMinecartMeta::new);
|
||||
put(TRADER_LLAMA, TraderLlamaMeta.class, TraderLlamaMeta::new);
|
||||
put(TRIDENT, ThrownTridentMeta.class, ThrownTridentMeta::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