diff --git a/src/minecraft/dark/library/damage/EntityTileDamage.java b/src/minecraft/dark/library/damage/EntityTileDamage.java index e62069a10..56dc1002c 100644 --- a/src/minecraft/dark/library/damage/EntityTileDamage.java +++ b/src/minecraft/dark/library/damage/EntityTileDamage.java @@ -4,6 +4,7 @@ import universalelectricity.core.vector.Vector3; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLiving; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.potion.PotionEffect; @@ -27,7 +28,7 @@ import cpw.mods.fml.relauncher.SideOnly; * @author DarkGuardsman * */ -public class EntityTileDamage extends Entity implements IEntityAdditionalSpawnData +public class EntityTileDamage extends EntityLiving implements IEntityAdditionalSpawnData { private TileEntity host; @@ -120,7 +121,7 @@ public class EntityTileDamage extends Entity implements IEntityAdditionalSpawnDa } @Override - protected void readEntityFromNBT(NBTTagCompound nbttagcompound) + public void readEntityFromNBT(NBTTagCompound nbttagcompound) { // TODO Auto-generated method stub @@ -132,7 +133,7 @@ public class EntityTileDamage extends Entity implements IEntityAdditionalSpawnDa } @Override - protected void writeEntityToNBT(NBTTagCompound nbttagcompound) + public void writeEntityToNBT(NBTTagCompound nbttagcompound) { // TODO Auto-generated method stub @@ -151,25 +152,12 @@ public class EntityTileDamage extends Entity implements IEntityAdditionalSpawnDa } - @Override - protected void entityInit() - { - // TODO Auto-generated method stub - - } - @Override public boolean canBeCollidedWith() { return true; } - @SideOnly(Side.CLIENT) - public boolean func_98034_c(EntityPlayer par1EntityPlayer) - { - return true; - } - @SideOnly(Side.CLIENT) @Override public boolean isInRangeToRenderVec3D(Vec3 par1Vec3) @@ -209,4 +197,10 @@ public class EntityTileDamage extends Entity implements IEntityAdditionalSpawnDa } return false; } + + @Override + public int getMaxHealth() + { + return this.host != null && host instanceof IHpTile ? ((IHpTile) host).getMaxHealth() : 100; + } } diff --git a/src/minecraft/dark/library/damage/TileDamageSource.java b/src/minecraft/dark/library/damage/TileDamageSource.java index af25cd83f..852e242ca 100644 --- a/src/minecraft/dark/library/damage/TileDamageSource.java +++ b/src/minecraft/dark/library/damage/TileDamageSource.java @@ -1,21 +1,14 @@ package dark.library.damage; -import universalelectricity.prefab.CustomDamageSource; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLiving; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.projectile.EntityArrow; -import net.minecraft.util.DamageSource; -import net.minecraft.util.EntityDamageSourceIndirect; -import cpw.mods.fml.common.registry.LanguageRegistry; +import universalelectricity.prefab.CustomDamageSource; public class TileDamageSource extends CustomDamageSource { protected Object damageSource; - public static final CustomDamageSource bullets = ((CustomDamageSource) new CustomDamageSource("Bullets").setProjectile()).setDeathMessage("%1$s was filled with holes!"); - public static final CustomDamageSource laser = ((CustomDamageSource) new CustomDamageSource("Laser").setFireDamage()).setDeathMessage("%1$s was vaporized!"); - public TileDamageSource(String damageName, Object attacker) { super(damageName); @@ -25,7 +18,7 @@ public class TileDamageSource extends CustomDamageSource @Override public Entity getEntity() { - return damageSource instanceof Entity ? (Entity) damageSource : null; + return damageSource instanceof Entity ? ((Entity) damageSource) : null; } @Override @@ -33,4 +26,14 @@ public class TileDamageSource extends CustomDamageSource { return this.damageSource != null && this.damageSource instanceof EntityLiving && !(this.damageSource instanceof EntityPlayer); } + + public static TileDamageSource doBulletDamage(Object object) + { + return (TileDamageSource) ((CustomDamageSource) new TileDamageSource("Bullets", object).setProjectile()).setDeathMessage("%1$s was filled with holes!"); + } + + public static TileDamageSource doLaserDamage(Object object) + { + return (TileDamageSource) ((CustomDamageSource) new TileDamageSource("Laser", object).setProjectile()).setDeathMessage("%1$s was vaporized!"); + } }