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


Java NBTTagCompound.setIntArray方法代碼示例

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


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

示例1: getFireworkCharge

import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
private static ItemStack getFireworkCharge() {
    ItemStack charge = new ItemStack(Items.FIREWORK_CHARGE);
    NBTTagCompound nbttagcompound = new NBTTagCompound();
    NBTTagCompound nbttagcompound1 = new NBTTagCompound();
    ArrayList<Integer> arraylist = new ArrayList<>();

    arraylist.add(ItemDye.DYE_COLORS[rand.nextInt(16)]);

    if (rand.nextBoolean()) nbttagcompound1.setBoolean("Flicker", true);

    if (rand.nextBoolean()) nbttagcompound1.setBoolean("Trail", true);

    byte b0 = (byte) rand.nextInt(5);

    int[] aint = new int[arraylist.size()];

    for (int j2 = 0; j2 < aint.length; ++j2) {
        aint[j2] = arraylist.get(j2);
    }

    nbttagcompound1.setIntArray("Colors", aint);
    nbttagcompound1.setByte("Type", b0);
    nbttagcompound.setTag("Explosion", nbttagcompound1);
    charge.setTagCompound(nbttagcompound);
    return charge;
}
 
開發者ID:TeamPneumatic,項目名稱:pnc-repressurized,代碼行數:27,代碼來源:DateEventHandler.java

示例2: writeToNBT

import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
public NBTTagCompound writeToNBT(NBTTagCompound compound) {
    int posarray[] = new int[cleanAir.size() * 3];
    byte airarray[] = new byte[cleanAir.size()];

    int idx = 0;
    for (Map.Entry<Long, Byte> entry : cleanAir.entrySet()) {
        BlockPos pos = BlockPos.fromLong(entry.getKey());
        airarray[idx] = entry.getValue();
        posarray[idx*3+0] = pos.getX();
        posarray[idx*3+1] = pos.getY();
        posarray[idx*3+2] = pos.getZ();
        idx++;
    }
    compound.setIntArray("airpos", posarray);
    compound.setByteArray("airval", airarray);

    return null;
}
 
開發者ID:McJty,項目名稱:needtobreath,代碼行數:19,代碼來源:DimensionData.java

示例3: writeToNBT

import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
public NBTTagCompound writeToNBT(NBTTagCompound nbt)
{
	nbt.setInteger("x",this.tilePosition.x);
	nbt.setInteger("z",this.tilePosition.z);
	nbt.setInteger("type",this.biome.ordinal());
	nbt.setBoolean("isOwned",this.isOwned);
	nbt.setInteger("owners.size",this.owners.size());

	for (int i=0; i<owners.size(); i++)
	{
		String ownerID = "owner_"+i;
		nbt.setLong(ownerID+"_ID1",owners.get(i).getMostSignificantBits());
		nbt.setLong(ownerID+"_ID1",owners.get(i).getLeastSignificantBits());
		int[] ownersTimeInt = new int[ownersTime.get(i).size()];
		for (int j=0; j<ownersTimeInt.length; j++)
		{
			ownersTimeInt[j] = ownersTime.get(i).get(j);
		}
		nbt.setIntArray(ownerID+"_time", ownersTimeInt);
	}
	return nbt;
}
 
開發者ID:stuebz88,項目名稱:modName,代碼行數:23,代碼來源:Tile.java

示例4: writeEntityToNBT

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

示例5: saveDimensionDataMap

import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
public static NBTTagCompound saveDimensionDataMap()
{
    int[] data = new int[(dimensionMap.length() + Integer.SIZE - 1 )/ Integer.SIZE];
    NBTTagCompound dimMap = new NBTTagCompound();
    for (int i = 0; i < data.length; i++)
    {
        int val = 0;
        for (int j = 0; j < Integer.SIZE; j++)
        {
            val |= dimensionMap.get(i * Integer.SIZE + j) ? (1 << j) : 0;
        }
        data[i] = val;
    }
    dimMap.setIntArray("DimensionArray", data);
    return dimMap;
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:17,代碼來源:DimensionManager.java

示例6: writeToPacket

import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
@Override
public void writeToPacket(NBTTagCompound tag) {
    super.writeToPacket(tag);
    tag.setIntArray("floorHeights", floorHeights);

    NBTTagList floorNameList = new NBTTagList();
    for (int key : floorNames.keySet()) {
        NBTTagCompound floorNameTag = new NBTTagCompound();
        floorNameTag.setInteger("floorHeight", key);
        floorNameTag.setString("floorName", floorNames.get(key));
        floorNameList.appendTag(floorNameTag);
    }
    tag.setTag("floorNames", floorNameList);
}
 
開發者ID:TeamPneumatic,項目名稱:pnc-repressurized,代碼行數:15,代碼來源:TileEntityElevatorBase.java

示例7: save

import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
@Override
protected NBTTagCompound save() {
    NBTTagCompound tag = new NBTTagCompound();
    tag.setInteger("dimId", dimId);
    tag.setIntArray("pos", new int[] { pos.getX(), pos.getY(), pos.getZ() });
    return tag;
}
 
開發者ID:Herobone,項目名稱:HeroUtils,代碼行數:8,代碼來源:Identifier.java

示例8: writeToNBT

import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
@Override
public NBTTagCompound writeToNBT(NBTTagCompound nbt){
	super.writeToNBT(nbt);
	if(linkedCurve != null){
		nbt.setIntArray("linkedFlagCoords", new int[]{
				linkedCurve.endPos.getX() + this.pos.getX(),
				linkedCurve.endPos.getY() + this.pos.getY(),
				linkedCurve.endPos.getZ() + this.pos.getZ()}
				);
		nbt.setFloat("linkedFlagAngle", linkedCurve.endAngle);
	}
	return nbt;
}
 
開發者ID:DonBruce64,項目名稱:OpenFlexiTrack,代碼行數:14,代碼來源:TileEntitySurveyFlag.java

示例9: createChestStack

import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
@Override
public ItemStack createChestStack(ItemStack transporter)
{
    ItemStack stack = super.createChestStack(transporter);
    NBTTagCompound nbt = new NBTTagCompound();
    nbt.setIntArray("size", new int[2]);
    stack.setTagCompound(nbt);
    return stack;
}
 
開發者ID:cubex2,項目名稱:chesttransporter,代碼行數:10,代碼來源:CompactChest.java

示例10: writeEntityToNBT

import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
@Override
public void writeEntityToNBT(NBTTagCompound tag) {
	super.writeEntityToNBT(tag);
	tag.setIntArray("AmmoC", ammoCount);
	tag.setBoolean("UnlimitedAmmo", this.unlimitedAmmo);
	tag.setByte("Team", (byte) this.getEntTeam());
	tag.setBoolean("Natural", this.natural);
	/*NBTTagList list = new NBTTagList();

	for (int i = 0; i < this.loadout.getSlots(); i++) {
		ItemStack itemstack = this.loadout.getStackInSlot(i);

		if (!itemstack.isEmpty()) {
			NBTTagCompound nbttagcompound = new NBTTagCompound();
			nbttagcompound.setByte("Slot", (byte) i);
			itemstack.writeToNBT(nbttagcompound);
			list.appendTag(nbttagcompound);
		}
	}
	tag.setTag("Loadout", list);*/
	tag.setTag("Loadout", this.loadout.serializeNBT());
	tag.setTag("LoadoutHeld", loadoutHeld.serializeNBT());
	tag.setTag("Refill", this.refill.getStackInSlot(0).serializeNBT());
	if (this.tradeOffers != null)
		tag.setTag("Offers", this.tradeOffers.getRecipiesAsTags());
	if(this.usedSlot == -1)
		this.usedSlot = this.getDefaultSlot();
	tag.setByte("Slot", (byte) this.usedSlot);
	tag.setByte("PSlot", (byte) this.preferredSlot);
	if(this.lastTrader!=null){
		tag.setUniqueId("TraderFollow", this.lastTrader.getUniqueID());
		tag.setInteger("TraderFollowTicks", this.traderFollowTicks);
	}
	if (this.getOwnerId() != null) {
		tag.setUniqueId("Owner", this.getOwnerId());
		tag.setString("OwnerName", this.ownerName);
	}
	
}
 
開發者ID:rafradek,項目名稱:Mods,代碼行數:40,代碼來源:EntityTF2Character.java

示例11: serverStop

import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
@Mod.EventHandler
public void serverStop(FMLServerStoppingEvent event) {
	//MapList.nameToData.clear();
	//MapList.buildInAttributes.clear();

	File output = new File(((AnvilSaveConverter) server.getActiveAnvilConverter()).savesDirectory, server.getFolderName() + "/teleports.dat");
	NBTTagCompound tagRoot = new NBTTagCompound();
	NBTTagCompound tag = new NBTTagCompound();
	tagRoot.setTag("Teleporters", tag);

	for (Entry<UUID, TeleporterData[]> entry : EntityTeleporter.teleporters.entrySet()) {
		NBTTagCompound exitTag = new NBTTagCompound();
		for (int i = 0; i < EntityTeleporter.TP_PER_PLAYER; i++) {
			TeleporterData blockPos = entry.getValue()[i];
			if (blockPos != null)
				exitTag.setIntArray(Integer.toString(i), new int[] { blockPos.getX(), blockPos.getY(), blockPos.getZ(), blockPos.id, blockPos.dimension});
		}
		tag.setTag(entry.getKey().toString(), exitTag);
	}
	tagRoot.setInteger("TPCount", EntityTeleporter.tpCount);

	try {
		CompressedStreamTools.writeCompressed(tagRoot, new FileOutputStream(output));
	} catch (IOException e) {
		e.printStackTrace();
	}

	EntityTeleporter.teleporters.clear();
	EntityTeleporter.tpCount = 0;
	if(udpServer != null) {
		udpServer.stopServer();
		udpServer = null;
	}
}
 
開發者ID:rafradek,項目名稱:Mods,代碼行數:35,代碼來源:TF2weapons.java

示例12: writeNBT

import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
public NBTTagCompound writeNBT() {
    NBTTagCompound tag = new NBTTagCompound();
    tag.setIntArray("inSlots", this.inSlots);
    tag.setIntArray("outSlots", this.outSlots);
    tag.setIntArray("miscSlots", this.miscSlots);

    NBTTagList inv = new NBTTagList();
    for (Integer slot : this.inventory.keySet()) {
        SlotStackHolder holder = this.inventory.get(slot);
        NBTTagCompound holderTag = new NBTTagCompound();
        holderTag.setBoolean("holderEmpty", holder.itemStack.isEmpty());
        holderTag.setInteger("holderId", slot);
        if(!holder.itemStack.isEmpty()) {
            holder.itemStack.writeToNBT(holderTag);
        }
        inv.appendTag(holderTag);
    }
    tag.setTag("inventoryArray", inv);

    int[] sides = new int[accessibleSides.size()];
    for (int i = 0; i < accessibleSides.size(); i++) {
        EnumFacing side = accessibleSides.get(i);
        sides[i] = side.ordinal();
    }
    tag.setIntArray("sides", sides);
    return tag;
}
 
開發者ID:HellFirePvP,項目名稱:ModularMachinery,代碼行數:28,代碼來源:IOInventory.java

示例13: writeToNBT

import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
/**
 * Writes this curve to the given {@link net.minecraft.nbt.NBTTagCompoundt nbt tag}.
 */
public void writeToNBT(NBTTagCompound nbt) {
	nbt.setFloat("curveStartAngle", this.startAngle);
	nbt.setFloat("curveEndAngle", this.endAngle);
	nbt.setIntArray("curveEndPoint", new int[]{this.endPos.getX(), this.endPos.getY(), this.endPos.getZ()});
}
 
開發者ID:DonBruce64,項目名稱:OpenFlexiTrack,代碼行數:9,代碼來源:OFTCurve.java


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