Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package NMS;
- import net.minecraft.server.v1_11_R1.DamageSource;
- import net.minecraft.server.v1_11_R1.Entity;
- import net.minecraft.server.v1_11_R1.EntityAgeable;
- import net.minecraft.server.v1_11_R1.EntityArrow;
- import net.minecraft.server.v1_11_R1.EntityHuman;
- import net.minecraft.server.v1_11_R1.EntityTameableAnimal;
- import net.minecraft.server.v1_11_R1.EntityWolf;
- import net.minecraft.server.v1_11_R1.GenericAttributes;
- import net.minecraft.server.v1_11_R1.PathfinderGoalFloat;
- import net.minecraft.server.v1_11_R1.PathfinderGoalHurtByTarget;
- import net.minecraft.server.v1_11_R1.PathfinderGoalLeapAtTarget;
- import net.minecraft.server.v1_11_R1.PathfinderGoalLookAtPlayer;
- import net.minecraft.server.v1_11_R1.PathfinderGoalMeleeAttack;
- import net.minecraft.server.v1_11_R1.PathfinderGoalRandomLookaround;
- import net.minecraft.server.v1_11_R1.PathfinderGoalRandomStrollLand;
- import net.minecraft.server.v1_11_R1.World;
- public class sdWolf extends EntityWolf {
- public sdWolf(World world) {
- super(world);
- setDefaultGoals();
- this.setAngry(true);
- }
- @Override
- public void r() {
- }
- public void setDefaultGoals() {
- NMSUtils.clearBehavior(goalSelector, targetSelector);
- this.goalSelector.a(1, new PathfinderGoalFloat(this));
- this.goalSelector.a(2, new sdPathfinderGoalNearestAttackableTarget(this, EntityHuman.class, true));
- this.goalSelector.a(4, new PathfinderGoalLeapAtTarget(this, 0.4F));
- this.goalSelector.a(5, new PathfinderGoalMeleeAttack(this, 1.0D, true));
- this.goalSelector.a(8, new PathfinderGoalRandomStrollLand(this, 1.0D));
- this.goalSelector.a(10, new PathfinderGoalLookAtPlayer(this, EntityHuman.class, 8.0F));
- this.goalSelector.a(10, new PathfinderGoalRandomLookaround(this));
- //this.targetSelector.a(3, new PathfinderGoalHurtByTarget(this, true, new Class[0]));
- this.targetSelector.a(2, new sdPathfinderGoalNearestAttackableTarget(this, EntityHuman.class, true));
- }
- @Override
- public void initAttributes() {
- super.initAttributes();
- this.getAttributeInstance(GenericAttributes.MOVEMENT_SPEED).setValue(0.30000001192092896D);
- if (this.isTamed()) {
- this.getAttributeInstance(GenericAttributes.maxHealth).setValue(20.0D);
- } else {
- this.getAttributeInstance(GenericAttributes.maxHealth).setValue(48.0D);
- }
- //this.getAttributeMap().b(GenericAttributes.ATTACK_DAMAGE).setValue(2.0D);
- }
- @Override
- public EntityAgeable createChild(EntityAgeable arg0) {
- // TODO Auto-generated method stub
- return null;
- }
- /*
- @Override
- public boolean damageEntity(DamageSource damagesource, float f) {
- if(damagesource.equals(DamageSource.FALL))
- return false;
- if (this.isInvulnerable(damagesource)) {
- return false;
- } else {
- Entity entity = damagesource.getEntity();
- if (this.goalSit != null) {
- // CraftBukkit - moved into EntityLiving.d(DamageSource, float)
- // PAIL : checkme
- // this.goalSit.setSitting(false);
- }
- if (entity != null && !(entity instanceof EntityHuman) && !(entity instanceof EntityArrow)) {
- f = (f + 1.0F) / 2.0F;
- }
- if(damagesource == null)
- damagesource = DamageSource.GENERIC;
- else
- System.out.println("Damage source was: " + damagesource + " for: " + f);
- if(f <=0)
- f = 0.5f;
- return super.damageEntity(damagesource, f);
- }
- }
- */
- public void setAngry(boolean flag) {
- byte b0 = ((Byte) this.datawatcher.get(sdWolf.bw)).byteValue();
- if (flag) {
- this.datawatcher.set(sdWolf.bw, Byte.valueOf((byte) (b0 | 2)));
- } else {
- this.datawatcher.set(sdWolf.bw, Byte.valueOf((byte) (b0 & -3)));
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement