本文整理汇总了Java中net.minecraft.nbt.NBTTagCompound.getString方法的典型用法代码示例。如果您正苦于以下问题:Java NBTTagCompound.getString方法的具体用法?Java NBTTagCompound.getString怎么用?Java NBTTagCompound.getString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraft.nbt.NBTTagCompound
的用法示例。
在下文中一共展示了NBTTagCompound.getString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: readScores
import net.minecraft.nbt.NBTTagCompound; //导入方法依赖的package包/类
protected void readScores(NBTTagList nbt)
{
for (int i = 0; i < nbt.tagCount(); ++i)
{
NBTTagCompound nbttagcompound = nbt.getCompoundTagAt(i);
ScoreObjective scoreobjective = this.theScoreboard.getObjective(nbttagcompound.getString("Objective"));
String s = nbttagcompound.getString("Name");
if (s.length() > 40)
{
s = s.substring(0, 40);
}
Score score = this.theScoreboard.getValueFromObjective(s, scoreobjective);
score.setScorePoints(nbttagcompound.getInteger("Score"));
if (nbttagcompound.hasKey("Locked"))
{
score.setLocked(nbttagcompound.getBoolean("Locked"));
}
}
}
示例2: validBookTagContents
import net.minecraft.nbt.NBTTagCompound; //导入方法依赖的package包/类
public static boolean validBookTagContents(NBTTagCompound nbt)
{
if (!ItemWritableBook.isNBTValid(nbt))
{
return false;
}
else if (!nbt.hasKey("title", 8))
{
return false;
}
else
{
String s = nbt.getString("title");
return s != null && s.length() <= 32 ? nbt.hasKey("author", 8) : false;
}
}
示例3: readObjectives
import net.minecraft.nbt.NBTTagCompound; //导入方法依赖的package包/类
protected void readObjectives(NBTTagList nbt)
{
for (int i = 0; i < nbt.tagCount(); ++i)
{
NBTTagCompound nbttagcompound = nbt.getCompoundTagAt(i);
IScoreObjectiveCriteria iscoreobjectivecriteria = (IScoreObjectiveCriteria)IScoreObjectiveCriteria.INSTANCES.get(nbttagcompound.getString("CriteriaName"));
if (iscoreobjectivecriteria != null)
{
String s = nbttagcompound.getString("Name");
if (s.length() > 16)
{
s = s.substring(0, 16);
}
ScoreObjective scoreobjective = this.theScoreboard.addScoreObjective(s, iscoreobjectivecriteria);
scoreobjective.setDisplayName(nbttagcompound.getString("DisplayName"));
scoreobjective.setRenderType(IScoreObjectiveCriteria.EnumRenderType.func_178795_a(nbttagcompound.getString("RenderType")));
}
}
}
示例4: getDisplayName
import net.minecraft.nbt.NBTTagCompound; //导入方法依赖的package包/类
/**
* returns the display name of the itemstack
*/
public String getDisplayName()
{
NBTTagCompound nbttagcompound = this.getSubCompound("display");
if (nbttagcompound != null)
{
if (nbttagcompound.hasKey("Name", 8))
{
return nbttagcompound.getString("Name");
}
if (nbttagcompound.hasKey("LocName", 8))
{
return I18n.translateToLocal(nbttagcompound.getString("LocName"));
}
}
return this.getItem().getItemStackDisplayName(this);
}
示例5: getEntityIdFromItem
import net.minecraft.nbt.NBTTagCompound; //导入方法依赖的package包/类
/**
* Gets the entity ID associated with a given ItemStack in its NBT data.
*/
@Nullable
public static String getEntityIdFromItem(ItemStack stack)
{
NBTTagCompound nbttagcompound = stack.getTagCompound();
if (nbttagcompound == null)
{
return null;
}
else if (!nbttagcompound.hasKey("EntityTag", 10))
{
return null;
}
else
{
NBTTagCompound nbttagcompound1 = nbttagcompound.getCompoundTag("EntityTag");
return !nbttagcompound1.hasKey("id", 8) ? null : nbttagcompound1.getString("id");
}
}
示例6: readFromNBT
import net.minecraft.nbt.NBTTagCompound; //导入方法依赖的package包/类
@Override
public void readFromNBT(NBTTagCompound tag)
{
super.readFromNBT(tag);
activeFaces.clear();
int faceCount = tag.getInteger("activeFaces");
for(int i = 0; i < faceCount; i++)
{
activeFaces.add(EnumFacing.getFront(tag.getInteger("activeFace_" + i)));
}
active = tag.getBoolean("active");
channel = tag.getString("channel");
distance = tag.getInteger("distance");
propagateTime = tag.getInteger("propagateTime");
fadeoutTime = tag.getInteger("fadeoutTime");
}
示例7: readEntityFromNBT
import net.minecraft.nbt.NBTTagCompound; //导入方法依赖的package包/类
/**
* (abstract) Protected helper method to read subclass entity data from NBT.
*/
public void readEntityFromNBT(NBTTagCompound compound)
{
String s = compound.getString("Motive");
for (EntityPainting.EnumArt entitypainting$enumart : EntityPainting.EnumArt.values())
{
if (entitypainting$enumart.title.equals(s))
{
this.art = entitypainting$enumart;
}
}
if (this.art == null)
{
this.art = EntityPainting.EnumArt.KEBAB;
}
super.readEntityFromNBT(compound);
}
示例8: readFromNBT
import net.minecraft.nbt.NBTTagCompound; //导入方法依赖的package包/类
public void readFromNBT(NBTTagCompound compound)
{
super.readFromNBT(compound);
this.skullType = compound.getByte("SkullType");
this.skullRotation = compound.getByte("Rot");
if (this.skullType == 3)
{
if (compound.hasKey("Owner", 10))
{
this.playerProfile = NBTUtil.readGameProfileFromNBT(compound.getCompoundTag("Owner"));
}
else if (compound.hasKey("ExtraType", 8))
{
String s = compound.getString("ExtraType");
if (!StringUtils.isNullOrEmpty(s))
{
this.playerProfile = new GameProfile((UUID)null, s);
this.updatePlayerProfile();
}
}
}
}
示例9: readFromNBT
import net.minecraft.nbt.NBTTagCompound; //导入方法依赖的package包/类
/**
* Set defined game rules from NBT.
*/
public void readFromNBT(NBTTagCompound nbt)
{
for (String s : nbt.getKeySet())
{
String s1 = nbt.getString(s);
this.setOrCreateGameRule(s, s1);
}
}
示例10: readFromNBT
import net.minecraft.nbt.NBTTagCompound; //导入方法依赖的package包/类
public void readFromNBT(NBTTagCompound compound)
{
super.readFromNBT(compound);
NBTTagList nbttaglist = compound.getTagList("Items", 10);
this.furnaceItemStacks = new ItemStack[this.getSizeInventory()];
for (int i = 0; i < nbttaglist.tagCount(); ++i)
{
NBTTagCompound nbttagcompound = nbttaglist.getCompoundTagAt(i);
int j = nbttagcompound.getByte("Slot");
if (j >= 0 && j < this.furnaceItemStacks.length)
{
this.furnaceItemStacks[j] = ItemStack.loadItemStackFromNBT(nbttagcompound);
}
}
this.furnaceBurnTime = compound.getShort("BurnTime");
this.cookTime = compound.getShort("CookTime");
this.totalCookTime = compound.getShort("CookTimeTotal");
this.currentItemBurnTime = getItemBurnTime(this.furnaceItemStacks[1]);
if (compound.hasKey("CustomName", 8))
{
this.furnaceCustomName = compound.getString("CustomName");
}
}
示例11: readFromNBT
import net.minecraft.nbt.NBTTagCompound; //导入方法依赖的package包/类
@Override
public void readFromNBT(@NotNull NBTTagCompound compound) {
fluid = null;
isWorkFinished = compound.getBoolean(NBT_WORK);
if (compound.hasKey(NBT_FLUID)) fluid = compound.getString(NBT_FLUID);
if (fluid != null && !FluidRegistry.isFluidRegistered(fluid)) fluid = null;
super.readFromNBT(compound);
}
示例12: readFromNBT
import net.minecraft.nbt.NBTTagCompound; //导入方法依赖的package包/类
@Override
public void readFromNBT(NBTTagCompound tag) {
super.readFromNBT(tag);
vacuum = tag.getBoolean("vacuum");
grateRange = tag.getInteger("grateRange");
entityFilter = tag.getString("entityFilter");
}
示例13: readEntityFromNBT
import net.minecraft.nbt.NBTTagCompound; //导入方法依赖的package包/类
@Override
public void readEntityFromNBT(NBTTagCompound compound) {
super.readEntityFromNBT(compound);
UUID uuid = null;
if (compound.hasKey("Owner")) {
String s1 = compound.getString("Owner");
uuid = getUUID(s1);
}
if (uuid != null) {
try {
setOwnerId(uuid);
setTamed(true);
}
catch (Throwable var4) {
setTamed(false);
}
}
if (compound.hasKey("Item") && compound.getCompoundTag("Item") != null) {
setHeldItemStack(new ItemStack(compound.getCompoundTag("Item")));
}
if (compound.hasKey("Chest")) {
if (chestInventory == null) {
chestInventory = new TempChest(compound.getInteger("ChestSize"));
}
NBTTagList tagList = compound.getTagList("Chest", 10);
for (int i = 0; i < tagList.tagCount(); i++) {
NBTTagCompound slotNBT = tagList.getCompoundTagAt(i);
if (slotNBT != null) {
chestInventory.setInventorySlotContents(slotNBT.getInteger("Slot"), new ItemStack(slotNBT));
}
}
}
if (isSitting() != compound.getBoolean("Sitting")) {
setSitting(compound.getBoolean("Sitting"));
}
}
示例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: readFromNBT
import net.minecraft.nbt.NBTTagCompound; //导入方法依赖的package包/类
@Override
public void readFromNBT(NBTTagCompound tag, int guiLeft, int guiTop) {
super.readFromNBT(tag, guiLeft, guiTop);
widget = new GuiButtonSpecial(-1, tag.getInteger("x") + guiLeft, tag.getInteger("y") + guiTop, tag.getInteger("width"), tag.getInteger("height"), tag.getString("text"));
settingCoordinate = new BlockPos(tag.getInteger("settingX"), tag.getInteger("settingY"), tag.getInteger("settingZ"));
widget.setTooltipText(tag.getString("tooltip"));
}