Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ final class MetaConverterRegistry {
put(TADPOLE, LivingEntityMeta.class, LivingEntityMeta::new); // TODO: Implement
put(TEXT_DISPLAY, TextDisplayMeta.class, TextDisplayMeta::new);
put(THROWN_EXP_BOTTLE, ThrownExpBottleMeta.class, ThrownExpBottleMeta::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);
Expand Down Expand Up @@ -190,4 +191,4 @@ public Class<? extends EntityMeta> getMetaClass(EntityType entityType) {
return converters.getOrDefault(entityType, EntityMeta::new);
}

}
}
31 changes: 31 additions & 0 deletions api/src/main/java/me/tofaa/entitylib/meta/other/TntMeta.java
Original file line number Diff line number Diff line change
@@ -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