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


Java NBTTagCompound.getByte方法代碼示例

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


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

示例1: readEntityFromNBT

import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
@Override
public void readEntityFromNBT(NBTTagCompound nbt) {
	super.readEntityFromNBT(nbt);
	this.begin=nbt.getShort("Begin");
	this.setBombSpell(nbt.getBoolean("Bomb"));
	this.bombCooldown=nbt.getShort("BombCooldown");
	this.bombDuration=nbt.getShort("BombDuration");
	this.topBlock=nbt.getShort("TopBlock");
	this.teleportCooldown=nbt.getShort("Teleport");
	this.hidden=nbt.getBoolean("Hidden");
	this.hideCount=nbt.getByte("HideCount");
	if(hidden){
		this.setNoAI(true);
		int[] pos=nbt.getIntArray("HiddenPos");
		this.hiddenBlock=new BlockPos(pos[0], pos[1], pos[2]);
		NBTTagList list=nbt.getTagList("Props", 11);
		for(int i=0;i<list.tagCount();i++){
			int[] arr=list.getIntArrayAt(i);
			this.usedPos.add(new BlockPos(arr[0],arr[1],arr[2]));
		}
	}
}
 
開發者ID:rafradek,項目名稱:Mods,代碼行數:23,代碼來源:EntityMerasmus.java

示例2: readEntityFromNBT

import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
/**
 * (abstract) Protected helper method to read subclass entity data from NBT.
 */
public void readEntityFromNBT(NBTTagCompound tagCompund)
{
    this.xTile = tagCompund.getShort("xTile");
    this.yTile = tagCompund.getShort("yTile");
    this.zTile = tagCompund.getShort("zTile");

    if (tagCompund.hasKey("inTile", 8))
    {
        this.inTile = Block.getBlockFromName(tagCompund.getString("inTile"));
    }
    else
    {
        this.inTile = Block.getBlockById(tagCompund.getByte("inTile") & 255);
    }

    this.shake = tagCompund.getByte("shake") & 255;
    this.inGround = tagCompund.getByte("inGround") == 1;
}
 
開發者ID:SkidJava,項目名稱:BaseClient,代碼行數:22,代碼來源:EntityFishHook.java

示例3: readFromNBT

import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
public void readFromNBT(NBTTagCompound compound)
{
    super.readFromNBT(compound);
    NBTTagList nbttaglist = compound.getTagList("Items", 10);
    this.stacks = new ItemStack[this.getSizeInventory()];

    for (int i = 0; i < nbttaglist.tagCount(); ++i)
    {
        NBTTagCompound nbttagcompound = nbttaglist.getCompoundTagAt(i);
        int j = nbttagcompound.getByte("Slot") & 255;

        if (j >= 0 && j < this.stacks.length)
        {
            this.stacks[j] = ItemStack.loadItemStackFromNBT(nbttagcompound);
        }
    }

    if (compound.hasKey("CustomName", 8))
    {
        this.customName = compound.getString("CustomName");
    }
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:23,代碼來源:TileEntityDispenser.java

示例4: readFromNBT

import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
/**
 * Reads from the given tag list and fills the slots in the inventory with the correct items.
 */
public void readFromNBT(NBTTagList p_70443_1_)
{
    this.mainInventory = new ItemStack[36];
    this.armorInventory = new ItemStack[4];

    for (int i = 0; i < p_70443_1_.tagCount(); ++i)
    {
        NBTTagCompound nbttagcompound = p_70443_1_.getCompoundTagAt(i);
        int j = nbttagcompound.getByte("Slot") & 255;
        ItemStack itemstack = ItemStack.loadItemStackFromNBT(nbttagcompound);

        if (itemstack != null)
        {
            if (j >= 0 && j < this.mainInventory.length)
            {
                this.mainInventory[j] = itemstack;
            }

            if (j >= 100 && j < this.armorInventory.length + 100)
            {
                this.armorInventory[j - 100] = itemstack;
            }
        }
    }
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:29,代碼來源:InventoryPlayer.java

示例5: onCollideWithPlayer

import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
@Override
public void onCollideWithPlayer(EntityPlayer player)
{
	if (!this.worldObj.isRemote)
	{
		NBTTagCompound nbt = new NBTTagCompound();
		this.writeToNBT(nbt);

		boolean inground = nbt.hasKey("inGround") && nbt.getByte("inGround") == 1;
		if(inground)
		{
			boolean flag = this.canBePickedUp == 1 || (this.canBePickedUp == 2 && player.capabilities.isCreativeMode);

			EntityItem ei = new EntityItem(this.worldObj, this.posX, this.posY, this.posZ, new ItemStack(this.pickupItem, 1, 0));

			if (this.canBePickedUp == 1)
			{
				EntityItemPickupEvent event = new EntityItemPickupEvent(player, ei);

				if (MinecraftForge.EVENT_BUS.post(event))
					return;
			}

			ItemStack itemstack = ei.getEntityItem();
			if (itemstack.stackSize <= 0)
				flag = true;
			else if (this.canBePickedUp == 1 && !player.inventory.addItemStackToInventory(itemstack))
				flag = false;

			if (flag)
			{
				this.playSound("random.pop", 0.2F, ((this.rand.nextFloat() - this.rand.nextFloat()) * 0.7F + 1.0F) * 2.0F);
				player.onItemPickup(this, 1);
				this.setDead();
			}
		}
	}
}
 
開發者ID:Wahazar,項目名稱:TFCPrimitiveTech,代碼行數:39,代碼來源:EntityProjectileHardStone.java

示例6: readCustomPotionEffectFromNBT

import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
/**
 * Read a custom potion effect from a potion item's NBT data.
 */
public static PotionEffect readCustomPotionEffectFromNBT(NBTTagCompound nbt)
{
    int i = nbt.getByte("Id") & 0xFF;
    Potion potion = Potion.getPotionById(i);

    if (potion == null)
    {
        return null;
    }
    else
    {
        int j = nbt.getByte("Amplifier");
        int k = nbt.getInteger("Duration");
        boolean flag = nbt.getBoolean("Ambient");
        boolean flag1 = true;

        if (nbt.hasKey("ShowParticles", 1))
        {
            flag1 = nbt.getBoolean("ShowParticles");
        }

        return new PotionEffect(potion, k, j, flag, flag1);
    }
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:28,代碼來源:PotionEffect.java

示例7: readCustomPotionEffectFromNBT

import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
/**
 * Read a custom potion effect from a potion item's NBT data.
 */
public static PotionEffect readCustomPotionEffectFromNBT(NBTTagCompound nbt)
{
    int i = nbt.getByte("Id");

    if (i >= 0 && i < Potion.potionTypes.length && Potion.potionTypes[i] != null)
    {
        int j = nbt.getByte("Amplifier");
        int k = nbt.getInteger("Duration");
        boolean flag = nbt.getBoolean("Ambient");
        boolean flag1 = true;

        if (nbt.hasKey("ShowParticles", 1))
        {
            flag1 = nbt.getBoolean("ShowParticles");
        }

        return new PotionEffect(i, k, j, flag, flag1);
    }
    else
    {
        return null;
    }
}
 
開發者ID:SkidJava,項目名稱:BaseClient,代碼行數:27,代碼來源:PotionEffect.java

示例8: readEntityFromNBT

import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
/**
 * (abstract) Protected helper method to read subclass entity data from NBT.
 */
protected void readEntityFromNBT(NBTTagCompound tagCompund)
{
    super.readEntityFromNBT(tagCompund);
    NBTTagList nbttaglist = tagCompund.getTagList("Items", 10);
    this.minecartContainerItems = new ItemStack[this.getSizeInventory()];

    for (int i = 0; i < nbttaglist.tagCount(); ++i)
    {
        NBTTagCompound nbttagcompound = nbttaglist.getCompoundTagAt(i);
        int j = nbttagcompound.getByte("Slot") & 255;

        if (j >= 0 && j < this.minecartContainerItems.length)
        {
            this.minecartContainerItems[j] = ItemStack.loadItemStackFromNBT(nbttagcompound);
        }
    }
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:21,代碼來源:EntityMinecartContainer.java

示例9: readFromNBT

import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
@Override
public void readFromNBT(NBTTagCompound tag) {
	super.readFromNBT(tag);
	
	if (tag.hasKey("inputtank")) {
		CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY.readNBT(inputTank, null, tag.getTag("inputtank"));
	}
	if (tag.hasKey("outputtank")) {
		CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY.readNBT(outputTank, null, tag.getTag("outputtank"));
	}
	if (tag.hasKey("heatstorage")) {
		Thermionics.CAPABILITY_HEATSTORAGE.readNBT(heat, null, tag.getTag("heatstorage"));
	}
	if (tag.hasKey("inventory")) {
		CapabilityItemHandler.ITEM_HANDLER_CAPABILITY.readNBT(itemStorage, null, tag.getTag("inventory"));
	}
	
	if (tag.hasKey("locked")) {
		tanksLocked = tag.getByte("locked")!=0;
	}
}
 
開發者ID:elytra,項目名稱:Thermionics,代碼行數:22,代碼來源:TileEntityPotStill.java

示例10: readFromNBT

import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
@Override
public void readFromNBT(NBTTagCompound compound) {
    super.readFromNBT(compound);
    timeout = compound.getInteger("timeout");
    portalSide = EnumFacing.VALUES[compound.getByte("portalSide")];
    BlockPos pos = BlockPos.fromLong(compound.getLong("pos"));
    int dim = compound.getInteger("dim");
    EnumFacing side = EnumFacing.VALUES[compound.getByte("side")];
    other = new TeleportDestination("", dim, pos, side);
    NBTTagList list = compound.getTagList("bl", Constants.NBT.TAG_COMPOUND);
    blackListed.clear();
    for (int i = 0 ; i < list.tagCount() ; i++) {
        NBTTagCompound tc = list.getCompoundTagAt(i);
        UUID uuid = new UUID(tc.getLong("m"), tc.getLong("l"));
        blackListed.add(uuid);
    }
}
 
開發者ID:McJty,項目名稱:MeeCreeps,代碼行數:18,代碼來源:PortalTileEntity.java

示例11: readEntityFromNBT

import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
/**
 * (abstract) Protected helper method to read subclass entity data from NBT.
 */
public void readEntityFromNBT(NBTTagCompound tagCompund)
{
    super.readEntityFromNBT(tagCompund);

    if (tagCompund.hasKey("SkeletonType", 99))
    {
        int i = tagCompund.getByte("SkeletonType");
        this.setSkeletonType(i);
    }

    this.setCombatTask();
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:16,代碼來源:EntitySkeleton.java

示例12: readItemsFromNBT

import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
public static NonNullList<Pair<Integer, ItemStack>> readItemsFromNBT(NBTTagCompound tagCompound)
{
    NonNullList<Pair<Integer, ItemStack>> items = NonNullList.create();

    NBTTagList nbtList = tagCompound.getTagList("Items", 10);

    for (int i = 0; i < nbtList.tagCount(); ++i)
    {
        NBTTagCompound nbtTagCompound = nbtList.getCompoundTagAt(i);
        NBTBase nbt = nbtTagCompound.getTag("Slot");
        int j;
        if (nbt instanceof NBTTagByte)
        {
            j = nbtTagCompound.getByte("Slot") & 255;
        } else
        {
            j = nbtTagCompound.getShort("Slot");
        }

        if (j >= 0)
        {
            ItemStack itemstack = new ItemStack(nbtTagCompound);
            items.add(Pair.of(j, itemstack));
        }
    }

    return items;
}
 
開發者ID:cubex2,項目名稱:chesttransporter,代碼行數:29,代碼來源:Util.java

示例13: readEntityFromNBT

import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
/**
 * (abstract) Protected helper method to read subclass entity data from NBT.
 */
public void readEntityFromNBT(NBTTagCompound tagCompund)
{
    this.xTile = tagCompund.getShort("xTile");
    this.yTile = tagCompund.getShort("yTile");
    this.zTile = tagCompund.getShort("zTile");

    if (tagCompund.hasKey("inTile", 8))
    {
        this.inTile = Block.getBlockFromName(tagCompund.getString("inTile"));
    }
    else
    {
        this.inTile = Block.getBlockById(tagCompund.getByte("inTile") & 255);
    }

    this.throwableShake = tagCompund.getByte("shake") & 255;
    this.inGround = tagCompund.getByte("inGround") == 1;
    this.thrower = null;
    this.throwerName = tagCompund.getString("ownerName");

    if (this.throwerName != null && this.throwerName.length() == 0)
    {
        this.throwerName = null;
    }

    this.thrower = this.getThrower();
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:31,代碼來源:EntityThrowable.java

示例14: readFromNBT

import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
@Override
public void readFromNBT(NBTTagCompound tag) {
    super.readFromNBT(tag);
    handler.deserializeNBT(tag.getCompoundTag("Items"));
    redstoneMode = tag.getByte("redstoneMode");
    craftingProgress = tag.getInteger("craftingProgress");
    inputTank.readFromNBT(tag.getCompoundTag("inputTank"));
    outputTank.readFromNBT(tag.getCompoundTag("outputTank"));
}
 
開發者ID:TeamPneumatic,項目名稱:pnc-repressurized,代碼行數:10,代碼來源:TileEntityThermopneumaticProcessingPlant.java

示例15: deserializeNBT

import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
@Override
public void deserializeNBT(NBTTagList nbt) {

	for (int i = 0; i < nbt.tagCount(); ++i) {
		NBTTagCompound nbttagcompound = nbt.getCompoundTagAt(i);
		int j = nbttagcompound.getByte("Slot");
		this.setInventorySlotContents(j, new ItemStack(nbttagcompound));
	}
	// System.out.println("Reading ");
}
 
開發者ID:rafradek,項目名稱:Mods,代碼行數:11,代碼來源:InventoryAmmoBelt.java


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