use of net.minecraft.nbt.CompoundTag in project Tropicraft by Tropicraft.
the class AirCompressorBlockEntity method save.
@Override
@Nonnull
public CompoundTag save(@Nonnull CompoundTag nbt) {
super.save(nbt);
nbt.putBoolean("Compressing", compressing);
CompoundTag var4 = new CompoundTag();
this.stack.save(var4);
nbt.put("Tank", var4);
return nbt;
}
use of net.minecraft.nbt.CompoundTag in project Tropicraft by Tropicraft.
the class DrinkMixerBlockEntity method save.
@Override
@Nonnull
public CompoundTag save(@Nonnull CompoundTag nbt) {
super.save(nbt);
nbt.putInt("MixTicks", ticks);
nbt.putBoolean("Mixing", mixing);
for (int i = 0; i < MAX_NUM_INGREDIENTS; i++) {
CompoundTag ingredientNbt = new CompoundTag();
ingredients.get(i).save(ingredientNbt);
nbt.put("Ingredient" + i, ingredientNbt);
}
CompoundTag resultNbt = new CompoundTag();
result.save(resultNbt);
nbt.put("Result", resultNbt);
return nbt;
}
use of net.minecraft.nbt.CompoundTag in project Tropicraft by Tropicraft.
the class HomeTreeBranchPiece method createJigsawNbt.
private static CompoundTag createJigsawNbt() {
CompoundTag nbt = new CompoundTag();
nbt.putString("name", "minecraft:bottom");
nbt.putString("final_state", "minecraft:air");
nbt.putString("pool", "minecraft:empty");
nbt.putString("target", "minecraft:empty");
nbt.putString("joint", JigsawBlockEntity.JointType.ROLLABLE.getSerializedName());
return nbt;
}
use of net.minecraft.nbt.CompoundTag in project Tropicraft by Tropicraft.
the class EntityKoaBase method readAdditionalSaveData.
@Override
public void readAdditionalSaveData(CompoundTag compound) {
super.readAdditionalSaveData(compound);
if (compound.contains("home_X")) {
this.restrictTo(new BlockPos(compound.getInt("home_X"), compound.getInt("home_Y"), compound.getInt("home_Z")), MAX_HOME_DISTANCE);
}
if (compound.contains("fireplace_X")) {
this.setFirelacePos(new BlockPos(compound.getInt("fireplace_X"), compound.getInt("fireplace_Y"), compound.getInt("fireplace_Z")));
}
lastTimeFished = compound.getLong("lastTimeFished");
if (compound.contains("koa_inventory", 9)) {
ListTag nbttaglist = compound.getList("koa_inventory", 10);
for (int i = 0; i < nbttaglist.size(); ++i) {
CompoundTag nbttagcompound = nbttaglist.getCompound(i);
int j = nbttagcompound.getByte("Slot") & 255;
this.inventory.setItem(j, ItemStack.of(nbttagcompound));
}
}
this.villageID = compound.getInt("village_id");
// backwards compat
if (!compound.contains("village_dimension")) {
this.villageDimension = level.dimension();
} else {
this.villageDimension = ResourceKey.create(Registry.DIMENSION_REGISTRY, new ResourceLocation(compound.getString("village_dim_id")));
}
if (compound.contains("role_id")) {
this.getEntityData().set(ROLE, compound.getInt("role_id"));
} else {
rollDiceRole();
}
if (compound.contains("gender_id")) {
this.getEntityData().set(GENDER, compound.getInt("gender_id"));
} else {
rollDiceGender();
}
this.lastTradeTime = compound.getLong("lastTradeTime");
for (int i = 0; i < MAX_DRUMS; i++) {
if (compound.contains("drum_" + i + "_X")) {
this.listPosDrums.add(new BlockPos(compound.getInt("drum_" + i + "_X"), compound.getInt("drum_" + i + "_Y"), compound.getInt("drum_" + i + "_Z")));
}
}
druggedTime = compound.getInt("druggedTime");
updateUniqueEntityAI();
}
use of net.minecraft.nbt.CompoundTag in project Tropicraft by Tropicraft.
the class CocktailItem method appendHoverText.
@Override
@OnlyIn(Dist.CLIENT)
public void appendHoverText(ItemStack stack, @Nullable Level world, List<Component> tooltip, TooltipFlag flag) {
Drink drink = getDrink(stack);
if (drink == Drink.COCKTAIL && stack.hasTag() && stack.getTag().contains("Ingredients")) {
final ListTag ingredients = stack.getTag().getList("Ingredients", 10);
for (int i = 0; i < ingredients.size(); ++i) {
CompoundTag ingredient = ingredients.getCompound(i);
int id = ingredient.getByte("IngredientID");
Component ingredientName = Ingredient.ingredientsList[id].getDisplayName();
int ingredientColor = Ingredient.ingredientsList[id].getColor();
// String lvl = StatCollector.translateToLocal("enchantment.level." + count);
// par3List.add(ingredientName + " " + lvl);
tooltip.add(ingredientName);
}
}
}
Aggregations