当前位置: 首页>>代码示例>>Java>>正文


Java EntityItem.setAgeToCreativeDespawnTime方法代码示例

本文整理汇总了Java中net.minecraft.entity.item.EntityItem.setAgeToCreativeDespawnTime方法的典型用法代码示例。如果您正苦于以下问题:Java EntityItem.setAgeToCreativeDespawnTime方法的具体用法?Java EntityItem.setAgeToCreativeDespawnTime怎么用?Java EntityItem.setAgeToCreativeDespawnTime使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.minecraft.entity.item.EntityItem的用法示例。


在下文中一共展示了EntityItem.setAgeToCreativeDespawnTime方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: dropFakeItems

import net.minecraft.entity.item.EntityItem; //导入方法依赖的package包/类
@SubscribeEvent(priority = EventPriority.LOW)
public void dropFakeItems(PlayerDropsEvent event) {
	InventoryWearables inv = event.getEntityLiving().getCapability(TF2weapons.INVENTORY_CAP, null);
	for (int i = 3; i < 13; i++)
		if (inv.getStackInSlot(i) != null) {
			event.getEntityPlayer().dropItem(inv.getStackInSlot(i), true, false);
		}
	
	if(WeaponsCapability.get(event.getEntity()).isFeign())
		for(EntityItem item:event.getDrops()) {
			item.getEntityData().setBoolean("Fake", true);
			item.setAgeToCreativeDespawnTime();
		}
}
 
开发者ID:rafradek,项目名称:Mods,代码行数:15,代码来源:TF2EventsCommon.java

示例2: processCreativeInventoryAction

import net.minecraft.entity.item.EntityItem; //导入方法依赖的package包/类
/**
 * Update the server with an ItemStack in a slot.
 */
public void processCreativeInventoryAction(C10PacketCreativeInventoryAction packetIn)
{
    PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.playerEntity.getServerForPlayer());

    if (this.playerEntity.theItemInWorldManager.isCreative())
    {
        boolean flag = packetIn.getSlotId() < 0;
        ItemStack itemstack = packetIn.getStack();

        if (itemstack != null && itemstack.hasTagCompound() && itemstack.getTagCompound().hasKey("BlockEntityTag", 10))
        {
            NBTTagCompound nbttagcompound = itemstack.getTagCompound().getCompoundTag("BlockEntityTag");

            if (nbttagcompound.hasKey("x") && nbttagcompound.hasKey("y") && nbttagcompound.hasKey("z"))
            {
                BlockPos blockpos = new BlockPos(nbttagcompound.getInteger("x"), nbttagcompound.getInteger("y"), nbttagcompound.getInteger("z"));
                TileEntity tileentity = this.playerEntity.worldObj.getTileEntity(blockpos);

                if (tileentity != null)
                {
                    NBTTagCompound nbttagcompound1 = new NBTTagCompound();
                    tileentity.writeToNBT(nbttagcompound1);
                    nbttagcompound1.removeTag("x");
                    nbttagcompound1.removeTag("y");
                    nbttagcompound1.removeTag("z");
                    itemstack.setTagInfo("BlockEntityTag", nbttagcompound1);
                }
            }
        }

        boolean flag1 = packetIn.getSlotId() >= 1 && packetIn.getSlotId() < 36 + InventoryPlayer.getHotbarSize();
        boolean flag2 = itemstack == null || itemstack.getItem() != null;
        boolean flag3 = itemstack == null || itemstack.getMetadata() >= 0 && itemstack.stackSize <= 64 && itemstack.stackSize > 0;

        if (flag1 && flag2 && flag3)
        {
            if (itemstack == null)
            {
                this.playerEntity.inventoryContainer.putStackInSlot(packetIn.getSlotId(), (ItemStack)null);
            }
            else
            {
                this.playerEntity.inventoryContainer.putStackInSlot(packetIn.getSlotId(), itemstack);
            }

            this.playerEntity.inventoryContainer.setCanCraft(this.playerEntity, true);
        }
        else if (flag && flag2 && flag3 && this.itemDropThreshold < 200)
        {
            this.itemDropThreshold += 20;
            EntityItem entityitem = this.playerEntity.dropPlayerItemWithRandomChoice(itemstack, true);

            if (entityitem != null)
            {
                entityitem.setAgeToCreativeDespawnTime();
            }
        }
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:63,代码来源:NetHandlerPlayServer.java

示例3: processCreativeInventoryAction

import net.minecraft.entity.item.EntityItem; //导入方法依赖的package包/类
/**
 * Update the server with an ItemStack in a slot.
 */
public void processCreativeInventoryAction(CPacketCreativeInventoryAction packetIn)
{
    PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.playerEntity.getServerWorld());

    if (this.playerEntity.interactionManager.isCreative())
    {
        boolean flag = packetIn.getSlotId() < 0;
        ItemStack itemstack = packetIn.getStack();

        if (!itemstack.func_190926_b() && itemstack.hasTagCompound() && itemstack.getTagCompound().hasKey("BlockEntityTag", 10))
        {
            NBTTagCompound nbttagcompound = itemstack.getTagCompound().getCompoundTag("BlockEntityTag");

            if (nbttagcompound.hasKey("x") && nbttagcompound.hasKey("y") && nbttagcompound.hasKey("z"))
            {
                BlockPos blockpos = new BlockPos(nbttagcompound.getInteger("x"), nbttagcompound.getInteger("y"), nbttagcompound.getInteger("z"));
                TileEntity tileentity = this.playerEntity.world.getTileEntity(blockpos);

                if (tileentity != null)
                {
                    NBTTagCompound nbttagcompound1 = tileentity.writeToNBT(new NBTTagCompound());
                    nbttagcompound1.removeTag("x");
                    nbttagcompound1.removeTag("y");
                    nbttagcompound1.removeTag("z");
                    itemstack.setTagInfo("BlockEntityTag", nbttagcompound1);
                }
            }
        }

        boolean flag1 = packetIn.getSlotId() >= 1 && packetIn.getSlotId() <= 45;
        boolean flag2 = itemstack.func_190926_b() || itemstack.getMetadata() >= 0 && itemstack.func_190916_E() <= 64 && !itemstack.func_190926_b();

        if (flag1 && flag2)
        {
            if (itemstack.func_190926_b())
            {
                this.playerEntity.inventoryContainer.putStackInSlot(packetIn.getSlotId(), ItemStack.field_190927_a);
            }
            else
            {
                this.playerEntity.inventoryContainer.putStackInSlot(packetIn.getSlotId(), itemstack);
            }

            this.playerEntity.inventoryContainer.setCanCraft(this.playerEntity, true);
        }
        else if (flag && flag2 && this.itemDropThreshold < 200)
        {
            this.itemDropThreshold += 20;
            EntityItem entityitem = this.playerEntity.dropItem(itemstack, true);

            if (entityitem != null)
            {
                entityitem.setAgeToCreativeDespawnTime();
            }
        }
    }
}
 
开发者ID:NSExceptional,项目名称:Zombe-Modpack,代码行数:61,代码来源:NetHandlerPlayServer.java

示例4: processCreativeInventoryAction

import net.minecraft.entity.item.EntityItem; //导入方法依赖的package包/类
/**
 * Update the server with an ItemStack in a slot.
 */
public void processCreativeInventoryAction(CPacketCreativeInventoryAction packetIn)
{
    PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.playerEntity.getServerWorld());

    if (this.playerEntity.interactionManager.isCreative())
    {
        boolean flag = packetIn.getSlotId() < 0;
        ItemStack itemstack = packetIn.getStack();

        if (itemstack != null && itemstack.hasTagCompound() && itemstack.getTagCompound().hasKey("BlockEntityTag", 10))
        {
            NBTTagCompound nbttagcompound = itemstack.getTagCompound().getCompoundTag("BlockEntityTag");

            if (nbttagcompound.hasKey("x") && nbttagcompound.hasKey("y") && nbttagcompound.hasKey("z"))
            {
                BlockPos blockpos = new BlockPos(nbttagcompound.getInteger("x"), nbttagcompound.getInteger("y"), nbttagcompound.getInteger("z"));
                TileEntity tileentity = this.playerEntity.worldObj.getTileEntity(blockpos);

                if (tileentity != null)
                {
                    NBTTagCompound nbttagcompound1 = tileentity.writeToNBT(new NBTTagCompound());
                    nbttagcompound1.removeTag("x");
                    nbttagcompound1.removeTag("y");
                    nbttagcompound1.removeTag("z");
                    itemstack.setTagInfo("BlockEntityTag", nbttagcompound1);
                }
            }
        }

        boolean flag1 = packetIn.getSlotId() >= 1 && packetIn.getSlotId() <= 45;
        boolean flag2 = itemstack == null || itemstack.getItem() != null;
        boolean flag3 = itemstack == null || itemstack.getMetadata() >= 0 && itemstack.stackSize <= 64 && itemstack.stackSize > 0;

        if (flag1 && flag2 && flag3)
        {
            if (itemstack == null)
            {
                this.playerEntity.inventoryContainer.putStackInSlot(packetIn.getSlotId(), (ItemStack)null);
            }
            else
            {
                this.playerEntity.inventoryContainer.putStackInSlot(packetIn.getSlotId(), itemstack);
            }

            this.playerEntity.inventoryContainer.setCanCraft(this.playerEntity, true);
        }
        else if (flag && flag2 && flag3 && this.itemDropThreshold < 200)
        {
            this.itemDropThreshold += 20;
            EntityItem entityitem = this.playerEntity.dropItem(itemstack, true);

            if (entityitem != null)
            {
                entityitem.setAgeToCreativeDespawnTime();
            }
        }
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:62,代码来源:NetHandlerPlayServer.java


注:本文中的net.minecraft.entity.item.EntityItem.setAgeToCreativeDespawnTime方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。