本文整理汇总了Java中net.minecraft.nbt.NBTTagCompound.removeTag方法的典型用法代码示例。如果您正苦于以下问题:Java NBTTagCompound.removeTag方法的具体用法?Java NBTTagCompound.removeTag怎么用?Java NBTTagCompound.removeTag使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraft.nbt.NBTTagCompound
的用法示例。
在下文中一共展示了NBTTagCompound.removeTag方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: removeColor
import net.minecraft.nbt.NBTTagCompound; //导入方法依赖的package包/类
/**
* Remove the color from the specified armor ItemStack.
*/
public void removeColor(ItemStack stack)
{
if (this.material == ItemArmor.ArmorMaterial.LEATHER)
{
NBTTagCompound nbttagcompound = stack.getTagCompound();
if (nbttagcompound != null)
{
NBTTagCompound nbttagcompound1 = nbttagcompound.getCompoundTag("display");
if (nbttagcompound1.hasKey("color"))
{
nbttagcompound1.removeTag("color");
}
}
}
}
示例2: dropBlockAsItemWithChance
import net.minecraft.nbt.NBTTagCompound; //导入方法依赖的package包/类
/**
* Spawns this Block's drops into the World as EntityItems.
*/
public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune)
{
TileEntity tileentity = worldIn.getTileEntity(pos);
if (tileentity instanceof TileEntityBanner)
{
ItemStack itemstack = new ItemStack(Items.banner, 1, ((TileEntityBanner)tileentity).getBaseColor());
NBTTagCompound nbttagcompound = new NBTTagCompound();
tileentity.writeToNBT(nbttagcompound);
nbttagcompound.removeTag("x");
nbttagcompound.removeTag("y");
nbttagcompound.removeTag("z");
nbttagcompound.removeTag("id");
itemstack.setTagInfo("BlockEntityTag", nbttagcompound);
spawnAsEntity(worldIn, pos, itemstack);
}
else
{
super.dropBlockAsItemWithChance(worldIn, pos, state, chance, fortune);
}
}
示例3: setAbstractCropGrowth
import net.minecraft.nbt.NBTTagCompound; //导入方法依赖的package包/类
public static void setAbstractCropGrowth(EntityPlayer player, boolean add) {
NBTTagCompound tag = player.getEntityData();
if (!tag.hasKey(TAG_ABSTRACT) && add) {
tag.setInteger(TAG_ABSTRACT, 1);
return;
}
if (add) {
tag.setInteger(TAG_ABSTRACT, tag.getInteger(TAG_ABSTRACT) + 1);
}
else if (!add) {
int value = tag.getInteger(TAG_ABSTRACT);
if (player.worldObj.rand.nextInt(5) == 0)
tag.setInteger(TAG_ABSTRACT, value - 1);
}
if (tag.getInteger(TAG_ABSTRACT) <= 0)
tag.removeTag(TAG_ABSTRACT);
}
示例4: canAdvance
import net.minecraft.nbt.NBTTagCompound; //导入方法依赖的package包/类
@Override
public boolean canAdvance(World world, BlockPos pos, IBlockState state) {
TileEntity tile = world.getTileEntity(pos);
if (tile != null && tile instanceof TileFeroxia) {
TileFeroxia te = (TileFeroxia)tile;
EntityPlayer player = UCUtils.getPlayerFromUUID(te.getOwner().toString());
if (!world.isRemote && player != null && world.getPlayerEntityByUUID(te.getOwner()) != null) {
NBTTagCompound tag = player.getEntityData();
if (!tag.hasKey("hasSacrificed"))
{
player.addChatMessage(new TextComponentString(TextFormatting.RED + "The savage plant whispers: \"The time is right to perform a self sacrifice.\""));
tag.setBoolean("hasSacrificed", false);
return false;
}
if (tag.hasKey("hasSacrificed") && tag.getBoolean("hasSacrificed"))
{
tag.removeTag("hasSacrificed");
world.setBlockState(pos, ((Feroxia)state.getBlock()).withAge(7), 2);
GrowthSteps.generateSteps(player);
return false;
}
}
}
return false;
}
示例5: fixTagCompound
import net.minecraft.nbt.NBTTagCompound; //导入方法依赖的package包/类
public NBTTagCompound fixTagCompound(NBTTagCompound compound)
{
if ("Zombie".equals(compound.getString("id")))
{
int i = compound.getInteger("ZombieType");
switch (i)
{
case 0:
default:
break;
case 1:
case 2:
case 3:
case 4:
case 5:
compound.setString("id", "ZombieVillager");
compound.setInteger("Profession", i - 1);
break;
case 6:
compound.setString("id", "Husk");
}
compound.removeTag("ZombieType");
}
return compound;
}
示例6: fixTagCompound
import net.minecraft.nbt.NBTTagCompound; //导入方法依赖的package包/类
public NBTTagCompound fixTagCompound(NBTTagCompound compound)
{
if (!"MobSpawner".equals(compound.getString("id")))
{
return compound;
}
else
{
if (compound.hasKey("EntityId", 8))
{
String s = compound.getString("EntityId");
NBTTagCompound nbttagcompound = compound.getCompoundTag("SpawnData");
nbttagcompound.setString("id", s.isEmpty() ? "Pig" : s);
compound.setTag("SpawnData", nbttagcompound);
compound.removeTag("EntityId");
}
if (compound.hasKey("SpawnPotentials", 9))
{
NBTTagList nbttaglist = compound.getTagList("SpawnPotentials", 10);
for (int i = 0; i < nbttaglist.tagCount(); ++i)
{
NBTTagCompound nbttagcompound1 = nbttaglist.getCompoundTagAt(i);
if (nbttagcompound1.hasKey("Type", 8))
{
NBTTagCompound nbttagcompound2 = nbttagcompound1.getCompoundTag("Properties");
nbttagcompound2.setString("id", nbttagcompound1.getString("Type"));
nbttagcompound1.setTag("Entity", nbttagcompound2);
nbttagcompound1.removeTag("Type");
nbttagcompound1.removeTag("Properties");
}
}
}
return compound;
}
}
示例7: getDescriptionPacket
import net.minecraft.nbt.NBTTagCompound; //导入方法依赖的package包/类
/**
* Allows for a specialized description packet to be created. This is often used to sync tile entity data from the
* server to the client easily. For example this is used by signs to synchronise the text to be displayed.
*/
public Packet getDescriptionPacket()
{
NBTTagCompound nbttagcompound = new NBTTagCompound();
this.writeToNBT(nbttagcompound);
nbttagcompound.removeTag("Item");
nbttagcompound.setInteger("Item", Item.getIdFromItem(this.flowerPotItem));
return new S35PacketUpdateTileEntity(this.pos, 5, nbttagcompound);
}
示例8: copyDataFromOld
import net.minecraft.nbt.NBTTagCompound; //导入方法依赖的package包/类
/**
* Prepares this entity in new dimension by copying NBT data from entity in old dimension
*/
private void copyDataFromOld(Entity entityIn)
{
NBTTagCompound nbttagcompound = entityIn.writeToNBT(new NBTTagCompound());
nbttagcompound.removeTag("Dimension");
this.readFromNBT(nbttagcompound);
this.timeUntilPortal = entityIn.timeUntilPortal;
this.lastPortalPos = entityIn.lastPortalPos;
this.lastPortalVec = entityIn.lastPortalVec;
this.teleportDirection = entityIn.teleportDirection;
}
示例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: process
import net.minecraft.nbt.NBTTagCompound; //导入方法依赖的package包/类
public NBTTagCompound process(IDataFixer fixer, NBTTagCompound compound, int versionIn)
{
if (!compound.hasKey("tag", 10))
{
return compound;
}
else
{
NBTTagCompound nbttagcompound = compound.getCompoundTag("tag");
if (nbttagcompound.hasKey("BlockEntityTag", 10))
{
NBTTagCompound nbttagcompound1 = nbttagcompound.getCompoundTag("BlockEntityTag");
String s = compound.getString("id");
String s1 = getBlockEntityID(s);
boolean flag;
if (s1 == null)
{
LOGGER.warn("Unable to resolve BlockEntity for ItemInstance: {}", new Object[] {s});
flag = false;
}
else
{
flag = !nbttagcompound1.hasKey("id");
nbttagcompound1.setString("id", s1);
}
fixer.process(FixTypes.BLOCK_ENTITY, nbttagcompound1, versionIn);
if (flag)
{
nbttagcompound1.removeTag("id");
}
}
return compound;
}
}
示例11: fixTagCompound
import net.minecraft.nbt.NBTTagCompound; //导入方法依赖的package包/类
public NBTTagCompound fixTagCompound(NBTTagCompound compound)
{
String s = compound.getString("id");
boolean flag = "Painting".equals(s);
boolean flag1 = "ItemFrame".equals(s);
if ((flag || flag1) && !compound.hasKey("Facing", 99))
{
EnumFacing enumfacing;
if (compound.hasKey("Direction", 99))
{
enumfacing = EnumFacing.getHorizontal(compound.getByte("Direction"));
compound.setInteger("TileX", compound.getInteger("TileX") + enumfacing.getFrontOffsetX());
compound.setInteger("TileY", compound.getInteger("TileY") + enumfacing.getFrontOffsetY());
compound.setInteger("TileZ", compound.getInteger("TileZ") + enumfacing.getFrontOffsetZ());
compound.removeTag("Direction");
if (flag1 && compound.hasKey("ItemRotation", 99))
{
compound.setByte("ItemRotation", (byte)(compound.getByte("ItemRotation") * 2));
}
}
else
{
enumfacing = EnumFacing.getHorizontal(compound.getByte("Dir"));
compound.removeTag("Dir");
}
compound.setByte("Facing", (byte)enumfacing.getHorizontalIndex());
}
return compound;
}
示例12: fixTagCompound
import net.minecraft.nbt.NBTTagCompound; //导入方法依赖的package包/类
public NBTTagCompound fixTagCompound(NBTTagCompound compound)
{
if ("Zombie".equals(compound.getString("id")) && compound.getBoolean("IsVillager"))
{
if (!compound.hasKey("ZombieType", 99))
{
ZombieType zombietype = null;
if (compound.hasKey("VillagerProfession", 99))
{
try
{
zombietype = ZombieType.getByOrdinal(compound.getInteger("VillagerProfession") + 1);
}
catch (RuntimeException var4)
{
;
}
}
if (zombietype == null)
{
zombietype = ZombieType.getByOrdinal(RANDOM.nextInt(5) + 1);
}
compound.setInteger("ZombieType", zombietype.getId());
}
compound.removeTag("IsVillager");
}
return compound;
}
示例13: fixTagCompound
import net.minecraft.nbt.NBTTagCompound; //导入方法依赖的package包/类
public NBTTagCompound fixTagCompound(NBTTagCompound compound)
{
if ("ArmorStand".equals(compound.getString("id")) && compound.getBoolean("Silent") && !compound.getBoolean("Marker"))
{
compound.removeTag("Silent");
}
return compound;
}
示例14: process
import net.minecraft.nbt.NBTTagCompound; //导入方法依赖的package包/类
public NBTTagCompound process(IDataFixer fixer, NBTTagCompound compound, int versionIn)
{
if (!compound.hasKey("tag", 10))
{
return compound;
}
else
{
NBTTagCompound nbttagcompound = compound.getCompoundTag("tag");
if (nbttagcompound.hasKey("BlockEntityTag", 10))
{
NBTTagCompound nbttagcompound1 = nbttagcompound.getCompoundTag("BlockEntityTag");
String s = compound.getString("id");
String s1 = getBlockEntityID(versionIn, s);
boolean flag;
if (s1 == null)
{
LOGGER.warn("Unable to resolve BlockEntity for ItemInstance: {}", new Object[] {s});
flag = false;
}
else
{
flag = !nbttagcompound1.hasKey("id");
nbttagcompound1.setString("id", s1);
}
fixer.process(FixTypes.BLOCK_ENTITY, nbttagcompound1, versionIn);
if (flag)
{
nbttagcompound1.removeTag("id");
}
}
return compound;
}
}
示例15: getUpdateTag
import net.minecraft.nbt.NBTTagCompound; //导入方法依赖的package包/类
public NBTTagCompound getUpdateTag()
{
NBTTagCompound nbttagcompound = this.writeToNBT(new NBTTagCompound());
nbttagcompound.removeTag("SpawnPotentials");
return nbttagcompound;
}