當前位置: 首頁>>代碼示例>>Java>>正文


Java NBTTagIntArray類代碼示例

本文整理匯總了Java中net.minecraft.nbt.NBTTagIntArray的典型用法代碼示例。如果您正苦於以下問題:Java NBTTagIntArray類的具體用法?Java NBTTagIntArray怎麽用?Java NBTTagIntArray使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


NBTTagIntArray類屬於net.minecraft.nbt包,在下文中一共展示了NBTTagIntArray類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: writeEntityToNBT

import net.minecraft.nbt.NBTTagIntArray; //導入依賴的package包/類
@Override
public void writeEntityToNBT(NBTTagCompound nbt) {
	super.writeEntityToNBT(nbt);
	nbt.setBoolean("Hidden", this.hidden);
	if(hidden){
		nbt.setIntArray("HiddenPos", new int[]{this.hiddenBlock.getX(),this.hiddenBlock.getY(),this.hiddenBlock.getZ()});
		NBTTagList list=new NBTTagList();
		nbt.setTag("Props", list);
		for(BlockPos pos:this.usedPos)
			list.appendTag(new NBTTagIntArray(new int[]{pos.getX(),pos.getY(),pos.getZ()}));
	}
	nbt.setShort("Begin", (short)this.begin);
	nbt.setShort("Teleport", (short)this.teleportCooldown);
	nbt.setShort("BombCooldown", (short)this.bombCooldown);
	nbt.setShort("BombDuration", (short)this.bombDuration);
	nbt.setShort("TopBlock", (short)this.topBlock);
	nbt.setByte("HideCount", (byte)this.hideCount);
	nbt.setBoolean("Bomb", this.isBombSpell());
	
}
 
開發者ID:rafradek,項目名稱:Mods,代碼行數:21,代碼來源:EntityMerasmus.java

示例2: deserializeNBT

import net.minecraft.nbt.NBTTagIntArray; //導入依賴的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

示例3: writeToNBT

import net.minecraft.nbt.NBTTagIntArray; //導入依賴的package包/類
@Nonnull @Override public NBTTagCompound writeToNBT(NBTTagCompound nbt) {
	super.writeToNBT(nbt);
	nbt.setInteger("E", (int) energy);
	NBTTagList nbtl = new NBTTagList();
	for (byte i = 0; i < items.length; i++) {
		if (items[i].isEmpty())
			continue;
		NBTTagCompound inbt = new NBTTagCompound();
		inbt.setByte("Slot", i);
		nbtl.appendTag(items[i].writeToNBT(inbt));
	}
	nbt.setTag("Items", nbtl);
	nbtl = new NBTTagList();
	for (byte i = 0; i < tanks.length; i++) {
		if (tanks[i].fluid == null || tanks[i].fluid.amount == 0)
			continue;
		NBTTagCompound fnbt = new NBTTagCompound();
		fnbt.setByte("Slot", i);
		nbtl.appendTag(tanks[i].fluid.writeToNBT(fnbt));
	}
	nbt.setTag("Fluids", nbtl);
	int[] v = new int[vals.length];
	System.arraycopy(vals, 0, v, 0, vals.length);
	nbt.setTag("Vals", new NBTTagIntArray(v));
	return nbt;
}
 
開發者ID:Szewek,項目名稱:Minecraft-Flux,代碼行數:27,代碼來源:TileEntityFluxGen.java

示例4: asJson

import net.minecraft.nbt.NBTTagIntArray; //導入依賴的package包/類
private static void asJson(NBTBase tag, StringBuilder builder) {
	switch(tag.getId()) {
	case NBT.TAG_BYTE: builder.append(((NBTTagByte)tag).getByte()).append('b'); break;
	case NBT.TAG_SHORT: builder.append(((NBTTagShort)tag).getByte()).append('b'); break;
	case NBT.TAG_INT: builder.append(((NBTTagInt)tag).getInt()); break;
	case NBT.TAG_LONG: builder.append(((NBTTagLong)tag).getByte()).append('l'); break;
	case NBT.TAG_FLOAT: builder.append(((NBTTagFloat)tag).getFloat()).append('f'); break;
	case NBT.TAG_DOUBLE: builder.append(((NBTTagDouble)tag).getDouble()).append('d'); break;
	case NBT.TAG_STRING: builder.append('"').append(((NBTTagString)tag).getString()).append('"'); break;
	case NBT.TAG_BYTE_ARRAY: builder.append(Arrays.toString(((NBTTagByteArray)tag).getByteArray())); break;
	case NBT.TAG_INT_ARRAY: builder.append(Arrays.toString(((NBTTagIntArray)tag).getIntArray())); break;
	case NBT.TAG_COMPOUND: asJson((NBTTagCompound) tag, builder); break;
	case NBT.TAG_LIST: asJson((NBTTagList) tag, builder); break;
	}

}
 
開發者ID:tiffit,項目名稱:TaleCraft,代碼行數:17,代碼來源:NBTHelper.java

示例5: getPetEgg

import net.minecraft.nbt.NBTTagIntArray; //導入依賴的package包/類
public ItemStack getPetEgg( String petType )
{
	PetType type = PetType.forName( petType );
	int[] skills = new int[ type.defaultSkills.size() ];
	for ( int i = 0; i < skills.length; ++i )
	{
		skills[ i ] = type.defaultSkills.get( i );
	}
	
	NBTTagCompound petTag = new NBTTagCompound();

	petTag.setString( "Type", type.name );
	petTag.setInteger( "Level", 1 );
	petTag.setInteger( "FreeSkillPoints", 1 );
	petTag.setTag( "Skills", new NBTTagIntArray( skills ) );
	petTag.setFloat( "Hunger", PetEntity.MAX_HUNGER );

	ItemStack stack = new ItemStack( this );
	NBTTagCompound tag = new NBTTagCompound();
	tag.setTag( "Pet", petTag );
	stack.setTagCompound( tag );
	
	return stack;
}
 
開發者ID:spacechase0,項目名稱:UsefulPets,代碼行數:25,代碼來源:PetEggItem.java

示例6: any

import net.minecraft.nbt.NBTTagIntArray; //導入依賴的package包/類
private static StringBuilder any(StringBuilder sb, NBTBase nbt) {
	switch (nbt.getId()) {
	case Constants.NBT.TAG_COMPOUND:
		return compound(sb, (NBTTagCompound) nbt);
	case Constants.NBT.TAG_LIST:
		return list(sb, (NBTTagList) nbt);
	case Constants.NBT.TAG_INT_ARRAY:
		return intArray(sb, (NBTTagIntArray) nbt);
	case Constants.NBT.TAG_STRING:
		return string(sb, (NBTTagString) nbt);
	case Constants.NBT.TAG_DOUBLE:
		return _double(sb, (NBTTagDouble) nbt);
	case Constants.NBT.TAG_FLOAT:
		return _float(sb, (NBTTagFloat) nbt);
	default:
		return other(sb, nbt);
	}
}
 
開發者ID:Earthcomputer,項目名稱:Easy-Editors,代碼行數:19,代碼來源:NBTToJson.java

示例7: writeToPacket

import net.minecraft.nbt.NBTTagIntArray; //導入依賴的package包/類
@Override
public void writeToPacket(NBTTagCompound compound) {
    int[] array = new int[removeClientQueue.size()];
    for (int i = 0; i < removeClientQueue.size(); i++) {
        array[i] = removeClientQueue.get(i);
    }
    compound.setTag("removals", new NBTTagIntArray(array));
    array = new int[addClientQueue.size()];
    for (int i = 0; i < addClientQueue.size(); i++) {
        array[i] = addClientQueue.get(i);
    }
    compound.setTag("additions", new NBTTagIntArray(array));

    removeClientQueue.clear();
    addClientQueue.clear();
}
 
開發者ID:makeoo,項目名稱:Gadomancy,代碼行數:17,代碼來源:DataAchromatic.java

示例8: createTag

import net.minecraft.nbt.NBTTagIntArray; //導入依賴的package包/類
/** Creates and returns a primitive NBT tag from a value.
 *  If the value already is an NBT tag, it is returned instead. */
public static NBTBase createTag(Object value) {
	if (value == null)
		throw new IllegalArgumentException("value is null");
	if (value instanceof NBTBase) return (NBTBase)value;
	if (value instanceof Byte)    return new NBTTagByte((Byte)value);
	if (value instanceof Short)   return new NBTTagShort((Short)value);
	if (value instanceof Integer) return new NBTTagInt((Integer)value);
	if (value instanceof Long)    return new NBTTagLong((Long)value);
	if (value instanceof Float)   return new NBTTagFloat((Float)value);
	if (value instanceof Double)  return new NBTTagDouble((Double)value);
	if (value instanceof String)  return new NBTTagString((String)value);
	if (value instanceof byte[])  return new NBTTagByteArray((byte[])value);
	if (value instanceof int[])   return new NBTTagIntArray((int[])value);
	throw new IllegalArgumentException("Can't create an NBT tag of value: " + value);
}
 
開發者ID:copygirl,項目名稱:copycore,代碼行數:18,代碼來源:NbtUtils.java

示例9: getObject

import net.minecraft.nbt.NBTTagIntArray; //導入依賴的package包/類
public static Object getObject(NBTBase base)
{
	if(base instanceof NBTTagByte)
		return ((NBTTagByte)base).func_150290_f();
	if(base instanceof NBTTagShort)
		return ((NBTTagShort)base).func_150289_e();
	if(base instanceof NBTTagInt)
		return ((NBTTagInt)base).func_150287_d();
	if(base instanceof NBTTagLong)
		return ((NBTTagLong)base).func_150291_c();
	if(base instanceof NBTTagFloat)
		return ((NBTTagFloat)base).func_150288_h();
	if(base instanceof NBTTagDouble)
		return ((NBTTagDouble)base).func_150286_g();
	if(base instanceof NBTTagByteArray)
		return ((NBTTagByteArray)base).func_150292_c();
	if(base instanceof NBTTagString)
		return ((NBTTagString)base).func_150285_a_();
	if(base instanceof NBTTagList)
		return base;
	if(base instanceof NBTTagCompound)
		return ((NBTTagCompound)base);
	if(base instanceof NBTTagIntArray)
		return ((NBTTagIntArray)base).func_150302_c();
	return null;
}
 
開發者ID:CreativeMD,項目名稱:CraftingManager,代碼行數:27,代碼來源:ConvertNBTTagCompound.java

示例10: setValidValue

import net.minecraft.nbt.NBTTagIntArray; //導入依賴的package包/類
private static void setValidValue(Node<NamedNBT> node, String value){
	NamedNBT named = node.getObject();
	NBTBase base = named.getNBT();
	
	if (base instanceof NBTTagByte)
		named.setNBT(new NBTTagByte(ParseHelper.parseByte(value)));
	if (base instanceof NBTTagShort)
		named.setNBT(new NBTTagShort(ParseHelper.parseShort(value)));
	if (base instanceof NBTTagInt)
		named.setNBT(new NBTTagInt(ParseHelper.parseInt(value)));
	if (base instanceof NBTTagLong)
		named.setNBT(new NBTTagLong(ParseHelper.parseLong(value)));
	if(base instanceof NBTTagFloat)
		named.setNBT(new NBTTagFloat(ParseHelper.parseFloat(value)));
	if(base instanceof NBTTagDouble)
		named.setNBT(new NBTTagDouble(ParseHelper.parseDouble(value)));
	if(base instanceof NBTTagByteArray)
		named.setNBT(new NBTTagByteArray(ParseHelper.parseByteArray(value)));
	if(base instanceof NBTTagIntArray)
		named.setNBT(new NBTTagIntArray(ParseHelper.parseIntArray(value)));
	if (base instanceof NBTTagString)
		named.setNBT(new NBTTagString(value));
}
 
開發者ID:DavidGoldman,項目名稱:NBTEdit,代碼行數:24,代碼來源:GuiEditNBT.java

示例11: getValue

import net.minecraft.nbt.NBTTagIntArray; //導入依賴的package包/類
private static String getValue(NBTBase base){
	switch(base.getId()){
	case 7:
		String s = "";
		for (byte b : ((NBTTagByteArray)base).func_150292_c() /*byteArray*/){
			s += b + " ";
		}
		return s;
	case 9:
		return "TagList";
	case 10:
		return "TagCompound";
	case 11:
		String i = "";
		for (int a : ((NBTTagIntArray)base).func_150302_c() /*intArray*/){
			i += a + " ";
		}
		return i;
	default: 
		return NBTStringHelper.toString(base);
	}
}
 
開發者ID:DavidGoldman,項目名稱:NBTEdit,代碼行數:23,代碼來源:GuiEditNBT.java

示例12: writeToNBT

import net.minecraft.nbt.NBTTagIntArray; //導入依賴的package包/類
@Override
public void writeToNBT(NBTTagCompound compound) {
	super.writeToNBT(compound);
	NBTTagList runes = new NBTTagList();
	for(FueledRuneEntity ent:poweredRunes){
		BlockPos pos = ent.getPos();
		NBTTagIntArray coords = new NBTTagIntArray(new int[]{pos.getX(),pos.getY(),pos.getZ()});
		runes.appendTag(coords);
	}
	compound.setTag("PoweredRunes", runes);
}
 
開發者ID:Xilef11,項目名稱:runesofwizardry-classics,代碼行數:12,代碼來源:RuneEntityPowerDistribution.java

示例13: writeToNBT

import net.minecraft.nbt.NBTTagIntArray; //導入依賴的package包/類
@Override
public void writeToNBT(NBTTagCompound compound) {
	super.writeToNBT(compound);
	compound.setString("player", activatingPlayer);
	compound.setBoolean("protecting", wasProtecting);
	NBTTagList pos = new NBTTagList();
	if(box!=null){
		for(BlockPos p:box){
			pos.appendTag(new NBTTagIntArray(new int[]{p.getX(),p.getY(),p.getZ()}));
		}
	}
	compound.setTag("boxPositions", pos);
}
 
開發者ID:Xilef11,項目名稱:runesofwizardry-classics,代碼行數:14,代碼來源:RuneEntitySpriteEarth.java

示例14: writeBooleanArray

import net.minecraft.nbt.NBTTagIntArray; //導入依賴的package包/類
public static void writeBooleanArray(NBTTagCompound tag, String name, boolean[] array) {
    int[] intArray = new int[array.length];

    for (int i = 0; i < intArray.length; ++i) {
        intArray[i] = array[i] ? 1 : 0;
    }

    tag.setTag(name, new NBTTagIntArray(intArray));
}
 
開發者ID:Alec-WAM,項目名稱:CrystalMod,代碼行數:10,代碼來源:BasicCraftingTask.java

示例15: toArray

import net.minecraft.nbt.NBTTagIntArray; //導入依賴的package包/類
NBTTagIntArray toArray() {
    int[] ret = new int[4];
    ret[0] = x;
    ret[1] = y;
    ret[2] = z;
    ret[3] = side;
    return new NBTTagIntArray(ret);
}
 
開發者ID:purpleposeidon,項目名稱:Factorization,代碼行數:9,代碼來源:MemberPos.java


注:本文中的net.minecraft.nbt.NBTTagIntArray類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。