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


Java EntityLivingBase.isChild方法代码示例

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


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

示例1: onEntityUpdate

import net.minecraft.entity.EntityLivingBase; //导入方法依赖的package包/类
@SubscribeEvent
public void onEntityUpdate(LivingUpdateEvent event)
{
	EntityLivingBase living = event.getEntityLiving();
	if(living instanceof IBurnInDay && living.world.isDaytime() && !living.world.isRemote && !living.isChild() && ((IBurnInDay)living).shouldBurn() && living.getBrightness() > 0.5F && 
			living.getRNG().nextFloat() * 30.0F < (living.getBrightness() - 0.4F) * 2.0F && living.world.canSeeSky(new BlockPos(living.posX, living.posY + (double)living.getEyeHeight(), living.posZ)))
	{
		boolean flag = true;
           ItemStack itemstack = living.getItemStackFromSlot(EntityEquipmentSlot.HEAD);
           if (!itemstack.isEmpty())
           {
               if (itemstack.isItemStackDamageable())
               {
                   itemstack.setItemDamage(itemstack.getItemDamage() + living.getRNG().nextInt(2));

                   if (itemstack.getItemDamage() >= itemstack.getMaxDamage())
                   {
                   	living.renderBrokenItemStack(itemstack);
                   	living.setItemStackToSlot(EntityEquipmentSlot.HEAD, ItemStack.EMPTY);
                   }
               }

               flag = false;
           }

           if (flag)
           {
           	living.setFire(8);
           }
	}
}
 
开发者ID:kenijey,项目名称:harshencastle,代码行数:32,代码来源:HandlerBurnInDaylight.java

示例2: onKillEntity

import net.minecraft.entity.EntityLivingBase; //导入方法依赖的package包/类
/**
 * This method gets called when the entity kills another one.
 */
public void onKillEntity(EntityLivingBase entityLivingIn)
{
    super.onKillEntity(entityLivingIn);

    if ((this.worldObj.getDifficulty() == EnumDifficulty.NORMAL || this.worldObj.getDifficulty() == EnumDifficulty.HARD) && entityLivingIn instanceof EntityVillager)
    {
        if (this.worldObj.getDifficulty() != EnumDifficulty.HARD && this.rand.nextBoolean())
        {
            return;
        }

        EntityLiving entityliving = (EntityLiving)entityLivingIn;
        EntityZombie entityzombie = new EntityZombie(this.worldObj);
        entityzombie.copyLocationAndAnglesFrom(entityLivingIn);
        this.worldObj.removeEntity(entityLivingIn);
        entityzombie.onInitialSpawn(this.worldObj.getDifficultyForLocation(new BlockPos(entityzombie)), (IEntityLivingData)null);
        entityzombie.setVillager(true);

        if (entityLivingIn.isChild())
        {
            entityzombie.setChild(true);
        }

        entityzombie.setNoAI(entityliving.isAIDisabled());

        if (entityliving.hasCustomName())
        {
            entityzombie.setCustomNameTag(entityliving.getCustomNameTag());
            entityzombie.setAlwaysRenderNameTag(entityliving.getAlwaysRenderNameTag());
        }

        this.worldObj.spawnEntityInWorld(entityzombie);
        this.worldObj.playAuxSFXAtEntity((EntityPlayer)null, 1016, new BlockPos((int)this.posX, (int)this.posY, (int)this.posZ), 0);
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:39,代码来源:EntityZombie.java

示例3: itemInteractionForEntity

import net.minecraft.entity.EntityLivingBase; //导入方法依赖的package包/类
@Override
public boolean itemInteractionForEntity(ItemStack stack, EntityPlayer player, EntityLivingBase elb, EnumHand hand) {
	
	if (stack.getItemDamage() == 19 && elb instanceof EntityChicken) {
		NBTTagCompound tag = elb.getEntityData();
		if (!elb.isChild() && !tag.hasKey(TAG_OVERCLUCK))
		{
			tag.setInteger(TAG_OVERCLUCK, elb.worldObj.rand.nextInt(60) + 900);
			if (!player.capabilities.isCreativeMode)
				stack.stackSize--;
			return true;
		}
	}
	return super.itemInteractionForEntity(stack, player, elb, hand);
}
 
开发者ID:bafomdad,项目名称:uniquecrops,代码行数:16,代码来源:ItemGeneric.java

示例4: doRenderLayer

import net.minecraft.entity.EntityLivingBase; //导入方法依赖的package包/类
public void doRenderLayer(EntityLivingBase entitylivingbaseIn, float p_177141_2_, float p_177141_3_, float partialTicks, float p_177141_5_, float p_177141_6_, float p_177141_7_, float scale)
{
    ItemStack itemstack = entitylivingbaseIn.getCurrentArmor(3);

    if (itemstack != null && itemstack.getItem() != null)
    {
        Item item = itemstack.getItem();
        Minecraft minecraft = Minecraft.getMinecraft();
        GlStateManager.pushMatrix();

        if (entitylivingbaseIn.isSneaking())
        {
            GlStateManager.translate(0.0F, 0.2F, 0.0F);
        }

        boolean flag = entitylivingbaseIn instanceof EntityVillager || entitylivingbaseIn instanceof EntityZombie && ((EntityZombie)entitylivingbaseIn).isVillager();

        if (!flag && entitylivingbaseIn.isChild())
        {
            float f = 2.0F;
            float f1 = 1.4F;
            GlStateManager.scale(f1 / f, f1 / f, f1 / f);
            GlStateManager.translate(0.0F, 16.0F * scale, 0.0F);
        }

        this.field_177209_a.postRender(0.0625F);
        GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);

        if (item instanceof ItemBlock)
        {
            float f2 = 0.625F;
            GlStateManager.translate(0.0F, -0.25F, 0.0F);
            GlStateManager.rotate(180.0F, 0.0F, 1.0F, 0.0F);
            GlStateManager.scale(f2, -f2, -f2);

            if (flag)
            {
                GlStateManager.translate(0.0F, 0.1875F, 0.0F);
            }

            minecraft.getItemRenderer().renderItem(entitylivingbaseIn, itemstack, ItemCameraTransforms.TransformType.HEAD);
        }
        else if (item == Items.skull)
        {
            float f3 = 1.1875F;
            GlStateManager.scale(f3, -f3, -f3);

            if (flag)
            {
                GlStateManager.translate(0.0F, 0.0625F, 0.0F);
            }

            GameProfile gameprofile = null;

            if (itemstack.hasTagCompound())
            {
                NBTTagCompound nbttagcompound = itemstack.getTagCompound();

                if (nbttagcompound.hasKey("SkullOwner", 10))
                {
                    gameprofile = NBTUtil.readGameProfileFromNBT(nbttagcompound.getCompoundTag("SkullOwner"));
                }
                else if (nbttagcompound.hasKey("SkullOwner", 8))
                {
                    String s = nbttagcompound.getString("SkullOwner");

                    if (!StringUtils.isNullOrEmpty(s))
                    {
                        gameprofile = TileEntitySkull.updateGameprofile(new GameProfile((UUID)null, s));
                        nbttagcompound.setTag("SkullOwner", NBTUtil.writeGameProfile(new NBTTagCompound(), gameprofile));
                    }
                }
            }

            TileEntitySkullRenderer.instance.renderSkull(-0.5F, 0.0F, -0.5F, EnumFacing.UP, 180.0F, itemstack.getMetadata(), gameprofile, -1);
        }

        GlStateManager.popMatrix();
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:81,代码来源:LayerCustomHead.java

示例5: doRenderLayer

import net.minecraft.entity.EntityLivingBase; //导入方法依赖的package包/类
public void doRenderLayer(EntityLivingBase entitylivingbaseIn, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale)
{
    ItemStack itemstack = entitylivingbaseIn.getItemStackFromSlot(EntityEquipmentSlot.HEAD);

    if (!itemstack.func_190926_b())
    {
        Item item = itemstack.getItem();
        Minecraft minecraft = Minecraft.getMinecraft();
        GlStateManager.pushMatrix();

        if (entitylivingbaseIn.isSneaking())
        {
            GlStateManager.translate(0.0F, 0.2F, 0.0F);
        }

        boolean flag = entitylivingbaseIn instanceof EntityVillager || entitylivingbaseIn instanceof EntityZombieVillager;

        if (entitylivingbaseIn.isChild() && !(entitylivingbaseIn instanceof EntityVillager))
        {
            float f = 2.0F;
            float f1 = 1.4F;
            GlStateManager.translate(0.0F, 0.5F * scale, 0.0F);
            GlStateManager.scale(0.7F, 0.7F, 0.7F);
            GlStateManager.translate(0.0F, 16.0F * scale, 0.0F);
        }

        this.modelRenderer.postRender(0.0625F);
        GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);

        if (item == Items.SKULL)
        {
            float f2 = 1.1875F;
            GlStateManager.scale(1.1875F, -1.1875F, -1.1875F);

            if (flag)
            {
                GlStateManager.translate(0.0F, 0.0625F, 0.0F);
            }

            GameProfile gameprofile = null;

            if (itemstack.hasTagCompound())
            {
                NBTTagCompound nbttagcompound = itemstack.getTagCompound();

                if (nbttagcompound.hasKey("SkullOwner", 10))
                {
                    gameprofile = NBTUtil.readGameProfileFromNBT(nbttagcompound.getCompoundTag("SkullOwner"));
                }
                else if (nbttagcompound.hasKey("SkullOwner", 8))
                {
                    String s = nbttagcompound.getString("SkullOwner");

                    if (!StringUtils.isBlank(s))
                    {
                        gameprofile = TileEntitySkull.updateGameprofile(new GameProfile((UUID)null, s));
                        nbttagcompound.setTag("SkullOwner", NBTUtil.writeGameProfile(new NBTTagCompound(), gameprofile));
                    }
                }
            }

            TileEntitySkullRenderer.instance.renderSkull(-0.5F, 0.0F, -0.5F, EnumFacing.UP, 180.0F, itemstack.getMetadata(), gameprofile, -1, limbSwing);
        }
        else if (!(item instanceof ItemArmor) || ((ItemArmor)item).getEquipmentSlot() != EntityEquipmentSlot.HEAD)
        {
            float f3 = 0.625F;
            GlStateManager.translate(0.0F, -0.25F, 0.0F);
            GlStateManager.rotate(180.0F, 0.0F, 1.0F, 0.0F);
            GlStateManager.scale(0.625F, -0.625F, -0.625F);

            if (flag)
            {
                GlStateManager.translate(0.0F, 0.1875F, 0.0F);
            }

            minecraft.getItemRenderer().renderItem(entitylivingbaseIn, itemstack, ItemCameraTransforms.TransformType.HEAD);
        }

        GlStateManager.popMatrix();
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:82,代码来源:LayerCustomHead.java

示例6: doRenderLayer

import net.minecraft.entity.EntityLivingBase; //导入方法依赖的package包/类
public void doRenderLayer(EntityLivingBase entitylivingbaseIn, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale)
{
    ItemStack itemstack = entitylivingbaseIn.getItemStackFromSlot(EntityEquipmentSlot.HEAD);

    if (itemstack != null && itemstack.getItem() != null)
    {
        Item item = itemstack.getItem();
        Minecraft minecraft = Minecraft.getMinecraft();
        GlStateManager.pushMatrix();

        if (entitylivingbaseIn.isSneaking())
        {
            GlStateManager.translate(0.0F, 0.2F, 0.0F);
        }

        boolean flag = entitylivingbaseIn instanceof EntityVillager || entitylivingbaseIn instanceof EntityZombie && ((EntityZombie)entitylivingbaseIn).isVillager();

        if (entitylivingbaseIn.isChild() && !(entitylivingbaseIn instanceof EntityVillager))
        {
            float f = 2.0F;
            float f1 = 1.4F;
            GlStateManager.translate(0.0F, 0.5F * scale, 0.0F);
            GlStateManager.scale(0.7F, 0.7F, 0.7F);
            GlStateManager.translate(0.0F, 16.0F * scale, 0.0F);
        }

        this.modelRenderer.postRender(0.0625F);
        GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);

        if (item == Items.SKULL)
        {
            float f2 = 1.1875F;
            GlStateManager.scale(1.1875F, -1.1875F, -1.1875F);

            if (flag)
            {
                GlStateManager.translate(0.0F, 0.0625F, 0.0F);
            }

            GameProfile gameprofile = null;

            if (itemstack.hasTagCompound())
            {
                NBTTagCompound nbttagcompound = itemstack.getTagCompound();

                if (nbttagcompound.hasKey("SkullOwner", 10))
                {
                    gameprofile = NBTUtil.readGameProfileFromNBT(nbttagcompound.getCompoundTag("SkullOwner"));
                }
                else if (nbttagcompound.hasKey("SkullOwner", 8))
                {
                    String s = nbttagcompound.getString("SkullOwner");

                    if (!StringUtils.isNullOrEmpty(s))
                    {
                        gameprofile = TileEntitySkull.updateGameprofile(new GameProfile((UUID)null, s));
                        nbttagcompound.setTag("SkullOwner", NBTUtil.writeGameProfile(new NBTTagCompound(), gameprofile));
                    }
                }
            }

            TileEntitySkullRenderer.instance.renderSkull(-0.5F, 0.0F, -0.5F, EnumFacing.UP, 180.0F, itemstack.getMetadata(), gameprofile, -1, limbSwing);
        }
        else if (!(item instanceof ItemArmor) || ((ItemArmor)item).getEquipmentSlot() != EntityEquipmentSlot.HEAD)
        {
            float f3 = 0.625F;
            GlStateManager.translate(0.0F, -0.25F, 0.0F);
            GlStateManager.rotate(180.0F, 0.0F, 1.0F, 0.0F);
            GlStateManager.scale(0.625F, -0.625F, -0.625F);

            if (flag)
            {
                GlStateManager.translate(0.0F, 0.1875F, 0.0F);
            }

            minecraft.getItemRenderer().renderItem(entitylivingbaseIn, itemstack, ItemCameraTransforms.TransformType.HEAD);
        }

        GlStateManager.popMatrix();
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:82,代码来源:LayerCustomHead.java


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