Moa update

This commit is contained in:
Kino 2016-12-24 10:34:03 -05:00
parent ea2295dbb6
commit f39c3ee470
2 changed files with 44 additions and 22 deletions

View file

@ -25,7 +25,7 @@ public class MoaLayer implements LayerRenderer<EntityMoa>
@Override
public void doRenderLayer(EntityMoa moa, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale)
{
if (moa.shouldSit)
if (moa.isSitting())
{
this.renderManager.renderEngine.bindTexture(TEXTURE_BRACE);
this.moaModel.render(moa, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scale);

View file

@ -45,7 +45,7 @@ public class EntityMoa extends EntitySaddleMount
public static final DataParameter<Boolean> HUNGRY = EntityDataManager.<Boolean>createKey(EntityMoa.class, DataSerializers.BOOLEAN);
public boolean shouldSit;
public static final DataParameter<Boolean> SITTING = EntityDataManager.<Boolean>createKey(EntityMoa.class, DataSerializers.BOOLEAN);
public float wingRotation, destPos, prevDestPos, prevWingRotation;
@ -69,17 +69,22 @@ public class EntityMoa extends EntitySaddleMount
this.setColor(color);
}
public void moveEntity(int x, int y, int z)
{
if (!this.shouldSit)
@Override
public void moveEntity(double x, double y, double z)
{
if (!this.isSitting())
{
super.moveEntity(x, y, z);
}
}
else
{
super.moveEntity(0, y, 0);
}
}
public int getRandomEggTime()
{
return 250 + this.rand.nextInt(25);
return 775 + this.rand.nextInt(50);
}
public void initAI()
@ -103,6 +108,7 @@ public class EntityMoa extends EntitySaddleMount
this.dataManager.register(PLAYER_GROWN, false);
this.dataManager.register(AMMOUNT_FEED, Byte.valueOf((byte) 0));
this.dataManager.register(HUNGRY, false);
this.dataManager.register(SITTING, false);
}
public boolean isAIEnabled()
@ -119,6 +125,16 @@ public class EntityMoa extends EntitySaddleMount
this.getEntityAttribute(SharedMonsterAttributes.MOVEMENT_SPEED).setBaseValue(1.0D);
}
public boolean isSitting()
{
return this.dataManager.get(SITTING);
}
public void setSitting(boolean isSitting)
{
this.dataManager.set(SITTING, isSitting);
}
public boolean isHungry()
{
return this.dataManager.get(HUNGRY);
@ -191,11 +207,6 @@ public class EntityMoa extends EntitySaddleMount
this.setMaxJumps(getColor().jumps);
if (this.shouldSit)
{
this.motionX = this.motionZ = 0.0F;
}
if (this.isJumping)
{
this.motionY += 0.05F;
@ -321,13 +332,13 @@ public class EntityMoa extends EntitySaddleMount
@Override
public boolean processInteract(EntityPlayer player, EnumHand hand, @Nullable ItemStack stack)
{
if (this.isPlayerGrown() && this.isHungry() && this.isChild() && player.getActiveItemStack() != null)
if (stack != null && this.isPlayerGrown())
{
if (this.getAmountFed() < 3)
{
Item currentItem = player.getActiveItemStack().getItem();
Item currentItem = stack.getItem();
if (currentItem == ItemsAether.aechor_petal)
if (this.isChild() && this.isHungry())
{
if (this.getAmountFed() < 3 && currentItem == ItemsAether.aechor_petal)
{
if (!player.capabilities.isCreativeMode)
{
@ -346,6 +357,15 @@ public class EntityMoa extends EntitySaddleMount
}
}
}
if (currentItem == ItemsAether.zanite_staff)
{
stack.damageItem(2, player);
this.setSitting(this.isSitting() ? false : true);
return true;
}
}
return super.processInteract(player, hand, stack);
@ -367,6 +387,7 @@ public class EntityMoa extends EntitySaddleMount
nbt.setInteger("color", this.getColor().ID);
nbt.setByte("amountFed", this.getAmountFed());
nbt.setBoolean("isHungry", this.isHungry());
nbt.setBoolean("isSitting", this.isSitting());
}
@Override
@ -379,30 +400,31 @@ public class EntityMoa extends EntitySaddleMount
this.setColor(MoaColor.getColor(nbt.getInteger("color")));
this.setAmountFed(nbt.getByte("amountFed"));
this.setHungry(nbt.getBoolean("isHungry"));
this.setSitting(nbt.getBoolean("isSitting"));
}
@Override
protected SoundEvent getAmbientSound()
{
return SoundsAether.moa_say; //"aether_legacy:aemob.moa.say";
return SoundsAether.moa_say;
}
@Override
protected SoundEvent getHurtSound()
{
return SoundsAether.moa_say;// "aether_legacy:aemob.moa.say";
return SoundsAether.moa_say;
}
@Override
protected SoundEvent getDeathSound()
{
return SoundsAether.moa_say;// "aether_legacy:aemob.moa.say";
return SoundsAether.moa_say;
}
@Override
protected void playStepSound(BlockPos pos, Block par4)
{
this.worldObj.playSound(this.posX, this.posY, this.posZ, SoundEvents.ENTITY_PIG_STEP, SoundCategory.NEUTRAL, 0.15F, 1.0F, false);
this.worldObj.playSound(null, this.posX, this.posY, this.posZ, SoundEvents.ENTITY_PIG_STEP, SoundCategory.NEUTRAL, 0.15F, 1.0F);
}
@Override
@ -431,7 +453,7 @@ public class EntityMoa extends EntitySaddleMount
@Override
public void jump()
{
if (this.getPassengers().isEmpty())
if (!this.isSitting() && this.getPassengers().isEmpty())
{
super.jump();
}