Originally Posted by
artizana
For people that want to do it le ugly way
@Override
public void processMovement() {
super.processMovement();
if (this.getName(). toLowerCase().contains("chicken") && getNextWalkDirection() != -1) {
this.setNextAnimation(new Animation(24183));
this.setNextForceMovement(new NewForceMovement(this, 1, null, 0,
Utils.getFaceDirection(
Utils.DIRECTION_DELTA_X[getNextWalkDirection()],
Utils.DIRECTION_DELTA_Y[getNextWalkDirection()])));
}
}
Just make a new file chicken.java or anything you want.
Ew. Don't do that.
1) You don't need that name check there if you're already making a class dedicated to chickens.
2) You're repeatedly creating new Animation and ForceMovement objects which really isn't good.
3) That is a wrong and nasty way of doing so.
Code:
public final class Chicken extends NPC {
public Chicken(final int id, final WorldTile tile, ...) {
this.id = id;
this.tile = tile;
... = ...;
this.setRenderAnimation(CORRECT_CHICKEN_RENDER_ANIMATION);
}
}
Of course this would force you to identify the render animation mask which on a 718 is 0x200 (all it does is send a short with the render animation id).