Added Laser Relay Functionality:

-Connections & Networks
-Power Transfer

Yet to do:
-NBT Saving
-Graphics
This commit is contained in:
Ellpeck 2015-10-20 00:22:36 +02:00
parent 1ae2515050
commit ab566297fa
10 changed files with 357 additions and 413 deletions

View file

@ -62,7 +62,7 @@ public class BlockLaserRelay extends BlockContainerBase implements IActAddItemOr
@Override
@SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister iconReg){
this.blockIcon = Blocks.beacon.getIcon(0, 0);
this.blockIcon = Blocks.coal_block.getIcon(0, 0);
}
@Override

View file

@ -11,406 +11,157 @@
package ellpeck.actuallyadditions.blocks.render;
import net.minecraft.client.model.ModelRenderer;
import org.lwjgl.opengl.GL11;
public class ModelLaserRelay extends ModelBaseAA{
private ModelRenderer[] shapes = new ModelRenderer[64];
ModelRenderer bottom;
ModelRenderer laserPillar;
ModelRenderer laserBase;
ModelRenderer covering1;
ModelRenderer covering2;
ModelRenderer covering3;
ModelRenderer covering4;
ModelRenderer covering5;
ModelRenderer covering6;
ModelRenderer covering7;
ModelRenderer covering8;
ModelRenderer top;
ModelRenderer covering9;
ModelRenderer covering10;
ModelRenderer covering11;
ModelRenderer covering12;
ModelRenderer energyBall;
public ModelLaserRelay(){
textureWidth = 128;
textureHeight = 128;
textureWidth = 64;
textureHeight = 64;
this.shapes[0] = new ModelRenderer(this, 0, 0);
this.shapes[0].addBox(0F, 0F, 0F, 10, 1, 10);
this.shapes[0].setRotationPoint(-5F, 23F, -5F);
this.shapes[0].setTextureSize(128, 128);
this.shapes[0].mirror = true;
setRotation(this.shapes[0], 0F, 0F, 0F);
this.shapes[1] = new ModelRenderer(this, 0, 12);
this.shapes[1].addBox(0F, 0F, 0F, 1, 3, 10);
this.shapes[1].setRotationPoint(-6F, 20F, -5F);
this.shapes[1].setTextureSize(128, 128);
this.shapes[1].mirror = true;
setRotation(this.shapes[1], 0F, 0F, 0F);
this.shapes[2] = new ModelRenderer(this, 0, 12);
this.shapes[2].addBox(0F, 0F, 0F, 1, 3, 10);
this.shapes[2].setRotationPoint(5F, 20F, -5F);
this.shapes[2].setTextureSize(128, 128);
this.shapes[2].mirror = true;
setRotation(this.shapes[2], 0F, 0F, 0F);
this.shapes[3] = new ModelRenderer(this, 0, 12);
this.shapes[3].addBox(0F, 0F, 0F, 1, 3, 10);
this.shapes[3].setRotationPoint(-5F, 20F, -5F);
this.shapes[3].setTextureSize(128, 128);
this.shapes[3].mirror = true;
setRotation(this.shapes[3], 0F, 1.579523F, 0F);
this.shapes[4] = new ModelRenderer(this, 0, 12);
this.shapes[4].addBox(0F, 0F, 0F, 1, 3, 10);
this.shapes[4].setRotationPoint(-5F, 20F, 6F);
this.shapes[4].setTextureSize(128, 128);
this.shapes[4].mirror = true;
setRotation(this.shapes[4], 0F, 1.579523F, 0F);
this.shapes[5] = new ModelRenderer(this, 23, 12);
this.shapes[5].addBox(0F, 0F, 0F, 1, 1, 8);
this.shapes[5].setRotationPoint(-7F, 14F, -4F);
this.shapes[5].setTextureSize(128, 128);
this.shapes[5].mirror = true;
setRotation(this.shapes[5], 0F, 0F, 0F);
this.shapes[6] = new ModelRenderer(this, 23, 12);
this.shapes[6].addBox(0F, 0F, 0F, 1, 1, 8);
this.shapes[6].setRotationPoint(6F, 14F, -4F);
this.shapes[6].setTextureSize(128, 128);
this.shapes[6].mirror = true;
setRotation(this.shapes[6], 0F, 0F, 0F);
this.shapes[7] = new ModelRenderer(this, 23, 12);
this.shapes[7].addBox(0F, 0F, 0F, 1, 1, 8);
this.shapes[7].setRotationPoint(-4F, 14F, -6F);
this.shapes[7].setTextureSize(128, 128);
this.shapes[7].mirror = true;
setRotation(this.shapes[7], 0F, 1.579523F, 0F);
this.shapes[8] = new ModelRenderer(this, 23, 12);
this.shapes[8].addBox(0F, 0F, 0F, 1, 1, 8);
this.shapes[8].setRotationPoint(-4F, 14F, 7F);
this.shapes[8].setTextureSize(128, 128);
this.shapes[8].mirror = true;
setRotation(this.shapes[8], 0F, 1.579523F, 0F);
this.shapes[9] = new ModelRenderer(this, 0, 26);
this.shapes[9].addBox(0F, 0F, 0F, 12, 1, 2);
this.shapes[9].setRotationPoint(-6F, 18F, -1F);
this.shapes[9].setTextureSize(128, 128);
this.shapes[9].mirror = true;
setRotation(this.shapes[9], 0F, 0F, 0F);
this.shapes[10] = new ModelRenderer(this, 41, 0);
this.shapes[10].addBox(0F, 0F, 0F, 2, 1, 5);
this.shapes[10].setRotationPoint(-1F, 18F, 1F);
this.shapes[10].setTextureSize(128, 128);
this.shapes[10].mirror = true;
setRotation(this.shapes[10], 0F, 0F, 0F);
this.shapes[11] = new ModelRenderer(this, 41, 0);
this.shapes[11].addBox(0F, 0F, 0F, 2, 1, 5);
this.shapes[11].setRotationPoint(-1F, 18F, -6F);
this.shapes[11].setTextureSize(128, 128);
this.shapes[11].mirror = true;
setRotation(this.shapes[11], 0F, 0F, 0F);
this.shapes[12] = new ModelRenderer(this, 41, 7);
this.shapes[12].addBox(0F, 0F, 0F, 1, 2, 4);
this.shapes[12].setRotationPoint(-2F, 16F, 2F);
this.shapes[12].setTextureSize(128, 128);
this.shapes[12].mirror = true;
setRotation(this.shapes[12], 0F, 0F, 0F);
this.shapes[13] = new ModelRenderer(this, 41, 7);
this.shapes[13].addBox(0F, 0F, 0F, 1, 2, 4);
this.shapes[13].setRotationPoint(1F, 16F, 2F);
this.shapes[13].setTextureSize(128, 128);
this.shapes[13].mirror = true;
setRotation(this.shapes[13], 0F, 0F, 0F);
this.shapes[14] = new ModelRenderer(this, 41, 7);
this.shapes[14].addBox(0F, 0F, 0F, 1, 2, 4);
this.shapes[14].setRotationPoint(-2F, 16F, -6F);
this.shapes[14].setTextureSize(128, 128);
this.shapes[14].mirror = true;
setRotation(this.shapes[14], 0F, 0F, 0F);
this.shapes[15] = new ModelRenderer(this, 41, 7);
this.shapes[15].addBox(0F, 0F, 0F, 1, 2, 4);
this.shapes[15].setRotationPoint(1F, 16F, -6F);
this.shapes[15].setTextureSize(128, 128);
this.shapes[15].mirror = true;
setRotation(this.shapes[15], 0F, 0F, 0F);
this.shapes[16] = new ModelRenderer(this, 41, 7);
this.shapes[16].addBox(0F, 0F, 0F, 1, 2, 4);
this.shapes[16].setRotationPoint(-6F, 16F, 2F);
this.shapes[16].setTextureSize(128, 128);
this.shapes[16].mirror = true;
setRotation(this.shapes[16], 0F, 1.579523F, 0F);
this.shapes[17] = new ModelRenderer(this, 41, 7);
this.shapes[17].addBox(0F, 0F, 0F, 1, 2, 4);
this.shapes[17].setRotationPoint(-6F, 16F, -1F);
this.shapes[17].setTextureSize(128, 128);
this.shapes[17].mirror = true;
setRotation(this.shapes[17], 0F, 1.579523F, 0F);
this.shapes[18] = new ModelRenderer(this, 41, 7);
this.shapes[18].addBox(0F, 0F, 0F, 1, 2, 4);
this.shapes[18].setRotationPoint(2F, 16F, 2F);
this.shapes[18].setTextureSize(128, 128);
this.shapes[18].mirror = true;
setRotation(this.shapes[18], 0F, 1.579523F, 0F);
this.shapes[19] = new ModelRenderer(this, 41, 7);
this.shapes[19].addBox(0F, 0F, 0F, 1, 2, 4);
this.shapes[19].setRotationPoint(2F, 16F, -1F);
this.shapes[19].setTextureSize(128, 128);
this.shapes[19].mirror = true;
setRotation(this.shapes[19], 0F, 1.579523F, 0F);
this.shapes[20] = new ModelRenderer(this, 0, 26);
this.shapes[20].addBox(0F, 0F, 0F, 12, 1, 2);
this.shapes[20].setRotationPoint(-6F, 15F, -1F);
this.shapes[20].setTextureSize(128, 128);
this.shapes[20].mirror = true;
setRotation(this.shapes[20], 0F, 0F, 0F);
this.shapes[21] = new ModelRenderer(this, 41, 0);
this.shapes[21].addBox(0F, 0F, 0F, 2, 1, 5);
this.shapes[21].setRotationPoint(-1F, 15F, 1F);
this.shapes[21].setTextureSize(128, 128);
this.shapes[21].mirror = true;
setRotation(this.shapes[21], 0F, 0F, 0F);
this.shapes[22] = new ModelRenderer(this, 41, 0);
this.shapes[22].addBox(0F, 0F, 0F, 2, 1, 5);
this.shapes[22].setRotationPoint(-1F, 15F, -6F);
this.shapes[22].setTextureSize(128, 128);
this.shapes[22].mirror = true;
setRotation(this.shapes[22], 0F, 0F, 0F);
this.shapes[23] = new ModelRenderer(this, 23, 23);
this.shapes[23].addBox(0F, 0F, 0F, 3, 1, 1);
this.shapes[23].setRotationPoint(-4F, 18F, -7F);
this.shapes[23].setTextureSize(128, 128);
this.shapes[23].mirror = true;
setRotation(this.shapes[23], 0F, 0F, 0F);
this.shapes[24] = new ModelRenderer(this, 23, 23);
this.shapes[24].addBox(0F, 0F, 0F, 3, 1, 1);
this.shapes[24].setRotationPoint(1F, 18F, -7F);
this.shapes[24].setTextureSize(128, 128);
this.shapes[24].mirror = true;
setRotation(this.shapes[24], 0F, 0F, 0F);
this.shapes[25] = new ModelRenderer(this, 23, 23);
this.shapes[25].addBox(0F, 0F, 0F, 3, 1, 1);
this.shapes[25].setRotationPoint(-4F, 18F, 6F);
this.shapes[25].setTextureSize(128, 128);
this.shapes[25].mirror = true;
setRotation(this.shapes[25], 0F, 0F, 0F);
this.shapes[26] = new ModelRenderer(this, 23, 23);
this.shapes[26].addBox(0F, 0F, 0F, 3, 1, 1);
this.shapes[26].setRotationPoint(1F, 18F, 6F);
this.shapes[26].setTextureSize(128, 128);
this.shapes[26].mirror = true;
setRotation(this.shapes[26], 0F, 0F, 0F);
this.shapes[27] = new ModelRenderer(this, 23, 23);
this.shapes[27].addBox(0F, 0F, 0F, 3, 1, 1);
this.shapes[27].setRotationPoint(-7F, 18F, 4F);
this.shapes[27].setTextureSize(128, 128);
this.shapes[27].mirror = true;
setRotation(this.shapes[27], 0F, 1.579523F, 0F);
this.shapes[28] = new ModelRenderer(this, 23, 23);
this.shapes[28].addBox(0F, 0F, 0F, 3, 1, 1);
this.shapes[28].setRotationPoint(-7F, 18F, -1F);
this.shapes[28].setTextureSize(128, 128);
this.shapes[28].mirror = true;
setRotation(this.shapes[28], 0F, 1.579523F, 0F);
this.shapes[29] = new ModelRenderer(this, 23, 23);
this.shapes[29].addBox(0F, 0F, 0F, 3, 1, 1);
this.shapes[29].setRotationPoint(6F, 18F, 4F);
this.shapes[29].setTextureSize(128, 128);
this.shapes[29].mirror = true;
setRotation(this.shapes[29], 0F, 1.579523F, 0F);
this.shapes[30] = new ModelRenderer(this, 23, 23);
this.shapes[30].addBox(0F, 0F, 0F, 3, 1, 1);
this.shapes[30].setRotationPoint(6F, 18F, -1F);
this.shapes[30].setTextureSize(128, 128);
this.shapes[30].mirror = true;
setRotation(this.shapes[30], 0F, 1.579523F, 0F);
this.shapes[31] = new ModelRenderer(this, 42, 14);
this.shapes[31].addBox(0F, 0F, 0F, 1, 2, 2);
this.shapes[31].setRotationPoint(-7F, 16F, -4F);
this.shapes[31].setTextureSize(128, 128);
this.shapes[31].mirror = true;
setRotation(this.shapes[31], 0F, 0F, 0F);
this.shapes[32] = new ModelRenderer(this, 42, 14);
this.shapes[32].addBox(0F, 0F, 0F, 1, 2, 2);
this.shapes[32].setRotationPoint(-7F, 16F, 2F);
this.shapes[32].setTextureSize(128, 128);
this.shapes[32].mirror = true;
setRotation(this.shapes[32], 0F, 0F, 0F);
this.shapes[33] = new ModelRenderer(this, 42, 14);
this.shapes[33].addBox(0F, 0F, 0F, 1, 2, 2);
this.shapes[33].setRotationPoint(6F, 16F, 2F);
this.shapes[33].setTextureSize(128, 128);
this.shapes[33].mirror = true;
setRotation(this.shapes[33], 0F, 0F, 0F);
this.shapes[34] = new ModelRenderer(this, 42, 14);
this.shapes[34].addBox(0F, 0F, 0F, 1, 2, 2);
this.shapes[34].setRotationPoint(6F, 16F, -4F);
this.shapes[34].setTextureSize(128, 128);
this.shapes[34].mirror = true;
setRotation(this.shapes[34], 0F, 0F, 0F);
this.shapes[35] = new ModelRenderer(this, 42, 14);
this.shapes[35].addBox(0F, 0F, 0F, 1, 2, 2);
this.shapes[35].setRotationPoint(2F, 16F, -6F);
this.shapes[35].setTextureSize(128, 128);
this.shapes[35].mirror = true;
setRotation(this.shapes[35], 0F, 1.579523F, 0F);
this.shapes[36] = new ModelRenderer(this, 42, 14);
this.shapes[36].addBox(0F, 0F, 0F, 1, 2, 2);
this.shapes[36].setRotationPoint(-4F, 16F, -6F);
this.shapes[36].setTextureSize(128, 128);
this.shapes[36].mirror = true;
setRotation(this.shapes[36], 0F, 1.579523F, 0F);
this.shapes[37] = new ModelRenderer(this, 42, 14);
this.shapes[37].addBox(0F, 0F, 0F, 1, 2, 2);
this.shapes[37].setRotationPoint(2F, 16F, 7F);
this.shapes[37].setTextureSize(128, 128);
this.shapes[37].mirror = true;
setRotation(this.shapes[37], 0F, 1.579523F, 0F);
this.shapes[38] = new ModelRenderer(this, 42, 14);
this.shapes[38].addBox(0F, 0F, 0F, 1, 2, 2);
this.shapes[38].setRotationPoint(-4F, 16F, 7F);
this.shapes[38].setTextureSize(128, 128);
this.shapes[38].mirror = true;
setRotation(this.shapes[38], 0F, 1.579523F, 0F);
this.shapes[39] = new ModelRenderer(this, 23, 23);
this.shapes[39].addBox(0F, 0F, 0F, 3, 1, 1);
this.shapes[39].setRotationPoint(6F, 15F, 4F);
this.shapes[39].setTextureSize(128, 128);
this.shapes[39].mirror = true;
setRotation(this.shapes[39], 0F, 1.579523F, 0F);
this.shapes[40] = new ModelRenderer(this, 23, 23);
this.shapes[40].addBox(0F, 0F, 0F, 3, 1, 1);
this.shapes[40].setRotationPoint(6F, 15F, -1F);
this.shapes[40].setTextureSize(128, 128);
this.shapes[40].mirror = true;
setRotation(this.shapes[40], 0F, 1.579523F, 0F);
this.shapes[41] = new ModelRenderer(this, 23, 23);
this.shapes[41].addBox(0F, 0F, 0F, 3, 1, 1);
this.shapes[41].setRotationPoint(1F, 15F, -7F);
this.shapes[41].setTextureSize(128, 128);
this.shapes[41].mirror = true;
setRotation(this.shapes[41], 0F, 0F, 0F);
this.shapes[42] = new ModelRenderer(this, 23, 23);
this.shapes[42].addBox(0F, 0F, 0F, 3, 1, 1);
this.shapes[42].setRotationPoint(-4F, 15F, -7F);
this.shapes[42].setTextureSize(128, 128);
this.shapes[42].mirror = true;
setRotation(this.shapes[42], 0F, 0F, 0F);
this.shapes[43] = new ModelRenderer(this, 23, 23);
this.shapes[43].addBox(0F, 0F, 0F, 3, 1, 1);
this.shapes[43].setRotationPoint(-7F, 15F, -1F);
this.shapes[43].setTextureSize(128, 128);
this.shapes[43].mirror = true;
setRotation(this.shapes[43], 0F, 1.579523F, 0F);
this.shapes[44] = new ModelRenderer(this, 23, 23);
this.shapes[44].addBox(0F, 0F, 0F, 3, 1, 1);
this.shapes[44].setRotationPoint(-7F, 15F, 4F);
this.shapes[44].setTextureSize(128, 128);
this.shapes[44].mirror = true;
setRotation(this.shapes[44], 0F, 1.579523F, 0F);
this.shapes[45] = new ModelRenderer(this, 23, 23);
this.shapes[45].addBox(0F, 0F, 0F, 3, 1, 1);
this.shapes[45].setRotationPoint(-4F, 15F, 6F);
this.shapes[45].setTextureSize(128, 128);
this.shapes[45].mirror = true;
setRotation(this.shapes[45], 0F, 0F, 0F);
this.shapes[46] = new ModelRenderer(this, 23, 23);
this.shapes[46].addBox(0F, 0F, 0F, 3, 1, 1);
this.shapes[46].setRotationPoint(1F, 15F, 6F);
this.shapes[46].setTextureSize(128, 128);
this.shapes[46].mirror = true;
setRotation(this.shapes[46], 0F, 0F, 0F);
this.shapes[47] = new ModelRenderer(this, 0, 12);
this.shapes[47].addBox(0F, 0F, 0F, 1, 3, 10);
this.shapes[47].setRotationPoint(-5F, 11F, -5F);
this.shapes[47].setTextureSize(128, 128);
this.shapes[47].mirror = true;
setRotation(this.shapes[47], 0F, 1.579523F, 0F);
this.shapes[48] = new ModelRenderer(this, 0, 12);
this.shapes[48].addBox(0F, 0F, 0F, 1, 3, 10);
this.shapes[48].setRotationPoint(-6F, 11F, -5F);
this.shapes[48].setTextureSize(128, 128);
this.shapes[48].mirror = true;
setRotation(this.shapes[48], 0F, 0F, 0F);
this.shapes[49] = new ModelRenderer(this, 0, 12);
this.shapes[49].addBox(0F, 0F, 0F, 1, 3, 10);
this.shapes[49].setRotationPoint(-5F, 11F, 6F);
this.shapes[49].setTextureSize(128, 128);
this.shapes[49].mirror = true;
setRotation(this.shapes[49], 0F, 1.579523F, 0F);
this.shapes[50] = new ModelRenderer(this, 0, 12);
this.shapes[50].addBox(0F, 0F, 0F, 1, 3, 10);
this.shapes[50].setRotationPoint(5F, 11F, -5F);
this.shapes[50].setTextureSize(128, 128);
this.shapes[50].mirror = true;
setRotation(this.shapes[50], 0F, 0F, 0F);
this.shapes[51] = new ModelRenderer(this, 56, 0);
this.shapes[51].addBox(0F, 0F, 0F, 1, 14, 1);
this.shapes[51].setRotationPoint(-2F, 9F, -2F);
this.shapes[51].setTextureSize(128, 128);
this.shapes[51].mirror = true;
setRotation(this.shapes[51], 0F, 0F, 0F);
this.shapes[52] = new ModelRenderer(this, 23, 12);
this.shapes[52].addBox(0F, 0F, 0F, 1, 1, 8);
this.shapes[52].setRotationPoint(6F, 19F, -4F);
this.shapes[52].setTextureSize(128, 128);
this.shapes[52].mirror = true;
setRotation(this.shapes[52], 0F, 0F, 0F);
this.shapes[53] = new ModelRenderer(this, 23, 12);
this.shapes[53].addBox(0F, 0F, 0F, 1, 1, 8);
this.shapes[53].setRotationPoint(-4F, 19F, 7F);
this.shapes[53].setTextureSize(128, 128);
this.shapes[53].mirror = true;
setRotation(this.shapes[53], 0F, 1.579523F, 0F);
this.shapes[54] = new ModelRenderer(this, 23, 12);
this.shapes[54].addBox(0F, 0F, 0F, 1, 1, 8);
this.shapes[54].setRotationPoint(-7F, 19F, -4F);
this.shapes[54].setTextureSize(128, 128);
this.shapes[54].mirror = true;
setRotation(this.shapes[54], 0F, 0F, 0F);
this.shapes[55] = new ModelRenderer(this, 23, 12);
this.shapes[55].addBox(0F, 0F, 0F, 1, 1, 8);
this.shapes[55].setRotationPoint(-4F, 19F, -6F);
this.shapes[55].setTextureSize(128, 128);
this.shapes[55].mirror = true;
setRotation(this.shapes[55], 0F, 1.579523F, 0F);
this.shapes[56] = new ModelRenderer(this, 56, 0);
this.shapes[56].addBox(0F, 0F, 0F, 1, 14, 1);
this.shapes[56].setRotationPoint(1F, 9F, -2F);
this.shapes[56].setTextureSize(128, 128);
this.shapes[56].mirror = true;
setRotation(this.shapes[56], 0F, 0F, 0F);
this.shapes[57] = new ModelRenderer(this, 56, 0);
this.shapes[57].addBox(0F, 0F, 0F, 1, 14, 1);
this.shapes[57].setRotationPoint(-2F, 9F, 1F);
this.shapes[57].setTextureSize(128, 128);
this.shapes[57].mirror = true;
setRotation(this.shapes[57], 0F, 0F, 0F);
this.shapes[58] = new ModelRenderer(this, 56, 0);
this.shapes[58].addBox(0F, 0F, 0F, 1, 14, 1);
this.shapes[58].setRotationPoint(1F, 9F, 1F);
this.shapes[58].setTextureSize(128, 128);
this.shapes[58].mirror = true;
setRotation(this.shapes[58], 0F, 0F, 0F);
this.shapes[59] = new ModelRenderer(this, 29, 26);
this.shapes[59].addBox(0F, 0F, 0F, 8, 2, 1);
this.shapes[59].setRotationPoint(-4F, 9F, -5F);
this.shapes[59].setTextureSize(128, 128);
this.shapes[59].mirror = true;
setRotation(this.shapes[59], 0F, 0F, 0F);
this.shapes[60] = new ModelRenderer(this, 29, 26);
this.shapes[60].addBox(0F, 0F, 0F, 8, 2, 1);
this.shapes[60].setRotationPoint(-4F, 9F, 4F);
this.shapes[60].setTextureSize(128, 128);
this.shapes[60].mirror = true;
setRotation(this.shapes[60], 0F, 0F, 0F);
this.shapes[61] = new ModelRenderer(this, 29, 26);
this.shapes[61].addBox(0F, 0F, 0F, 8, 2, 1);
this.shapes[61].setRotationPoint(-5F, 9F, 4F);
this.shapes[61].setTextureSize(128, 128);
this.shapes[61].mirror = true;
setRotation(this.shapes[61], 0F, 1.579523F, 0F);
this.shapes[62] = new ModelRenderer(this, 29, 26);
this.shapes[62].addBox(0F, 0F, 0F, 8, 2, 1);
this.shapes[62].setRotationPoint(4F, 9F, 4F);
this.shapes[62].setTextureSize(128, 128);
this.shapes[62].mirror = true;
setRotation(this.shapes[62], 0F, 1.579523F, 0F);
this.shapes[63] = new ModelRenderer(this, 0, 31);
this.shapes[63].addBox(0F, 0F, 0F, 8, 1, 8);
this.shapes[63].setRotationPoint(-4F, 8F, -4F);
this.shapes[63].setTextureSize(128, 128);
this.shapes[63].mirror = true;
setRotation(this.shapes[63], 0F, 0F, 0F);
bottom = new ModelRenderer(this, 0, 0);
bottom.addBox(0F, 0F, 0F, 8, 1, 8);
bottom.setRotationPoint(-4F, 23F, -4F);
bottom.setTextureSize(64, 64);
bottom.mirror = true;
setRotation(bottom, 0F, 0F, 0F);
laserPillar = new ModelRenderer(this, 54, 0);
laserPillar.addBox(0F, 0F, 0F, 2, 11, 2);
laserPillar.setRotationPoint(-1F, 10F, -1F);
laserPillar.setTextureSize(64, 64);
laserPillar.mirror = true;
setRotation(laserPillar, 0F, 0F, 0F);
laserBase = new ModelRenderer(this, 33, 0);
laserBase.addBox(0F, 0F, 0F, 5, 2, 5);
laserBase.setRotationPoint(-2.5F, 21F, -2.5F);
laserBase.setTextureSize(64, 64);
laserBase.mirror = true;
setRotation(laserBase, 0F, 0F, 0F);
covering1 = new ModelRenderer(this, 0, 10);
covering1.addBox(0F, 0F, 0F, 8, 3, 1);
covering1.setRotationPoint(-4F, 20F, -5F);
covering1.setTextureSize(64, 64);
covering1.mirror = true;
setRotation(covering1, 0F, 0F, 0F);
covering2 = new ModelRenderer(this, 0, 10);
covering2.addBox(0F, 0F, 0F, 8, 3, 1);
covering2.setRotationPoint(-4F, 20F, 4F);
covering2.setTextureSize(64, 64);
covering2.mirror = true;
setRotation(covering2, 0F, 0F, 0F);
covering3 = new ModelRenderer(this, 0, 10);
covering3.addBox(0F, 0F, 0F, 8, 3, 1);
covering3.setRotationPoint(-5F, 20F, 4F);
covering3.setTextureSize(64, 64);
covering3.mirror = true;
setRotation(covering3, 0F, 1.579523F, 0F);
covering4 = new ModelRenderer(this, 0, 10);
covering4.addBox(0F, 0F, 0F, 8, 3, 1);
covering4.setRotationPoint(4F, 20F, 4F);
covering4.setTextureSize(64, 64);
covering4.mirror = true;
setRotation(covering4, 0F, 1.579523F, 0F);
covering5 = new ModelRenderer(this, 0, 10);
covering5.addBox(0F, 0F, 0F, 8, 3, 1);
covering5.setRotationPoint(-4F, 10F, -5F);
covering5.setTextureSize(64, 64);
covering5.mirror = true;
setRotation(covering5, 0F, 0F, 0F);
covering6 = new ModelRenderer(this, 0, 10);
covering6.addBox(0F, 0F, 0F, 8, 3, 1);
covering6.setRotationPoint(-4F, 10F, 4F);
covering6.setTextureSize(64, 64);
covering6.mirror = true;
setRotation(covering6, 0F, 0F, 0F);
covering7 = new ModelRenderer(this, 0, 10);
covering7.addBox(0F, 0F, 0F, 8, 3, 1);
covering7.setRotationPoint(-5F, 10F, 4F);
covering7.setTextureSize(64, 64);
covering7.mirror = true;
setRotation(covering7, 0F, 1.579523F, 0F);
covering8 = new ModelRenderer(this, 0, 10);
covering8.addBox(0F, 0F, 0F, 8, 3, 1);
covering8.setRotationPoint(4F, 10F, 4F);
covering8.setTextureSize(64, 64);
covering8.mirror = true;
setRotation(covering8, 0F, 1.579523F, 0F);
top = new ModelRenderer(this, 0, 0);
top.addBox(0F, 0F, 0F, 8, 1, 8);
top.setRotationPoint(-4F, 9F, -4F);
top.setTextureSize(64, 64);
top.mirror = true;
setRotation(top, 0F, 0F, 0F);
covering9 = new ModelRenderer(this, 19, 10);
covering9.addBox(0F, 0F, 0F, 8, 7, 1);
covering9.setRotationPoint(-4F, 13F, 5F);
covering9.setTextureSize(64, 64);
covering9.mirror = true;
setRotation(covering9, 0F, 0F, 0F);
covering10 = new ModelRenderer(this, 19, 10);
covering10.addBox(0F, 0F, 0F, 8, 7, 1);
covering10.setRotationPoint(-4F, 13F, -6F);
covering10.setTextureSize(64, 64);
covering10.mirror = true;
setRotation(covering10, 0F, 0F, 0F);
covering11 = new ModelRenderer(this, 19, 10);
covering11.addBox(0F, 0F, 0F, 8, 7, 1);
covering11.setRotationPoint(-6F, 13F, 4F);
covering11.setTextureSize(64, 64);
covering11.mirror = true;
setRotation(covering11, 0F, 1.579523F, 0F);
covering12 = new ModelRenderer(this, 19, 10);
covering12.addBox(0F, 0F, 0F, 8, 7, 1);
covering12.setRotationPoint(5F, 13F, 4F);
covering12.setTextureSize(64, 64);
covering12.mirror = true;
setRotation(covering12, 0F, 1.579523F, 0F);
energyBall = new ModelRenderer(this, 0, 15);
energyBall.addBox(0F, 0F, 0F, 3, 3, 3);
energyBall.setRotationPoint(-1.5F, 15F, -1.5F);
energyBall.setTextureSize(64, 64);
energyBall.mirror = true;
setRotation(energyBall, 0F, 0F, 0F);
}
@Override
public void render(float f){
for(ModelRenderer renderer : this.shapes){
renderer.render(f);
}
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
bottom.render(f);
laserPillar.render(f);
laserBase.render(f);
covering1.render(f);
covering2.render(f);
covering3.render(f);
covering4.render(f);
covering5.render(f);
covering6.render(f);
covering7.render(f);
covering8.render(f);
top.render(f);
covering9.render(f);
covering10.render(f);
covering11.render(f);
covering12.render(f);
energyBall.render(f);
}
@Override

View file

@ -127,9 +127,14 @@ public class InitItems{
public static Item itemChestToCrateUpgrade;
public static Item itemLaserWrench;
public static void init(){
ModUtil.LOGGER.info("Initializing Items...");
itemLaserWrench = new ItemLaserWrench();
ItemUtil.register(itemLaserWrench);
itemChestToCrateUpgrade = new ItemChestToCrateUpgrade();
ItemUtil.register(itemChestToCrateUpgrade);

View file

@ -0,0 +1,99 @@
/*
* This file ("ItemLaserWrench.java") is part of the Actually Additions Mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
* http://github.com/Ellpeck/ActuallyAdditions/blob/master/README.md
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
* © 2015 Ellpeck
*/
package ellpeck.actuallyadditions.items;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import ellpeck.actuallyadditions.misc.LaserRelayConnectionHandler;
import ellpeck.actuallyadditions.tile.TileEntityLaserRelay;
import ellpeck.actuallyadditions.util.IActAddItemOrBlock;
import ellpeck.actuallyadditions.util.ModUtil;
import ellpeck.actuallyadditions.util.WorldPos;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ChatComponentText;
import net.minecraft.util.IIcon;
import net.minecraft.world.World;
public class ItemLaserWrench extends Item implements IActAddItemOrBlock{
public ItemLaserWrench(){
this.setMaxStackSize(1);
}
@Override
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int par7, float par8, float par9, float par10){
TileEntity tile = world.getTileEntity(x, y, z);
if(tile instanceof TileEntityLaserRelay){
if(!world.isRemote){
if(ItemPhantomConnector.getStoredPosition(stack) == null){
ItemPhantomConnector.storeConnection(stack, x, y, z, world);
player.addChatComponentMessage(new ChatComponentText("Stored!"));
}
else{
WorldPos savedPos = ItemPhantomConnector.getStoredPosition(stack);
if(savedPos.getTileEntity() instanceof TileEntityLaserRelay){
WorldPos otherPos = new WorldPos(world, x, y, z);
if(!savedPos.isEqual(otherPos) && savedPos.getWorld() == otherPos.getWorld()){
LaserRelayConnectionHandler.getInstance().addConnection(savedPos, otherPos);
player.addChatComponentMessage(new ChatComponentText("Connected!"));
ItemPhantomConnector.clearStorage(stack);
}
}
else{
ItemPhantomConnector.clearStorage(stack);
player.addChatComponentMessage(new ChatComponentText("The Laser Relay you were trying to connect to doesn't exist anymore!"));
}
}
}
return true;
}
return false;
}
@Override
public boolean getShareTag(){
return true;
}
@Override
public void onUpdate(ItemStack stack, World world, Entity entity, int par4, boolean par5){
if(ItemPhantomConnector.getStoredPosition(stack) == null){
ItemPhantomConnector.clearStorage(stack);
}
}
@Override
public EnumRarity getRarity(ItemStack stack){
return EnumRarity.epic;
}
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IIconRegister iconReg){
this.itemIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getName());
}
@Override
public IIcon getIcon(ItemStack stack, int pass){
return this.itemIcon;
}
@Override
public String getName(){
return "itemLaserWrench";
}
}

View file

@ -45,8 +45,8 @@ public class ItemPhantomConnector extends Item implements IActAddItemOrBlock{
//Passing to Phantom
if(tile instanceof IPhantomTile){
if(this.checkHasConnection(stack, player, tile)){
((IPhantomTile)tile).setBoundPosition(this.getStoredPosition(stack));
this.clearStorage(stack);
((IPhantomTile)tile).setBoundPosition(getStoredPosition(stack));
clearStorage(stack);
player.addChatComponentMessage(new ChatComponentText(StringUtil.localize("tooltip."+ModUtil.MOD_ID_LOWER+".phantom.connected.desc")));
return true;
}
@ -54,14 +54,14 @@ public class ItemPhantomConnector extends Item implements IActAddItemOrBlock{
}
}
//Storing Connections
this.storeConnection(stack, x, y, z, world);
storeConnection(stack, x, y, z, world);
player.addChatComponentMessage(new ChatComponentText(StringUtil.localize("tooltip."+ModUtil.MOD_ID_LOWER+".phantom.stored.desc")));
}
return true;
}
public boolean checkHasConnection(ItemStack stack, EntityPlayer player, TileEntity tile){
if(this.getStoredPosition(stack) != null){
if(getStoredPosition(stack) != null){
return true;
}
else{
@ -73,7 +73,7 @@ public class ItemPhantomConnector extends Item implements IActAddItemOrBlock{
}
}
public WorldPos getStoredPosition(ItemStack stack){
public static WorldPos getStoredPosition(ItemStack stack){
NBTTagCompound tag = stack.getTagCompound();
if(tag != null){
int x = tag.getInteger("XCoordOfTileStored");
@ -87,11 +87,11 @@ public class ItemPhantomConnector extends Item implements IActAddItemOrBlock{
return null;
}
public void clearStorage(ItemStack stack){
public static void clearStorage(ItemStack stack){
stack.setTagCompound(new NBTTagCompound());
}
public void storeConnection(ItemStack stack, int x, int y, int z, World world){
public static void storeConnection(ItemStack stack, int x, int y, int z, World world){
NBTTagCompound tag = stack.getTagCompound();
if(tag == null){
tag = new NBTTagCompound();
@ -112,8 +112,8 @@ public class ItemPhantomConnector extends Item implements IActAddItemOrBlock{
@Override
public void onUpdate(ItemStack stack, World world, Entity entity, int par4, boolean par5){
if(this.getStoredPosition(stack) == null){
this.clearStorage(stack);
if(getStoredPosition(stack) == null){
clearStorage(stack);
}
}

View file

@ -10,9 +10,14 @@
package ellpeck.actuallyadditions.misc;
import cofh.api.energy.IEnergyReceiver;
import ellpeck.actuallyadditions.util.WorldPos;
import ellpeck.actuallyadditions.util.WorldUtil;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.util.ForgeDirection;
import java.util.ArrayList;
import java.util.Iterator;
public class LaserRelayConnectionHandler{
@ -53,16 +58,31 @@ public class LaserRelayConnectionHandler{
ArrayList<ConnectionPair> firstNetwork = this.getNetworkFor(firstRelay);
ArrayList<ConnectionPair> secondNetwork = this.getNetworkFor(secondRelay);
if(firstNetwork != null && secondNetwork != null){
//No Network exists
if(firstNetwork == null && secondNetwork == null){
firstNetwork = new ArrayList<ConnectionPair>();
this.networks.add(firstNetwork);
firstNetwork.add(new ConnectionPair(firstRelay, secondRelay));
}
//The same Network
else if(firstNetwork == secondNetwork){
return;
}
//Both relays have networks
else if(firstNetwork != null && secondNetwork != null){
this.mergeNetworks(firstNetwork, secondNetwork);
}
//Only first network exists
else if(firstNetwork != null){
firstNetwork.add(new ConnectionPair(firstRelay, secondRelay));
}
//Only second network exists
else if(secondNetwork != null){
secondNetwork.add(new ConnectionPair(firstRelay, secondRelay));
}
WorldData.makeDirty();
System.out.println("Connected "+firstRelay.toString()+" to "+secondRelay.toString());
System.out.println(firstNetwork == null ? secondNetwork.toString() : firstNetwork.toString());
}
/**
@ -71,11 +91,21 @@ public class LaserRelayConnectionHandler{
public void removeRelayFromNetwork(WorldPos relay){
ArrayList<ConnectionPair> network = this.getNetworkFor(relay);
if(network != null){
for(ConnectionPair pair : network){
if(pair.contains(relay)){
network.remove(pair);
//Remove the relay from the network
Iterator<ConnectionPair> iterator = network.iterator();
while(iterator.hasNext()){
ConnectionPair next = iterator.next();
if(next.contains(relay)){
iterator.remove();
System.out.println("Removed "+relay.toString()+" from Network "+network.toString());
}
}
//Setup new network (so that splitting a network will cause it to break into two)
this.networks.remove(network);
for(ConnectionPair pair : network){
this.addConnection(pair.firstRelay, pair.secondRelay);
}
}
WorldData.makeDirty();
}
@ -89,6 +119,37 @@ public class LaserRelayConnectionHandler{
firstNetwork.add(secondPair);
}
this.networks.remove(secondNetwork);
WorldData.makeDirty();
System.out.println("Merged Two Networks!");
}
public int transferEnergyToReceiverInNeed(ArrayList<ConnectionPair> network, int maxTransfer, boolean simulate){
//Go through all of the connections in the network
for(ConnectionPair pair : network){
WorldPos[] relays = new WorldPos[]{pair.firstRelay, pair.secondRelay};
//Go through both relays in the connection
for(WorldPos relay : relays){
if(relay != null){
//Get every side of the relay
for(int i = 0; i <= 5; i++){
ForgeDirection side = ForgeDirection.getOrientation(i);
//Get the TileEntity at the side
TileEntity tile = WorldUtil.getTileEntityFromSide(side, relay.getWorld(), relay.getX(), relay.getY(), relay.getZ());
if(tile instanceof IEnergyReceiver){
IEnergyReceiver receiver = (IEnergyReceiver)tile;
//Does it need Energy?
if(receiver.getEnergyStored(side.getOpposite()) < receiver.getMaxEnergyStored(side.getOpposite())){
if(receiver.canConnectEnergy(side.getOpposite())){
//Transfer the energy
return ((IEnergyReceiver)tile).receiveEnergy(side.getOpposite(), maxTransfer, simulate);
}
}
}
}
}
}
}
return 0;
}
public static class ConnectionPair{
@ -104,5 +165,10 @@ public class LaserRelayConnectionHandler{
public boolean contains(WorldPos relay){
return (this.firstRelay != null && this.firstRelay.isEqual(relay)) || (this.secondRelay != null && this.secondRelay.isEqual(relay));
}
@Override
public String toString(){
return (this.firstRelay == null ? "-" : this.firstRelay.toString())+" | "+(this.secondRelay == null ? "-" : this.secondRelay.toString());
}
}
}

View file

@ -20,8 +20,8 @@ public class WorldData extends WorldSavedData{
public static final String DATA_TAG = ModUtil.MOD_ID+"WorldData";
public WorldData(){
super(DATA_TAG);
public WorldData(String tag){
super(tag);
}
public static WorldData instance;
@ -49,7 +49,7 @@ public class WorldData extends WorldSavedData{
WorldSavedData savedData = world.loadItemData(WorldData.class, WorldData.DATA_TAG);
//Generate new SavedData
if(savedData == null){
savedData = new WorldData();
savedData = new WorldData(WorldData.DATA_TAG);
world.setItemData(WorldData.DATA_TAG, savedData);
}
//Set the current SavedData to the retreived one

View file

@ -83,8 +83,8 @@ public class ClientProxy implements IProxy{
ClientRegistry.bindTileEntitySpecialRenderer(TileEntitySmileyCloud.class, new RenderSmileyCloud(new ModelSmileyCloud()));
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(InitBlocks.blockSmileyCloud), new RenderItems(new ModelSmileyCloud()));
//ClientRegistry.bindTileEntitySpecialRenderer(TileEntityLaserRelay.class, new RenderTileEntity(new ModelLaserRelay()));
//MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(InitBlocks.blockLaserRelay), new RenderItems(new ModelLaserRelay()));
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityLaserRelay.class, new RenderTileEntity(new ModelLaserRelay()));
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(InitBlocks.blockLaserRelay), new RenderItems(new ModelLaserRelay()));
VillagerRegistry.instance().registerVillagerSkin(ConfigIntValues.JAM_VILLAGER_ID.getValue(), new ResourceLocation(ModUtil.MOD_ID_LOWER, "textures/entity/villager/jamVillager.png"));
}

View file

@ -11,9 +11,13 @@
package ellpeck.actuallyadditions.tile;
import cofh.api.energy.IEnergyReceiver;
import ellpeck.actuallyadditions.misc.LaserRelayConnectionHandler;
import ellpeck.actuallyadditions.util.WorldPos;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.common.util.ForgeDirection;
import java.util.ArrayList;
public class TileEntityLaserRelay extends TileEntityBase implements IEnergyReceiver{
@Override
@ -21,6 +25,14 @@ public class TileEntityLaserRelay extends TileEntityBase implements IEnergyRecei
return false;
}
@Override
public void invalidate(){
super.invalidate();
if(!worldObj.isRemote){
LaserRelayConnectionHandler.getInstance().removeRelayFromNetwork(new WorldPos(this.worldObj, this.xCoord, this.yCoord, this.zCoord));
}
}
@Override
public void writeSyncableNBT(NBTTagCompound compound, boolean isForSync){
@ -38,20 +50,27 @@ public class TileEntityLaserRelay extends TileEntityBase implements IEnergyRecei
@Override
public int getEnergyStored(ForgeDirection from){
return 0; //TODO Get Energy in Network
return 0;
}
@Override
public int getMaxEnergyStored(ForgeDirection from){
return 0; //TODO Get Max Energy in Network
return 0;
}
@Override
public boolean canConnectEnergy(ForgeDirection from){
return false;
return true;
}
public int transmitEnergy(int maxTransmit, boolean simulate){
return 0;
int transmitted = 0;
if(maxTransmit > 0){
ArrayList<LaserRelayConnectionHandler.ConnectionPair> network = LaserRelayConnectionHandler.getInstance().getNetworkFor(new WorldPos(this.worldObj, this.xCoord, this.yCoord, this.zCoord));
if(network != null){
transmitted = LaserRelayConnectionHandler.getInstance().transferEnergyToReceiverInNeed(network, maxTransmit, simulate);
}
}
return transmitted;
}
}

View file

@ -73,4 +73,8 @@ public class WorldPos{
public WorldPos copy(){
return new WorldPos(this.world, this.x, this.y, this.z);
}
public String toString(){
return "["+this.x+", "+this.y+", "+this.z+" in world "+this.world.provider.dimensionId+"]";
}
}