当前位置: 首页>>代码示例>>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;未经允许,请勿转载。