Improved tesla shock animation

This commit is contained in:
Calclavia 2014-03-13 21:10:13 +08:00
parent af43dc1d60
commit 7ca7d6f570
7 changed files with 30 additions and 6 deletions

View file

@ -213,16 +213,18 @@ public class TileTesla extends TileElectrical implements IMultiBlockStructure<Ti
}
Vector3 targetVector = new Vector3((TileEntity) tesla);
int heightRange = 1;
if (tesla instanceof TileTesla)
{
getMultiBlock().get().outputBlacklist.add(this);
targetVector = new Vector3(((TileTesla) tesla).getTopTelsa());
heightRange = ((TileTesla) tesla).getHeight();
}
double distance = topTeslaVector.distance(targetVector);
Electrical.proxy.renderElectricShock(this.worldObj, new Vector3(topTesla).translate(new Vector3(0.5)), targetVector.translate(new Vector3(0.5)), EnumColor.DYES[this.dyeID].toColor());
Electrical.proxy.renderElectricShock(this.worldObj, new Vector3(topTesla).translate(new Vector3(0.5)), targetVector.translate(new Vector3(0.5, Math.random() * heightRange / 3 - heightRange / 3, 0.5)), EnumColor.DYES[this.dyeID].toColor());
this.transfer(tesla, Math.min(transferEnergy, TRANSFER_CAP));
@ -280,7 +282,6 @@ public class TileTesla extends TileElectrical implements IMultiBlockStructure<Ti
if (tileEntity instanceof TileTesla)
{
TileTesla otherTesla = (TileTesla) tileEntity;
// Make sure Tesla is the same color
if (!(otherTesla.dyeID == dyeID || (otherTesla.dyeID == DEFAULT_COLOR || dyeID == DEFAULT_COLOR)))
{

View file

@ -48,7 +48,7 @@ public class PartFramedWire extends PartFramedConnection<EnumWireMaterial, ICond
{
public PartFramedWire()
{
super();
super(Electrical.itemInsulation);
if (FMLCommonHandler.instance().getEffectiveSide() == Side.CLIENT)
breakIcon = RenderFramedWire.breakIcon;
}

View file

@ -35,7 +35,7 @@ public class PartPipe extends PartFramedNode<EnumPipeMaterial, FluidPressureNode
public PartPipe()
{
super();
super(null);
material = EnumPipeMaterial.values()[0];
requiresInsulation = false;

View file

@ -1,5 +1,6 @@
package resonantinduction.mechanical.logistic.rail;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.ForgeDirection;
@ -18,6 +19,11 @@ import codechicken.multipart.TSlottedPart;
*/
public class PartRailing extends PartFramedConnection<EnumPipeMaterial, IRailing, INodeNetwork> implements IRailing, TSlottedPart, JNormalOcclusion, IHollowConnect
{
public PartRailing()
{
super(null);
}
RedstoneControl control;
@Override

View file

@ -29,7 +29,12 @@ public abstract class PartColorableMaterial<M extends Enum> extends PartAdvanced
public M material;
public boolean isInsulated = false;
public boolean requiresInsulation = true;
protected Item insulationType = Electrical.itemInsulation;
protected final Item insulationType;
public PartColorableMaterial(Item insulationType)
{
this.insulationType = insulationType;
}
/**
* Material Methods

View file

@ -6,6 +6,7 @@ import java.util.Set;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.Icon;
import net.minecraft.util.MovingObjectPosition;
@ -34,7 +35,6 @@ import cpw.mods.fml.relauncher.SideOnly;
public abstract class PartFramedConnection<M extends Enum, C extends IConnector<N>, N extends INodeNetwork> extends PartColorableMaterial<M> implements IConnector<N>, TSlottedPart, JNormalOcclusion, IHollowConnect
{
public static IndexedCuboid6[] sides = new IndexedCuboid6[7];
public static IndexedCuboid6[] insulatedSides = new IndexedCuboid6[7];
@ -72,6 +72,11 @@ public abstract class PartFramedConnection<M extends Enum, C extends IConnector<
@SideOnly(Side.CLIENT)
protected Icon breakIcon;
public PartFramedConnection(Item insulationType)
{
super(insulationType);
}
public void preparePlacement(int meta)
{
this.setMaterial(meta);

View file

@ -7,6 +7,7 @@ import java.util.Set;
import net.minecraft.client.particle.EffectRenderer;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.Icon;
import net.minecraft.util.MovingObjectPosition;
@ -36,6 +37,7 @@ import cpw.mods.fml.relauncher.SideOnly;
public abstract class PartFramedNode<M extends Enum, N extends Node, T extends INodeProvider> extends PartColorableMaterial<M> implements INodeProvider, TSlottedPart, JNormalOcclusion, IHollowConnect, JIconHitEffects
{
public static IndexedCuboid6[] sides = new IndexedCuboid6[7];
public static IndexedCuboid6[] insulatedSides = new IndexedCuboid6[7];
@ -72,6 +74,11 @@ public abstract class PartFramedNode<M extends Enum, N extends Node, T extends I
@SideOnly(Side.CLIENT)
protected Icon breakIcon;
public PartFramedNode(Item insulationType)
{
super(insulationType);
}
public void preparePlacement(int meta)
{
this.setMaterial(meta);