use of com.github.steveice10.opennbt.tag.builtin.ByteTag in project Geyser by GeyserMC.
the class AxolotlBucketTranslator method translateToBedrock.
@Override
public void translateToBedrock(GeyserSession session, CompoundTag itemTag, ItemMapping mapping) {
// Bedrock Edition displays the properties of the axolotl. Java does not.
// To work around this, set the custom name to the Axolotl translation and it's displayed correctly
itemTag.put(new ByteTag("AppendCustomName", (byte) 1));
itemTag.put(new StringTag("CustomName", MinecraftLocale.getLocaleString("entity.minecraft.axolotl", session.getLocale())));
// Boilerplate required so the nametag does not appear as "Bucket of "
itemTag.put(new StringTag("ColorID", ""));
itemTag.put(new StringTag("BodyID", ""));
}
use of com.github.steveice10.opennbt.tag.builtin.ByteTag in project Geyser by GeyserMC.
the class FireworkBaseTranslator method translateExplosionToJava.
protected CompoundTag translateExplosionToJava(CompoundTag explosion, String newName) {
CompoundTag newExplosionData = new CompoundTag(newName);
if (explosion.get("FireworkType") != null) {
newExplosionData.put(new ByteTag("Type", MathUtils.getNbtByte(explosion.get("FireworkType").getValue())));
}
if (explosion.get("FireworkColor") != null) {
byte[] oldColors = (byte[]) explosion.get("FireworkColor").getValue();
int[] colors = new int[oldColors.length];
int i = 0;
for (byte color : oldColors) {
colors[i++] = FireworkColor.fromBedrockId(color);
}
newExplosionData.put(new IntArrayTag("Colors", colors));
}
if (explosion.get("FireworkFade") != null) {
byte[] oldColors = (byte[]) explosion.get("FireworkFade").getValue();
int[] colors = new int[oldColors.length];
int i = 0;
for (byte color : oldColors) {
colors[i++] = FireworkColor.fromBedrockId(color);
}
newExplosionData.put(new IntArrayTag("FadeColors", colors));
}
if (explosion.get("FireworkTrail") != null) {
newExplosionData.put(new ByteTag("Trail", MathUtils.getNbtByte(explosion.get("FireworkTrail").getValue())));
}
if (explosion.get("FireworkFlicker") != null) {
newExplosionData.put(new ByteTag("Flicker", MathUtils.getNbtByte(explosion.get("FireworkFlicker").getValue())));
}
return newExplosionData;
}
use of com.github.steveice10.opennbt.tag.builtin.ByteTag in project Geyser by GeyserMC.
the class FireworkRocketTranslator method translateToJava.
@Override
public void translateToJava(CompoundTag itemTag, ItemMapping mapping) {
CompoundTag fireworks = itemTag.get("Fireworks");
if (fireworks == null) {
return;
}
if (fireworks.contains("Flight")) {
fireworks.put(new ByteTag("Flight", MathUtils.getNbtByte(fireworks.get("Flight").getValue())));
}
ListTag explosions = fireworks.get("Explosions");
if (explosions == null) {
return;
}
for (Tag effect : explosions.getValue()) {
CompoundTag effectData = (CompoundTag) effect;
CompoundTag newEffectData = translateExplosionToJava(effectData, "");
explosions.remove(effect);
explosions.add(newEffectData);
}
}
use of com.github.steveice10.opennbt.tag.builtin.ByteTag in project ViaVersion by ViaVersion.
the class EntityPackets method createEndEntry.
private static CompoundTag createEndEntry() {
CompoundTag tag = new CompoundTag();
tag.put("piglin_safe", new ByteTag((byte) 0));
tag.put("natural", new ByteTag((byte) 0));
tag.put("ambient_light", new FloatTag(0));
tag.put("infiniburn", new StringTag("minecraft:infiniburn_end"));
tag.put("respawn_anchor_works", new ByteTag((byte) 0));
tag.put("has_skylight", new ByteTag((byte) 0));
tag.put("bed_works", new ByteTag((byte) 0));
tag.put("fixed_time", new LongTag(6000));
tag.put("has_raids", new ByteTag((byte) 1));
tag.put("name", new StringTag("minecraft:the_end"));
tag.put("logical_height", new IntTag(256));
tag.put("shrunk", new ByteTag((byte) 0));
tag.put("ultrawarm", new ByteTag((byte) 0));
tag.put("has_ceiling", new ByteTag((byte) 0));
return tag;
}
use of com.github.steveice10.opennbt.tag.builtin.ByteTag in project ViaVersion by ViaVersion.
the class EntityPackets method addSharedOverwaldEntries.
private static void addSharedOverwaldEntries(CompoundTag tag) {
tag.put("piglin_safe", new ByteTag((byte) 0));
tag.put("natural", new ByteTag((byte) 1));
tag.put("ambient_light", new FloatTag(0));
tag.put("infiniburn", new StringTag("minecraft:infiniburn_overworld"));
tag.put("respawn_anchor_works", new ByteTag((byte) 0));
tag.put("has_skylight", new ByteTag((byte) 1));
tag.put("bed_works", new ByteTag((byte) 1));
tag.put("has_raids", new ByteTag((byte) 1));
tag.put("logical_height", new IntTag(256));
tag.put("shrunk", new ByteTag((byte) 0));
tag.put("ultrawarm", new ByteTag((byte) 0));
}
Aggregations