I'm modifying the zombie ai and the problem is that the zombies attack like 5 times per second so damage you 5 times per second! So something in this has to affect the attackspeed but i can't find the error Can you help me? Code:java package me.jalau.mob; import java.util.UUID;import net.minecraft.server.v1_7_R1.AttributeInstance;import net.minecraft.server.v1_7_R1.AttributeModifier;import net.minecraft.server.v1_7_R1.Block;import net.minecraft.server.v1_7_R1.Blocks;import net.minecraft.server.v1_7_R1.EntityHuman;import net.minecraft.server.v1_7_R1.EnumMonsterType;import net.minecraft.server.v1_7_R1.GenericAttributes;import net.minecraft.server.v1_7_R1.GroupDataEntity;import net.minecraft.server.v1_7_R1.IRangedEntity;import net.minecraft.server.v1_7_R1.MobEffect;import net.minecraft.server.v1_7_R1.MobEffectList;import net.minecraft.server.v1_7_R1.NBTTagCompound;import net.minecraft.server.v1_7_R1.PathfinderGoalArrowAttack;import net.minecraft.server.v1_7_R1.PathfinderGoalFloat;import net.minecraft.server.v1_7_R1.PathfinderGoalHurtByTarget;import net.minecraft.server.v1_7_R1.PathfinderGoalLookAtPlayer;import net.minecraft.server.v1_7_R1.PathfinderGoalMeleeAttack;import net.minecraft.server.v1_7_R1.PathfinderGoalMoveTowardsRestriction;import net.minecraft.server.v1_7_R1.PathfinderGoalNearestAttackableTarget;import net.minecraft.server.v1_7_R1.PathfinderGoalRandomLookaround;import net.minecraft.server.v1_7_R1.PathfinderGoalRandomStroll;import net.minecraft.server.v1_7_R1.World;import net.minecraft.server.v1_7_R1.WorldServer; import org.bukkit.craftbukkit.v1_7_R1.CraftWorld;import org.bukkit.craftbukkit.v1_7_R1.inventory.CraftItemStack; public class CustomZombie extends MobBase { private static final UUID bq = UUID.fromString("B9766B59-9566-4402-BC1F-2EE2A276D836");private static final AttributeModifier br = new AttributeModifier(bq, "Baby speed boost", 0.2D, 1);private int bt;private String customType;private int tier; public CustomZombie(World world, int dropequip) {this(world, 20F, dropequip);} public CustomZombie(org.bukkit.World world, String name, int tier, String typemob, float maxHealth, org.bukkit.inventory.ItemStack[] drops, int[] dropC, int[] dropA, int dropequip, org.bukkit.inventory.ItemStack[] equipment) {this(((CraftWorld)world).getHandle(), maxHealth, dropequip); this.setCustomName(name); this.tier = tier;this.drops = drops;this.dropC = dropC;this.dropA = dropA;customType = typemob; for(int e = 0; e < equipment.length ;e++) {this.setEquipment(e, CraftItemStack.asNMSCopy(equipment[e]));}} public CustomZombie(World world) {this(world, 1);} public CustomZombie(World world, float health, int dropequip) {super(world, health, dropequip);this.getNavigation().b(true);this.goalSelector.a(0, new PathfinderGoalFloat(this));this.goalSelector.a(2, new PathfinderGoalMeleeAttack(this, EntityHuman.class, 1.0D, false));this.goalSelector.a(4, new PathfinderGoalMoveTowardsRestriction(this, 1.0D));this.goalSelector.a(6, new PathfinderGoalRandomStroll(this, 1.0D));this.goalSelector.a(7, new PathfinderGoalLookAtPlayer(this, EntityHuman.class, 8.0F));this.goalSelector.a(7, new PathfinderGoalRandomLookaround(this));this.targetSelector.a(1, new PathfinderGoalHurtByTarget(this, true));this.targetSelector.a(2, new PathfinderGoalNearestAttackableTarget(this, EntityHuman.class, 0, true));if (this.world != null && !this.world.isStatic) {AttributeInstance attributeinstance = this.getAttributeInstance(GenericAttributes.d); attributeinstance.b(br);attributeinstance.a(br);}} @Overrideprotected void aD() {super.aD();this.getAttributeInstance(GenericAttributes.b).setValue(40.0D);this.getAttributeInstance(GenericAttributes.d).setValue(0.23000000417232513D);this.getAttributeInstance(GenericAttributes.e).setValue(3.0D);} @Overrideprotected void c() {super.c();this.getDataWatcher().a(12, Byte.valueOf((byte) 0));this.getDataWatcher().a(13, Byte.valueOf((byte) 0));this.getDataWatcher().a(14, Byte.valueOf((byte) 0));} @Overridepublic int aV() {int v = super.aV() + 2; if (v > 20) {v = 20;} return v;} @Overrideprotected boolean bk() {return true;} @Overridepublic boolean isBaby() {return this.getDataWatcher().getByte(12) == 1;} public void setBaby(boolean flag) {this.getDataWatcher().watch(12, Byte.valueOf((byte) (flag ? 1 : 0)));if (this.world != null && !this.world.isStatic) {AttributeInstance attributeinstance = this.getAttributeInstance(GenericAttributes.d); attributeinstance.b(br);if (flag) {attributeinstance.a(br);}}} public boolean isVillager() {return this.getDataWatcher().getByte(13) == 1;} public void setVillager(boolean flag) {this.getDataWatcher().watch(13, Byte.valueOf((byte) (flag ? 1 : 0)));} @Overrideprotected String t() {switch(customType) {case "Human":return "";case "Orc":return "mob.zombiepig.zpig";default:return "mob.zombie.say";}} @Overrideprotected String aT() {switch(customType) {case "Human":return "random.hurt";case "Orc":return "mob.zombiepig.zpighurt";default:return "mob.zombie.hurt";}} @Overrideprotected String aU() {switch(customType) {case "Human":return "random.hurt";case "Orc":return "mob.zombiepig.zpigdeath";default:return "mob.zombie.death";}} @Overrideprotected void a(int i, int j, int k, Block block) {this.makeSound("mob.zombie.step", 0.15F, 1.0F);} @Overridepublic EnumMonsterType getMonsterType() {return EnumMonsterType.UNDEFINED;} @Overridepublic void b(NBTTagCompound nbttagcompound) {super.b(nbttagcompound);if (this.isBaby()) {nbttagcompound.setBoolean("IsBaby", true);} if (this.isVillager()) {nbttagcompound.setBoolean("IsVillager", true);} nbttagcompound.setString("customType", this.customType);nbttagcompound.setInt("dropequipment", this.dropequipment);}@Overridepublic void a(NBTTagCompound nbttagcompound) {super.a(nbttagcompound);if (nbttagcompound.getBoolean("IsBaby")) {this.setBaby(true);} if (nbttagcompound.getBoolean("IsVillager")) {this.setVillager(true);} this.customType = nbttagcompound.getString("customType");this.dropequipment = nbttagcompound.getInt("dropequipment");}@Overridepublic GroupDataEntity a(GroupDataEntity groupdataentity) {Object object = super.a(groupdataentity);float v = this.world.b(this.locX, this.locY, this.locZ); this.h(this.random.nextFloat() < 0.55F * v);if (object == null) {object = new GroupDataZombie(this, this.world.random.nextFloat() < 0.05F, this.world.random.nextFloat() < 0.05F, (EmptyClass4) null);} if (object instanceof GroupDataZombie) {GroupDataZombie groupdatazombie = (GroupDataZombie) object; if (groupdatazombie.b) {this.setVillager(true);} if (groupdatazombie.a) {this.setBaby(true);}} this.bA();this.bB(); return (GroupDataEntity) object;} protected void a(int i){this.bt = i;getDataWatcher().watch(14, Byte.valueOf((byte)1));m(MobEffectList.WEAKNESS.id);addEffect(new MobEffect(MobEffectList.INCREASE_DAMAGE.id, i, Math.min(this.world.difficulty.a() - 1, 0)));this.world.broadcastEntityEffect(this, (byte)16);} @Overrideprotected boolean isTypeNotPersistent() {return !this.ca();} public boolean ca() {return this.getDataWatcher().getByte(14) == 1;} protected int cc() {int i = 1; if (this.random.nextFloat() < 0.01F) {int j = 0; for (int k = (int)this.locX - 4; (k < (int)this.locX + 4) && (j < 14); k++) {for (int l = (int)this.locY - 4; (l < (int)this.locY + 4) && (j < 14); l++) {for (int i1 = (int)this.locZ - 4; (i1 < (int)this.locZ + 4) && (j < 14); i1++) {Block block = this.world.getType(k, l, i1); if ((block == Blocks.IRON_FENCE) || (block == Blocks.BED)) {if (this.random.nextFloat() < 0.3F) {i++;} j++;}}}}} return i;}}
zombiekiller753 I'm modifying the zombie ai and the problem is that the zombies attack like 5 times per second so damage you 5 times per second! So something in this has to affect the attackspeed but i can't find the error
Jalau Wait. So you want the zombies to attack 5 times per second? Or you don't want to, but they are because of something you did?
Mathias Eklund Vanilla Zombies simply aren't doing that so why are mine doing that? Also if i would know where the attack speed is set i would change it! Bump.... EDIT by Moderator: merged posts, please use the edit button instead of double posting.