Work on reactor interface a tad, work on Solar Neutron Activator

This commit is contained in:
Aidan C. Brady 2015-02-27 00:28:46 -05:00
parent 89de5ccea7
commit 9c7831d07b
13 changed files with 131 additions and 12 deletions

View file

@ -28,7 +28,6 @@ public class GuiSolarNeutronActivator extends GuiMekanism
tileEntity = tentity;
guiElements.add(new GuiRedstoneControl(this, tileEntity, MekanismUtils.getResource(ResourceType.GUI, "GuiBlank.png")));
guiElements.add(new GuiUpgradeTab(this, tileEntity, MekanismUtils.getResource(ResourceType.GUI, "GuiBlank.png")));
guiElements.add(new GuiSlot(SlotType.NORMAL, this, MekanismUtils.getResource(ResourceType.GUI, "GuiBlank.png"), 4, 24).with(SlotOverlay.PLUS));
guiElements.add(new GuiSlot(SlotType.NORMAL, this, MekanismUtils.getResource(ResourceType.GUI, "GuiBlank.png"), 4, 55).with(SlotOverlay.MINUS));
@ -64,6 +63,7 @@ public class GuiSolarNeutronActivator extends GuiMekanism
int yAxis = (mouseY - (height - ySize) / 2);
fontRendererObj.drawString(tileEntity.getInventoryName(), 26, 4, 0x404040);
fontRendererObj.drawString(MekanismUtils.localize("container.inventory"), 8, (ySize - 96) + 4, 0x404040);
super.drawGuiContainerForegroundLayer(mouseX, mouseY);
}

View file

@ -429,6 +429,19 @@ public final class RecipeHandler
return null;
}
public static SolarNeutronRecipe getSolarNeutronRecipe(GasInput input)
{
if(input.isValid())
{
HashMap<GasInput, SolarNeutronRecipe> recipes = Recipe.SOLAR_NEUTRON_ACTIVATOR.get();
SolarNeutronRecipe recipe = recipes.get(input);
return recipe == null ? null : recipe.copy();
}
return null;
}
public static PressurizedRecipe getPRCRecipe(PressurizedInput input)
{

View file

@ -99,6 +99,8 @@ public class TileEntityChemicalCrystallizer extends TileEntityNoisyElectricBlock
@Override
public void onUpdate()
{
super.onUpdate();
if(worldObj.isRemote && updateDelay > 0)
{
updateDelay--;

View file

@ -75,6 +75,8 @@ public class TileEntityChemicalInfuser extends TileEntityNoisyElectricBlock impl
@Override
public void onUpdate()
{
super.onUpdate();
if(worldObj.isRemote && updateDelay > 0)
{
updateDelay--;

View file

@ -75,6 +75,8 @@ public class TileEntityChemicalOxidizer extends TileEntityNoisyElectricBlock imp
@Override
public void onUpdate()
{
super.onUpdate();
if(worldObj.isRemote && updateDelay > 0)
{
updateDelay--;

View file

@ -88,6 +88,8 @@ public class TileEntityChemicalWasher extends TileEntityNoisyElectricBlock imple
@Override
public void onUpdate()
{
super.onUpdate();
if(worldObj.isRemote && updateDelay > 0)
{
updateDelay--;

View file

@ -81,6 +81,8 @@ public class TileEntityRotaryCondensentrator extends TileEntityElectricBlock imp
@Override
public void onUpdate()
{
super.onUpdate();
if(worldObj.isRemote)
{
if(updateDelay > 0)

View file

@ -19,9 +19,13 @@ import mekanism.common.base.IDropperHandler;
import mekanism.common.base.IRedstoneControl;
import mekanism.common.base.ISustainedData;
import mekanism.common.network.PacketTileEntity.TileEntityMessage;
import mekanism.common.recipe.RecipeHandler;
import mekanism.common.recipe.inputs.GasInput;
import mekanism.common.recipe.machines.SolarNeutronRecipe;
import mekanism.common.util.MekanismUtils;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.util.ForgeDirection;
public class TileEntitySolarNeutronActivator extends TileEntityContainerBlock implements IRedstoneControl, IBoundingBlock, IGasHandler, ITubeConnection, IActiveState, ISustainedData, IDropperHandler
@ -39,6 +43,8 @@ public class TileEntitySolarNeutronActivator extends TileEntityContainerBlock im
public int gasOutput = 256;
public SolarNeutronRecipe cachedRecipe;
/** This machine's current RedstoneControl type. */
public RedstoneControl controlType = RedstoneControl.DISABLED;
@ -51,7 +57,85 @@ public class TileEntitySolarNeutronActivator extends TileEntityContainerBlock im
@Override
public void onUpdate()
{
if(worldObj.isRemote && updateDelay > 0)
{
updateDelay--;
if(updateDelay == 0 && clientActive != isActive)
{
isActive = clientActive;
MekanismUtils.updateBlock(worldObj, xCoord, yCoord, zCoord);
}
}
if(!worldObj.isRemote)
{
SolarNeutronRecipe recipe = getRecipe();
if(updateDelay > 0)
{
updateDelay--;
if(updateDelay == 0 && clientActive != isActive)
{
Mekanism.packetHandler.sendToReceivers(new TileEntityMessage(Coord4D.get(this), getNetworkedData(new ArrayList())), new Range4D(Coord4D.get(this)));
}
}
//Buckets
if(canOperate(recipe) && MekanismUtils.canFunction(this))
{
setActive(true);
operate(recipe);
}
else {
setActive(false);
}
if(outputTank.getGas() != null)
{
GasStack toSend = new GasStack(outputTank.getGas().getGas(), Math.min(outputTank.getStored(), gasOutput));
TileEntity tileEntity = Coord4D.get(this).getFromSide(ForgeDirection.getOrientation(facing)).getTileEntity(worldObj);
if(tileEntity instanceof IGasHandler)
{
if(((IGasHandler)tileEntity).canReceiveGas(ForgeDirection.getOrientation(facing).getOpposite(), outputTank.getGas().getGas()))
{
outputTank.draw(((IGasHandler)tileEntity).receiveGas(ForgeDirection.getOrientation(facing).getOpposite(), toSend, true), true);
}
}
}
}
}
public SolarNeutronRecipe getRecipe()
{
GasInput input = getInput();
if(cachedRecipe == null || !input.testEquality(cachedRecipe.getInput()))
{
cachedRecipe = RecipeHandler.getSolarNeutronRecipe(getInput());
}
return cachedRecipe;
}
public GasInput getInput()
{
return new GasInput(inputTank.getGas());
}
public boolean canOperate(SolarNeutronRecipe recipe)
{
return recipe != null && recipe.canOperate(inputTank, outputTank);
}
public void operate(SolarNeutronRecipe recipe)
{
recipe.operate(inputTank, outputTank);
}
@Override

View file

@ -57,10 +57,10 @@ public class GuiReactorController extends GuiMekanism
if(tileEntity.getActive())
{
fontRendererObj.drawString(MekanismUtils.localize("container.reactor.formed"), 8, 16, 0x404040);
fontRendererObj.drawString(MekanismUtils.localize("gui.formed"), 8, 16, 0x404040);
}
else {
fontRendererObj.drawString(MekanismUtils.localize("container.reactor.notFormed"), 8, 16, 0x404040);
fontRendererObj.drawString(MekanismUtils.localize("gui.incomplete"), 8, 16, 0x404040);
}
}

View file

@ -24,15 +24,15 @@ import mekanism.common.util.MekanismUtils.ResourceType;
import mekanism.generators.common.MekanismGenerators;
import mekanism.generators.common.network.PacketGeneratorsGui.GeneratorsGuiMessage;
import mekanism.generators.common.tile.reactor.TileEntityReactorController;
import net.minecraft.client.gui.GuiTextField;
import net.minecraft.entity.player.InventoryPlayer;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import org.lwjgl.input.Keyboard;
import org.lwjgl.opengl.GL11;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class GuiReactorFuel extends GuiMekanism
{
@ -104,7 +104,9 @@ public class GuiReactorFuel extends GuiMekanism
super.drawGuiContainerForegroundLayer(mouseX, mouseY);
fontRendererObj.drawString(tileEntity.getInventoryName(), 46, 6, 0x404040);
fontRendererObj.drawString(MekanismUtils.localize("gui.injectionRate") + ": " + (tileEntity.getReactor() == null ? "None" : tileEntity.getReactor().getInjectionRate()), 55, 35, 0x404040);
String str = MekanismUtils.localize("gui.reactor.injectionRate") + ": " + (tileEntity.getReactor() == null ? "None" : tileEntity.getReactor().getInjectionRate());
fontRendererObj.drawString(str, (xSize / 2) - (fontRendererObj.getStringWidth(str) / 2), 35, 0x404040);
fontRendererObj.drawString("Edit Rate" + ":", 50, 117, 0x404040);
}
@Override
@ -157,7 +159,6 @@ public class GuiReactorFuel extends GuiMekanism
SoundHandler.playSound("gui.button.press");
MekanismGenerators.packetHandler.sendToServer(new GeneratorsGuiMessage(Coord4D.get(tileEntity), 10));
}
}
}
@ -209,7 +210,7 @@ public class GuiReactorFuel extends GuiMekanism
String prevRad = injectionRateField != null ? injectionRateField.getText() : "";
injectionRateField = new GuiTextField(fontRendererObj, guiWidth + 75, guiHeight + 115, 26, 11);
injectionRateField = new GuiTextField(fontRendererObj, guiWidth + 98, guiHeight + 115, 26, 11);
injectionRateField.setMaxStringLength(2);
injectionRateField.setText(prevRad);
}

View file

@ -52,9 +52,8 @@ public class GuiReactorStats extends GuiMekanism
@Override
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY)
{
super.drawGuiContainerForegroundLayer(mouseX, mouseY);
fontRendererObj.drawString(tileEntity.getInventoryName(), 46, 6, 0x404040);
if(tileEntity.isFormed())
{
fontRendererObj.drawString(EnumColor.DARK_GREEN + MekanismUtils.localize("gui.passive"), 6, 26, 0x404040);
@ -72,6 +71,8 @@ public class GuiReactorStats extends GuiMekanism
fontRendererObj.drawString(MekanismUtils.localize("gui.passiveGeneration") + ": " + MekanismUtils.getEnergyDisplay(tileEntity.getReactor().getPassiveGeneration(true, false))+"/t", 16, 142, 0x404040);
fontRendererObj.drawString(MekanismUtils.localize("gui.steamProduction") + ": " + nf.format(tileEntity.getReactor().getSteamPerTick(false)) + "mB/t", 16, 152, 0x404040);
}
super.drawGuiContainerForegroundLayer(mouseX, mouseY);
}
@Override
@ -112,6 +113,5 @@ public class GuiReactorStats extends GuiMekanism
SoundHandler.playSound("gui.button.press");
MekanismGenerators.packetHandler.sendToServer(new GeneratorsGuiMessage(Coord4D.get(tileEntity), 10));
}
}
}}

View file

@ -119,6 +119,7 @@ public class FusionReactor implements IFusionReactor
injectFuel();
int fuelBurned = burnFuel();
neutronFlux(fuelBurned);
if(fuelBurned == 0)
{
burning = false;
@ -229,6 +230,7 @@ public class FusionReactor implements IFusionReactor
{
source.simulateHeat();
}
applyTemperatureChange();
}

View file

@ -251,6 +251,7 @@ gas.brine=Gaseous Brine
gas.deuterium=Deuterium
gas.tritium=Tritium
gas.lithium=Lithium
gas.fusionFuelDT=D-T Fuel
gas.iron=Iron Slurry
gas.gold=Gold Slurry
@ -287,6 +288,8 @@ fluid.ethene=Liquid Ethylene
fluid.sodium=Liquid Sodium
fluid.heavyWater=Heavy Water
fluid.lithium=Liquid Lithium
fluid.deuterium=Liquid Deuterium
fluid.tritium=Liquid Tritium
//OreGas names
oregas.iron=Iron Ore
@ -385,6 +388,12 @@ gui.min=Min
gui.max=Max
gui.delay=Delay
gui.noDelay=No Delay
gui.fuel=Fuel
gui.heat=Heat
gui.formed=Formed
gui.incomplete=Incomplete
gui.reactor.injectionRate=Injection Rate
gui.upgrades=Upgrades
gui.upgrades.supported=Supported