Posted December 24, 201410 yr I am having a problem with my dragon. It is a very large model with a lenght of 30 blocks, but it has the hitbar of a "tiny" player. And the attack reach of the dragon is as large as it's body, so the player can't hit it before the dragon hits the player. Is there a way to give it a larger hitbar?
December 24, 201410 yr Author I allready have that, "setSize(30,3)". The hitbar is still very small. But the hitbar isn't large enough.
December 24, 201410 yr Author I have looked in EntityZombie and EntityDragon (of minecraft) and there block size is used. Can it be a problem with max lenght or something?
December 24, 201410 yr Author I have tested it's hitbar with arrows. The hitbar for arrows is different than the hitbar for normal attacks. Really strange, isn't it?
December 24, 201410 yr Show your code. There's 10 types of people in this world; Those that understand binary and those that don't.
December 25, 201410 yr Author Here is the superclass: public abstract class Dragon extends EntityFlying implements IMob{ protected EntityLivingBase target; public Dragon(World worldIn) { super(worldIn); setSize(30, 3); isImmuneToFire = true; } public void onUpdate(){ super.onUpdate(); if(target == null){ target = worldObj.getClosestPlayerToEntity(this, getEntityAttribute(SharedMonsterAttributes.followRange).getAttributeValue()); } if(target != null){ followTarget(); shootingUpdate(); faceEntity(target, 30, 30); } attackEntities(); } public abstract void shootingUpdate(); public void attackEntities(){ AxisAlignedBB aabb = getEntityBoundingBox(); List list = worldObj.getEntitiesWithinAABBExcludingEntity(this, aabb); int times = 0; while(times < list.size()){ Entity entity = (Entity) list.get(times); if(!(entity instanceof EntityItem)){ entity.attackEntityFrom(DamageSource.causeMobDamage(this), (float) getEntityAttribute(SharedMonsterAttributes.attackDamage).getAttributeValue()); } ++times; } } public void followTarget(){ Line line = new Line(new Position(this), new Position(target)); double speed = getEntityAttribute(SharedMonsterAttributes.movementSpeed).getAttributeValue(); motionX = ExtraUtils.divineAccurate(line.distanceXT, line.distance) * speed; motionY = ExtraUtils.divineAccurate(line.distanceYT, line.distance) * speed; motionZ = ExtraUtils.divineAccurate(line.distanceZT, line.distance) * speed; } public void setAttackTarget(EntityLivingBase entity){ target = entity; } public void setRevengeTarget(EntityLivingBase entity){ target = entity; } public EntityLivingBase getAttackTarget(){ return target; } public EntityLivingBase getAITarget(){ return target; } public void applyEntityAttributes(){ super.applyEntityAttributes(); getAttributeMap().registerAttribute(SharedMonsterAttributes.attackDamage); } public AxisAlignedBB getCollisionBox(Entity in){ return getEntityBoundingBox(); } public AxisAlignedBB getBoundingBox(){ return getEntityBoundingBox(); } } Here is the 'real' class: public class FireDragon extends Dragon{ public int cooldown; public int fireTimer; public boolean shootCooldown; public FireDragon(World worldIn) { super(worldIn); setSize(30,3); } @Override public void shootingUpdate() { if(!worldObj.isRemote){ if(cooldown <= 0){ if(fireTimer < 5 && shootCooldown){ EntityLargeFireball fire = new EntityLargeFireball(worldObj, this, 1, 1, 1); fire.explosionPower = 2; worldObj.spawnEntityInWorld(fire); ++fireTimer; shootCooldown = false; } else if(fireTimer >= 5){ cooldown = 100; fireTimer = 0; } else { shootCooldown = true; } } else { --cooldown; } } } @Override public void applyEntityAttributes(){ super.applyEntityAttributes(); getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(10); getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.3); getEntityAttribute(SharedMonsterAttributes.followRange).setBaseValue(64); getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(400); } } Any ideas what can go wrong?
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.