本文整理匯總了Java中net.minecraft.entity.passive.EntityChicken.setGrowingAge方法的典型用法代碼示例。如果您正苦於以下問題:Java EntityChicken.setGrowingAge方法的具體用法?Java EntityChicken.setGrowingAge怎麽用?Java EntityChicken.setGrowingAge使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類net.minecraft.entity.passive.EntityChicken
的用法示例。
在下文中一共展示了EntityChicken.setGrowingAge方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: itemInteractionForEntity
import net.minecraft.entity.passive.EntityChicken; //導入方法依賴的package包/類
@Override
public boolean itemInteractionForEntity(ItemStack stack, EntityPlayer player, EntityLivingBase target) {
if (target.worldObj.isRemote || ItemStackHelper.getItemDamage(stack) != WORMS)
return false;
if (target instanceof EntityChicken) {
// If the chicken is a child, make it an adult. If it is
// an adult, accelerate egg laying.
final EntityChicken chicken = (EntityChicken) target;
if (chicken.isChild()) {
chicken.setGrowingAge(-1);
} else {
chicken.timeUntilNextEgg -= random.nextInt(EGG_ACCELERATION) + EGG_ACCELERATION;
}
stack.stackSize--;
return true;
}
return false;
}
示例2: updateEntity
import net.minecraft.entity.passive.EntityChicken; //導入方法依賴的package包/類
@Override
public void updateEntity(){
if(PowerStored > 0 && slot != null && slot.getItem().equals(Items.egg)) {
Tick++;
if(Tick % 10 == 0){
PowerStored--;
}
}
System.out.println("Tick: " + Integer.toString(Tick));
System.out.println("ChickTick: " + Integer.toString(ChickenTick));
if(slot != null && slot.getItem().equals(Items.egg) && Tick == ChickenTick + 48000){
ChickenTick = 0;
EntityChicken entityChicken = new EntityChicken(this.worldObj);
entityChicken.setLocationAndAngles(pos.getX() + .5, pos.getY() + 1, pos.getZ() + .5, 0.0F, 0.0F);
entityChicken.setGrowingAge(-24000);
this.worldObj.spawnEntityInWorld(entityChicken);
}
}
示例3: onImpact
import net.minecraft.entity.passive.EntityChicken; //導入方法依賴的package包/類
/**
* Called when this EntityThrowable hits a block or entity.
*/
protected void onImpact(MovingObjectPosition p_70184_1_)
{
if (p_70184_1_.entityHit != null)
{
p_70184_1_.entityHit.attackEntityFrom(DamageSource.causeThrownDamage(this, this.getThrower()), 0.0F);
}
if (!this.worldObj.isRemote && this.rand.nextInt(8) == 0)
{
int i = 1;
if (this.rand.nextInt(32) == 0)
{
i = 4;
}
for (int j = 0; j < i; ++j)
{
EntityChicken entitychicken = new EntityChicken(this.worldObj);
entitychicken.setGrowingAge(-24000);
entitychicken.setLocationAndAngles(this.posX, this.posY, this.posZ, this.rotationYaw, 0.0F);
this.worldObj.spawnEntityInWorld(entitychicken);
}
}
double d0 = 0.08D;
for (int k = 0; k < 8; ++k)
{
this.worldObj.spawnParticle(EnumParticleTypes.ITEM_CRACK, this.posX, this.posY, this.posZ, ((double)this.rand.nextFloat() - 0.5D) * 0.08D, ((double)this.rand.nextFloat() - 0.5D) * 0.08D, ((double)this.rand.nextFloat() - 0.5D) * 0.08D, new int[] {Item.getIdFromItem(Items.egg)});
}
if (!this.worldObj.isRemote)
{
this.setDead();
}
}
示例4: onImpact
import net.minecraft.entity.passive.EntityChicken; //導入方法依賴的package包/類
/**
* Called when this EntityThrowable hits a block or entity.
*/
protected void onImpact(RayTraceResult result)
{
if (result.entityHit != null)
{
result.entityHit.attackEntityFrom(DamageSource.causeThrownDamage(this, this.getThrower()), 0.0F);
}
if (!this.world.isRemote)
{
if (this.rand.nextInt(8) == 0)
{
int i = 1;
if (this.rand.nextInt(32) == 0)
{
i = 4;
}
for (int j = 0; j < i; ++j)
{
EntityChicken entitychicken = new EntityChicken(this.world);
entitychicken.setGrowingAge(-24000);
entitychicken.setLocationAndAngles(this.posX, this.posY, this.posZ, this.rotationYaw, 0.0F);
this.world.spawnEntityInWorld(entitychicken);
}
}
this.world.setEntityState(this, (byte)3);
this.setDead();
}
}
示例5: onImpact
import net.minecraft.entity.passive.EntityChicken; //導入方法依賴的package包/類
/**
* Called when this EntityThrowable hits a block or entity.
*/
protected void onImpact(RayTraceResult result)
{
if (result.entityHit != null)
{
result.entityHit.attackEntityFrom(DamageSource.causeThrownDamage(this, this.getThrower()), 0.0F);
}
if (!this.worldObj.isRemote && this.rand.nextInt(8) == 0)
{
int i = 1;
if (this.rand.nextInt(32) == 0)
{
i = 4;
}
for (int j = 0; j < i; ++j)
{
EntityChicken entitychicken = new EntityChicken(this.worldObj);
entitychicken.setGrowingAge(-24000);
entitychicken.setLocationAndAngles(this.posX, this.posY, this.posZ, this.rotationYaw, 0.0F);
this.worldObj.spawnEntityInWorld(entitychicken);
}
}
double d0 = 0.08D;
for (int k = 0; k < 8; ++k)
{
this.worldObj.spawnParticle(EnumParticleTypes.ITEM_CRACK, this.posX, this.posY, this.posZ, ((double)this.rand.nextFloat() - 0.5D) * 0.08D, ((double)this.rand.nextFloat() - 0.5D) * 0.08D, ((double)this.rand.nextFloat() - 0.5D) * 0.08D, new int[] {Item.getIdFromItem(Items.EGG)});
}
if (!this.worldObj.isRemote)
{
this.setDead();
}
}
示例6: handleEggs
import net.minecraft.entity.passive.EntityChicken; //導入方法依賴的package包/類
private void handleEggs()
{
if(TrackedItemsIterator == null || !TrackedItemsIterator.hasNext())
{
TrackedItems.addAll(TrackedItemsAdd);
TrackedItemsAdd.clear();
TrackedItemsIterator = TrackedItems.iterator();
}
else
{
EntityItem entity = TrackedItemsIterator.next();
World world = entity.world;
ItemStack stack = entity.getEntityItem();
BlockPos pos = entity.getPosition();
boolean remove = false;
if(entity.isDead || stack.isEmpty() || stack.getItem() != Items.EGG || stack.getCount() > 1)
remove = true;
else if((int) ReflectionHelper.getPrivateValue(EntityItem.class, entity, "d", "field_70292_b", "age") > 5400 && hasPadding(world,pos.down()) && hasLitLight(world,pos.up()))
{
world.playSound(null,entity.posX,entity.posY,entity.posZ, SoundEvents.ENTITY_CHICKEN_EGG, SoundCategory.NEUTRAL, 0.25F, world.rand.nextFloat() * 1.5F + 1.0F);
EntityChicken chick = new EntityChicken(world);
chick.setGrowingAge(-24000);
chick.setLocationAndAngles(entity.posX, entity.posY, entity.posZ, 0F, 0F);
world.spawnEntity(chick);
stack.shrink(1);
if (stack.isEmpty()) entity.setDead();
}
if(remove)
TrackedItemsIterator.remove();
}
}
示例7: onImpact
import net.minecraft.entity.passive.EntityChicken; //導入方法依賴的package包/類
/**
* Called when this EntityThrowable hits a block or entity.
*/
protected void onImpact(MovingObjectPosition par1MovingObjectPosition)
{
if (par1MovingObjectPosition.entityHit != null)
{
par1MovingObjectPosition.entityHit.attackEntityFrom(DamageSource.causeThrownDamage(this, this.getThrower()), 0.0F);
}
if (!this.worldObj.isClient && this.rand.nextInt(8) == 0)
{
byte var2 = 1;
if (this.rand.nextInt(32) == 0)
{
var2 = 4;
}
for (int var3 = 0; var3 < var2; ++var3)
{
EntityChicken var4 = new EntityChicken(this.worldObj);
var4.setGrowingAge(-24000);
var4.setLocationAndAngles(this.posX, this.posY, this.posZ, this.rotationYaw, 0.0F);
this.worldObj.spawnEntityInWorld(var4);
}
}
for (int var5 = 0; var5 < 8; ++var5)
{
this.worldObj.spawnParticle("snowballpoof", this.posX, this.posY, this.posZ, 0.0D, 0.0D, 0.0D);
}
if (!this.worldObj.isClient)
{
this.setDead();
}
}
示例8: onImpact
import net.minecraft.entity.passive.EntityChicken; //導入方法依賴的package包/類
protected void onImpact(MovingObjectPosition p_70184_1_)
{
if (p_70184_1_.entityHit != null)
{
p_70184_1_.entityHit.attackEntityFrom(DamageSource.causeThrownDamage(this, this.getThrower()), 0.0F);
}
if (!this.worldObj.isRemote && this.rand.nextInt(8) == 0)
{
byte b0 = 1;
if (this.rand.nextInt(32) == 0)
{
b0 = 4;
}
for (int i = 0; i < b0; ++i)
{
EntityChicken entitychicken = new EntityChicken(this.worldObj);
entitychicken.setGrowingAge(-24000);
entitychicken.setLocationAndAngles(this.posX, this.posY, this.posZ, this.rotationYaw, 0.0F);
this.worldObj.spawnEntityInWorld(entitychicken);
}
}
for (int j = 0; j < 8; ++j)
{
this.worldObj.spawnParticle("snowballpoof", this.posX, this.posY, this.posZ, 0.0D, 0.0D, 0.0D);
}
if (!this.worldObj.isRemote)
{
this.setDead();
}
}
示例9: onImpact
import net.minecraft.entity.passive.EntityChicken; //導入方法依賴的package包/類
/**
* Called when this EntityThrowable hits a block or entity.
*/
protected void onImpact(MovingObjectPosition par1MovingObjectPosition)
{
if (par1MovingObjectPosition.entityHit != null)
{
par1MovingObjectPosition.entityHit.attackEntityFrom(DamageSource.causeThrownDamage(this, this.getThrower()), 0.0F);
}
if (!this.worldObj.isRemote && this.rand.nextInt(8) == 0)
{
byte b0 = 1;
if (this.rand.nextInt(32) == 0)
{
b0 = 4;
}
for (int i = 0; i < b0; ++i)
{
EntityChicken entitychicken = new EntityChicken(this.worldObj);
entitychicken.setGrowingAge(-24000);
entitychicken.setLocationAndAngles(this.posX, this.posY, this.posZ, this.rotationYaw, 0.0F);
this.worldObj.spawnEntityInWorld(entitychicken);
}
}
for (int j = 0; j < 8; ++j)
{
this.worldObj.spawnParticle("snowballpoof", this.posX, this.posY, this.posZ, 0.0D, 0.0D, 0.0D);
}
if (!this.worldObj.isRemote)
{
this.setDead();
}
}
示例10: onImpact
import net.minecraft.entity.passive.EntityChicken; //導入方法依賴的package包/類
/**
* Called when this EntityThrowable hits a block or entity.
*/
protected void onImpact(MovingObjectPosition p_70184_1_)
{
if (p_70184_1_.entityHit != null)
{
p_70184_1_.entityHit.attackEntityFrom(DamageSource.causeThrownDamage(this, this.getThrower()), 0.0F);
}
if (!this.worldObj.isRemote && this.rand.nextInt(8) == 0)
{
byte b0 = 1;
if (this.rand.nextInt(32) == 0)
{
b0 = 4;
}
for (int i = 0; i < b0; ++i)
{
EntityChicken entitychicken = new EntityChicken(this.worldObj);
entitychicken.setGrowingAge(-24000);
entitychicken.setLocationAndAngles(this.posX, this.posY, this.posZ, this.rotationYaw, 0.0F);
this.worldObj.spawnEntityInWorld(entitychicken);
}
}
for (int j = 0; j < 8; ++j)
{
this.worldObj.spawnParticle("snowballpoof", this.posX, this.posY, this.posZ, 0.0D, 0.0D, 0.0D);
}
if (!this.worldObj.isRemote)
{
this.setDead();
}
}