mirror of
https://github.com/Thorfusion/Mekanism-Community-Edition.git
synced 2026-11-23 13:29:40 +00:00
Laser model! Also added some new Reactor Block assets.
This commit is contained in:
1 parent
5f268ae0b0
commit
22b3097d15
14 files changed
+332
-66
No files matched your search
@@ -74,6 +74,7 @@ import mekanism.client.render.tileentity.RenderElectrolyticSeparator;
|
||||
import mekanism.client.render.tileentity.RenderEnergyCube;
|
||||
import mekanism.client.render.tileentity.RenderFluidicPlenisher;
|
||||
import mekanism.client.render.tileentity.RenderGasTank;
|
||||
import mekanism.client.render.tileentity.RenderLaser;
|
||||
import mekanism.client.render.tileentity.RenderLogisticalSorter;
|
||||
import mekanism.client.render.tileentity.RenderMetallurgicInfuser;
|
||||
import mekanism.client.render.tileentity.RenderObsidianTNT;
|
||||
@@ -154,7 +155,6 @@ import cpw.mods.fml.client.registry.ClientRegistry;
|
||||
import cpw.mods.fml.client.registry.RenderingRegistry;
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
@@ -311,8 +311,7 @@ public class ClientProxy extends CommonProxy
|
||||
ClientRegistry.registerTileEntity(TileEntityPRC.class, "PressurizedReactionChamber", new RenderPressurizedReactionChamber());
|
||||
ClientRegistry.registerTileEntity(TileEntityPortableTank.class, "PortableTank", new RenderPortableTank());
|
||||
ClientRegistry.registerTileEntity(TileEntityFluidicPlenisher.class, "FluidicPlenisher", new RenderFluidicPlenisher());
|
||||
//TODO needs a model, I think.
|
||||
GameRegistry.registerTileEntity(TileEntityLaser.class, "Laser");
|
||||
ClientRegistry.registerTileEntity(TileEntityLaser.class, "Laser", new RenderLaser());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -0,0 +1,179 @@
|
||||
package mekanism.client.model;
|
||||
|
||||
import net.minecraft.client.model.ModelBase;
|
||||
import net.minecraft.client.model.ModelRenderer;
|
||||
import net.minecraft.entity.Entity;
|
||||
|
||||
public class ModelLaser extends ModelBase
|
||||
{
|
||||
ModelRenderer LeftOuterRail;
|
||||
ModelRenderer LowerCache;
|
||||
ModelRenderer LeftInnerRail;
|
||||
ModelRenderer RightInnerRail;
|
||||
ModelRenderer RightOuterRail;
|
||||
ModelRenderer RightTopDecor;
|
||||
ModelRenderer Base;
|
||||
ModelRenderer LeftTopDecor;
|
||||
ModelRenderer RightBottomDecor;
|
||||
ModelRenderer LeftBottomDecor;
|
||||
ModelRenderer HigherCache;
|
||||
ModelRenderer LaserTip;
|
||||
ModelRenderer LaserCable1;
|
||||
ModelRenderer LaserCable2;
|
||||
ModelRenderer LaserCable3;
|
||||
ModelRenderer LaserCable4;
|
||||
ModelRenderer LaserBase;
|
||||
ModelRenderer LaserDecor;
|
||||
ModelRenderer LaserDecor2;
|
||||
|
||||
public ModelLaser()
|
||||
{
|
||||
textureWidth = 64;
|
||||
textureHeight = 64;
|
||||
|
||||
LeftOuterRail = new ModelRenderer(this, 22, 29);
|
||||
LeftOuterRail.addBox(0F, 0F, 0F, 1, 2, 14);
|
||||
LeftOuterRail.setRotationPoint(-7F, 18F, -7F);
|
||||
LeftOuterRail.setTextureSize(64, 64);
|
||||
LeftOuterRail.mirror = true;
|
||||
setRotation(LeftOuterRail, 0F, 0F, 0F);
|
||||
LowerCache = new ModelRenderer(this, 0, 18);
|
||||
LowerCache.addBox(0F, -4F, 0F, 12, 1, 10);
|
||||
LowerCache.setRotationPoint(-6F, 23F, -5F);
|
||||
LowerCache.setTextureSize(64, 64);
|
||||
LowerCache.mirror = true;
|
||||
setRotation(LowerCache, 0F, 0F, 0F);
|
||||
LeftInnerRail = new ModelRenderer(this, 22, 29);
|
||||
LeftInnerRail.addBox(0F, 0F, 0F, 1, 2, 14);
|
||||
LeftInnerRail.setRotationPoint(-5F, 18F, -7F);
|
||||
LeftInnerRail.setTextureSize(64, 64);
|
||||
LeftInnerRail.mirror = true;
|
||||
setRotation(LeftInnerRail, 0F, 0F, 0F);
|
||||
RightInnerRail = new ModelRenderer(this, 22, 29);
|
||||
RightInnerRail.addBox(0F, 0F, 0F, 1, 2, 14);
|
||||
RightInnerRail.setRotationPoint(4F, 18F, -7F);
|
||||
RightInnerRail.setTextureSize(64, 64);
|
||||
RightInnerRail.mirror = true;
|
||||
setRotation(RightInnerRail, 0F, 0F, 0F);
|
||||
RightOuterRail = new ModelRenderer(this, 22, 29);
|
||||
RightOuterRail.addBox(0F, 0F, 0F, 1, 2, 14);
|
||||
RightOuterRail.setRotationPoint(6F, 18F, -7F);
|
||||
RightOuterRail.setTextureSize(64, 64);
|
||||
RightOuterRail.mirror = true;
|
||||
setRotation(RightOuterRail, 0F, 0F, 0F);
|
||||
RightTopDecor = new ModelRenderer(this, 0, 43);
|
||||
RightTopDecor.addBox(0F, 0F, 0F, 1, 1, 8);
|
||||
RightTopDecor.setRotationPoint(7F, 19F, -4F);
|
||||
RightTopDecor.setTextureSize(64, 64);
|
||||
RightTopDecor.mirror = true;
|
||||
setRotation(RightTopDecor, 0F, 0F, 0F);
|
||||
Base = new ModelRenderer(this, 0, 0);
|
||||
Base.addBox(0F, 0F, 0F, 14, 4, 14);
|
||||
Base.setRotationPoint(-7F, 20F, -7F);
|
||||
Base.setTextureSize(64, 64);
|
||||
Base.mirror = true;
|
||||
setRotation(Base, 0F, 0F, 0F);
|
||||
LeftTopDecor = new ModelRenderer(this, 0, 43);
|
||||
LeftTopDecor.addBox(0F, 0F, 0F, 1, 1, 8);
|
||||
LeftTopDecor.setRotationPoint(-8F, 19F, -4F);
|
||||
LeftTopDecor.setTextureSize(64, 64);
|
||||
LeftTopDecor.mirror = true;
|
||||
setRotation(LeftTopDecor, 0F, 0F, 0F);
|
||||
RightBottomDecor = new ModelRenderer(this, 0, 29);
|
||||
RightBottomDecor.addBox(0F, 0F, 0F, 1, 4, 10);
|
||||
RightBottomDecor.setRotationPoint(7F, 20F, -5F);
|
||||
RightBottomDecor.setTextureSize(64, 64);
|
||||
RightBottomDecor.mirror = true;
|
||||
setRotation(RightBottomDecor, 0F, 0F, 0F);
|
||||
LeftBottomDecor = new ModelRenderer(this, 0, 29);
|
||||
LeftBottomDecor.addBox(0F, 0F, 0F, 1, 4, 10);
|
||||
LeftBottomDecor.setRotationPoint(-8F, 20F, -5F);
|
||||
LeftBottomDecor.setTextureSize(64, 64);
|
||||
LeftBottomDecor.mirror = true;
|
||||
setRotation(LeftBottomDecor, 0F, 0F, 0F);
|
||||
HigherCache = new ModelRenderer(this, 0, 18);
|
||||
HigherCache.addBox(0F, -4F, 0F, 12, 1, 10);
|
||||
HigherCache.setRotationPoint(-6F, 21.5F, -5F);
|
||||
HigherCache.setTextureSize(64, 64);
|
||||
HigherCache.mirror = true;
|
||||
setRotation(HigherCache, 0F, 0F, 0F);
|
||||
LaserTip = new ModelRenderer(this, 30, 45);
|
||||
LaserTip.addBox(0F, -4F, 0F, 2, 3, 2);
|
||||
LaserTip.setRotationPoint(-1F, 13.5F, -1F);
|
||||
LaserTip.setTextureSize(64, 64);
|
||||
LaserTip.mirror = true;
|
||||
setRotation(LaserTip, 0F, 0F, 0F);
|
||||
LaserCable1 = new ModelRenderer(this, 22, 45);
|
||||
LaserCable1.addBox(0F, 0F, 0F, 1, 1, 3);
|
||||
LaserCable1.setRotationPoint(1F, 11.5F, -3F);
|
||||
LaserCable1.setTextureSize(64, 64);
|
||||
LaserCable1.mirror = true;
|
||||
setRotation(LaserCable1, 0F, 0F, 0F);
|
||||
LaserCable2 = new ModelRenderer(this, 18, 43);
|
||||
LaserCable2.addBox(0F, -4F, 0F, 1, 6, 1);
|
||||
LaserCable2.setRotationPoint(1F, 15.5F, -4F);
|
||||
LaserCable2.setTextureSize(64, 64);
|
||||
LaserCable2.mirror = true;
|
||||
setRotation(LaserCable2, 0F, 0F, 0F);
|
||||
LaserCable3 = new ModelRenderer(this, 22, 45);
|
||||
LaserCable3.addBox(0F, 0F, 0F, 1, 1, 3);
|
||||
LaserCable3.setRotationPoint(-2F, 11.5F, -3F);
|
||||
LaserCable3.setTextureSize(64, 64);
|
||||
LaserCable3.mirror = true;
|
||||
setRotation(LaserCable3, 0F, 0F, 0F);
|
||||
LaserCable4 = new ModelRenderer(this, 18, 43);
|
||||
LaserCable4.addBox(0F, -4F, 0F, 1, 6, 1);
|
||||
LaserCable4.setRotationPoint(-2F, 15.5F, -4F);
|
||||
LaserCable4.setTextureSize(64, 64);
|
||||
LaserCable4.mirror = true;
|
||||
setRotation(LaserCable4, 0F, 0F, 0F);
|
||||
LaserBase = new ModelRenderer(this, 0, 52);
|
||||
LaserBase.addBox(0F, -4F, 0F, 6, 5, 6);
|
||||
LaserBase.setRotationPoint(-3F, 16.5F, -3F);
|
||||
LaserBase.setTextureSize(64, 64);
|
||||
LaserBase.mirror = true;
|
||||
setRotation(LaserBase, 0F, 0F, 0F);
|
||||
LaserDecor = new ModelRenderer(this, 44, 18);
|
||||
LaserDecor.addBox(-0.5F, 0F, 0F, 1, 4, 4);
|
||||
LaserDecor.setRotationPoint(2.5F, 14.7F, -2F);
|
||||
LaserDecor.setTextureSize(64, 64);
|
||||
LaserDecor.mirror = true;
|
||||
setRotation(LaserDecor, 0F, 0F, -0.6320361F);
|
||||
LaserDecor2 = new ModelRenderer(this, 44, 18);
|
||||
LaserDecor2.addBox(-0.5F, 0F, 0F, 1, 4, 4);
|
||||
LaserDecor2.setRotationPoint(-2.5F, 14.7F, -2F);
|
||||
LaserDecor2.setTextureSize(64, 64);
|
||||
LaserDecor2.mirror = true;
|
||||
setRotation(LaserDecor2, 0F, 0F, 0.6320364F);
|
||||
}
|
||||
|
||||
public void render(float size)
|
||||
{
|
||||
LeftOuterRail.render(size);
|
||||
LowerCache.render(size);
|
||||
LeftInnerRail.render(size);
|
||||
RightInnerRail.render(size);
|
||||
RightOuterRail.render(size);
|
||||
RightTopDecor.render(size);
|
||||
Base.render(size);
|
||||
LeftTopDecor.render(size);
|
||||
RightBottomDecor.render(size);
|
||||
LeftBottomDecor.render(size);
|
||||
HigherCache.render(size);
|
||||
LaserTip.render(size);
|
||||
LaserCable1.render(size);
|
||||
LaserCable2.render(size);
|
||||
LaserCable3.render(size);
|
||||
LaserCable4.render(size);
|
||||
LaserBase.render(size);
|
||||
LaserDecor.render(size);
|
||||
LaserDecor2.render(size);
|
||||
}
|
||||
|
||||
private void setRotation(ModelRenderer model, float x, float y, float z)
|
||||
{
|
||||
model.rotateAngleX = x;
|
||||
model.rotateAngleY = y;
|
||||
model.rotateAngleZ = z;
|
||||
}
|
||||
}
|
||||
@@ -11,6 +11,7 @@ import mekanism.client.model.ModelDigitalMiner;
|
||||
import mekanism.client.model.ModelElectricPump;
|
||||
import mekanism.client.model.ModelElectrolyticSeparator;
|
||||
import mekanism.client.model.ModelFluidicPlenisher;
|
||||
import mekanism.client.model.ModelLaser;
|
||||
import mekanism.client.model.ModelLogisticalSorter;
|
||||
import mekanism.client.model.ModelMetallurgicInfuser;
|
||||
import mekanism.client.model.ModelPressurizedReactionChamber;
|
||||
@@ -49,6 +50,7 @@ public class MachineRenderingHandler implements ISimpleBlockRenderingHandler
|
||||
public ModelSeismicVibrator seismicVibrator = new ModelSeismicVibrator();
|
||||
public ModelPressurizedReactionChamber pressurizedReactionChamber = new ModelPressurizedReactionChamber();
|
||||
public ModelFluidicPlenisher fluidicPlenisher = new ModelFluidicPlenisher();
|
||||
public ModelLaser laser = new ModelLaser();
|
||||
|
||||
@Override
|
||||
public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer)
|
||||
@@ -183,6 +185,14 @@ public class MachineRenderingHandler implements ISimpleBlockRenderingHandler
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(MekanismUtils.getResource(ResourceType.RENDER, "FluidicPlenisher.png"));
|
||||
fluidicPlenisher.render(0.0560F);
|
||||
}
|
||||
else if(type == MachineType.LASER)
|
||||
{
|
||||
GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
|
||||
GL11.glRotatef(90F, 0.0F, -1.0F, 0.0F);
|
||||
GL11.glTranslatef(0.0F, -0.85F, 0.0F);
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(MekanismUtils.getResource(ResourceType.RENDER, "Laser.png"));
|
||||
laser.render(0.0560F);
|
||||
}
|
||||
else {
|
||||
MekanismRenderer.renderItem(renderer, metadata, block);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,65 @@
|
||||
package mekanism.client.render.tileentity;
|
||||
|
||||
import mekanism.client.model.ModelLaser;
|
||||
import mekanism.common.tile.TileEntityLaser;
|
||||
import mekanism.common.util.MekanismUtils;
|
||||
import mekanism.common.util.MekanismUtils.ResourceType;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class RenderLaser extends TileEntitySpecialRenderer
|
||||
{
|
||||
private ModelLaser model = new ModelLaser();
|
||||
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float partialTick)
|
||||
{
|
||||
renderAModelAt((TileEntityLaser)tileEntity, x, y, z, partialTick);
|
||||
}
|
||||
|
||||
private void renderAModelAt(TileEntityLaser tileEntity, double x, double y, double z, float partialTick)
|
||||
{
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef((float)x + 0.5F, (float)y + 1.5F, (float)z + 0.5F);
|
||||
|
||||
bindTexture(MekanismUtils.getResource(ResourceType.RENDER, "Laser.png"));
|
||||
|
||||
switch(tileEntity.facing)
|
||||
{
|
||||
case 0:
|
||||
GL11.glTranslatef(0.0F, -2.0F, 0.0F);
|
||||
GL11.glRotatef(180F, 1.0F, 0.0F, 0.0F);
|
||||
break;
|
||||
case 5:
|
||||
GL11.glTranslatef(0.0F, -1.0F, 0.0F);
|
||||
GL11.glTranslatef(1.0F, 0.0F, 0.0F);
|
||||
GL11.glRotatef(90, 0.0F, 0.0F, -1.0F);
|
||||
break;
|
||||
case 4:
|
||||
GL11.glTranslatef(0.0F, -1.0F, 0.0F);
|
||||
GL11.glTranslatef(-1.0F, 0.0F, 0.0F);
|
||||
GL11.glRotatef(90, 0.0F, 0.0F, 1.0F);
|
||||
break;
|
||||
case 2:
|
||||
GL11.glTranslatef(0.0F, -1.0F, 0.0F);
|
||||
GL11.glTranslatef(0.0F, 0.0F, -1.0F);
|
||||
GL11.glRotatef(90, -1.0F, 0.0F, 0.0F);
|
||||
break;
|
||||
case 3:
|
||||
GL11.glTranslatef(0.0F, -1.0F, 0.0F);
|
||||
GL11.glTranslatef(0.0F, 0.0F, 1.0F);
|
||||
GL11.glRotatef(90, 1.0F, 0.0F, 0.0F);
|
||||
break;
|
||||
}
|
||||
|
||||
GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
|
||||
model.render(0.0625F);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
}
|
||||
@@ -124,7 +124,7 @@ import dan200.computercraft.api.peripheral.IPeripheralProvider;
|
||||
* 1:10: Pressurized Reaction Chamber
|
||||
* 1:11: Portable Tank
|
||||
* 1:12: Fluidic Plenisher
|
||||
* 1:13; Laser
|
||||
* 1:13: Laser
|
||||
* @author AidanBrady
|
||||
*
|
||||
*/
|
||||
@@ -185,8 +185,6 @@ public class BlockMachine extends BlockContainer implements ISpecialBounds, IPer
|
||||
icons[5][0] = register.registerIcon("mekanism:PrecisionSawmillFrontOff");
|
||||
icons[5][1] = register.registerIcon("mekanism:PrecisionSawmillFrontOn");
|
||||
icons[5][2] = register.registerIcon("mekanism:SteelCasing");
|
||||
icons[13][0] = register.registerIcon("mekanism:SteelCasing");
|
||||
icons[13][1] = register.registerIcon("mekanism:Laser");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -462,16 +460,6 @@ public class BlockMachine extends BlockContainer implements ISpecialBounds, IPer
|
||||
return icons[meta][0];
|
||||
}
|
||||
}
|
||||
else if(meta == 13)
|
||||
{
|
||||
if(side == 3)
|
||||
{
|
||||
return icons[meta][0];
|
||||
}
|
||||
else {
|
||||
return icons[meta][1];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
@@ -605,7 +593,7 @@ public class BlockMachine extends BlockContainer implements ISpecialBounds, IPer
|
||||
return icons[metadata][2];
|
||||
}
|
||||
}
|
||||
else if(metadata == 9 || metadata == 13)
|
||||
else if(metadata == 9)
|
||||
{
|
||||
if(side == tileEntity.facing)
|
||||
{
|
||||
@@ -1285,7 +1273,7 @@ public class BlockMachine extends BlockContainer implements ISpecialBounds, IPer
|
||||
PRESSURIZED_REACTION_CHAMBER(Mekanism.MachineBlock2, 10, "PressurizedReactionChamber", 40, 20000, TileEntityPRC.class, true, true, false),
|
||||
PORTABLE_TANK(Mekanism.MachineBlock2, 11, "PortableTank", 41, 0, TileEntityPortableTank.class, false, true, false),
|
||||
FLUIDIC_PLENISHER(Mekanism.MachineBlock2, 12, "FluidicPlenisher", 42, 10000, TileEntityFluidicPlenisher.class, true, true, false),
|
||||
LASER(Mekanism.MachineBlock2, 13, "Laser", -1, 100000, TileEntityLaser.class, true, false, false);
|
||||
LASER(Mekanism.MachineBlock2, 13, "Laser", -1, 100000, TileEntityLaser.class, true, true, false);
|
||||
|
||||
public Block typeBlock;
|
||||
public int meta;
|
||||
|
||||
@@ -104,6 +104,8 @@ import cpw.mods.fml.relauncher.SideOnly;
|
||||
* 1:9: Seismic Vibrator
|
||||
* 1:10: Pressurized Reaction Chamber
|
||||
* 1:11: Portable Tank
|
||||
* 1:12: Fluidic Plenisher
|
||||
* 1:13: Laser
|
||||
* @author AidanBrady
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -16,7 +16,6 @@ import mekanism.generators.common.block.BlockGenerator;
|
||||
import mekanism.generators.common.block.BlockReactor;
|
||||
import mekanism.generators.common.item.ItemBlockGenerator;
|
||||
import mekanism.generators.common.item.ItemBlockReactor;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
@@ -27,7 +26,6 @@ import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidContainerRegistry;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
import buildcraft.api.fuels.IronEngineFuel;
|
||||
|
||||
import cpw.mods.fml.client.event.ConfigChangedEvent.OnConfigChangedEvent;
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.common.Mod;
|
||||
@@ -59,6 +57,7 @@ public class MekanismGenerators implements IModule
|
||||
//Blocks
|
||||
public static Block Generator;
|
||||
public static Block Reactor;
|
||||
public static Block ReactorGlass;
|
||||
|
||||
//Generation Configuration
|
||||
public static double advancedSolarGeneration;
|
||||
@@ -144,9 +143,11 @@ public class MekanismGenerators implements IModule
|
||||
//Declarations
|
||||
Generator = new BlockGenerator().setBlockName("Generator");
|
||||
Reactor = new BlockReactor().setBlockName("Reactor");
|
||||
ReactorGlass = new BlockReactor().setBlockName("ReactorGlass");
|
||||
|
||||
GameRegistry.registerBlock(Generator, ItemBlockGenerator.class, "Generator");
|
||||
GameRegistry.registerBlock(Reactor, ItemBlockReactor.class, "Reactor");
|
||||
GameRegistry.registerBlock(ReactorGlass, ItemBlockReactor.class, "ReactorGlass");
|
||||
}
|
||||
|
||||
public void addItems()
|
||||
|
||||
@@ -3,19 +3,11 @@ package mekanism.generators.common.block;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import mekanism.api.energy.IEnergizedItem;
|
||||
import mekanism.common.IActiveState;
|
||||
import mekanism.common.IBoundingBlock;
|
||||
import mekanism.common.ISustainedInventory;
|
||||
import mekanism.common.ISustainedTank;
|
||||
import mekanism.common.ItemAttacher;
|
||||
import mekanism.common.Mekanism;
|
||||
import mekanism.common.tile.TileEntityBasicBlock;
|
||||
import mekanism.common.tile.TileEntityElectricBlock;
|
||||
import mekanism.common.util.MekanismUtils;
|
||||
import mekanism.generators.client.GeneratorsClientProxy;
|
||||
import mekanism.generators.common.MekanismGenerators;
|
||||
import mekanism.generators.common.tile.TileEntitySolarGenerator;
|
||||
import mekanism.generators.common.tile.reactor.TileEntityReactorBlock;
|
||||
import mekanism.generators.common.tile.reactor.TileEntityReactorController;
|
||||
import mekanism.generators.common.tile.reactor.TileEntityReactorFrame;
|
||||
@@ -23,30 +15,24 @@ import mekanism.generators.common.tile.reactor.TileEntityReactorGlass;
|
||||
import mekanism.generators.common.tile.reactor.TileEntityReactorLaserFocusMatrix;
|
||||
import mekanism.generators.common.tile.reactor.TileEntityReactorNeutronCapture;
|
||||
import mekanism.generators.common.tile.reactor.TileEntityReactorPort;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import buildcraft.api.tools.IToolWrench;
|
||||
import cpw.mods.fml.common.ModAPIManager;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
import buildcraft.api.tools.IToolWrench;
|
||||
|
||||
public class BlockReactor extends BlockContainer
|
||||
{
|
||||
public IIcon[][] icons = new IIcon[16][16];
|
||||
@@ -69,10 +55,13 @@ public class BlockReactor extends BlockContainer
|
||||
icons[0][1] = register.registerIcon("mekanism:ReactorControllerOn");
|
||||
icons[0][2] = register.registerIcon("mekanism:ReactorFrame");
|
||||
icons[1][0] = register.registerIcon("mekanism:ReactorFrame");
|
||||
icons[2][0] = register.registerIcon("mekanism:ReactorGlass");
|
||||
icons[3][0] = register.registerIcon("mekanism:ReactorLaserFocus");
|
||||
icons[4][0] = register.registerIcon("mekanism:ReactorNeutronCapture");
|
||||
icons[5][0] = register.registerIcon("mekanism:ReactorPort");
|
||||
icons[2][0] = register.registerIcon("mekanism:ReactorLaserFocus");
|
||||
icons[3][0] = register.registerIcon("mekanism:ReactorNeutronCapture");
|
||||
icons[4][0] = register.registerIcon("mekanism:ReactorPort");
|
||||
}
|
||||
else if(this == MekanismGenerators.ReactorGlass)
|
||||
{
|
||||
icons[0][0] = register.registerIcon("mekanism:ReactorGlass");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -86,11 +75,14 @@ public class BlockReactor extends BlockContainer
|
||||
{
|
||||
return icons[0][side == 6 ? 0 : 2];
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
return icons[meta][0];
|
||||
}
|
||||
}
|
||||
else if(this == MekanismGenerators.ReactorGlass)
|
||||
{
|
||||
return icons[meta][0];
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
@@ -114,11 +106,14 @@ public class BlockReactor extends BlockContainer
|
||||
return icons[0][2];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
return icons[metadata][0];
|
||||
}
|
||||
}
|
||||
else if(this == MekanismGenerators.ReactorGlass)
|
||||
{
|
||||
return icons[metadata][0];
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
@@ -185,12 +180,12 @@ public class BlockReactor extends BlockContainer
|
||||
{
|
||||
if(!entityplayer.isSneaking())
|
||||
{
|
||||
entityplayer.openGui(MekanismGenerators.instance, ReactorBlockType.getFromMetadata(metadata).guiId, world, x, y, z);
|
||||
entityplayer.openGui(MekanismGenerators.instance, ReactorBlockType.get(this, metadata).guiId, world, x, y, z);
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
((TileEntityReactorController)tileEntity).formMultiblock();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -199,14 +194,15 @@ public class BlockReactor extends BlockContainer
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubBlocks(Item i, CreativeTabs creativetabs, List list)
|
||||
public void getSubBlocks(Item item, CreativeTabs creativetabs, List list)
|
||||
{
|
||||
list.add(new ItemStack(i, 1, 0));
|
||||
list.add(new ItemStack(i, 1, 1));
|
||||
list.add(new ItemStack(i, 1, 2));
|
||||
list.add(new ItemStack(i, 1, 3));
|
||||
list.add(new ItemStack(i, 1, 4));
|
||||
list.add(new ItemStack(i, 1, 5));
|
||||
for(ReactorBlockType type : ReactorBlockType.values())
|
||||
{
|
||||
if(type.typeBlock == this)
|
||||
{
|
||||
list.add(new ItemStack(item, 1, type.meta));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -218,7 +214,7 @@ public class BlockReactor extends BlockContainer
|
||||
@Override
|
||||
public TileEntity createTileEntity(World world, int metadata)
|
||||
{
|
||||
ReactorBlockType type = ReactorBlockType.getFromMetadata(metadata);
|
||||
ReactorBlockType type = ReactorBlockType.get(this, metadata);
|
||||
|
||||
if(type != null)
|
||||
{
|
||||
@@ -239,6 +235,12 @@ public class BlockReactor extends BlockContainer
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderBlockPass()
|
||||
{
|
||||
return this == MekanismGenerators.Reactor ? 0 : 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube()
|
||||
@@ -255,35 +257,45 @@ public class BlockReactor extends BlockContainer
|
||||
|
||||
public static enum ReactorBlockType
|
||||
{
|
||||
CONTROLLER(0, "ReactorController", 10, TileEntityReactorController.class),
|
||||
FRAME(1, "ReactorFrame", -1, TileEntityReactorFrame.class),
|
||||
GLASS(2, "ReactorGlass", -1, TileEntityReactorGlass.class),
|
||||
LASER_FOCUS_MATRIX(3, "ReactorLaserFocusMatrix", -1, TileEntityReactorLaserFocusMatrix.class),
|
||||
NEUTRON_CAPTURE(4, "ReactorNeutronCapturePlate", 11, TileEntityReactorNeutronCapture.class),
|
||||
PORT(5, "ReactorInOutPort", -1, TileEntityReactorPort.class);
|
||||
CONTROLLER(MekanismGenerators.Reactor, 0, "ReactorController", 10, TileEntityReactorController.class),
|
||||
FRAME(MekanismGenerators.Reactor, 1, "ReactorFrame", -1, TileEntityReactorFrame.class),
|
||||
LASER_FOCUS_MATRIX(MekanismGenerators.Reactor, 2, "ReactorLaserFocusMatrix", -1, TileEntityReactorLaserFocusMatrix.class),
|
||||
NEUTRON_CAPTURE(MekanismGenerators.Reactor, 3, "ReactorNeutronCapturePlate", 11, TileEntityReactorNeutronCapture.class),
|
||||
PORT(MekanismGenerators.Reactor, 4, "ReactorInOutPort", -1, TileEntityReactorPort.class),
|
||||
GLASS(MekanismGenerators.ReactorGlass, 0, "ReactorGlass", -1, TileEntityReactorGlass.class);
|
||||
|
||||
public Block typeBlock;
|
||||
public int meta;
|
||||
public String name;
|
||||
public int guiId;
|
||||
public Class<? extends TileEntity> tileEntityClass;
|
||||
|
||||
private ReactorBlockType(int i, String s, int j, Class<? extends TileEntityElectricBlock> tileClass)
|
||||
private ReactorBlockType(Block b, int i, String s, int j, Class<? extends TileEntityElectricBlock> tileClass)
|
||||
{
|
||||
typeBlock = b;
|
||||
meta = i;
|
||||
name = s;
|
||||
guiId = j;
|
||||
tileEntityClass = tileClass;
|
||||
}
|
||||
|
||||
public static ReactorBlockType getFromMetadata(int meta)
|
||||
public static ReactorBlockType get(Block block, int meta)
|
||||
{
|
||||
for(ReactorBlockType type : values())
|
||||
{
|
||||
if(type.meta == meta)
|
||||
if(type.typeBlock == block && type.meta == meta)
|
||||
{
|
||||
return type;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static ReactorBlockType get(ItemStack stack)
|
||||
{
|
||||
return get(Block.getBlockFromItem(stack.getItem()), stack.getItemDamage());
|
||||
}
|
||||
|
||||
public TileEntity create()
|
||||
{
|
||||
@@ -303,7 +315,7 @@ public class BlockReactor extends BlockContainer
|
||||
|
||||
public ItemStack getStack()
|
||||
{
|
||||
return new ItemStack(MekanismGenerators.Reactor, 1, meta);
|
||||
return new ItemStack(typeBlock, 1, meta);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -41,14 +41,14 @@ public class ItemBlockReactor extends ItemBlock
|
||||
@Override
|
||||
public String getUnlocalizedName(ItemStack itemstack)
|
||||
{
|
||||
return getUnlocalizedName() + "." + ReactorBlockType.getFromMetadata(itemstack.getItemDamage()).name;
|
||||
return getUnlocalizedName() + "." + ReactorBlockType.get(itemstack).name;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addInformation(ItemStack itemstack, EntityPlayer entityplayer, List list, boolean flag)
|
||||
{
|
||||
ReactorBlockType type = ReactorBlockType.getFromMetadata(itemstack.getItemDamage());
|
||||
ReactorBlockType type = ReactorBlockType.get(itemstack);
|
||||
|
||||
if(!Keyboard.isKeyDown(Keyboard.KEY_LSHIFT))
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user