本文整理汇总了Java中net.minecraft.nbt.NBTTagCompound.setTag方法的典型用法代码示例。如果您正苦于以下问题:Java NBTTagCompound.setTag方法的具体用法?Java NBTTagCompound.setTag怎么用?Java NBTTagCompound.setTag使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraft.nbt.NBTTagCompound
的用法示例。
在下文中一共展示了NBTTagCompound.setTag方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: writeToNBT
import net.minecraft.nbt.NBTTagCompound; //导入方法依赖的package包/类
@Override
public NBTTagCompound writeToNBT(NBTTagCompound compound) {
super.writeToNBT(compound);
compound.setTag("items", inventory.saveToNbt());
if (inventory.hasCustomName()) {
compound.setString("CustomName", this.customName);
}
compound.setInteger("WorkTime", (short) this.workTime);
compound.setInteger("totalWorkTime", (short) this.totalWorkTime);
compound.setInteger("BurnTime", (short) this.burnTime);
compound.setInteger("itemBurnTime", (short) this.itemBurnTime);
compound.setBoolean("isBurning", this.isBurning);
return compound;
}
示例2: saveChunk
import net.minecraft.nbt.NBTTagCompound; //导入方法依赖的package包/类
public void saveChunk(World worldIn, Chunk chunkIn) throws MinecraftException, IOException
{
worldIn.checkSessionLock();
try
{
NBTTagCompound nbttagcompound = new NBTTagCompound();
NBTTagCompound nbttagcompound1 = new NBTTagCompound();
nbttagcompound.setTag("Level", nbttagcompound1);
this.writeChunkToNBT(chunkIn, worldIn, nbttagcompound1);
this.addChunkToPending(chunkIn.getChunkCoordIntPair(), nbttagcompound);
}
catch (Exception exception)
{
logger.error((String)"Failed to save chunk", (Throwable)exception);
}
}
示例3: writeToTags
import net.minecraft.nbt.NBTTagCompound; //导入方法依赖的package包/类
public NBTTagCompound writeToTags()
{
NBTTagCompound nbttagcompound = new NBTTagCompound();
nbttagcompound.setTag("buy", this.itemToBuy.writeToNBT(new NBTTagCompound()));
nbttagcompound.setTag("sell", this.itemToSell.writeToNBT(new NBTTagCompound()));
if (this.secondItemToBuy != null)
{
nbttagcompound.setTag("buyB", this.secondItemToBuy.writeToNBT(new NBTTagCompound()));
}
nbttagcompound.setInteger("uses", this.toolUses);
nbttagcompound.setInteger("maxUses", this.maxTradeUses);
nbttagcompound.setBoolean("rewardExp", this.rewardsExp);
return nbttagcompound;
}
示例4: writeToNBT
import net.minecraft.nbt.NBTTagCompound; //导入方法依赖的package包/类
public NBTTagCompound writeToNBT(NBTTagCompound compound)
{
super.writeToNBT(compound);
compound.setInteger("Base", this.baseColor.getDyeDamage());
if (this.patterns != null)
{
compound.setTag("Patterns", this.patterns);
}
if (this.hasCustomName())
{
compound.setString("CustomName", this.field_190617_a);
}
return compound;
}
示例5: writeToNBT
import net.minecraft.nbt.NBTTagCompound; //导入方法依赖的package包/类
@Override
public void writeToNBT(NBTTagCompound tag) {
NBTTagCompound pneumaticTag = new NBTTagCompound();
pneumaticTag.setInteger("air", air);
pneumaticTag.setInteger("volume", volume);
pneumaticTag.setFloat("maxPressure", maxPressure);
tag.setTag("pneumatic", pneumaticTag);
}
示例6: writeToNBT
import net.minecraft.nbt.NBTTagCompound; //导入方法依赖的package包/类
@Override
public NBTTagCompound writeToNBT(NBTTagCompound nbtTagCompound) {
super.writeToNBT(nbtTagCompound);
nbtTagCompound.setInteger("burnTime", burnTime);
nbtTagCompound.setInteger("maxBurn", maxBurnTime);
nbtTagCompound.setInteger("redstoneMode", redstoneMode);
nbtTagCompound.setTag("Items", inventory.serializeNBT());
return nbtTagCompound;
}
示例7: writeEntityToNBT
import net.minecraft.nbt.NBTTagCompound; //导入方法依赖的package包/类
/**
* (abstract) Protected helper method to write subclass entity data to NBT.
*/
protected void writeEntityToNBT(NBTTagCompound compound)
{
super.writeEntityToNBT(compound);
if (this.lootTable != null)
{
compound.setString("LootTable", this.lootTable.toString());
if (this.lootTableSeed != 0L)
{
compound.setLong("LootTableSeed", this.lootTableSeed);
}
}
else
{
NBTTagList nbttaglist = new NBTTagList();
for (int i = 0; i < this.minecartContainerItems.length; ++i)
{
if (this.minecartContainerItems[i] != null)
{
NBTTagCompound nbttagcompound = new NBTTagCompound();
nbttagcompound.setByte("Slot", (byte)i);
this.minecartContainerItems[i].writeToNBT(nbttagcompound);
nbttaglist.appendTag(nbttagcompound);
}
}
compound.setTag("Items", nbttaglist);
}
}
示例8: readPoseFromNBT
import net.minecraft.nbt.NBTTagCompound; //导入方法依赖的package包/类
private NBTTagCompound readPoseFromNBT()
{
NBTTagCompound nbttagcompound = new NBTTagCompound();
if (!DEFAULT_HEAD_ROTATION.equals(this.headRotation))
{
nbttagcompound.setTag("Head", this.headRotation.writeToNBT());
}
if (!DEFAULT_BODY_ROTATION.equals(this.bodyRotation))
{
nbttagcompound.setTag("Body", this.bodyRotation.writeToNBT());
}
if (!DEFAULT_LEFTARM_ROTATION.equals(this.leftArmRotation))
{
nbttagcompound.setTag("LeftArm", this.leftArmRotation.writeToNBT());
}
if (!DEFAULT_RIGHTARM_ROTATION.equals(this.rightArmRotation))
{
nbttagcompound.setTag("RightArm", this.rightArmRotation.writeToNBT());
}
if (!DEFAULT_LEFTLEG_ROTATION.equals(this.leftLegRotation))
{
nbttagcompound.setTag("LeftLeg", this.leftLegRotation.writeToNBT());
}
if (!DEFAULT_RIGHTLEG_ROTATION.equals(this.rightLegRotation))
{
nbttagcompound.setTag("RightLeg", this.rightLegRotation.writeToNBT());
}
return nbttagcompound;
}
示例9: fixTagCompound
import net.minecraft.nbt.NBTTagCompound; //导入方法依赖的package包/类
public NBTTagCompound fixTagCompound(NBTTagCompound compound)
{
if ("EntityHorse".equals(compound.getString("id")) && !compound.hasKey("SaddleItem", 10) && compound.getBoolean("Saddle"))
{
NBTTagCompound nbttagcompound = new NBTTagCompound();
nbttagcompound.setString("id", "minecraft:saddle");
nbttagcompound.setByte("Count", (byte)1);
nbttagcompound.setShort("Damage", (short)0);
compound.setTag("SaddleItem", nbttagcompound);
compound.removeTag("Saddle");
}
return compound;
}
示例10: actionPerformed
import net.minecraft.nbt.NBTTagCompound; //导入方法依赖的package包/类
@Override
public void actionPerformed(GuiButton button) {
if (button.id == 0) {
invSearchGui = new GuiInventorySearcher(FMLClientHandler.instance().getClient().player);
FMLClientHandler.instance().showGuiScreen(invSearchGui);
} else if (button.id == 1) {
NBTTagCompound mainTag = new NBTTagCompound();
mainTag.setTag("main", remote.getTagCompound() != null ? remote.getTagCompound().getTagList("actionWidgets", 10) : new NBTTagCompound());
FMLClientHandler.instance().showGuiScreen(pastebinGui = new GuiPastebin(this, mainTag));
}
}
示例11: writeToNBT
import net.minecraft.nbt.NBTTagCompound; //导入方法依赖的package包/类
@Override
public NBTTagCompound writeToNBT(NBTTagCompound compound) {
NBTTagList list = new NBTTagList();
for (Map.Entry<Integer, DimensionData> entry : dimensionDataMap.entrySet()) {
int dimensionId = entry.getKey();
DimensionData data = entry.getValue();
NBTTagCompound tag = new NBTTagCompound();
tag.setInteger("dimension", dimensionId);
data.writeToNBT(tag);
list.appendTag(tag);
}
compound.setTag("dimlist", list);
return compound;
}
示例12: writeEntityToNBT
import net.minecraft.nbt.NBTTagCompound; //导入方法依赖的package包/类
/**
* (abstract) Protected helper method to write subclass entity data to NBT.
*/
public void writeEntityToNBT(NBTTagCompound compound)
{
super.writeEntityToNBT(compound);
compound.setInteger("Profession", this.getProfession());
compound.setString("ProfessionName", this.getProfessionForge().getRegistryName().toString());
compound.setInteger("Riches", this.wealth);
compound.setInteger("Career", this.careerId);
compound.setInteger("CareerLevel", this.careerLevel);
compound.setBoolean("Willing", this.isWillingToMate);
if (this.buyingList != null)
{
compound.setTag("Offers", this.buyingList.getRecipiesAsTags());
}
NBTTagList nbttaglist = new NBTTagList();
for (int i = 0; i < this.villagerInventory.getSizeInventory(); ++i)
{
ItemStack itemstack = this.villagerInventory.getStackInSlot(i);
if (itemstack != null)
{
nbttaglist.appendTag(itemstack.writeToNBT(new NBTTagCompound()));
}
}
compound.setTag("Inventory", nbttaglist);
}
示例13: writeToNBT
import net.minecraft.nbt.NBTTagCompound; //导入方法依赖的package包/类
public NBTTagCompound writeToNBT(NBTTagCompound compound)
{
super.writeToNBT(compound);
if (!this.checkLootAndWrite(compound))
{
NBTTagList nbttaglist = new NBTTagList();
for (int i = 0; i < this.inventory.length; ++i)
{
if (this.inventory[i] != null)
{
NBTTagCompound nbttagcompound = new NBTTagCompound();
nbttagcompound.setByte("Slot", (byte)i);
this.inventory[i].writeToNBT(nbttagcompound);
nbttaglist.appendTag(nbttagcompound);
}
}
compound.setTag("Items", nbttaglist);
}
compound.setInteger("TransferCooldown", this.transferCooldown);
if (this.hasCustomName())
{
compound.setString("CustomName", this.customName);
}
return compound;
}
示例14: applyEntityIdToItemStack
import net.minecraft.nbt.NBTTagCompound; //导入方法依赖的package包/类
/**
* APplies the given entity ID to the given ItemStack's NBT data.
*/
public static void applyEntityIdToItemStack(ItemStack stack, ResourceLocation entityId)
{
NBTTagCompound nbttagcompound = stack.hasTagCompound() ? stack.getTagCompound() : new NBTTagCompound();
NBTTagCompound nbttagcompound1 = new NBTTagCompound();
nbttagcompound1.setString("id", entityId.toString());
nbttagcompound.setTag("EntityTag", nbttagcompound1);
stack.setTagCompound(nbttagcompound);
}
示例15: onItemUse
import net.minecraft.nbt.NBTTagCompound; //导入方法依赖的package包/类
@Override
public EnumActionResult onItemUse(EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
ItemStack iStack = player.getHeldItem(hand);
if (!world.isRemote) {
EntityDrone drone = new EntityLogisticsDrone(world, player);
BlockPos placePos = pos.offset(facing);
drone.setPosition(placePos.getX() + 0.5, placePos.getY() + 0.5, placePos.getZ() + 0.5);
world.spawnEntity(drone);
NBTTagCompound stackTag = iStack.getTagCompound();
NBTTagCompound entityTag = new NBTTagCompound();
drone.writeEntityToNBT(entityTag);
if (stackTag != null) {
entityTag.setFloat("currentAir", stackTag.getFloat("currentAir"));
entityTag.setInteger("color", stackTag.getInteger("color"));
entityTag.setTag(ChargeableItemHandler.NBT_UPGRADE_TAG, stackTag.getCompoundTag(ChargeableItemHandler.NBT_UPGRADE_TAG));
}
drone.readEntityFromNBT(entityTag);
addLogisticsProgram(pos, drone.progWidgets);
if (iStack.hasDisplayName()) drone.setCustomNameTag(iStack.getDisplayName());
drone.naturallySpawned = false;
//TODO 1.8 check if valid replacement drone.onSpawnWithEgg(null);
drone.onInitialSpawn(world.getDifficultyForLocation(placePos), null);
iStack.shrink(1);
}
return EnumActionResult.SUCCESS;
}