diff --git a/src/resonantinduction/ResonantInduction.java b/src/resonantinduction/ResonantInduction.java index 854ae0c8..888b55d4 100644 --- a/src/resonantinduction/ResonantInduction.java +++ b/src/resonantinduction/ResonantInduction.java @@ -12,6 +12,7 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntityFurnace; +import net.minecraft.util.DamageSource; import net.minecraftforge.common.Configuration; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.oredict.ShapedOreRecipe; @@ -20,7 +21,6 @@ import net.minecraftforge.oredict.ShapelessOreRecipe; import org.modstats.ModstatInfo; import org.modstats.Modstats; -import codechicken.lib.colour.ColourRGBA; import resonantinduction.contractor.BlockEMContractor; import resonantinduction.contractor.ItemBlockContractor; import resonantinduction.contractor.TileEntityEMContractor; @@ -36,13 +36,13 @@ import resonantinduction.tesla.BlockTesla; import resonantinduction.tesla.TileEntityTesla; import resonantinduction.wire.EnumWireMaterial; import resonantinduction.wire.ItemWire; -import universalelectricity.api.item.IElectricalItem; -import universalelectricity.api.vector.Vector3; import basiccomponents.api.BasicRegistry; import calclavia.lib.UniversalRecipe; import calclavia.lib.network.PacketHandler; import calclavia.lib.network.PacketTile; +import calclavia.lib.prefab.CustomDamageSource; import calclavia.lib.prefab.TranslationHelper; +import codechicken.lib.colour.ColourRGBA; import cpw.mods.fml.common.FMLLog; import cpw.mods.fml.common.Loader; import cpw.mods.fml.common.Mod; diff --git a/src/resonantinduction/tesla/TileEntityTesla.java b/src/resonantinduction/tesla/TileEntityTesla.java index 1bd30ef7..cf6507d1 100644 --- a/src/resonantinduction/tesla/TileEntityTesla.java +++ b/src/resonantinduction/tesla/TileEntityTesla.java @@ -17,7 +17,6 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.network.packet.Packet; import net.minecraft.server.MinecraftServer; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.DamageSource; import net.minecraft.util.MovingObjectPosition; import net.minecraft.world.World; import net.minecraftforge.common.ForgeDirection; @@ -26,6 +25,7 @@ import resonantinduction.api.ITesla; import universalelectricity.api.vector.Vector3; import calclavia.lib.network.IPacketReceiver; import calclavia.lib.network.IPacketSender; +import calclavia.lib.prefab.CustomDamageSource; import calclavia.lib.tile.EnergyStorage; import calclavia.lib.tile.TileEntityElectrical; @@ -231,7 +231,7 @@ public class TileEntityTesla extends TileEntityElectrical implements ITesla, IPa { if (mop.entityHit instanceof EntityLivingBase) { - mop.entityHit.attackEntityFrom(DamageSource.magic, 4); + mop.entityHit.attackEntityFrom(CustomDamageSource.electrocution, 4); ResonantInduction.proxy.renderElectricShock(this.worldObj, new Vector3(topTesla).clone().translate(0.5), new Vector3(mop.entityHit)); } } diff --git a/src/resonantinduction/wire/part/PartAdvancedWire.java b/src/resonantinduction/wire/part/PartAdvancedWire.java index 4a0c68ac..c26517b0 100644 --- a/src/resonantinduction/wire/part/PartAdvancedWire.java +++ b/src/resonantinduction/wire/part/PartAdvancedWire.java @@ -4,14 +4,17 @@ import java.util.ArrayList; import java.util.Collections; import java.util.List; +import calclavia.lib.prefab.CustomDamageSource; import net.minecraft.block.Block; import net.minecraft.block.BlockColored; +import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemShears; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.MovingObjectPosition; +import resonantinduction.ResonantInduction; import resonantinduction.wire.EnumWireMaterial; import universalelectricity.api.CompatibilityModule; import codechicken.lib.data.MCDataInput; @@ -58,6 +61,15 @@ public abstract class PartAdvancedWire extends PartConductor return false; } + @Override + public void onEntityCollision(Entity entity) + { + if (!this.isInsulated() && this.getNetwork().getLastBuffer() > 0) + { + entity.attackEntityFrom(CustomDamageSource.electrocution, this.getNetwork().getLastBuffer()); + } + } + @Override public long getEnergyLoss() { diff --git a/src/resonantinduction/wire/part/PartConductor.java b/src/resonantinduction/wire/part/PartConductor.java index 99554110..91b954f3 100644 --- a/src/resonantinduction/wire/part/PartConductor.java +++ b/src/resonantinduction/wire/part/PartConductor.java @@ -22,7 +22,7 @@ public abstract class PartConductor extends PartAdvanced implements IConductor */ @Override public long onReceiveEnergy(ForgeDirection from, long receive, boolean doReceive) - { + {System.out.println("RECEIVE"); return this.getNetwork().produce(new Vector3(tile()).modifyPositionFromSide(from).getTileEntity(world()), from.getOpposite(), receive, doReceive); } diff --git a/src/resonantinduction/wire/part/TraitConductor.java b/src/resonantinduction/wire/part/TraitConductor.java index d83a2a44..dc9d6f0e 100644 --- a/src/resonantinduction/wire/part/TraitConductor.java +++ b/src/resonantinduction/wire/part/TraitConductor.java @@ -104,15 +104,18 @@ public class TraitConductor extends TileMultipart implements IConductor /** * Try out different sides to try to inject energy into. */ - for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) + if (this.partMap(from.ordinal()) == null) { - if (dir != from.getOpposite() && dir != from) + for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) { - TMultiPart part = this.partMap(dir.ordinal()); - - if (this.interfaces.contains(part)) + if (dir != from.getOpposite()) { - return ((IConductor) part).onReceiveEnergy(from, receive, doReceive); + TMultiPart part = this.partMap(dir.ordinal()); + + if (this.interfaces.contains(part)) + { + return ((IConductor) part).onReceiveEnergy(from, receive, doReceive); + } } } }