diff --git a/src/main/java/mekanism/api/lasers/LaserManager.java b/src/main/java/mekanism/api/lasers/LaserManager.java index 1bfd1d134..1c0f5eaf6 100644 --- a/src/main/java/mekanism/api/lasers/LaserManager.java +++ b/src/main/java/mekanism/api/lasers/LaserManager.java @@ -1,11 +1,11 @@ package mekanism.api.lasers; import mekanism.api.Coord4D; +import mekanism.common.Mekanism; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.MovingObjectPosition; import net.minecraft.util.Vec3; -import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; @@ -34,17 +34,23 @@ public class LaserManager ((ILaserReceptor)tile).receiveLaserEnergy(energy, ForgeDirection.getOrientation(mop.sideHit)); } } + } + } - renderLaser(from, new Coord4D(mop.blockX, mop.blockY, mop.blockZ)); + public static void fireLaserClient(Coord4D from, ForgeDirection direction, World world) + { + Coord4D rangeFrom = from.getFromSide(direction, 1); + Coord4D to = from.getFromSide(direction, range); + MovingObjectPosition mop = world.rayTraceBlocks(Vec3.createVectorHelper(rangeFrom.xCoord, rangeFrom.yCoord, rangeFrom.zCoord), Vec3.createVectorHelper(to.xCoord, to.yCoord, to.zCoord)); + + if(mop != null) + { + Mekanism.proxy.renderLaser(world, from, new Coord4D(mop.blockX, mop.blockY, mop.blockZ), direction); } else { - renderLaser(from, to); + Mekanism.proxy.renderLaser(world, from, to, direction); } } - public static void renderLaser(Coord4D from, Coord4D to) - { - //TODO Particle effects - } } diff --git a/src/main/java/mekanism/api/reactor/IFusionReactor.java b/src/main/java/mekanism/api/reactor/IFusionReactor.java index 41f91ce07..9eb4383af 100644 --- a/src/main/java/mekanism/api/reactor/IFusionReactor.java +++ b/src/main/java/mekanism/api/reactor/IFusionReactor.java @@ -35,4 +35,6 @@ public interface IFusionReactor public double getBufferSize(); public void formMultiblock(); + + public boolean isFormed(); } diff --git a/src/main/java/mekanism/client/ClientProxy.java b/src/main/java/mekanism/client/ClientProxy.java index 38d0b44e6..79f20f899 100644 --- a/src/main/java/mekanism/client/ClientProxy.java +++ b/src/main/java/mekanism/client/ClientProxy.java @@ -4,6 +4,7 @@ import java.io.File; import java.util.HashMap; import mekanism.api.Coord4D; +import mekanism.client.entity.EntityLaser; import mekanism.client.gui.GuiChemicalCrystallizer; import mekanism.client.gui.GuiChemicalDissolutionChamber; import mekanism.client.gui.GuiChemicalInfuser; @@ -147,6 +148,7 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; import net.minecraftforge.client.MinecraftForgeClient; import net.minecraftforge.common.config.Configuration; +import net.minecraftforge.common.util.ForgeDirection; import cpw.mods.fml.client.FMLClientHandler; import cpw.mods.fml.client.registry.ClientRegistry; import cpw.mods.fml.client.registry.RenderingRegistry; @@ -583,4 +585,10 @@ public class ClientProxy extends CommonProxy return Minecraft.getMinecraft().thePlayer; } } + + @Override + public void renderLaser(World world, Coord4D from, Coord4D to, ForgeDirection direction) + { + Minecraft.getMinecraft().effectRenderer.addEffect(new EntityLaser(world, from, to, direction)); + } } diff --git a/src/main/java/mekanism/client/entity/EntityLaser.java b/src/main/java/mekanism/client/entity/EntityLaser.java new file mode 100644 index 000000000..5b1cd41b3 --- /dev/null +++ b/src/main/java/mekanism/client/entity/EntityLaser.java @@ -0,0 +1,97 @@ +package mekanism.client.entity; + +import mekanism.api.Coord4D; +import mekanism.api.Pos3D; +import mekanism.client.render.MekanismRenderer; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.particle.EntityFX; +import net.minecraft.client.renderer.Tessellator; +import net.minecraft.util.ResourceLocation; +import net.minecraft.world.World; +import net.minecraftforge.common.util.ForgeDirection; +import cpw.mods.fml.client.FMLClientHandler; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import org.lwjgl.opengl.GL11; + +@SideOnly(Side.CLIENT) +public class EntityLaser extends EntityFX +{ + double length; + ForgeDirection direction; + + public EntityLaser(World world, Coord4D start, Coord4D end, ForgeDirection direction) + { + super(world, (start.xCoord + end.xCoord)/2D + 0.5D, (start.yCoord + end.yCoord)/2D + 0.5D, (start.zCoord+end.zCoord)/2D + 0.5D); + particleMaxAge = 5; + particleRed = 1; + particleGreen = 0; + particleBlue = 0; + particleAlpha = 0.1F; + particleScale = 0.1F; + length = new Pos3D(end).distance(new Pos3D(start)); + this.direction = direction; + } + + @Override + public void renderParticle(Tessellator tessellator, float partialTick, float rotationX, float rotationXZ, float rotationZ, float rotationYZ, float rotationXY) + { + tessellator.draw(); + + GL11.glPushMatrix(); + GL11.glPushAttrib(GL11.GL_POLYGON_BIT + GL11.GL_ENABLE_BIT); + GL11.glDisable(GL11.GL_CULL_FACE); + Minecraft.getMinecraft().renderEngine.bindTexture(new ResourceLocation("mekanism", "particles/laser.png")); + + float newX = (float)(this.prevPosX + (this.posX - this.prevPosX) * (double)partialTick - interpPosX); + float newY = (float)(this.prevPosY + (this.posY - this.prevPosY) * (double)partialTick - interpPosY); + float newZ = (float)(this.prevPosZ + (this.posZ - this.prevPosZ) * (double)partialTick - interpPosZ); + + GL11.glTranslatef(newX, newY, newZ); + + switch(direction) + { + case UP: + case DOWN: + default: + break; + case WEST: + case EAST: + GL11.glRotated(90, 0, 0, 1); + break; + case NORTH: + case SOUTH: + GL11.glRotated(90, 1, 0, 0); + break; + } + GL11.glRotated(45, 0, 1, 0); + tessellator.startDrawingQuads(); + tessellator.setColorRGBA_F(particleRed, particleGreen, particleBlue, particleAlpha); + tessellator.addVertexWithUV(-particleScale, -length/2, 0, 0, 0); + tessellator.addVertexWithUV(-particleScale, length/2, 0, 0, 1); + tessellator.addVertexWithUV(particleScale, length/2, 0, 1, 1); + tessellator.addVertexWithUV(particleScale, -length/2, 0, 1, 0); + tessellator.draw(); + + GL11.glRotated(90, 0, 1, 0); + tessellator.startDrawingQuads(); + tessellator.setColorRGBA_F(particleRed, particleGreen, particleBlue, particleAlpha); + tessellator.addVertexWithUV(-particleScale, -length/2, 0, 0, 0); + tessellator.addVertexWithUV(-particleScale, length/2, 0, 0, 1); + tessellator.addVertexWithUV(particleScale, length/2, 0, 1, 1); + tessellator.addVertexWithUV(particleScale, -length/2, 0, 1, 0); + tessellator.draw(); + + GL11.glPopAttrib(); + GL11.glPopMatrix(); + + Minecraft.getMinecraft().renderEngine.bindTexture(MekanismRenderer.getBlocksTexture()); + tessellator.startDrawingQuads(); + } + + public int getFXLayer() + { + return 1; + } +} diff --git a/src/main/java/mekanism/client/gui/GuiNumberGauge.java b/src/main/java/mekanism/client/gui/GuiNumberGauge.java new file mode 100644 index 000000000..42c8c82ee --- /dev/null +++ b/src/main/java/mekanism/client/gui/GuiNumberGauge.java @@ -0,0 +1,48 @@ +package mekanism.client.gui; + +import net.minecraft.util.IIcon; +import net.minecraft.util.ResourceLocation; + +import static java.lang.Math.min; + +public class GuiNumberGauge extends GuiGauge +{ + INumberInfoHandler infoHandler; + + public GuiNumberGauge(INumberInfoHandler handler, Type type, IGuiWrapper gui, ResourceLocation def, int x, int y) + { + super(type, gui, def, x, y); + + infoHandler = handler; + } + + @Override + public int getScaledLevel() + { + return (int)((height-2) * min(infoHandler.getLevel() / infoHandler.getMaxLevel(), 1)); + } + + @Override + public IIcon getIcon() + { + return infoHandler.getIcon(); + } + + @Override + public String getTooltipText() + { + return infoHandler.getText(infoHandler.getLevel()); + } + + + public static interface INumberInfoHandler + { + public IIcon getIcon(); + + public double getLevel(); + + public double getMaxLevel(); + + public String getText(double level); + } +} diff --git a/src/main/java/mekanism/common/CommonProxy.java b/src/main/java/mekanism/common/CommonProxy.java index 68f701f58..dd2ce8bc3 100644 --- a/src/main/java/mekanism/common/CommonProxy.java +++ b/src/main/java/mekanism/common/CommonProxy.java @@ -2,6 +2,7 @@ package mekanism.common; import java.io.File; +import mekanism.api.Coord4D; import mekanism.api.MekanismAPI; import mekanism.common.EnergyDisplay.EnergyType; import mekanism.common.entity.EntityRobit; @@ -85,6 +86,7 @@ import net.minecraft.inventory.Container; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; import net.minecraftforge.common.config.Configuration; +import net.minecraftforge.common.util.ForgeDirection; import cpw.mods.fml.common.FMLCommonHandler; import cpw.mods.fml.common.network.simpleimpl.MessageContext; import cpw.mods.fml.common.registry.GameRegistry; @@ -143,7 +145,7 @@ public class CommonProxy /** * Registers a client-side sound, assigned to a TileEntity. - * @param tile - TileEntity who is registering the sound + * @param tileEntity - TileEntity who is registering the sound */ public void registerSound(TileEntity tileEntity) {} @@ -471,4 +473,6 @@ public class CommonProxy { return context.getServerHandler().playerEntity; } + + public void renderLaser(World world, Coord4D from, Coord4D to, ForgeDirection direction) {} } diff --git a/src/main/java/mekanism/common/ITileNetwork.java b/src/main/java/mekanism/common/ITileNetwork.java index 758c497f0..95679654e 100644 --- a/src/main/java/mekanism/common/ITileNetwork.java +++ b/src/main/java/mekanism/common/ITileNetwork.java @@ -13,9 +13,6 @@ public interface ITileNetwork { /** * Receive and manage a packet's data. - * @param network - * @param packet - * @param player * @param dataStream */ public void handlePacketData(ByteBuf dataStream) throws Exception; diff --git a/src/main/java/mekanism/common/multipart/PartSidedPipe.java b/src/main/java/mekanism/common/multipart/PartSidedPipe.java index 07f06d11a..a4227926e 100644 --- a/src/main/java/mekanism/common/multipart/PartSidedPipe.java +++ b/src/main/java/mekanism/common/multipart/PartSidedPipe.java @@ -312,7 +312,7 @@ public abstract class PartSidedPipe extends TMultiPart implements TSlottedPart, @SideOnly(Side.CLIENT) public boolean renderStatic(Vector3 pos, int pass) { - if(pass == 1) + if(pass == 0) { RenderPartTransmitter.getInstance().renderStatic(this); return true; diff --git a/src/main/java/mekanism/common/network/PacketTransmitterUpdate.java b/src/main/java/mekanism/common/network/PacketTransmitterUpdate.java index 3b01c90ed..8b3a1ce1f 100644 --- a/src/main/java/mekanism/common/network/PacketTransmitterUpdate.java +++ b/src/main/java/mekanism/common/network/PacketTransmitterUpdate.java @@ -9,6 +9,7 @@ import mekanism.api.gas.GasStack; import mekanism.api.transmitters.IGridTransmitter; import mekanism.common.EnergyNetwork; import mekanism.common.FluidNetwork; +import mekanism.common.Mekanism; import mekanism.common.PacketHandler; import mekanism.common.network.PacketTransmitterUpdate.TransmitterUpdateMessage; import net.minecraft.entity.player.EntityPlayer; diff --git a/src/main/java/mekanism/common/tile/TileEntityBasicBlock.java b/src/main/java/mekanism/common/tile/TileEntityBasicBlock.java index 7cd71e50a..882b84736 100644 --- a/src/main/java/mekanism/common/tile/TileEntityBasicBlock.java +++ b/src/main/java/mekanism/common/tile/TileEntityBasicBlock.java @@ -182,7 +182,7 @@ public abstract class TileEntityBasicBlock extends TileEntity implements IWrench facing = direction; } - if(facing != clientFacing) + if(!(facing == clientFacing || worldObj.isRemote)) { Mekanism.packetHandler.sendToDimension(new TileEntityMessage(Coord4D.get(this), getNetworkedData(new ArrayList())), worldObj.provider.dimensionId); worldObj.notifyBlocksOfNeighborChange(xCoord, yCoord, zCoord, worldObj.getBlock(xCoord, yCoord, zCoord)); diff --git a/src/main/java/mekanism/common/tile/TileEntityEnergyCube.java b/src/main/java/mekanism/common/tile/TileEntityEnergyCube.java index 86e921166..2fb1fd9b1 100644 --- a/src/main/java/mekanism/common/tile/TileEntityEnergyCube.java +++ b/src/main/java/mekanism/common/tile/TileEntityEnergyCube.java @@ -65,7 +65,7 @@ public class TileEntityEnergyCube extends TileEntityElectricBlock implements IPe int newScale = getScaledEnergyLevel(20); - if(newScale != prevScale) + if(!(newScale == prevScale || worldObj.isRemote)) { Mekanism.packetHandler.sendToAllAround(new TileEntityMessage(Coord4D.get(this), getNetworkedData(new ArrayList())), Coord4D.get(this).getTargetPoint(50D)); } diff --git a/src/main/java/mekanism/common/tile/TileEntityLaser.java b/src/main/java/mekanism/common/tile/TileEntityLaser.java index e4981dca2..42cf51da7 100644 --- a/src/main/java/mekanism/common/tile/TileEntityLaser.java +++ b/src/main/java/mekanism/common/tile/TileEntityLaser.java @@ -1,18 +1,26 @@ package mekanism.common.tile; +import java.util.ArrayList; + import mekanism.api.Coord4D; import mekanism.api.lasers.LaserManager; +import mekanism.common.Mekanism; +import mekanism.common.network.PacketTileEntity.TileEntityMessage; import net.minecraft.item.ItemStack; import net.minecraftforge.common.util.ForgeDirection; +import io.netty.buffer.ByteBuf; + public class TileEntityLaser extends TileEntityElectricBlock { - public static final double LASER_ENERGY = 50000; + public static final double LASER_ENERGY = 1E10; + + public boolean on; public TileEntityLaser() { - super("Laser", 100000); + super("Laser", 2*LASER_ENERGY); inventory = new ItemStack[0]; } @@ -21,10 +29,49 @@ public class TileEntityLaser extends TileEntityElectricBlock { super.onUpdate(); - if(getEnergy() >= LASER_ENERGY) + if(worldObj.isRemote) { - LaserManager.fireLaser(Coord4D.get(this), ForgeDirection.getOrientation(facing), LASER_ENERGY, worldObj); - setEnergy(getEnergy()-LASER_ENERGY); + if(on) + { + LaserManager.fireLaserClient(Coord4D.get(this), ForgeDirection.getOrientation(facing), worldObj); + } + } + else + { + if(getEnergy() >= LASER_ENERGY) + { + if(!on) + { + on = true; + Mekanism.packetHandler.sendToAllAround(new TileEntityMessage(Coord4D.get(this), getNetworkedData(new ArrayList())), Coord4D.get(this).getTargetPoint(50D)); + } + + LaserManager.fireLaser(Coord4D.get(this), ForgeDirection.getOrientation(facing), LASER_ENERGY, worldObj); + setEnergy(getEnergy() - LASER_ENERGY); + } + else if(on) + { + on = false; + Mekanism.packetHandler.sendToAllAround(new TileEntityMessage(Coord4D.get(this), getNetworkedData(new ArrayList())), Coord4D.get(this).getTargetPoint(50D)); + } } } + + @Override + public ArrayList getNetworkedData(ArrayList data) + { + super.getNetworkedData(data); + + data.add(on); + + return data; + } + + @Override + public void handlePacketData(ByteBuf dataStream) + { + super.handlePacketData(dataStream); + + on = dataStream.readBoolean(); + } } diff --git a/src/main/java/mekanism/generators/client/gui/GuiReactorController.java b/src/main/java/mekanism/generators/client/gui/GuiReactorController.java index 44444f695..4b1312306 100644 --- a/src/main/java/mekanism/generators/client/gui/GuiReactorController.java +++ b/src/main/java/mekanism/generators/client/gui/GuiReactorController.java @@ -12,20 +12,19 @@ import mekanism.client.gui.GuiGasGauge; import mekanism.client.gui.GuiGasGauge.IGasInfoHandler; import mekanism.client.gui.GuiGauge.Type; import mekanism.client.gui.GuiMekanism; +import mekanism.client.gui.GuiNumberGauge; +import mekanism.client.gui.GuiNumberGauge.INumberInfoHandler; import mekanism.client.gui.GuiPowerBar; -import mekanism.client.gui.GuiRedstoneControl; import mekanism.client.gui.GuiSlot; -import mekanism.client.gui.GuiSlot.SlotOverlay; import mekanism.client.gui.GuiSlot.SlotType; import mekanism.common.util.MekanismUtils; import mekanism.common.util.MekanismUtils.ResourceType; -import mekanism.generators.common.MekanismGenerators; import mekanism.generators.common.inventory.container.ContainerReactorController; -import mekanism.generators.common.inventory.container.ContainerSolarGenerator; -import mekanism.generators.common.tile.TileEntitySolarGenerator; import mekanism.generators.common.tile.reactor.TileEntityReactorController; +import net.minecraft.block.BlockStaticLiquid; import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.util.IIcon; import net.minecraftforge.fluids.FluidTank; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -49,7 +48,7 @@ public class GuiReactorController extends GuiMekanism "Storing: " + MekanismUtils.getEnergyDisplay(tileEntity.getEnergy()), "Max Output: " + MekanismUtils.getEnergyDisplay(tileEntity.getMaxOutput()) + "/t"); } - }, this, MekanismUtils.getResource(ResourceType.GUI, "GuiBlank.png"))); + }, this, MekanismUtils.getResource(ResourceType.GUI, "GuiTall.png"))); guiElements.add(new GuiGasGauge(new IGasInfoHandler() { @Override @@ -57,7 +56,7 @@ public class GuiReactorController extends GuiMekanism { return tentity.deuteriumTank; } - }, Type.SMALL, this, MekanismUtils.getResource(ResourceType.GUI, "GuiBlank.png"), 124, 16)); + }, Type.SMALL, this, MekanismUtils.getResource(ResourceType.GUI, "GuiTall.png"), 124, 6)); guiElements.add(new GuiGasGauge(new IGasInfoHandler() { @Override @@ -65,7 +64,7 @@ public class GuiReactorController extends GuiMekanism { return tentity.tritiumTank; } - }, Type.SMALL, this, MekanismUtils.getResource(ResourceType.GUI, "GuiBlank.png"), 124, 46)); + }, Type.SMALL, this, MekanismUtils.getResource(ResourceType.GUI, "GuiTall.png"), 124, 36)); guiElements.add(new GuiGasGauge(new IGasInfoHandler() { @Override @@ -73,7 +72,7 @@ public class GuiReactorController extends GuiMekanism { return tentity.fuelTank; } - }, Type.STANDARD, this, MekanismUtils.getResource(ResourceType.GUI, "GuiBlank.png"), 144, 16)); + }, Type.STANDARD, this, MekanismUtils.getResource(ResourceType.GUI, "GuiTall.png"), 144, 6)); guiElements.add(new GuiFluidGauge(new IFluidInfoHandler() { @Override @@ -81,7 +80,7 @@ public class GuiReactorController extends GuiMekanism { return tentity.waterTank; } - }, Type.SMALL, this, MekanismUtils.getResource(ResourceType.GUI, "GuiBlank.png"), 78, 46)); + }, Type.SMALL, this, MekanismUtils.getResource(ResourceType.GUI, "GuiTall.png"), 78, 46)); guiElements.add(new GuiFluidGauge(new IFluidInfoHandler() { @Override @@ -89,9 +88,61 @@ public class GuiReactorController extends GuiMekanism { return tentity.steamTank; } - }, Type.SMALL, this, MekanismUtils.getResource(ResourceType.GUI, "GuiBlank.png"), 98, 46)); - guiElements.add(new GuiPowerBar(this, tileEntity, MekanismUtils.getResource(ResourceType.GUI, "GuiBlank.png"), 164, 15)); - guiElements.add(new GuiSlot(SlotType.NORMAL, this, MekanismUtils.getResource(ResourceType.GUI, "GuiBlank.png"), 98, 26)); + }, Type.SMALL, this, MekanismUtils.getResource(ResourceType.GUI, "GuiTall.png"), 98, 46)); + guiElements.add(new GuiNumberGauge(new INumberInfoHandler() + { + @Override + public IIcon getIcon() + { + return BlockStaticLiquid.getLiquidIcon("lava_still"); + } + + @Override + public double getLevel() + { + return tileEntity.getPlasmaTemp(); + } + + @Override + public double getMaxLevel() + { + return 5E8; + } + + @Override + public String getText(double level) + { + return "Plasma: " + (int)(level+23) + "C"; + } + }, Type.STANDARD, this, MekanismUtils.getResource(ResourceType.GUI, "GuiTall"), 124, 76)); + guiElements.add(new GuiNumberGauge(new INumberInfoHandler() + { + @Override + public IIcon getIcon() + { + return BlockStaticLiquid.getLiquidIcon("lava_still"); + } + + @Override + public double getLevel() + { + return tileEntity.getCaseTemp(); + } + + @Override + public double getMaxLevel() + { + return 5E8; + } + + @Override + public String getText(double level) + { + return "Case: " + (int)(level+23) + "C"; + } + }, Type.STANDARD, this, MekanismUtils.getResource(ResourceType.GUI, "GuiTall.png"), 144, 76)); + guiElements.add(new GuiPowerBar(this, tileEntity, MekanismUtils.getResource(ResourceType.GUI, "GuiTall.png"), 164, 15)); + guiElements.add(new GuiSlot(SlotType.NORMAL, this, MekanismUtils.getResource(ResourceType.GUI, "GuiTall.png"), 98, 26)); } @Override @@ -99,24 +150,21 @@ public class GuiReactorController extends GuiMekanism { super.drawGuiContainerForegroundLayer(mouseX, mouseY); - fontRendererObj.drawString(tileEntity.getInventoryName(), 30, 6, 0x404040); - fontRendererObj.drawString(MekanismUtils.localize("container.inventory"), 8, (ySize - 96) + 2, 0x404040); - if(tileEntity.getReactor() == null) + fontRendererObj.drawString(tileEntity.getInventoryName(), 6, 6, 0x404040); + if(tileEntity.getActive()) { - fontRendererObj.drawString(MekanismUtils.localize("container.reactor.notFormed"), 8, 16, 0x404040); + fontRendererObj.drawString(MekanismUtils.localize("container.reactor.formed"), 8, 16, 0x404040); } else { - fontRendererObj.drawString(MekanismUtils.localize("container.reactor.formed"), 8, 16, 0x404040); - fontRendererObj.drawString(MekanismUtils.localize("plasma") + ": " + (int)(tileEntity.getReactor().getPlasmaTemp()+23)+"C", 8, 26, 0x404040); - fontRendererObj.drawString(MekanismUtils.localize("casing") + ": " + (int)(tileEntity.getReactor().getCaseTemp()+23)+"C", 8, 36, 0x404040); + fontRendererObj.drawString(MekanismUtils.localize("container.reactor.notFormed"), 8, 16, 0x404040); } } @Override protected void drawGuiContainerBackgroundLayer(float partialTick, int mouseX, int mouseY) { - mc.renderEngine.bindTexture(MekanismUtils.getResource(ResourceType.GUI, "GuiBlank.png")); + mc.renderEngine.bindTexture(MekanismUtils.getResource(ResourceType.GUI, "GuiTall.png")); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); int guiWidth = (width - xSize) / 2; int guiHeight = (height - ySize) / 2; diff --git a/src/main/java/mekanism/generators/common/FusionReactor.java b/src/main/java/mekanism/generators/common/FusionReactor.java index d1ab0a00b..c2b6e6a12 100644 --- a/src/main/java/mekanism/generators/common/FusionReactor.java +++ b/src/main/java/mekanism/generators/common/FusionReactor.java @@ -15,9 +15,11 @@ import mekanism.api.reactor.IFusionReactor; import mekanism.api.reactor.INeutronCapture; import mekanism.api.reactor.IReactorBlock; import mekanism.common.Mekanism; +import mekanism.generators.common.item.ItemHohlraum; import mekanism.generators.common.tile.reactor.TileEntityReactorController; import net.minecraft.block.Block; +import net.minecraft.item.ItemCoal; import net.minecraft.tileentity.TileEntity; import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.fluids.FluidContainerRegistry; @@ -61,7 +63,6 @@ public class FusionReactor implements IFusionReactor public static double caseAirConductivity = 0.1; public boolean burning = false; - public boolean hasHohlraum = false; public boolean activelyCooled = true; public boolean formed = false; @@ -77,6 +78,11 @@ public class FusionReactor implements IFusionReactor plasmaTemperature += energyAdded / plasmaHeatCapacity; } + public boolean hasHohlraum() + { + return controller != null && controller.inventory[0] != null && controller.inventory[0].getItem() instanceof ItemCoal; + } + @Override public void simulate() { @@ -90,7 +96,7 @@ public class FusionReactor implements IFusionReactor if(plasmaTemperature >= burnTemperature) { //If we're not burning yet we need a hohlraum to ignite - if(!burning && hasHohlraum) + if(!burning && hasHohlraum()) { vaporiseHohlraum(); } @@ -117,7 +123,11 @@ public class FusionReactor implements IFusionReactor public void vaporiseHohlraum() { getFuelTank().receive(new GasStack(GasRegistry.getGas("fusionFuelDT"), 10), true); - hasHohlraum = false; + controller.inventory[0].stackSize -= 1; + if(controller.inventory[0].stackSize == 0) + { + controller.inventory[0] = null; + } burning = true; } @@ -391,4 +401,10 @@ public class FusionReactor implements IFusionReactor return true; } + + public boolean isFormed() + { + return formed; + } + } diff --git a/src/main/java/mekanism/generators/common/inventory/container/ContainerReactorController.java b/src/main/java/mekanism/generators/common/inventory/container/ContainerReactorController.java index 8600ee349..91808e4b8 100644 --- a/src/main/java/mekanism/generators/common/inventory/container/ContainerReactorController.java +++ b/src/main/java/mekanism/generators/common/inventory/container/ContainerReactorController.java @@ -21,14 +21,6 @@ public class ContainerReactorController extends Container addSlotToContainer(new Slot(tentity, 0, 99, 27)); int slotX; - for(slotX = 0; slotX < 3; ++slotX) - { - for(int slotY = 0; slotY < 9; ++slotY) - { - addSlotToContainer(new Slot(inventory, slotY + slotX * 9 + 9, 8 + slotY * 18, 84 + slotX * 18)); - } - } - for(slotX = 0; slotX < 9; ++slotX) { addSlotToContainer(new Slot(inventory, slotX, 8 + slotX * 18, 142)); diff --git a/src/main/java/mekanism/generators/common/item/ItemHohlraum.java b/src/main/java/mekanism/generators/common/item/ItemHohlraum.java new file mode 100644 index 000000000..b1670f990 --- /dev/null +++ b/src/main/java/mekanism/generators/common/item/ItemHohlraum.java @@ -0,0 +1,7 @@ +package mekanism.generators.common.item; + +import mekanism.common.item.ItemMekanism; + +public class ItemHohlraum extends ItemMekanism +{ +} diff --git a/src/main/java/mekanism/generators/common/tile/reactor/TileEntityReactorController.java b/src/main/java/mekanism/generators/common/tile/reactor/TileEntityReactorController.java index 5d0760fe1..161cc1e8d 100644 --- a/src/main/java/mekanism/generators/common/tile/reactor/TileEntityReactorController.java +++ b/src/main/java/mekanism/generators/common/tile/reactor/TileEntityReactorController.java @@ -57,12 +57,30 @@ public class TileEntityReactorController extends TileEntityReactorBlock implemen getReactor().formMultiblock(); } + public double getPlasmaTemp() + { + if(getReactor() == null || !getReactor().isFormed()) + { + return 0; + } + return getReactor().getPlasmaTemp(); + } + + public double getCaseTemp() + { + if(getReactor() == null || !getReactor().isFormed()) + { + return 0; + } + return getReactor().getCaseTemp(); + } + @Override public void onUpdate() { super.onUpdate(); - if(getReactor() != null) + if(getReactor() != null && getReactor().isFormed()) { getReactor().simulate(); } @@ -73,7 +91,7 @@ public class TileEntityReactorController extends TileEntityReactorBlock implemen { super.getNetworkedData(data); - data.add(getReactor() != null); + data.add(getReactor() != null && getReactor().isFormed()); if(getReactor() != null) { data.add(getReactor().getPlasmaTemp()); @@ -100,6 +118,7 @@ public class TileEntityReactorController extends TileEntityReactorBlock implemen setReactor(new FusionReactor(this)); MekanismUtils.updateBlock(worldObj, xCoord, yCoord, zCoord); } + ((FusionReactor)getReactor()).formed = true; getReactor().setPlasmaTemp(dataStream.readDouble()); getReactor().setCaseTemp(dataStream.readDouble()); fuelTank.setGas(new GasStack(GasRegistry.getGas("fusionFuelDT"), dataStream.readInt())); @@ -118,7 +137,7 @@ public class TileEntityReactorController extends TileEntityReactorBlock implemen @Override public boolean getActive() { - return getReactor() != null; + return getReactor() != null && getReactor().isFormed(); } @Override diff --git a/src/main/resources/assets/mekanism/gui/GuiTall.png b/src/main/resources/assets/mekanism/gui/GuiTall.png new file mode 100644 index 000000000..f1edcc4d3 Binary files /dev/null and b/src/main/resources/assets/mekanism/gui/GuiTall.png differ diff --git a/src/main/resources/assets/mekanism/lang/en_US.lang b/src/main/resources/assets/mekanism/lang/en_US.lang index 3eb24488d..89ec5fa37 100644 --- a/src/main/resources/assets/mekanism/lang/en_US.lang +++ b/src/main/resources/assets/mekanism/lang/en_US.lang @@ -657,6 +657,9 @@ tile.Generator.BioGenerator.name=Bio-Generator tile.Generator.AdvancedSolarGenerator.name=Advanced Solar Generator tile.Generator.WindTurbine.name=Wind Turbine +//Reactor Blocks +tile.Reactor.ReactorController.name=Reactor Controller + //Gui text gui.heatGenerator.fuel=Fuel gui.solarGenerator.sun=Sun diff --git a/src/main/resources/assets/mekanism/particles/laser.png b/src/main/resources/assets/mekanism/particles/laser.png new file mode 100644 index 000000000..d2ddfa721 Binary files /dev/null and b/src/main/resources/assets/mekanism/particles/laser.png differ diff --git a/src/main/resources/assets/mekanism/textures/blocks/LiquidChlorine.png.mcmeta b/src/main/resources/assets/mekanism/textures/blocks/LiquidChlorine.png.mcmeta new file mode 100644 index 000000000..4b721e09a --- /dev/null +++ b/src/main/resources/assets/mekanism/textures/blocks/LiquidChlorine.png.mcmeta @@ -0,0 +1,5 @@ +{ + "animation": { + "frametime": 2 + } +}