本文整理汇总了Java中net.minecraft.nbt.NBTPrimitive类的典型用法代码示例。如果您正苦于以下问题:Java NBTPrimitive类的具体用法?Java NBTPrimitive怎么用?Java NBTPrimitive使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
NBTPrimitive类属于net.minecraft.nbt包,在下文中一共展示了NBTPrimitive类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: deserializeNBT
import net.minecraft.nbt.NBTPrimitive; //导入依赖的package包/类
@Override public void deserializeNBT(NBTBase nbt) {
if (nbt == null)
return;
// NEW NBT DESERIALIZING
if (nbt instanceof NBTTagIntArray) {
int[] ia = ((NBTTagIntArray) nbt).getIntArray();
for (int i : ia)
received.add(i);
}
// OLD NBT DESERIALIZING
else if (nbt instanceof NBTTagList) {
NBTTagList nbtl = (NBTTagList) nbt;
for (int i = 0; i < nbtl.tagCount(); i++) {
NBTBase nb = nbtl.get(i);
if (nb instanceof NBTPrimitive)
received.add(((NBTPrimitive) nb).getInt());
}
}
}
开发者ID:Szewek,项目名称:Minecraft-Flux,代码行数:20,代码来源:SpecialEventReceiver.java
示例2: toLua
import net.minecraft.nbt.NBTPrimitive; //导入依赖的package包/类
public static Object toLua(NBTBase nbt) {
checkNotNull(nbt, "nbt == null!");
if (nbt instanceof NBTPrimitive)
return toLua((NBTPrimitive) nbt);
if (nbt instanceof NBTTagString)
return toLua((NBTTagString) nbt);
if (nbt instanceof NBTTagList)
return toLua((NBTTagList) nbt);
if (nbt instanceof NBTTagCompound)
return toLua((NBTTagCompound) nbt);
throw new IllegalArgumentException(
"Unsupported NBT type for conversion: " + nbt.getClass().getName());
}
开发者ID:wizards-of-lua,项目名称:wizards-of-lua,代码行数:14,代码来源:NbtConverter.java
示例3: compareData
import net.minecraft.nbt.NBTPrimitive; //导入依赖的package包/类
/**
* Compare two {@link NBTTagCompound}s for morphing acquiring
*/
public static boolean compareData(NBTTagCompound a, NBTTagCompound b)
{
/* Different count of tags? They're different */
if (a.getSize() != b.getSize())
{
return false;
}
for (String key : a.getKeySet())
{
NBTBase aTag = a.getTag(key);
NBTBase bTag = b.getTag(key);
/* Supporting condition for size check above, in case if the size
* the same, but different keys are missing */
if (bTag == null)
{
return false;
}
/* We check only strings and primitives, lists and compounds aren't
* concern of mine */
if (!(aTag instanceof NBTPrimitive) && !(aTag instanceof NBTTagString))
{
continue;
}
if (!aTag.equals(bTag))
{
return false;
}
}
return true;
}
开发者ID:mchorse,项目名称:metamorph,代码行数:39,代码来源:EntityUtils.java
示例4: readItemStacksFromTag
import net.minecraft.nbt.NBTPrimitive; //导入依赖的package包/类
/**
* NBT item loading function with support for stack sizes > 32K
*/
public static void readItemStacksFromTag(ItemStack[] items, NBTTagList tagList) {
for (int i = 0; i < tagList.tagCount(); i++) {
NBTTagCompound tag = tagList.getCompoundTagAt(i);
int b = tag.getShort("Slot");
items[b] = new ItemStack(tag);
if (tag.hasKey("Quantity")) {
items[b].setCount(((NBTPrimitive) tag.getTag("Quantity")).getInt());
}
}
}
开发者ID:TheCBProject,项目名称:CodeChickenLib,代码行数:14,代码来源:InventoryUtils.java
示例5: getUses
import net.minecraft.nbt.NBTPrimitive; //导入依赖的package包/类
public static float getUses(NBTTagCompound tag) {
NBTBase value = tag.getTag(TAG_USES);
if (value == null) return 0;
if (value instanceof NBTPrimitive) return ((NBTPrimitive)value).getFloat();
throw new IllegalStateException("Invalid tag type: " + value);
}
开发者ID:OpenMods,项目名称:OpenBlocks,代码行数:8,代码来源:ItemImaginary.java
示例6: test
import net.minecraft.nbt.NBTPrimitive; //导入依赖的package包/类
@Override
public boolean test(NBTPrimitive nbtPrimitive) {
return nbtPrimitive instanceof NBTTagFloat && comparisonMode.testFloat(this.getFloat(), nbtPrimitive.getFloat());
}
开发者ID:HellFirePvP,项目名称:ModularMachinery,代码行数:5,代码来源:NBTComparableFloat.java
示例7: test
import net.minecraft.nbt.NBTPrimitive; //导入依赖的package包/类
@Override
public boolean test(NBTPrimitive nbtPrimitive) {
return nbtPrimitive instanceof NBTTagShort && comparisonMode.testShort(this.getShort(), nbtPrimitive.getShort());
}
开发者ID:HellFirePvP,项目名称:ModularMachinery,代码行数:5,代码来源:NBTComparableShort.java
示例8: test
import net.minecraft.nbt.NBTPrimitive; //导入依赖的package包/类
@Override
public boolean test(NBTPrimitive nbtPrimitive) {
return nbtPrimitive instanceof NBTTagLong && comparisonMode.testLong(this.getLong(), nbtPrimitive.getLong());
}
开发者ID:HellFirePvP,项目名称:ModularMachinery,代码行数:5,代码来源:NBTComparableLong.java
示例9: test
import net.minecraft.nbt.NBTPrimitive; //导入依赖的package包/类
@Override
public boolean test(NBTPrimitive nbtPrimitive) {
return nbtPrimitive instanceof NBTTagDouble && comparisonMode.testDouble(this.getDouble(), nbtPrimitive.getDouble());
}
开发者ID:HellFirePvP,项目名称:ModularMachinery,代码行数:5,代码来源:NBTComparableDouble.java
示例10: test
import net.minecraft.nbt.NBTPrimitive; //导入依赖的package包/类
@Override
public boolean test(NBTPrimitive nbtPrimitive) {
return nbtPrimitive instanceof NBTTagByte && comparisonMode.testByte(this.getByte(), nbtPrimitive.getByte());
}
开发者ID:HellFirePvP,项目名称:ModularMachinery,代码行数:5,代码来源:NBTComparableByte.java
示例11: test
import net.minecraft.nbt.NBTPrimitive; //导入依赖的package包/类
@Override
public boolean test(NBTPrimitive nbtPrimitive) {
return nbtPrimitive instanceof NBTTagInt && comparisonMode.testInt(this.getInt(), nbtPrimitive.getInt());
}
开发者ID:HellFirePvP,项目名称:ModularMachinery,代码行数:5,代码来源:NBTComparableInteger.java
示例12: readNBT
import net.minecraft.nbt.NBTPrimitive; //导入依赖的package包/类
@Override
public void readNBT(Capability<IMunny> capability, IMunny instance, EnumFacing side, NBTBase nbt) {
instance.setMunny(((NBTPrimitive)nbt).getInt());
}
开发者ID:Wehavecookies56,项目名称:Kingdom-Keys-Re-Coded,代码行数:6,代码来源:MunnyCapability.java
示例13: readNBT
import net.minecraft.nbt.NBTPrimitive; //导入依赖的package包/类
@Override
public void readNBT(Capability<ICheatMode> capability, ICheatMode instance, EnumFacing side, NBTBase nbt) {
instance.setCheatMode(((NBTPrimitive)nbt).getInt() == 1);
}
开发者ID:Wehavecookies56,项目名称:Kingdom-Keys-Re-Coded,代码行数:5,代码来源:CheatModeCapability.java
示例14: hasPrimitive
import net.minecraft.nbt.NBTPrimitive; //导入依赖的package包/类
private static boolean hasPrimitive(NBTTagCompound compound, String key)
{
return compound.hasKey(key) && compound.getTag(key) instanceof NBTPrimitive;
}
开发者ID:Ivorforce,项目名称:IvToolkit,代码行数:5,代码来源:NBTStateInjector.java
示例15: test
import net.minecraft.nbt.NBTPrimitive; //导入依赖的package包/类
public boolean test(NBTPrimitive numberTag);
开发者ID:HellFirePvP,项目名称:ModularMachinery,代码行数:2,代码来源:NBTComparableNumber.java
注:本文中的net.minecraft.nbt.NBTPrimitive类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论