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


Java Items.SPAWN_EGG属性代码示例

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


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

示例1: processInteract

public boolean processInteract(EntityPlayer player, EnumHand hand, @Nullable ItemStack stack)
{
    boolean flag = stack != null && stack.getItem() == Items.SPAWN_EGG;

    if (!flag && this.isEntityAlive() && !this.isTrading() && !this.isChild() && !player.isSneaking())
    {
        if (!this.worldObj.isRemote && (this.buyingList == null || !this.buyingList.isEmpty()))
        {
            this.setCustomer(player);
            player.displayVillagerTradeGui(this);
        }

        player.addStat(StatList.TALKED_TO_VILLAGER);
        return true;
    }
    else
    {
        return super.processInteract(player, hand, stack);
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:20,代码来源:EntityVillager.java

示例2: displayAllRelevantItems

@Override
public void displayAllRelevantItems(NonNullList<ItemStack> items) {
	items.add(new ItemStack(ModItems.FRIENDER_PEARL));
	items.add(new ItemStack(ModItems.SKULL_ENDERMAN));
	items.add(new ItemStack(ModItems.SKULL_FRIENDERMAN));
	items.add(new ItemStack(ModItems.SKULL_EVOLVED_ENDERMAN));

	ItemStack evolvedEndermanEgg = new ItemStack(Items.SPAWN_EGG);
	NBTTagCompound evolvedEndermanTag = new NBTTagCompound();
	NBTTagCompound evolvedEndermanEntityTag = new NBTTagCompound();
	evolvedEndermanEntityTag.setString("id", ModGlobals.MODID + ":enderman_evolved");
	evolvedEndermanTag.setTag("EntityTag", evolvedEndermanEntityTag);
	evolvedEndermanEgg.setTagCompound(evolvedEndermanTag);
	items.add(evolvedEndermanEgg);

	ItemStack frindermanEgg = new ItemStack(Items.SPAWN_EGG);
	NBTTagCompound frindermanTag = new NBTTagCompound();
	NBTTagCompound frindermanEntityTag = new NBTTagCompound();
	frindermanEntityTag.setString("id", ModGlobals.MODID + ":frienderman");
	frindermanTag.setTag("EntityTag", frindermanEntityTag);
	frindermanEgg.setTagCompound(frindermanTag);
	items.add(frindermanEgg);

	ItemStack evolvedEndermiteEgg = new ItemStack(Items.SPAWN_EGG);
	NBTTagCompound evolvedEndermiteTag = new NBTTagCompound();
	NBTTagCompound evolvedEndermiteEntityTag = new NBTTagCompound();
	evolvedEndermiteEntityTag.setString("id", ModGlobals.MODID + ":evolved_endermite");
	evolvedEndermiteTag.setTag("EntityTag", evolvedEndermiteEntityTag);
	evolvedEndermiteEgg.setTagCompound(evolvedEndermiteTag);
	items.add(evolvedEndermiteEgg);

	super.displayAllRelevantItems(items);
}
 
开发者ID:p455w0rd,项目名称:EndermanEvolution,代码行数:33,代码来源:ModCreativeTab.java

示例3: processInteract

public boolean processInteract(EntityPlayer player, EnumHand hand)
{
    ItemStack itemstack = player.getHeldItem(hand);

    if (itemstack.getItem() == Items.SPAWN_EGG)
    {
        if (!this.world.isRemote)
        {
            Class <? extends Entity > oclass = (Class)EntityList.field_191308_b.getObject(ItemMonsterPlacer.func_190908_h(itemstack));

            if (oclass != null && this.getClass() == oclass)
            {
                EntityAgeable entityageable = this.createChild(this);

                if (entityageable != null)
                {
                    entityageable.setGrowingAge(-24000);
                    entityageable.setLocationAndAngles(this.posX, this.posY, this.posZ, 0.0F, 0.0F);
                    this.world.spawnEntityInWorld(entityageable);

                    if (itemstack.hasDisplayName())
                    {
                        entityageable.setCustomNameTag(itemstack.getDisplayName());
                    }

                    if (!player.capabilities.isCreativeMode)
                    {
                        itemstack.func_190918_g(1);
                    }
                }
            }
        }

        return true;
    }
    else
    {
        return false;
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:40,代码来源:EntityAgeable.java

示例4: func_190669_a

protected boolean func_190669_a(ItemStack p_190669_1_, Class <? extends Entity > p_190669_2_)
{
    if (p_190669_1_.getItem() != Items.SPAWN_EGG)
    {
        return false;
    }
    else
    {
        Class <? extends Entity > oclass = (Class)EntityList.field_191308_b.getObject(ItemMonsterPlacer.func_190908_h(p_190669_1_));
        return oclass != null && p_190669_2_ == oclass;
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:12,代码来源:EntityAgeable.java

示例5: processInteract

public boolean processInteract(EntityPlayer player, EnumHand hand, @Nullable ItemStack stack)
{
    if (stack != null && stack.getItem() == Items.SPAWN_EGG)
    {
        if (!this.worldObj.isRemote)
        {
            Class <? extends Entity > oclass = EntityList.NAME_TO_CLASS.get(ItemMonsterPlacer.getEntityIdFromItem(stack));

            if (oclass != null && this.getClass() == oclass)
            {
                EntityAgeable entityageable = this.createChild(this);

                if (entityageable != null)
                {
                    entityageable.setGrowingAge(-24000);
                    entityageable.setLocationAndAngles(this.posX, this.posY, this.posZ, 0.0F, 0.0F);
                    this.worldObj.spawnEntityInWorld(entityageable);

                    if (stack.hasDisplayName())
                    {
                        entityageable.setCustomNameTag(stack.getDisplayName());
                    }

                    if (!player.capabilities.isCreativeMode)
                    {
                        --stack.stackSize;
                    }
                }
            }
        }

        return true;
    }
    else
    {
        return false;
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:38,代码来源:EntityAgeable.java

示例6: updateDestination

private void updateDestination() {
    doneTurning = false;
    // take dispenser upgrade in account
    double payloadFrictionY = 0.98D; // this value will differ when a dispenser upgrade is inserted.
    double payloadFrictionX = 0.98D;
    double payloadGravity = 0.04D;
    if (getUpgrades(EnumUpgrade.ENTITY_TRACKER) > 0) {
        payloadFrictionY = 0.98D;
        payloadFrictionX = 0.91D;
        payloadGravity = 0.08D;
    } else if (getUpgrades(EnumUpgrade.DISPENSER) > 0 && !inventory.getStackInSlot(CANNON_SLOT).isEmpty()) {
        Item item = inventory.getStackInSlot(CANNON_SLOT).getItem();
        if (item == Items.POTIONITEM || item == Items.EXPERIENCE_BOTTLE || item == Items.EGG || item == Items.SNOWBALL) {// EntityThrowable
            payloadFrictionY = 0.99D;
            payloadGravity = 0.03D;
        } else if (item == Items.ARROW) {
            payloadFrictionY = 0.99D;
            payloadGravity = 0.05D;
        } else if (item == Items.MINECART || item == Items.CHEST_MINECART || item == Items.HOPPER_MINECART || item == Items.TNT_MINECART || item == Items.FURNACE_MINECART) {
            payloadFrictionY = 0.95D;
        }
        // else if(itemID == Item.fireballCharge.itemID){
        // payloadGravity = 0.0D;
        // }

        // family items (throwable) which only differ in gravity.
        if (item == Items.POTIONITEM) {
            payloadGravity = 0.05D;
        } else if (item == Items.EXPERIENCE_BOTTLE) {
            payloadGravity = 0.07D;
        }

        payloadFrictionX = payloadFrictionY;

        // items which have different frictions for each axis.
        if (item == Items.BOAT) {
            payloadFrictionX = 0.99D;
            payloadFrictionY = 0.95D;
        }
        if (item == Items.SPAWN_EGG) {
            payloadFrictionY = 0.98D;
            payloadFrictionX = 0.91D;
            payloadGravity = 0.08D;
        }
    }

    // calculate the heading.
    double deltaX = gpsX - getPos().getX();
    double deltaZ = gpsZ - getPos().getZ();
    float calculatedRotationAngle;
    if (deltaX >= 0 && deltaZ < 0) {
        calculatedRotationAngle = (float) (Math.atan(Math.abs(deltaX / deltaZ)) / Math.PI * 180D);
    } else if (deltaX >= 0 && deltaZ >= 0) {
        calculatedRotationAngle = (float) (Math.atan(Math.abs(deltaZ / deltaX)) / Math.PI * 180D) + 90;
    } else if (deltaX < 0 && deltaZ >= 0) {
        calculatedRotationAngle = (float) (Math.atan(Math.abs(deltaX / deltaZ)) / Math.PI * 180D) + 180;
    } else {
        calculatedRotationAngle = (float) (Math.atan(Math.abs(deltaZ / deltaX)) / Math.PI * 180D) + 270;
    }

    // calculate the height angle.
    double distance = Math.sqrt(deltaX * deltaX + deltaZ * deltaZ);
    double deltaY = gpsY - getPos().getY();
    float calculatedHeightAngle = calculateBestHeightAngle(distance, deltaY, getForce(), payloadGravity, payloadFrictionX, payloadFrictionY);

    setTargetAngles(calculatedRotationAngle, calculatedHeightAngle);
}
 
开发者ID:TeamPneumatic,项目名称:pnc-repressurized,代码行数:67,代码来源:TileEntityAirCannon.java

示例7: registerVillagerTrades

public static void registerVillagerTrades()
{
	careerKrog.addTrade(1, new VillagerTradeItemForItem(new ItemStack(ModItems.shiny_stone), new EntityVillager.PriceInfo(1, 1),
			new ItemStack(Items.LEATHER), new EntityVillager.PriceInfo(2, 2)));

	careerKrog.addTrade(1, new VillagerTradeItemForItem(new ItemStack(Items.PAINTING), new EntityVillager.PriceInfo(1, 1),
			new ItemStack(Blocks.CACTUS), new EntityVillager.PriceInfo(8, 16)));

	careerKrog.addTrade(1, new VillagerTradeItemForItem(new ItemStack(Items.FISHING_ROD), new EntityVillager.PriceInfo(1, 1),
			new ItemStack(Items.FISH), new EntityVillager.PriceInfo(5, 8)));

	careerKrog.addTrade(2, new VillagerTradeItemForItem(new ItemStack(Items.DYE), new EntityVillager.PriceInfo(5, 10),
			new ItemStack(Blocks.VINE), new EntityVillager.PriceInfo(2, 4)));

	if (Loader.isModLoaded("tconstruct"))
	{
		Item arrowhead = Item.REGISTRY.getObject(new ResourceLocation("tconstruct", "arrow_head"));
		if (arrowhead != null)
		{
			NBTTagCompound material = new NBTTagCompound();
			material.setString("Material", "obsidian");

			ItemStack stack = new ItemStack(arrowhead);
			stack.setTagCompound(material);

			careerKrog.addTrade(2, new VillagerTradeItemForItem(new ItemStack(Items.COAL, 1, 1), new EntityVillager.PriceInfo(10, 20),
					stack, new EntityVillager.PriceInfo(1, 1)));
		}
	}

	if (Loader.isModLoaded("actuallyadditions"))
	{
		Item crystal = Item.REGISTRY.getObject(new ResourceLocation("actuallyadditions", "item_crystal"));
		if (crystal != null)
		{
			ItemStack starterKit = createChickenSpawnerKit();
			careerKrog.addTrade(3, new VillagerTradeItemForItem(new ItemStack(crystal, 1, 4), new EntityVillager.PriceInfo(1, 3),
					starterKit, new EntityVillager.PriceInfo(1, 1)));
		}
	}

	careerTorg.addTrade(1, new VillagerTradeItemForItem(new ItemStack(Items.BEEF), new EntityVillager.PriceInfo(1, 3),
			new ItemStack(Blocks.SAPLING, 1, 3), new EntityVillager.PriceInfo(1, 3)));

	careerTorg.addTrade(1, new VillagerTradeItemForItem(new ItemStack(Items.LEATHER), new EntityVillager.PriceInfo(2, 4),
			new ItemStack(Items.MELON_SEEDS), new EntityVillager.PriceInfo(4, 6)));

	Block net = Block.REGISTRY.getObject(new ResourceLocation("actuallyadditions", "block_fishing_net"));
	if (net != Blocks.AIR)
	{
		careerTorg.addTrade(2, new VillagerTradeItemForItem(new ItemStack(net), new EntityVillager.PriceInfo(1, 1),
				new ItemStack(Items.DYE, 1, 3), new EntityVillager.PriceInfo(24, 36)));
	}

	if (Loader.isModLoaded("rustic"))
	{
		NBTTagCompound parrotTag = new NBTTagCompound();
		parrotTag.setString("id", "minecraft:parrot");
		ItemStack parrotEgg = new ItemStack(Items.SPAWN_EGG, 1);
		parrotEgg.setTagInfo("EntityTag", parrotTag);

		careerTorg.addTrade(3, new VillagerTradeItemForItem(new ItemStack(rustic.common.items.ModItems.HONEYCOMB), new EntityVillager.PriceInfo(30, 40),
				parrotEgg, new EntityVillager.PriceInfo(1, 1)));
	}
}
 
开发者ID:DarkMorford,项目名称:BetterThanWeagles,代码行数:65,代码来源:ModVillagers.java

示例8: processInteract

public boolean processInteract(EntityPlayer player, EnumHand hand)
{
    ItemStack itemstack = player.getHeldItem(hand);
    boolean flag = !itemstack.func_190926_b();

    if (flag && itemstack.getItem() == Items.SPAWN_EGG)
    {
        return super.processInteract(player, hand);
    }
    else if (!this.isTame())
    {
        return false;
    }
    else if (this.isChild())
    {
        return super.processInteract(player, hand);
    }
    else if (player.isSneaking())
    {
        this.openGUI(player);
        return true;
    }
    else if (this.isBeingRidden())
    {
        return super.processInteract(player, hand);
    }
    else
    {
        if (flag)
        {
            if (itemstack.getItem() == Items.SADDLE && !this.isHorseSaddled())
            {
                this.openGUI(player);
                return true;
            }

            if (itemstack.interactWithEntity(player, this, hand))
            {
                return true;
            }
        }

        this.mountTo(player);
        return true;
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:46,代码来源:EntitySkeletonHorse.java

示例9: processInteract

public boolean processInteract(EntityPlayer player, EnumHand hand)
{
    ItemStack itemstack = player.getHeldItem(hand);

    if (itemstack.getItem() == Items.SPAWN_EGG)
    {
        return super.processInteract(player, hand);
    }
    else
    {
        if (!this.isChild())
        {
            if (this.isTame() && player.isSneaking())
            {
                this.openGUI(player);
                return true;
            }

            if (this.isBeingRidden())
            {
                return super.processInteract(player, hand);
            }
        }

        if (!itemstack.func_190926_b())
        {
            boolean flag = this.func_190678_b(player, itemstack);

            if (!flag && !this.isTame())
            {
                if (itemstack.interactWithEntity(player, this, hand))
                {
                    return true;
                }

                this.func_190687_dF();
                return true;
            }

            if (!flag && !this.func_190695_dh() && itemstack.getItem() == Item.getItemFromBlock(Blocks.CHEST))
            {
                this.setChested(true);
                this.func_190697_dk();
                flag = true;
                this.initHorseChest();
            }

            if (!flag && !this.isChild() && !this.isHorseSaddled() && itemstack.getItem() == Items.SADDLE)
            {
                this.openGUI(player);
                return true;
            }

            if (flag)
            {
                if (!player.capabilities.isCreativeMode)
                {
                    itemstack.func_190918_g(1);
                }

                return true;
            }
        }

        if (this.isChild())
        {
            return super.processInteract(player, hand);
        }
        else if (itemstack.interactWithEntity(player, this, hand))
        {
            return true;
        }
        else
        {
            this.mountTo(player);
            return true;
        }
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:79,代码来源:AbstractChestHorse.java

示例10: processInteract

public boolean processInteract(EntityPlayer player, EnumHand hand)
{
    ItemStack itemstack = player.getHeldItem(hand);
    boolean flag = !itemstack.func_190926_b();

    if (flag && itemstack.getItem() == Items.SPAWN_EGG)
    {
        return super.processInteract(player, hand);
    }
    else if (!this.isTame())
    {
        return false;
    }
    else if (this.isChild())
    {
        return super.processInteract(player, hand);
    }
    else if (player.isSneaking())
    {
        this.openGUI(player);
        return true;
    }
    else if (this.isBeingRidden())
    {
        return super.processInteract(player, hand);
    }
    else
    {
        if (flag)
        {
            if (!this.isHorseSaddled() && itemstack.getItem() == Items.SADDLE)
            {
                this.openGUI(player);
                return true;
            }

            if (itemstack.interactWithEntity(player, this, hand))
            {
                return true;
            }
        }

        this.mountTo(player);
        return true;
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:46,代码来源:EntityZombieHorse.java

示例11: processInteract

public boolean processInteract(EntityPlayer player, EnumHand hand)
{
    ItemStack itemstack = player.getHeldItem(hand);
    boolean flag = !itemstack.func_190926_b();

    if (flag && itemstack.getItem() == Items.SPAWN_EGG)
    {
        return super.processInteract(player, hand);
    }
    else
    {
        if (!this.isChild())
        {
            if (this.isTame() && player.isSneaking())
            {
                this.openGUI(player);
                return true;
            }

            if (this.isBeingRidden())
            {
                return super.processInteract(player, hand);
            }
        }

        if (flag)
        {
            if (this.func_190678_b(player, itemstack))
            {
                if (!player.capabilities.isCreativeMode)
                {
                    itemstack.func_190918_g(1);
                }

                return true;
            }

            if (itemstack.interactWithEntity(player, this, hand))
            {
                return true;
            }

            if (!this.isTame())
            {
                this.func_190687_dF();
                return true;
            }

            boolean flag1 = HorseArmorType.getByItemStack(itemstack) != HorseArmorType.NONE;
            boolean flag2 = !this.isChild() && !this.isHorseSaddled() && itemstack.getItem() == Items.SADDLE;

            if (flag1 || flag2)
            {
                this.openGUI(player);
                return true;
            }
        }

        if (this.isChild())
        {
            return super.processInteract(player, hand);
        }
        else
        {
            this.mountTo(player);
            return true;
        }
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:69,代码来源:EntityHorse.java


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