Changed how electrocution is handled for wires, damage is no longer in the millions and only works when wire has a current
This commit is contained in:
parent
853c7bfdb0
commit
bb1aaecc5b
1 changed files with 280 additions and 285 deletions
|
@ -16,6 +16,7 @@ import net.minecraftforge.common.ForgeDirection;
|
|||
import resonantinduction.core.MultipartUtility;
|
||||
import resonantinduction.electrical.Electrical;
|
||||
import universalelectricity.api.CompatibilityModule;
|
||||
import universalelectricity.api.electricity.IElectricalNetwork;
|
||||
import universalelectricity.api.energy.IConductor;
|
||||
import calclavia.lib.prefab.CustomDamageSource;
|
||||
import codechicken.lib.data.MCDataInput;
|
||||
|
@ -23,10 +24,7 @@ import codechicken.lib.data.MCDataOutput;
|
|||
import codechicken.multipart.IRedstonePart;
|
||||
import codechicken.multipart.TMultiPart;
|
||||
|
||||
/**
|
||||
* @author Calclavia
|
||||
*
|
||||
*/
|
||||
/** @author Calclavia */
|
||||
@Deprecated
|
||||
public abstract class PartAdvancedWire extends PartConductor
|
||||
{
|
||||
|
@ -37,10 +35,7 @@ public abstract class PartAdvancedWire extends PartConductor
|
|||
public boolean isInsulated = false;
|
||||
protected Item insulationType = Electrical.itemInsulation;
|
||||
|
||||
/**
|
||||
* INTERNAL USE.
|
||||
* Can this conductor connect with an external object?
|
||||
*/
|
||||
/** INTERNAL USE. Can this conductor connect with an external object? */
|
||||
@Override
|
||||
public boolean canConnectTo(Object obj)
|
||||
{
|
||||
|
@ -93,9 +88,17 @@ public abstract class PartAdvancedWire extends PartConductor
|
|||
@Override
|
||||
public void onEntityCollision(Entity entity)
|
||||
{
|
||||
if (!this.isInsulated() && this.getNetwork().getLastBuffer() > 0)
|
||||
if (!this.isInsulated())
|
||||
{
|
||||
entity.attackEntityFrom(CustomDamageSource.electrocution, this.getNetwork().getLastBuffer());
|
||||
float damage = 0;
|
||||
|
||||
if (this.getNetwork() instanceof IElectricalNetwork && this.getNetwork().getRequest() > 0)
|
||||
{
|
||||
damage = ((IElectricalNetwork) this.getNetwork()).getVoltage() / 60;
|
||||
}
|
||||
|
||||
if (damage > 0)
|
||||
entity.attackEntityFrom(CustomDamageSource.electrocution, Math.max(damage, 10));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -111,9 +114,7 @@ public abstract class PartAdvancedWire extends PartConductor
|
|||
return this.getMaterial().maxAmps;
|
||||
}
|
||||
|
||||
/**
|
||||
* Material Methods
|
||||
*/
|
||||
/** Material Methods */
|
||||
public EnumWireMaterial getMaterial()
|
||||
{
|
||||
return this.material;
|
||||
|
@ -134,9 +135,7 @@ public abstract class PartAdvancedWire extends PartConductor
|
|||
return this.material.ordinal();
|
||||
}
|
||||
|
||||
/**
|
||||
* Insulation Methods
|
||||
*/
|
||||
/** Insulation Methods */
|
||||
public void setInsulated(boolean insulated)
|
||||
{
|
||||
this.isInsulated = insulated;
|
||||
|
@ -172,9 +171,7 @@ public abstract class PartAdvancedWire extends PartConductor
|
|||
tile().getWriteStream(this).writeByte(1).writeBoolean(this.isInsulated);
|
||||
}
|
||||
|
||||
/**
|
||||
* Wire Coloring Methods
|
||||
*/
|
||||
/** Wire Coloring Methods */
|
||||
public int getColor()
|
||||
{
|
||||
return this.isInsulated ? this.color : -1;
|
||||
|
@ -199,9 +196,7 @@ public abstract class PartAdvancedWire extends PartConductor
|
|||
tile().getWriteStream(this).writeByte(2).writeInt(this.color);
|
||||
}
|
||||
|
||||
/**
|
||||
* Changes the wire's color.
|
||||
*/
|
||||
/** Changes the wire's color. */
|
||||
@Override
|
||||
public boolean activate(EntityPlayer player, MovingObjectPosition part, ItemStack itemStack)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue