Skip to content

Commit

Permalink
Turkey display while attacking
Browse files Browse the repository at this point in the history
  • Loading branch information
itsmeow committed Nov 20, 2019
1 parent fba735a commit b1ee1a2
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,39 @@ public void setRotationAngles(float limbSwing, float limbSwingAmount, float ageI
} else {
this.neck.rotateAngleX = -1.0471975511965976F;
}
if(ent.isAttackingFromServer()) {
this.setRotateAngle(tail01, 0.9424777960769379F, 0.0F, 0.0F);
this.setRotateAngle(rTailFeather01, 0.0F, -0.06981317007977318F, 0.0F);
this.setRotateAngle(lTailFeather04, 0.0F, 1.0471975511965976F, 0.0F);
this.setRotateAngle(tail02, 0.45378560551852565F, 0.0F, 0.0F);
this.setRotateAngle(rTailFeather05, 0.0F, -1.3089969389957472F, 0.0F);
this.setRotateAngle(lTailFeather02, 0.0F, 0.296705972839036F, 0.0F);
this.setRotateAngle(rTailFeather02, 0.0F, -0.296705972839036F, 0.0F);
this.setRotateAngle(rTailFeather03, 0.0F, -0.6981317007977318F, 0.0F);
this.setRotateAngle(hackles, 0.7330382858376184F, 0.0F, 0.0F);
this.setRotateAngle(lTailFeather03, 0.0F, 0.6981317007977318F, 0.0F);
this.setRotateAngle(lTailFeather05, 0.0F, 1.3089969389957472F, 0.0F);
this.setRotateAngle(lTailFeather01, 0.0F, 0.06981317007977318F, 0.0F);
this.setRotateAngle(rTailFeather04, 0.0F, -1.0471975511965976F, 0.0F);
} else {
this.setRotateAngle(rTailFeather04, 0.0F, -0.17453292519943295F, 0.0F);
this.setRotateAngle(lTailFeather01, 0.0F, 0.017453292519943295F, 0.0F);
this.setRotateAngle(lTailFeather05, 0.0F, 0.2617993877991494F, 0.0F);
this.setRotateAngle(lTailFeather03, 0.0F, 0.12217304763960307F, 0.0F);
this.setRotateAngle(hackles, 0.17453292519943295F, 0.0F, 0.0F);
this.setRotateAngle(rTailFeather03, 0.0F, -0.12217304763960307F, 0.0F);
this.setRotateAngle(rTailFeather02, 0.0F, -0.05235987755982988F, 0.0F);
this.setRotateAngle(lTailFeather02, 0.0F, 0.05235987755982988F, 0.0F);
this.setRotateAngle(rTailFeather05, 0.0F, -0.2617993877991494F, 0.0F);
this.setRotateAngle(tail02, 0.12217304763960307F, 0.0F, 0.0F);
this.setRotateAngle(lTailFeather04, 0.0F, 0.17453292519943295F, 0.0F);
this.setRotateAngle(rTailFeather02, 0.0F, -0.05235987755982988F, 0.0F);
this.setRotateAngle(lTailFeather02, 0.0F, 0.05235987755982988F, 0.0F);
this.setRotateAngle(tail02, 0.12217304763960307F, 0.0F, 0.0F);
this.setRotateAngle(lTailFeather04, 0.0F, 0.17453292519943295F, 0.0F);
this.setRotateAngle(rTailFeather01, 0.0F, -0.017453292519943295F, 0.0F);
this.setRotateAngle(tail01, 0.0F, 0.0F, 0.0F);
}
}
this.head.rotateAngleX = headPitch * 0.017453292F + 0.2617993877991494F;
this.rLeg01.rotateAngleX = MathHelper.cos(limbSwing * 0.6662F) * 1.4F * limbSwingAmount;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
public class EntityTurkey extends EntityAnimalWithTypes {

protected static final DataParameter<Integer> PECK_TIME = EntityDataManager.<Integer>createKey(EntityTurkey.class, DataSerializers.VARINT);
protected static final DataParameter<Boolean> ATTACKING = EntityDataManager.<Boolean>createKey(EntityTurkey.class, DataSerializers.BOOLEAN);
public float wingRotation;
public float destPos;
public float oFlapSpeed;
Expand Down Expand Up @@ -111,6 +112,20 @@ protected void applyEntityAttributes() {
this.getAttributeMap().registerAttribute(SharedMonsterAttributes.ATTACK_DAMAGE);
this.getEntityAttribute(SharedMonsterAttributes.ATTACK_DAMAGE).setBaseValue(1D);
}

@Override
public void setAttackTarget(EntityLivingBase entitylivingbaseIn) {
this.setAttackingOnClient(entitylivingbaseIn != null);
super.setAttackTarget(entitylivingbaseIn);
}

public boolean isAttackingFromServer() {
return this.dataManager.get(ATTACKING).booleanValue();
}

public void setAttackingOnClient(boolean in) {
this.dataManager.set(ATTACKING, Boolean.valueOf(in));
}

@Override
public boolean attackEntityAsMob(Entity entityIn) {
Expand Down Expand Up @@ -151,7 +166,7 @@ public void onLivingUpdate() {

this.wingRotation += this.wingRotDelta * 2.0F;

if(!this.onGround || this.getMoveHelper().isUpdating()) {
if(!this.onGround || this.getMoveHelper().isUpdating() || this.getAttackTarget() != null) {
if(this.getPeckTime() <= 61) {
this.setPeckTime(80);
}
Expand Down Expand Up @@ -212,6 +227,7 @@ protected ResourceLocation getLootTable() {
protected void entityInit() {
super.entityInit();
this.dataManager.register(PECK_TIME, Integer.valueOf(0));
this.dataManager.register(ATTACKING, Boolean.valueOf(false));
}

public int getPeckTime() {
Expand Down

0 comments on commit b1ee1a2

Please sign in to comment.