Made tesla render based on height
This commit is contained in:
parent
17f29aeb7c
commit
8ac93513ac
7 changed files with 347 additions and 57 deletions
BIN
resources/assets/resonantinduction/textures/models/tesla_top.png
Normal file
BIN
resources/assets/resonantinduction/textures/models/tesla_top.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 966 B |
|
@ -5,6 +5,7 @@ package resonantinduction.base;
|
|||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
/**
|
||||
* @author Calclavia
|
||||
|
@ -82,9 +83,9 @@ public class Vector3
|
|||
*
|
||||
* @return The cross product between this vector and another.
|
||||
*/
|
||||
public Vector3 crossProduct(Vector3 vec2)
|
||||
public Vector3 crossProduct(Vector3 compare)
|
||||
{
|
||||
return new Vector3(this.y * vec2.z - this.z * vec2.y, this.z * vec2.x - this.x * vec2.z, this.x * vec2.y - this.y * vec2.x);
|
||||
return new Vector3(this.y * compare.z - this.z * compare.y, this.z * compare.x - this.x * compare.z, this.x * compare.y - this.y * compare.x);
|
||||
}
|
||||
|
||||
public Vector3 xCrossProduct()
|
||||
|
@ -196,6 +197,21 @@ public class Vector3
|
|||
return new Vector3(Math.cos(Math.toRadians(rotationYaw)), Math.sin(Math.toRadians(rotationPitch)), Math.sin(Math.toRadians(rotationYaw)));
|
||||
}
|
||||
|
||||
public double getAngle(Vector3 vector)
|
||||
{
|
||||
return this.getAnglePreNorm(vector.clone().normalize());
|
||||
}
|
||||
|
||||
public double getAnglePreNorm(Vector3 vector)
|
||||
{
|
||||
return Math.acos(this.dotProduct(vector));
|
||||
}
|
||||
|
||||
public TileEntity getTileEntity(World world)
|
||||
{
|
||||
return world.getBlockTileEntity((int) this.x, (int) this.y, (int) this.z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Vector3 clone()
|
||||
{
|
||||
|
|
|
@ -79,9 +79,10 @@ public class FXElectricBolt extends EntityFX
|
|||
double offsetRatio = this.boltLength * this.complexity;
|
||||
this.split(offsetRatio / 8, 0.1f, 45);
|
||||
|
||||
this.split(offsetRatio / 12, 0.1f, 90);
|
||||
this.split(offsetRatio / 18, 0.1f, 90);
|
||||
this.split(offsetRatio / 18, 0.1f, 90);
|
||||
/*
|
||||
* this.split(offsetRatio / 12, 0.1f, 90); this.split(offsetRatio / 18, 0.1f, 90);
|
||||
* this.split(offsetRatio / 18, 0.1f, 90);
|
||||
*/
|
||||
|
||||
/**
|
||||
* Finish up calculations
|
||||
|
@ -250,48 +251,60 @@ public class FXElectricBolt extends EntityFX
|
|||
|
||||
for (BoltSegment segment : this.segments)
|
||||
{
|
||||
double width = this.width * ((new Vector3(player).distance(segment.start) / 5 + 1) * (1.0F + segment.alpha) * 0.5f);
|
||||
Vector3 prevDiff = playerVector.crossProduct(segment.prevDiff).scale(this.width);
|
||||
Vector3 nextDiff = playerVector.crossProduct(segment.nextDiff).scale(this.width);
|
||||
|
||||
Vector3 renderStart = segment.start;
|
||||
Vector3 renderEnd = segment.end;
|
||||
tessellator.setColorRGBA_F(this.particleRed, this.particleGreen, this.particleBlue, segment.alpha);
|
||||
|
||||
float rx1 = (float) (renderStart.x - interpPosX);
|
||||
float ry1 = (float) (renderStart.y - interpPosY);
|
||||
float rz1 = (float) (renderStart.z - interpPosZ);
|
||||
float rx2 = (float) (renderEnd.x - interpPosX);
|
||||
float ry2 = (float) (renderEnd.y - interpPosY);
|
||||
float rz2 = (float) (renderEnd.z - interpPosZ);
|
||||
|
||||
tessellator.addVertexWithUV(rx2 - nextDiff.x, ry2 - nextDiff.y, rz2 - nextDiff.z, 0.5D, 0.0D);
|
||||
tessellator.addVertexWithUV(rx1 - prevDiff.x, ry1 - prevDiff.y, rz1 - prevDiff.z, 0.5D, 0.0D);
|
||||
tessellator.addVertexWithUV(rx1 + prevDiff.x, ry1 + prevDiff.y, rz1 + prevDiff.z, 0.5D, 1.0D);
|
||||
tessellator.addVertexWithUV(rx2 + nextDiff.x, ry2 + nextDiff.y, rz2 + nextDiff.z, 0.5D, 1.0D);
|
||||
|
||||
if (segment.prev == null)
|
||||
if (segment != null)
|
||||
{
|
||||
Vector3 roundend = segment.start.clone().difference(segment.difference.clone().normalize().scale(width));
|
||||
float rx3 = (float) (roundend.x - interpPosX);
|
||||
float ry3 = (float) (roundend.y - interpPosY);
|
||||
float rz3 = (float) (roundend.z - interpPosZ);
|
||||
tessellator.addVertexWithUV(rx1 - prevDiff.x, ry1 - prevDiff.y, rz1 - prevDiff.z, 0.5D, 0.0D);
|
||||
tessellator.addVertexWithUV(rx3 - prevDiff.x, ry3 - prevDiff.y, rz3 - prevDiff.z, 0.0D, 0.0D);
|
||||
tessellator.addVertexWithUV(rx3 + prevDiff.x, ry3 + prevDiff.y, rz3 + prevDiff.z, 0.0D, 1.0D);
|
||||
tessellator.addVertexWithUV(rx1 + prevDiff.x, ry1 + prevDiff.y, rz1 + prevDiff.z, 0.5D, 1.0D);
|
||||
}
|
||||
double renderWidth = this.boltWidth * ((new Vector3(player).distance(segment.start) / 5 + 1) * (1.0F + segment.alpha) * 0.5f);
|
||||
Vector3 prevDiff = playerVector.crossProduct(segment.prevDiff).scale(renderWidth / segment.sinPrev);
|
||||
Vector3 nextDiff = playerVector.crossProduct(segment.nextDiff).scale(renderWidth / segment.sinNext);
|
||||
|
||||
if (segment.next == null)
|
||||
{
|
||||
Vector3 roundend = segment.end.clone().translate(segment.difference.clone().normalize().scale(width));
|
||||
float rx3 = (float) (roundend.x - interpPosX);
|
||||
float ry3 = (float) (roundend.y - interpPosY);
|
||||
float rz3 = (float) (roundend.z - interpPosZ);
|
||||
tessellator.addVertexWithUV(rx3 - nextDiff.x, ry3 - nextDiff.y, rz3 - nextDiff.z, 0.0D, 0.0D);
|
||||
tessellator.addVertexWithUV(rx2 - nextDiff.x, ry2 - nextDiff.y, rz2 - nextDiff.z, 0.5D, 0.0D);
|
||||
tessellator.addVertexWithUV(rx2 + nextDiff.x, ry2 + nextDiff.y, rz2 + nextDiff.z, 0.5D, 1.0D);
|
||||
tessellator.addVertexWithUV(rx3 + nextDiff.x, ry3 + nextDiff.y, rz3 + nextDiff.z, 0.0D, 1.0D);
|
||||
Vector3 renderStart = segment.start;
|
||||
Vector3 renderEnd = segment.end;
|
||||
|
||||
float rxStart = (float) (renderStart.x - interpPosX);
|
||||
float ryStart = (float) (renderStart.y - interpPosY);
|
||||
float rzStart = (float) (renderStart.z - interpPosZ);
|
||||
float rxEnd = (float) (renderEnd.x - interpPosX);
|
||||
float ryEnd = (float) (renderEnd.y - interpPosY);
|
||||
float rzEnd = (float) (renderEnd.z - interpPosZ);
|
||||
|
||||
/*
|
||||
* TODO: segment . alpha
|
||||
*/
|
||||
tessellator.setColorRGBA_F(this.particleRed, this.particleGreen, this.particleBlue, 1);
|
||||
|
||||
// System.out.println("SHOCK" + this.particleBlue);
|
||||
|
||||
tessellator.addVertexWithUV(rxEnd - nextDiff.x, ryEnd - nextDiff.y, rzEnd - nextDiff.z, 0.5D, 0.0D);
|
||||
tessellator.addVertexWithUV(rxStart - prevDiff.x, ryStart - prevDiff.y, rzStart - prevDiff.z, 0.5D, 0.0D);
|
||||
tessellator.addVertexWithUV(rxStart + prevDiff.x, ryStart + prevDiff.y, rzStart + prevDiff.z, 0.5D, 1.0D);
|
||||
tessellator.addVertexWithUV(rxEnd + nextDiff.x, ryEnd + nextDiff.y, rzEnd + nextDiff.z, 0.5D, 1.0D);
|
||||
|
||||
/**
|
||||
* Renders the bolt "ball".
|
||||
*/
|
||||
if (segment.prev == null)
|
||||
{
|
||||
Vector3 roundend = segment.start.clone().difference(segment.difference.clone().normalize().scale(renderWidth));
|
||||
float rx3 = (float) (roundend.x - interpPosX);
|
||||
float ry3 = (float) (roundend.y - interpPosY);
|
||||
float rz3 = (float) (roundend.z - interpPosZ);
|
||||
tessellator.addVertexWithUV(rxStart - prevDiff.x, ryStart - prevDiff.y, rzStart - prevDiff.z, 0.5D, 0.0D);
|
||||
tessellator.addVertexWithUV(rx3 - prevDiff.x, ry3 - prevDiff.y, rz3 - prevDiff.z, 0.0D, 0.0D);
|
||||
tessellator.addVertexWithUV(rx3 + prevDiff.x, ry3 + prevDiff.y, rz3 + prevDiff.z, 0.0D, 1.0D);
|
||||
tessellator.addVertexWithUV(rxStart + prevDiff.x, ryStart + prevDiff.y, rzStart + prevDiff.z, 0.5D, 1.0D);
|
||||
}
|
||||
|
||||
if (segment.next == null)
|
||||
{
|
||||
Vector3 roundend = segment.end.clone().translate(segment.difference.clone().normalize().scale(renderWidth));
|
||||
float rx3 = (float) (roundend.x - interpPosX);
|
||||
float ry3 = (float) (roundend.y - interpPosY);
|
||||
float rz3 = (float) (roundend.z - interpPosZ);
|
||||
tessellator.addVertexWithUV(rx3 - nextDiff.x, ry3 - nextDiff.y, rz3 - nextDiff.z, 0.0D, 0.0D);
|
||||
tessellator.addVertexWithUV(rxEnd - nextDiff.x, ryEnd - nextDiff.y, rzEnd - nextDiff.z, 0.5D, 0.0D);
|
||||
tessellator.addVertexWithUV(rxEnd + nextDiff.x, ryEnd + nextDiff.y, rzEnd + nextDiff.z, 0.5D, 1.0D);
|
||||
tessellator.addVertexWithUV(rx3 + nextDiff.x, ry3 + nextDiff.y, rz3 + nextDiff.z, 0.0D, 1.0D);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -307,7 +320,7 @@ public class FXElectricBolt extends EntityFX
|
|||
@Override
|
||||
public boolean shouldRenderInPass(int pass)
|
||||
{
|
||||
return pass == 2;
|
||||
return true;//pass == 2;
|
||||
}
|
||||
|
||||
public class BoltPoint extends Vector3
|
||||
|
@ -344,6 +357,8 @@ public class FXElectricBolt extends EntityFX
|
|||
private Vector3 difference;
|
||||
public Vector3 prevDiff;
|
||||
public Vector3 nextDiff;
|
||||
public double sinPrev;
|
||||
public double sinNext;
|
||||
|
||||
public BoltSegment(BoltPoint start, BoltPoint end)
|
||||
{
|
||||
|
@ -366,24 +381,28 @@ public class FXElectricBolt extends EntityFX
|
|||
|
||||
if (this.prev != null)
|
||||
{
|
||||
Vector3 prevdiffnorm = this.prev.difference.clone().normalize();
|
||||
Vector3 thisdiffnorm = this.difference.clone().normalize();
|
||||
this.prevDiff = thisdiffnorm.translate(prevdiffnorm).normalize();
|
||||
Vector3 prevDiffNorm = this.prev.difference.clone().normalize();
|
||||
Vector3 diffNorm = this.difference.clone().normalize();
|
||||
this.prevDiff = diffNorm.translate(prevDiffNorm).normalize();
|
||||
this.sinPrev = Math.sin(diffNorm.getAnglePreNorm(prevDiffNorm.scale(-1)) / 2);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.prevDiff = this.difference.clone().normalize();
|
||||
this.sinPrev = 1;
|
||||
}
|
||||
|
||||
if (this.next != null)
|
||||
{
|
||||
Vector3 nextdiffnorm = this.next.difference.clone().normalize();
|
||||
Vector3 thisdiffnorm = this.difference.clone().normalize();
|
||||
this.nextDiff = thisdiffnorm.translate(nextdiffnorm).normalize();
|
||||
Vector3 nextDiffNorm = this.next.difference.clone().normalize();
|
||||
Vector3 diffNorm = this.difference.clone().normalize();
|
||||
this.nextDiff = diffNorm.translate(nextDiffNorm).normalize();
|
||||
this.sinNext = Math.sin(diffNorm.getAnglePreNorm(nextDiffNorm.scale(-1)) / 2);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.nextDiff = this.difference.clone().normalize();
|
||||
this.sinNext = 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
204
src/resonantinduction/model/ModelTeslaTop.java
Normal file
204
src/resonantinduction/model/ModelTeslaTop.java
Normal file
|
@ -0,0 +1,204 @@
|
|||
package resonantinduction.model;
|
||||
|
||||
import net.minecraft.client.model.ModelBase;
|
||||
import net.minecraft.client.model.ModelRenderer;
|
||||
|
||||
public class ModelTeslaTop extends ModelBase
|
||||
{
|
||||
// fields
|
||||
ModelRenderer Base;
|
||||
ModelRenderer Collumn1;
|
||||
ModelRenderer Collumn2;
|
||||
ModelRenderer Collumn3;
|
||||
ModelRenderer Collumn4;
|
||||
ModelRenderer CrossCollumn1;
|
||||
ModelRenderer CrossCollumn2;
|
||||
ModelRenderer CrossCollumn3;
|
||||
ModelRenderer CrossCollumn4;
|
||||
ModelRenderer CrossCollumn5;
|
||||
ModelRenderer CrossCollumn6;
|
||||
ModelRenderer CrossCollumn7;
|
||||
ModelRenderer CrossCollumn8;
|
||||
ModelRenderer HolderLeft;
|
||||
ModelRenderer FrontCoil;
|
||||
ModelRenderer RightCoil;
|
||||
ModelRenderer BackCoil;
|
||||
ModelRenderer LeftCoil;
|
||||
ModelRenderer LFSCoil;
|
||||
ModelRenderer RFSCoil;
|
||||
ModelRenderer RBSCoil;
|
||||
ModelRenderer LBSCoil;
|
||||
|
||||
public ModelTeslaTop()
|
||||
{
|
||||
textureWidth = 128;
|
||||
textureHeight = 128;
|
||||
|
||||
Base = new ModelRenderer(this, 0, 0);
|
||||
Base.addBox(0F, 0F, 0F, 4, 4, 4);
|
||||
Base.setRotationPoint(-2F, 20F, -2F);
|
||||
Base.setTextureSize(128, 128);
|
||||
Base.mirror = true;
|
||||
setRotation(Base, 0F, 0F, 0F);
|
||||
Collumn1 = new ModelRenderer(this, 0, 9);
|
||||
Collumn1.addBox(0F, 0F, 0F, 1, 6, 1);
|
||||
Collumn1.setRotationPoint(1F, 14F, 1F);
|
||||
Collumn1.setTextureSize(128, 128);
|
||||
Collumn1.mirror = true;
|
||||
setRotation(Collumn1, 0F, 0F, 0F);
|
||||
Collumn2 = new ModelRenderer(this, 0, 9);
|
||||
Collumn2.addBox(0F, 0F, 0F, 1, 6, 1);
|
||||
Collumn2.setRotationPoint(1F, 14F, -2F);
|
||||
Collumn2.setTextureSize(128, 128);
|
||||
Collumn2.mirror = true;
|
||||
setRotation(Collumn2, 0F, 0F, 0F);
|
||||
Collumn3 = new ModelRenderer(this, 0, 9);
|
||||
Collumn3.addBox(0F, 0F, 0F, 1, 6, 1);
|
||||
Collumn3.setRotationPoint(-2F, 14F, -2F);
|
||||
Collumn3.setTextureSize(128, 128);
|
||||
Collumn3.mirror = true;
|
||||
setRotation(Collumn3, 0F, 0F, 0F);
|
||||
Collumn4 = new ModelRenderer(this, 0, 9);
|
||||
Collumn4.addBox(0F, 0F, 0F, 1, 6, 1);
|
||||
Collumn4.setRotationPoint(-2F, 14F, 1F);
|
||||
Collumn4.setTextureSize(128, 128);
|
||||
Collumn4.mirror = true;
|
||||
setRotation(Collumn4, 0F, 0F, 0F);
|
||||
CrossCollumn1 = new ModelRenderer(this, 17, 0);
|
||||
CrossCollumn1.addBox(0F, 0F, 0F, 1, 1, 2);
|
||||
CrossCollumn1.setRotationPoint(-2F, 16.5F, -1F);
|
||||
CrossCollumn1.setTextureSize(128, 128);
|
||||
CrossCollumn1.mirror = true;
|
||||
setRotation(CrossCollumn1, 0F, 0F, 0F);
|
||||
CrossCollumn2 = new ModelRenderer(this, 17, 0);
|
||||
CrossCollumn2.addBox(0F, 0F, 0F, 2, 1, 1);
|
||||
CrossCollumn2.setRotationPoint(-1F, 15.5F, -2F);
|
||||
CrossCollumn2.setTextureSize(128, 128);
|
||||
CrossCollumn2.mirror = true;
|
||||
setRotation(CrossCollumn2, 0F, 0F, 0F);
|
||||
CrossCollumn3 = new ModelRenderer(this, 17, 0);
|
||||
CrossCollumn3.addBox(0F, 0F, 0F, 1, 1, 2);
|
||||
CrossCollumn3.setRotationPoint(-2F, 14.5F, -1F);
|
||||
CrossCollumn3.setTextureSize(128, 128);
|
||||
CrossCollumn3.mirror = true;
|
||||
setRotation(CrossCollumn3, 0F, 0F, 0F);
|
||||
CrossCollumn4 = new ModelRenderer(this, 17, 0);
|
||||
CrossCollumn4.addBox(0F, 0F, 0F, 1, 1, 2);
|
||||
CrossCollumn4.setRotationPoint(1F, 14.5F, -1F);
|
||||
CrossCollumn4.setTextureSize(128, 128);
|
||||
CrossCollumn4.mirror = true;
|
||||
setRotation(CrossCollumn4, 0F, 0F, 0F);
|
||||
CrossCollumn5 = new ModelRenderer(this, 17, 0);
|
||||
CrossCollumn5.addBox(0F, 0F, 0F, 1, 1, 2);
|
||||
CrossCollumn5.setRotationPoint(1F, 16.5F, -1F);
|
||||
CrossCollumn5.setTextureSize(128, 128);
|
||||
CrossCollumn5.mirror = true;
|
||||
setRotation(CrossCollumn5, 0F, 0F, 0F);
|
||||
CrossCollumn6 = new ModelRenderer(this, 17, 0);
|
||||
CrossCollumn6.addBox(0F, 0F, 0F, 2, 1, 1);
|
||||
CrossCollumn6.setRotationPoint(-1F, 15.5F, 1F);
|
||||
CrossCollumn6.setTextureSize(128, 128);
|
||||
CrossCollumn6.mirror = true;
|
||||
setRotation(CrossCollumn6, 0F, 0F, 0F);
|
||||
CrossCollumn7 = new ModelRenderer(this, 17, 0);
|
||||
CrossCollumn7.addBox(0F, 0F, 0F, 2, 1, 1);
|
||||
CrossCollumn7.setRotationPoint(-1F, 17.5F, -2F);
|
||||
CrossCollumn7.setTextureSize(128, 128);
|
||||
CrossCollumn7.mirror = true;
|
||||
setRotation(CrossCollumn7, 0F, 0F, 0F);
|
||||
CrossCollumn8 = new ModelRenderer(this, 17, 0);
|
||||
CrossCollumn8.addBox(0F, 0F, 0F, 2, 1, 1);
|
||||
CrossCollumn8.setRotationPoint(-1F, 17.5F, 1F);
|
||||
CrossCollumn8.setTextureSize(128, 128);
|
||||
CrossCollumn8.mirror = true;
|
||||
setRotation(CrossCollumn8, 0F, 0F, 0F);
|
||||
HolderLeft = new ModelRenderer(this, 5, 9);
|
||||
HolderLeft.addBox(0F, 0F, 0F, 2, 5, 2);
|
||||
HolderLeft.setRotationPoint(-1F, 10.5F, -1F);
|
||||
HolderLeft.setTextureSize(128, 128);
|
||||
HolderLeft.mirror = true;
|
||||
setRotation(HolderLeft, 0F, 0F, 0F);
|
||||
FrontCoil = new ModelRenderer(this, 26, 0);
|
||||
FrontCoil.addBox(0F, 0F, 0F, 6, 2, 1);
|
||||
FrontCoil.setRotationPoint(-3F, 11F, -4F);
|
||||
FrontCoil.setTextureSize(128, 128);
|
||||
FrontCoil.mirror = true;
|
||||
setRotation(FrontCoil, 0F, 0F, 0F);
|
||||
RightCoil = new ModelRenderer(this, 26, 4);
|
||||
RightCoil.addBox(0F, 0F, 0F, 1, 2, 6);
|
||||
RightCoil.setRotationPoint(3F, 11.02222F, -3F);
|
||||
RightCoil.setTextureSize(128, 128);
|
||||
RightCoil.mirror = true;
|
||||
setRotation(RightCoil, 0F, 0F, 0F);
|
||||
BackCoil = new ModelRenderer(this, 26, 0);
|
||||
BackCoil.addBox(0F, 0F, 0F, 6, 2, 1);
|
||||
BackCoil.setRotationPoint(-3F, 11F, 3F);
|
||||
BackCoil.setTextureSize(128, 128);
|
||||
BackCoil.mirror = true;
|
||||
setRotation(BackCoil, 0F, 0F, 0F);
|
||||
LeftCoil = new ModelRenderer(this, 26, 4);
|
||||
LeftCoil.addBox(0F, 0F, 0F, 1, 2, 6);
|
||||
LeftCoil.setRotationPoint(-4F, 11.02222F, -3F);
|
||||
LeftCoil.setTextureSize(128, 128);
|
||||
LeftCoil.mirror = true;
|
||||
setRotation(LeftCoil, 0F, 0F, 0F);
|
||||
LFSCoil = new ModelRenderer(this, 0, 20);
|
||||
LFSCoil.addBox(0F, 0F, 0F, 1, 2, 1);
|
||||
LFSCoil.setRotationPoint(-3F, 11F, -3F);
|
||||
LFSCoil.setTextureSize(128, 128);
|
||||
LFSCoil.mirror = true;
|
||||
setRotation(LFSCoil, 0F, 0F, 0F);
|
||||
RFSCoil = new ModelRenderer(this, 0, 20);
|
||||
RFSCoil.addBox(0F, 0F, 0F, 1, 2, 1);
|
||||
RFSCoil.setRotationPoint(2F, 11F, -3F);
|
||||
RFSCoil.setTextureSize(128, 128);
|
||||
RFSCoil.mirror = true;
|
||||
setRotation(RFSCoil, 0F, 0F, 0F);
|
||||
RBSCoil = new ModelRenderer(this, 0, 20);
|
||||
RBSCoil.addBox(0F, 0F, 0F, 1, 2, 1);
|
||||
RBSCoil.setRotationPoint(2F, 11F, 2F);
|
||||
RBSCoil.setTextureSize(128, 128);
|
||||
RBSCoil.mirror = true;
|
||||
setRotation(RBSCoil, 0F, 0F, 0F);
|
||||
LBSCoil = new ModelRenderer(this, 0, 20);
|
||||
LBSCoil.addBox(0F, 0F, 0F, 1, 2, 1);
|
||||
LBSCoil.setRotationPoint(-3F, 11F, 2F);
|
||||
LBSCoil.setTextureSize(128, 128);
|
||||
LBSCoil.mirror = true;
|
||||
setRotation(LBSCoil, 0F, 0F, 0F);
|
||||
}
|
||||
|
||||
public void render(float f5)
|
||||
{
|
||||
Base.render(f5);
|
||||
Collumn1.render(f5);
|
||||
Collumn2.render(f5);
|
||||
Collumn3.render(f5);
|
||||
Collumn4.render(f5);
|
||||
CrossCollumn1.render(f5);
|
||||
CrossCollumn2.render(f5);
|
||||
CrossCollumn3.render(f5);
|
||||
CrossCollumn4.render(f5);
|
||||
CrossCollumn5.render(f5);
|
||||
CrossCollumn6.render(f5);
|
||||
CrossCollumn7.render(f5);
|
||||
CrossCollumn8.render(f5);
|
||||
HolderLeft.render(f5);
|
||||
FrontCoil.render(f5);
|
||||
RightCoil.render(f5);
|
||||
BackCoil.render(f5);
|
||||
LeftCoil.render(f5);
|
||||
LFSCoil.render(f5);
|
||||
RFSCoil.render(f5);
|
||||
RBSCoil.render(f5);
|
||||
LBSCoil.render(f5);
|
||||
}
|
||||
|
||||
private void setRotation(ModelRenderer model, float x, float y, float z)
|
||||
{
|
||||
model.rotateAngleX = x;
|
||||
model.rotateAngleY = y;
|
||||
model.rotateAngleZ = z;
|
||||
}
|
||||
|
||||
}
|
|
@ -12,6 +12,7 @@ import org.lwjgl.opengl.GL11;
|
|||
import resonantinduction.ResonantInduction;
|
||||
import resonantinduction.model.ModelTeslaBottom;
|
||||
import resonantinduction.model.ModelTeslaMiddle;
|
||||
import resonantinduction.model.ModelTeslaTop;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
|
@ -23,10 +24,11 @@ import cpw.mods.fml.relauncher.SideOnly;
|
|||
public class RenderTesla extends TileEntitySpecialRenderer
|
||||
{
|
||||
public static final ResourceLocation TEXTURE_BOTTOM = new ResourceLocation(ResonantInduction.DOMAIN, ResonantInduction.MODEL_TEXTURE_DIRECTORY + "tesla_bottom.png");
|
||||
public static final ResourceLocation TEXTURE_MIDDILE = new ResourceLocation(ResonantInduction.DOMAIN, ResonantInduction.MODEL_TEXTURE_DIRECTORY + "tesla_middile.png");
|
||||
public static final ResourceLocation TEXTURE_TOP = new ResourceLocation(ResonantInduction.DOMAIN, ResonantInduction.MODEL_TEXTURE_DIRECTORY + "tesla_bottom.png");
|
||||
public static final ResourceLocation TEXTURE_MIDDLE = new ResourceLocation(ResonantInduction.DOMAIN, ResonantInduction.MODEL_TEXTURE_DIRECTORY + "tesla_middle.png");
|
||||
public static final ResourceLocation TEXTURE_TOP = new ResourceLocation(ResonantInduction.DOMAIN, ResonantInduction.MODEL_TEXTURE_DIRECTORY + "tesla_top.png");
|
||||
public static final ModelTeslaBottom MODEL_BOTTOM = new ModelTeslaBottom();
|
||||
public static final ModelTeslaMiddle MODEL_MIDDILE = new ModelTeslaMiddle();
|
||||
public static final ModelTeslaMiddle MODEL_MIDDLE = new ModelTeslaMiddle();
|
||||
public static final ModelTeslaTop MODEL_TOP = new ModelTeslaTop();
|
||||
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntity t, double x, double y, double z, float f)
|
||||
|
@ -34,8 +36,23 @@ public class RenderTesla extends TileEntitySpecialRenderer
|
|||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(x + 0.5, y + 1.5, z + 0.5);
|
||||
GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
|
||||
this.func_110628_a(TEXTURE_BOTTOM);
|
||||
MODEL_BOTTOM.render(0.0625f);
|
||||
|
||||
switch (t.getBlockMetadata())
|
||||
{
|
||||
default:
|
||||
this.func_110628_a(TEXTURE_BOTTOM);
|
||||
MODEL_BOTTOM.render(0.0625f);
|
||||
break;
|
||||
case 1:
|
||||
this.func_110628_a(TEXTURE_MIDDLE);
|
||||
MODEL_MIDDLE.render(0.0625f);
|
||||
break;
|
||||
case 2:
|
||||
this.func_110628_a(TEXTURE_TOP);
|
||||
MODEL_TOP.render(0.0625f);
|
||||
break;
|
||||
}
|
||||
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
|
|
|
@ -25,6 +25,21 @@ public class BlockTesla extends BlockBase implements ITileEntityProvider
|
|||
this.func_111022_d(ResonantInduction.PREFIX + "machine");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockAdded(World world, int x, int y, int z)
|
||||
{
|
||||
super.onBlockAdded(world, x, y, z);
|
||||
TileEntity tileEntity = world.getBlockTileEntity(x, y, z);
|
||||
((TileEntityTesla) tileEntity).updatePositionStatus();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNeighborBlockChange(World world, int x, int y, int z, int id)
|
||||
{
|
||||
TileEntity tileEntity = world.getBlockTileEntity(x, y, z);
|
||||
((TileEntityTesla) tileEntity).updatePositionStatus();
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world)
|
||||
{
|
||||
|
|
|
@ -114,6 +114,25 @@ public class TileEntityTesla extends TileEntityBase implements ITesla
|
|||
return 8;
|
||||
}
|
||||
|
||||
public void updatePositionStatus()
|
||||
{
|
||||
boolean isTop = new Vector3(this).translate(new Vector3(0, 1, 0)).getTileEntity(this.worldObj) instanceof TileEntityTesla;
|
||||
boolean isBottom = new Vector3(this).translate(new Vector3(0, -1, 0)).getTileEntity(this.worldObj) instanceof TileEntityTesla;
|
||||
|
||||
if (isTop && isBottom)
|
||||
{
|
||||
this.worldObj.setBlockMetadataWithNotify(this.xCoord, this.yCoord, this.zCoord, 1, 3);
|
||||
}
|
||||
else if (isBottom)
|
||||
{
|
||||
this.worldObj.setBlockMetadataWithNotify(this.xCoord, this.yCoord, this.zCoord, 2, 3);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.worldObj.setBlockMetadataWithNotify(this.xCoord, this.yCoord, this.zCoord, 0, 3);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void invalidate()
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue