use of net.minecraft.nbt.CompoundTag in project MC-Prefab by Brian-Wuest.
the class StructureTagMessage method encode.
public static void encode(StructureTagMessage message, FriendlyByteBuf buf) {
CompoundTag tag = new CompoundTag();
tag.putInt("config", message.structureConfig.identifier);
tag.put("dataTag", message.tagMessage);
buf.writeNbt(tag);
}
use of net.minecraft.nbt.CompoundTag in project MC-Prefab by Brian-Wuest.
the class StructureConfiguration method WriteToCompoundTag.
/**
* Writes the properties to an CompoundTag.
*
* @return An CompoundTag with the updated properties.
*/
public CompoundTag WriteToCompoundTag() {
CompoundTag tag = new CompoundTag();
if (this.pos != null) {
tag.putInt(StructureConfiguration.hitXTag, this.pos.getX());
tag.putInt(StructureConfiguration.hitYTag, this.pos.getY());
tag.putInt(StructureConfiguration.hitZTag, this.pos.getZ());
}
tag.putString(StructureConfiguration.houseFacingTag, this.houseFacing.getSerializedName());
tag = this.CustomWriteToCompoundTag(tag);
return tag;
}
use of net.minecraft.nbt.CompoundTag in project MC-Prefab by Brian-Wuest.
the class HouseConfiguration method WriteToCompoundTag.
@Override
public CompoundTag WriteToCompoundTag() {
CompoundTag tag = new CompoundTag();
// This tag should only be written for options which will NOT be overwritten by server options.
// Server configuration settings will be used for all other options.
// This is so the server admin can force a player to not use something.
tag.putBoolean(HouseConfiguration.addTorchesTag, this.addTorches);
tag.putBoolean(HouseConfiguration.addBedTag, this.addBed);
tag.putBoolean(HouseConfiguration.addCraftingTableTag, this.addCraftingTable);
tag.putBoolean(HouseConfiguration.addFurnaceTag, this.addFurnace);
tag.putBoolean(HouseConfiguration.addChestTag, this.addChest);
tag.putBoolean(HouseConfiguration.addChestContentsTag, this.addChestContents);
tag.putBoolean(HouseConfiguration.addMineShaftTag, this.addMineShaft);
tag.putInt(HouseConfiguration.hitXTag, this.pos.getX());
tag.putInt(HouseConfiguration.hitYTag, this.pos.getY());
tag.putInt(HouseConfiguration.hitZTag, this.pos.getZ());
tag.putString(HouseConfiguration.houseFacingTag, this.houseFacing.getSerializedName());
tag.putInt(HouseConfiguration.houseStyleTag, this.houseStyle.value);
tag.putString(HouseConfiguration.glassColorTag, this.glassColor.getSerializedName().toUpperCase());
tag.putString(HouseConfiguration.bedColorTag, this.bedColor.getSerializedName().toUpperCase());
return tag;
}
use of net.minecraft.nbt.CompoundTag in project MC-Prefab by Brian-Wuest.
the class EntityPlayerConfiguration method loadFromEntityData.
/**
* Creates an EntityPlayerConfiguration from an entity player object.
*
* @param player The player to create the instance from.
* @return A new instance of EntityPlayerConfiguration.
*/
public static EntityPlayerConfiguration loadFromEntityData(Player player) {
EntityPlayerConfiguration config = new EntityPlayerConfiguration();
CompoundTag compoundTag = config.getModIsPlayerNewTag(player);
config.loadFromNBTTagCompound(compoundTag);
return config;
}
use of net.minecraft.nbt.CompoundTag in project MC-Prefab by Brian-Wuest.
the class EntityPlayerConfiguration method saveToPlayer.
/**
* Saves this instance's data to the player tag.
*
* @param player The player to save the data too.
*/
public void saveToPlayer(Player player) {
CompoundTag compoundTag = this.getModIsPlayerNewTag(player);
compoundTag.putBoolean(EntityPlayerConfiguration.Built_Starter_house_Tag, this.builtStarterHouse);
compoundTag.putBoolean(EntityPlayerConfiguration.GIVEN_HOUSEBUILDER_TAG, this.givenHouseBuilder);
}
Aggregations