Better NEI integration, fixed a major issue with the Chemical Washer recipe handler, finished off Solar Neutron Activator
This commit is contained in:
parent
c4c2f97170
commit
dd254ef326
15 changed files with 391 additions and 66 deletions
|
@ -28,8 +28,8 @@ public class GuiSolarNeutronActivator extends GuiMekanism
|
|||
tileEntity = tentity;
|
||||
|
||||
guiElements.add(new GuiRedstoneControl(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));
|
||||
guiElements.add(new GuiSlot(SlotType.NORMAL, this, MekanismUtils.getResource(ResourceType.GUI, "GuiBlank.png"), 154, 55).with(SlotOverlay.PLUS));
|
||||
|
||||
guiElements.add(new GuiGasGauge(new IGasInfoHandler() {
|
||||
@Override
|
||||
|
|
|
@ -1,6 +1,10 @@
|
|||
package mekanism.client.nei;
|
||||
|
||||
import java.awt.*;
|
||||
import static codechicken.lib.gui.GuiDraw.changeTexture;
|
||||
import static codechicken.lib.gui.GuiDraw.drawTexturedModalRect;
|
||||
|
||||
import java.awt.Point;
|
||||
import java.awt.Rectangle;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
|
@ -9,8 +13,8 @@ import mekanism.client.gui.GuiChemicalCrystallizer;
|
|||
import mekanism.common.ObfuscatedNames;
|
||||
import mekanism.common.recipe.RecipeHandler.Recipe;
|
||||
import mekanism.common.recipe.machines.CrystallizerRecipe;
|
||||
import mekanism.common.util.LangUtils;
|
||||
import mekanism.common.util.MekanismUtils;
|
||||
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
|
@ -23,9 +27,6 @@ import codechicken.nei.PositionedStack;
|
|||
import codechicken.nei.recipe.GuiRecipe;
|
||||
import codechicken.nei.recipe.TemplateRecipeHandler;
|
||||
|
||||
import static codechicken.lib.gui.GuiDraw.changeTexture;
|
||||
import static codechicken.lib.gui.GuiDraw.drawTexturedModalRect;
|
||||
|
||||
public class ChemicalCrystallizerRecipeHandler extends BaseRecipeHandler
|
||||
{
|
||||
private int ticksPassed;
|
||||
|
@ -140,7 +141,7 @@ public class ChemicalCrystallizerRecipeHandler extends BaseRecipeHandler
|
|||
|
||||
if(xAxis >= 6 && xAxis <= 22 && yAxis >= 5+13 && yAxis <= 63+13)
|
||||
{
|
||||
currenttip.add(((CachedIORecipe)arecipes.get(recipe)).inputStack.getGas().getLocalizedName());
|
||||
currenttip.add(LangUtils.localizeGasStack(((CachedIORecipe)arecipes.get(recipe)).inputStack));
|
||||
}
|
||||
|
||||
return super.handleTooltip(gui, currenttip, recipe);
|
||||
|
|
|
@ -1,6 +1,10 @@
|
|||
package mekanism.client.nei;
|
||||
|
||||
import java.awt.*;
|
||||
import static codechicken.lib.gui.GuiDraw.changeTexture;
|
||||
import static codechicken.lib.gui.GuiDraw.drawTexturedModalRect;
|
||||
|
||||
import java.awt.Point;
|
||||
import java.awt.Rectangle;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
|
@ -10,8 +14,8 @@ import mekanism.client.gui.GuiChemicalDissolutionChamber;
|
|||
import mekanism.common.ObfuscatedNames;
|
||||
import mekanism.common.recipe.RecipeHandler.Recipe;
|
||||
import mekanism.common.recipe.machines.DissolutionRecipe;
|
||||
import mekanism.common.util.LangUtils;
|
||||
import mekanism.common.util.MekanismUtils;
|
||||
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
|
@ -24,9 +28,6 @@ import codechicken.nei.PositionedStack;
|
|||
import codechicken.nei.recipe.GuiRecipe;
|
||||
import codechicken.nei.recipe.TemplateRecipeHandler;
|
||||
|
||||
import static codechicken.lib.gui.GuiDraw.changeTexture;
|
||||
import static codechicken.lib.gui.GuiDraw.drawTexturedModalRect;
|
||||
|
||||
public class ChemicalDissolutionChamberRecipeHandler extends BaseRecipeHandler
|
||||
{
|
||||
private int ticksPassed;
|
||||
|
@ -145,7 +146,7 @@ public class ChemicalDissolutionChamberRecipeHandler extends BaseRecipeHandler
|
|||
}
|
||||
else if(xAxis >= 134 && xAxis <= 150 && yAxis >= 14+4 && yAxis <= 72+4)
|
||||
{
|
||||
currenttip.add(((CachedIORecipe)arecipes.get(recipe)).outputStack.getGas().getLocalizedName());
|
||||
currenttip.add(LangUtils.localizeGasStack(((CachedIORecipe)arecipes.get(recipe)).outputStack));
|
||||
}
|
||||
|
||||
return super.handleTooltip(gui, currenttip, recipe);
|
||||
|
|
|
@ -10,8 +10,8 @@ import mekanism.common.ObfuscatedNames;
|
|||
import mekanism.common.recipe.RecipeHandler.Recipe;
|
||||
import mekanism.common.recipe.inputs.ChemicalPairInput;
|
||||
import mekanism.common.recipe.machines.ChemicalInfuserRecipe;
|
||||
import mekanism.common.util.LangUtils;
|
||||
import mekanism.common.util.MekanismUtils;
|
||||
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
@ -21,7 +21,6 @@ import codechicken.nei.NEIClientConfig;
|
|||
import codechicken.nei.PositionedStack;
|
||||
import codechicken.nei.recipe.GuiRecipe;
|
||||
import codechicken.nei.recipe.TemplateRecipeHandler;
|
||||
|
||||
import static codechicken.lib.gui.GuiDraw.changeTexture;
|
||||
import static codechicken.lib.gui.GuiDraw.drawTexturedModalRect;
|
||||
|
||||
|
@ -166,15 +165,15 @@ public class ChemicalInfuserRecipeHandler extends BaseRecipeHandler
|
|||
|
||||
if(xAxis >= 26 && xAxis <= 42 && yAxis >= 14+13 && yAxis <= 72+13)
|
||||
{
|
||||
currenttip.add(((CachedIORecipe)arecipes.get(recipe)).chemicalInput.leftGas.getGas().getLocalizedName());
|
||||
currenttip.add(LangUtils.localizeGasStack(((CachedIORecipe)arecipes.get(recipe)).chemicalInput.leftGas));
|
||||
}
|
||||
else if(xAxis >= 80 && xAxis <= 96 && yAxis >= 5+13 && yAxis <= 63+13)
|
||||
{
|
||||
currenttip.add(((CachedIORecipe)arecipes.get(recipe)).outputStack.getGas().getLocalizedName());
|
||||
currenttip.add(LangUtils.localizeGasStack(((CachedIORecipe)arecipes.get(recipe)).outputStack));
|
||||
}
|
||||
else if(xAxis >= 134 && xAxis <= 150 && yAxis >= 14+13 && yAxis <= 72+13)
|
||||
{
|
||||
currenttip.add(((CachedIORecipe)arecipes.get(recipe)).chemicalInput.rightGas.getGas().getLocalizedName());
|
||||
currenttip.add(LangUtils.localizeGasStack(((CachedIORecipe)arecipes.get(recipe)).chemicalInput.rightGas));
|
||||
}
|
||||
|
||||
return super.handleTooltip(gui, currenttip, recipe);
|
||||
|
|
|
@ -1,6 +1,10 @@
|
|||
package mekanism.client.nei;
|
||||
|
||||
import java.awt.*;
|
||||
import static codechicken.lib.gui.GuiDraw.changeTexture;
|
||||
import static codechicken.lib.gui.GuiDraw.drawTexturedModalRect;
|
||||
|
||||
import java.awt.Point;
|
||||
import java.awt.Rectangle;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
|
@ -18,9 +22,9 @@ import mekanism.client.gui.GuiSlot.SlotType;
|
|||
import mekanism.common.ObfuscatedNames;
|
||||
import mekanism.common.recipe.RecipeHandler.Recipe;
|
||||
import mekanism.common.recipe.machines.OxidationRecipe;
|
||||
import mekanism.common.util.LangUtils;
|
||||
import mekanism.common.util.MekanismUtils;
|
||||
import mekanism.common.util.MekanismUtils.ResourceType;
|
||||
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
|
@ -33,9 +37,6 @@ import codechicken.nei.PositionedStack;
|
|||
import codechicken.nei.recipe.GuiRecipe;
|
||||
import codechicken.nei.recipe.TemplateRecipeHandler;
|
||||
|
||||
import static codechicken.lib.gui.GuiDraw.changeTexture;
|
||||
import static codechicken.lib.gui.GuiDraw.drawTexturedModalRect;
|
||||
|
||||
public class ChemicalOxidizerRecipeHandler extends BaseRecipeHandler
|
||||
{
|
||||
private int ticksPassed;
|
||||
|
@ -173,7 +174,7 @@ public class ChemicalOxidizerRecipeHandler extends BaseRecipeHandler
|
|||
|
||||
if(xAxis >= 134-5 && xAxis <= 150-5 && yAxis >= 14-11 && yAxis <= 72-11)
|
||||
{
|
||||
currenttip.add(((CachedIORecipe)arecipes.get(recipe)).outputStack.getGas().getLocalizedName());
|
||||
currenttip.add(LangUtils.localizeGasStack(((CachedIORecipe)arecipes.get(recipe)).outputStack));
|
||||
}
|
||||
|
||||
return super.handleTooltip(gui, currenttip, recipe);
|
||||
|
|
|
@ -1,6 +1,10 @@
|
|||
package mekanism.client.nei;
|
||||
|
||||
import java.awt.*;
|
||||
import static codechicken.lib.gui.GuiDraw.changeTexture;
|
||||
import static codechicken.lib.gui.GuiDraw.drawTexturedModalRect;
|
||||
|
||||
import java.awt.Point;
|
||||
import java.awt.Rectangle;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
|
@ -9,8 +13,8 @@ import mekanism.client.gui.GuiChemicalWasher;
|
|||
import mekanism.common.ObfuscatedNames;
|
||||
import mekanism.common.recipe.RecipeHandler.Recipe;
|
||||
import mekanism.common.recipe.machines.WasherRecipe;
|
||||
import mekanism.common.util.LangUtils;
|
||||
import mekanism.common.util.MekanismUtils;
|
||||
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
@ -23,9 +27,6 @@ import codechicken.nei.PositionedStack;
|
|||
import codechicken.nei.recipe.GuiRecipe;
|
||||
import codechicken.nei.recipe.TemplateRecipeHandler;
|
||||
|
||||
import static codechicken.lib.gui.GuiDraw.changeTexture;
|
||||
import static codechicken.lib.gui.GuiDraw.drawTexturedModalRect;
|
||||
|
||||
public class ChemicalWasherRecipeHandler extends BaseRecipeHandler
|
||||
{
|
||||
private int ticksPassed;
|
||||
|
@ -151,7 +152,7 @@ public class ChemicalWasherRecipeHandler extends BaseRecipeHandler
|
|||
{
|
||||
for(WasherRecipe irecipe : getRecipes())
|
||||
{
|
||||
if(irecipe.getOutput().output.isGasEqual((GasStack)ingredients[0]))
|
||||
if(irecipe.getInput().ingredient.isGasEqual((GasStack)ingredients[0]))
|
||||
{
|
||||
arecipes.add(new CachedIORecipe(irecipe));
|
||||
}
|
||||
|
@ -176,11 +177,11 @@ public class ChemicalWasherRecipeHandler extends BaseRecipeHandler
|
|||
}
|
||||
else if(xAxis >= 27 && xAxis <= 43 && yAxis >= 14+13 && yAxis <= 72+13)
|
||||
{
|
||||
currenttip.add(((CachedIORecipe)arecipes.get(recipe)).inputStack.getGas().getLocalizedName());
|
||||
currenttip.add(LangUtils.localizeGasStack(((CachedIORecipe)arecipes.get(recipe)).inputStack));
|
||||
}
|
||||
else if(xAxis >= 134 && xAxis <= 150 && yAxis >= 14+13 && yAxis <= 72+13)
|
||||
{
|
||||
currenttip.add(((CachedIORecipe)arecipes.get(recipe)).outputStack.getGas().getLocalizedName());
|
||||
currenttip.add(LangUtils.localizeGasStack(((CachedIORecipe)arecipes.get(recipe)).outputStack));
|
||||
}
|
||||
|
||||
return super.handleTooltip(gui, currenttip, recipe);
|
||||
|
|
|
@ -17,11 +17,10 @@ import mekanism.client.gui.GuiPrecisionSawmill;
|
|||
import mekanism.client.gui.GuiPurificationChamber;
|
||||
import mekanism.client.gui.GuiRotaryCondensentrator;
|
||||
import mekanism.client.gui.GuiSolarEvaporationController;
|
||||
import mekanism.client.gui.GuiSolarNeutronActivator;
|
||||
import mekanism.common.MekanismBlocks;
|
||||
import mekanism.common.MekanismItems;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import codechicken.nei.api.API;
|
||||
import codechicken.nei.api.IConfigureNEI;
|
||||
import codechicken.nei.guihook.GuiContainerManager;
|
||||
|
@ -84,6 +83,9 @@ public class NEIMekanismConfig implements IConfigureNEI
|
|||
|
||||
API.registerRecipeHandler(new PRCRecipeHandler());
|
||||
API.registerUsageHandler(new PRCRecipeHandler());
|
||||
|
||||
API.registerRecipeHandler(new SolarNeutronRecipeHandler());
|
||||
API.registerUsageHandler(new SolarNeutronRecipeHandler());
|
||||
|
||||
API.setGuiOffset(GuiEnrichmentChamber.class, 16, 6);
|
||||
API.setGuiOffset(GuiOsmiumCompressor.class, 16, 6);
|
||||
|
@ -103,6 +105,7 @@ public class NEIMekanismConfig implements IConfigureNEI
|
|||
API.setGuiOffset(GuiChemicalCrystallizer.class, ChemicalCrystallizerRecipeHandler.xOffset, ChemicalCrystallizerRecipeHandler.yOffset);
|
||||
API.setGuiOffset(GuiPRC.class, PRCRecipeHandler.xOffset, PRCRecipeHandler.yOffset);
|
||||
API.setGuiOffset(GuiSolarEvaporationController.class, SolarEvaporationRecipeHandler.xOffset, SolarEvaporationRecipeHandler.yOffset);
|
||||
API.setGuiOffset(GuiSolarNeutronActivator.class, SolarNeutronRecipeHandler.xOffset, SolarNeutronRecipeHandler.yOffset);
|
||||
|
||||
GuiContainerManager.addSlotClickHandler(new MekanismSlotClickHandler());
|
||||
|
||||
|
@ -121,6 +124,6 @@ public class NEIMekanismConfig implements IConfigureNEI
|
|||
@Override
|
||||
public String getVersion()
|
||||
{
|
||||
return "1.3";
|
||||
return "8.0.0";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -270,11 +270,11 @@ public class PRCRecipeHandler extends BaseRecipeHandler
|
|||
}
|
||||
else if(xAxis >= 29-5 && xAxis <= 45-5 && yAxis >= 11-10 && yAxis <= 69-10)
|
||||
{
|
||||
currenttip.add(((CachedIORecipe)arecipes.get(recipe)).pressurizedRecipe.getInput().getGas().getGas().getLocalizedName());
|
||||
currenttip.add(LangUtils.localizeGasStack(((CachedIORecipe)arecipes.get(recipe)).pressurizedRecipe.getInput().getGas()));
|
||||
}
|
||||
else if(xAxis >= 141-5 && xAxis <= 157-5 && yAxis >= 41-10 && yAxis <= 69-10)
|
||||
{
|
||||
currenttip.add(((CachedIORecipe)arecipes.get(recipe)).pressurizedRecipe.getOutput().getGasOutput().getGas().getLocalizedName());
|
||||
currenttip.add(LangUtils.localizeGasStack(((CachedIORecipe)arecipes.get(recipe)).pressurizedRecipe.getOutput().getGasOutput()));
|
||||
}
|
||||
|
||||
return super.handleTooltip(gui, currenttip, recipe);
|
||||
|
|
|
@ -185,11 +185,11 @@ public class RotaryCondensentratorRecipeHandler extends BaseRecipeHandler
|
|||
|
||||
if(xAxis >= 26 && xAxis <= 42 && yAxis >= 14+4 && yAxis <= 72+4)
|
||||
{
|
||||
currenttip.add(LangUtils.localiseGasStack(((CachedIORecipe) arecipes.get(recipe)).gasStack));
|
||||
currenttip.add(LangUtils.localizeGasStack(((CachedIORecipe)arecipes.get(recipe)).gasStack));
|
||||
}
|
||||
else if(xAxis >= 134 && xAxis <= 150 && yAxis >= 14+4 && yAxis <= 72+4)
|
||||
{
|
||||
currenttip.add(LangUtils.localizeFluidStack(((CachedIORecipe) arecipes.get(recipe)).fluidStack));
|
||||
currenttip.add(LangUtils.localizeFluidStack(((CachedIORecipe)arecipes.get(recipe)).fluidStack));
|
||||
}
|
||||
|
||||
return super.handleTooltip(gui, currenttip, recipe);
|
||||
|
|
289
src/main/java/mekanism/client/nei/SolarNeutronRecipeHandler.java
Normal file
289
src/main/java/mekanism/client/nei/SolarNeutronRecipeHandler.java
Normal file
|
@ -0,0 +1,289 @@
|
|||
package mekanism.client.nei;
|
||||
|
||||
import static codechicken.lib.gui.GuiDraw.changeTexture;
|
||||
import static codechicken.lib.gui.GuiDraw.drawTexturedModalRect;
|
||||
|
||||
import java.awt.Point;
|
||||
import java.awt.Rectangle;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import mekanism.api.gas.GasStack;
|
||||
import mekanism.client.gui.GuiSolarNeutronActivator;
|
||||
import mekanism.client.nei.RotaryCondensentratorRecipeHandler.CachedIORecipe;
|
||||
import mekanism.common.ObfuscatedNames;
|
||||
import mekanism.common.recipe.RecipeHandler.Recipe;
|
||||
import mekanism.common.recipe.machines.SolarNeutronRecipe;
|
||||
import mekanism.common.util.LangUtils;
|
||||
import mekanism.common.util.MekanismUtils;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import codechicken.lib.gui.GuiDraw;
|
||||
import codechicken.nei.NEIClientConfig;
|
||||
import codechicken.nei.PositionedStack;
|
||||
import codechicken.nei.recipe.GuiRecipe;
|
||||
import codechicken.nei.recipe.TemplateRecipeHandler;
|
||||
|
||||
public class SolarNeutronRecipeHandler extends BaseRecipeHandler
|
||||
{
|
||||
private int ticksPassed;
|
||||
|
||||
public static int xOffset = 5;
|
||||
public static int yOffset = 12;
|
||||
|
||||
@Override
|
||||
public String getRecipeName()
|
||||
{
|
||||
return MekanismUtils.localize("tile.MachineBlock3.SolarNeutronActivator.name");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getOverlayIdentifier()
|
||||
{
|
||||
return "solarneutron";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getGuiTexture()
|
||||
{
|
||||
return "mekanism:gui/GuiSolarNeutronActivator.png";
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class getGuiClass()
|
||||
{
|
||||
return GuiSolarNeutronActivator.class;
|
||||
}
|
||||
|
||||
public String getRecipeId()
|
||||
{
|
||||
return "mekanism.solarneutron";
|
||||
}
|
||||
|
||||
public Collection<SolarNeutronRecipe> getRecipes()
|
||||
{
|
||||
return Recipe.SOLAR_NEUTRON_ACTIVATOR.get().values();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawBackground(int i)
|
||||
{
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
changeTexture(getGuiTexture());
|
||||
drawTexturedModalRect(-2, 0, 3, yOffset, 170, 70);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawExtras(int i)
|
||||
{
|
||||
CachedIORecipe recipe = (CachedIORecipe)arecipes.get(i);
|
||||
|
||||
drawTexturedModalRect(61-xOffset, 39-yOffset, 176, 63, 55, 8);
|
||||
|
||||
if(recipe.outputStack != null)
|
||||
{
|
||||
displayGauge(58, 26-xOffset, 14-yOffset, 176, 40, 58, null, recipe.inputStack);
|
||||
}
|
||||
|
||||
if(recipe.inputStack != null)
|
||||
{
|
||||
displayGauge(58, 134-xOffset, 14-yOffset, 176, 40, 58, null, recipe.outputStack);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate()
|
||||
{
|
||||
super.onUpdate();
|
||||
|
||||
ticksPassed++;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadTransferRects()
|
||||
{
|
||||
transferRects.add(new TemplateRecipeHandler.RecipeTransferRect(new Rectangle(64-xOffset, 39-yOffset, 48, 8), getRecipeId(), new Object[0]));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadCraftingRecipes(String outputId, Object... results)
|
||||
{
|
||||
if(outputId.equals(getRecipeId()))
|
||||
{
|
||||
for(SolarNeutronRecipe irecipe : getRecipes())
|
||||
{
|
||||
arecipes.add(new CachedIORecipe(irecipe));
|
||||
}
|
||||
}
|
||||
else if(outputId.equals("gas") && results.length == 1 && results[0] instanceof GasStack)
|
||||
{
|
||||
for(SolarNeutronRecipe irecipe : getRecipes())
|
||||
{
|
||||
if(((GasStack)results[0]).isGasEqual(irecipe.getOutput().output))
|
||||
{
|
||||
arecipes.add(new CachedIORecipe(irecipe));
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
super.loadCraftingRecipes(outputId, results);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadUsageRecipes(String inputId, Object... ingredients)
|
||||
{
|
||||
if(inputId.equals("gas") && ingredients.length == 1 && ingredients[0] instanceof GasStack)
|
||||
{
|
||||
for(SolarNeutronRecipe irecipe : getRecipes())
|
||||
{
|
||||
if(irecipe.getInput().ingredient.isGasEqual((GasStack)ingredients[0]))
|
||||
{
|
||||
arecipes.add(new CachedIORecipe(irecipe));
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
super.loadUsageRecipes(inputId, ingredients);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> handleTooltip(GuiRecipe gui, List<String> currenttip, int recipe)
|
||||
{
|
||||
Point point = GuiDraw.getMousePosition();
|
||||
|
||||
int xAxis = point.x-(Integer)MekanismUtils.getPrivateValue(gui, GuiContainer.class, ObfuscatedNames.GuiContainer_guiLeft);
|
||||
int yAxis = point.y-(Integer)MekanismUtils.getPrivateValue(gui, GuiContainer.class, ObfuscatedNames.GuiContainer_guiTop);
|
||||
|
||||
if(xAxis >= 26 && xAxis <= 42 && yAxis >= 14+4 && yAxis <= 72+4)
|
||||
{
|
||||
currenttip.add(LangUtils.localizeGasStack(((CachedIORecipe)arecipes.get(recipe)).inputStack));
|
||||
}
|
||||
else if(xAxis >= 134 && xAxis <= 150 && yAxis >= 14+4 && yAxis <= 72+4)
|
||||
{
|
||||
currenttip.add(LangUtils.localizeGasStack(((CachedIORecipe)arecipes.get(recipe)).outputStack));
|
||||
}
|
||||
|
||||
return super.handleTooltip(gui, currenttip, recipe);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean keyTyped(GuiRecipe gui, char keyChar, int keyCode, int recipe)
|
||||
{
|
||||
Point point = GuiDraw.getMousePosition();
|
||||
|
||||
int xAxis = point.x-(Integer)MekanismUtils.getPrivateValue(gui, GuiContainer.class, ObfuscatedNames.GuiContainer_guiLeft);
|
||||
int yAxis = point.y-(Integer)MekanismUtils.getPrivateValue(gui, GuiContainer.class, ObfuscatedNames.GuiContainer_guiTop);
|
||||
|
||||
GasStack gas = null;
|
||||
|
||||
if(xAxis >= 26 && xAxis <= 42 && yAxis >= 14+4 && yAxis <= 72+4)
|
||||
{
|
||||
gas = ((CachedIORecipe)arecipes.get(recipe)).inputStack;
|
||||
}
|
||||
else if(xAxis >= 134 && xAxis <= 150 && yAxis >= 14+4 && yAxis <= 72+4)
|
||||
{
|
||||
gas = ((CachedIORecipe)arecipes.get(recipe)).outputStack;
|
||||
}
|
||||
|
||||
if(gas != null)
|
||||
{
|
||||
if(keyCode == NEIClientConfig.getKeyBinding("gui.recipe"))
|
||||
{
|
||||
if(doGasLookup(gas, false))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else if(keyCode == NEIClientConfig.getKeyBinding("gui.usage"))
|
||||
{
|
||||
if(doGasLookup(gas, true))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return super.keyTyped(gui, keyChar, keyCode, recipe);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean mouseClicked(GuiRecipe gui, int button, int recipe)
|
||||
{
|
||||
Point point = GuiDraw.getMousePosition();
|
||||
|
||||
int xAxis = point.x - (Integer)MekanismUtils.getPrivateValue(gui, GuiContainer.class, ObfuscatedNames.GuiContainer_guiLeft);
|
||||
int yAxis = point.y - (Integer)MekanismUtils.getPrivateValue(gui, GuiContainer.class, ObfuscatedNames.GuiContainer_guiTop);
|
||||
|
||||
GasStack gas = null;
|
||||
|
||||
if(xAxis >= 26 && xAxis <= 42 && yAxis >= 14+18 && yAxis <= 72+18)
|
||||
{
|
||||
gas = ((CachedIORecipe)arecipes.get(recipe)).inputStack;
|
||||
}
|
||||
else if(xAxis >= 134 && xAxis <= 150 && yAxis >= 14+18 && yAxis <= 72+18)
|
||||
{
|
||||
gas = ((CachedIORecipe)arecipes.get(recipe)).outputStack;
|
||||
}
|
||||
|
||||
if(gas != null)
|
||||
{
|
||||
if(button == 0)
|
||||
{
|
||||
if(doGasLookup(gas, false))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else if(button == 1)
|
||||
{
|
||||
if(doGasLookup(gas, true))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return super.mouseClicked(gui, button, recipe);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int recipiesPerPage()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addGuiElements()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public class CachedIORecipe extends TemplateRecipeHandler.CachedRecipe
|
||||
{
|
||||
public GasStack inputStack;
|
||||
public GasStack outputStack;
|
||||
|
||||
@Override
|
||||
public PositionedStack getResult()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public CachedIORecipe(GasStack input, GasStack output)
|
||||
{
|
||||
inputStack = input;
|
||||
outputStack = output;
|
||||
}
|
||||
|
||||
public CachedIORecipe(SolarNeutronRecipe recipe)
|
||||
{
|
||||
this(recipe.getInput().ingredient, recipe.getOutput().output);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -452,6 +452,9 @@ public class Mekanism
|
|||
CraftingManager.getInstance().getRecipeList().add(new MekanismRecipe(MekanismItems.GaugeDropper.getEmptyItem(), new Object[] {
|
||||
" O ", "G G", "GGG", Character.valueOf('O'), "ingotOsmium", Character.valueOf('G'), "paneGlass"
|
||||
}));
|
||||
CraftingManager.getInstance().getRecipeList().add(new MekanismRecipe(new ItemStack(MekanismBlocks.MachineBlock3, 1, 1), new Object[] {
|
||||
"APA", "CSC", "BBB", Character.valueOf('A'), "alloyElite", Character.valueOf('S'), new ItemStack(MekanismBlocks.BasicBlock, 1, 8), Character.valueOf('P'), MekanismItems.Polyethene, Character.valueOf('B'), "ingotBronze", Character.valueOf('C'), "circuitElite"
|
||||
}));
|
||||
|
||||
//Energy Cube recipes
|
||||
CraftingManager.getInstance().getRecipeList().add(new MekanismRecipe(MekanismUtils.getEnergyCube(EnergyCubeTier.BASIC), new Object[] {
|
||||
|
|
|
@ -20,20 +20,20 @@ public class ContainerSolarNeutronActivator extends Container
|
|||
public ContainerSolarNeutronActivator(InventoryPlayer inventory, TileEntitySolarNeutronActivator tentity)
|
||||
{
|
||||
tileEntity = tentity;
|
||||
addSlotToContainer(new SlotStorageTank(tentity, 0, 5, 25));
|
||||
addSlotToContainer(new SlotStorageTank(tentity, 1, 5, 56));
|
||||
addSlotToContainer(new SlotStorageTank(tentity, 0, 5, 56));
|
||||
addSlotToContainer(new SlotStorageTank(tentity, 1, 155, 56));
|
||||
|
||||
int slotX;
|
||||
|
||||
for(slotX = 0; slotX < 3; ++slotX)
|
||||
for(slotX = 0; slotX < 3; slotX++)
|
||||
{
|
||||
for(int slotY = 0; slotY < 9; ++slotY)
|
||||
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)
|
||||
for(slotX = 0; slotX < 9; slotX++)
|
||||
{
|
||||
addSlotToContainer(new Slot(inventory, slotX, 8 + slotX * 18, 142));
|
||||
}
|
||||
|
@ -79,7 +79,7 @@ public class ContainerSolarNeutronActivator extends Container
|
|||
return null;
|
||||
}
|
||||
}
|
||||
else if(((IGasItem)slotStack.getItem()).canReceiveGas(slotStack, tileEntity.inputTank.getGas() != null ? tileEntity.inputTank.getGas().getGas() : null))
|
||||
else if(((IGasItem)slotStack.getItem()).canReceiveGas(slotStack, tileEntity.outputTank.getGas() != null ? tileEntity.outputTank.getGas().getGas() : null))
|
||||
{
|
||||
if(!mergeItemStack(slotStack, 1, 2, false))
|
||||
{
|
||||
|
|
|
@ -408,21 +408,6 @@ public class TileEntityChemicalWasher extends TileEntityNoisyElectricBlock imple
|
|||
return null;
|
||||
}
|
||||
|
||||
public int getScaledFluidLevel(int i)
|
||||
{
|
||||
return fluidTank != null ? fluidTank.getFluidAmount()*i / MAX_FLUID : 0;
|
||||
}
|
||||
|
||||
public int getScaledInputGasLevel(int i)
|
||||
{
|
||||
return inputTank != null ? inputTank.getStored()*i / MAX_GAS : 0;
|
||||
}
|
||||
|
||||
public int getScaledOutputGasLevel(int i)
|
||||
{
|
||||
return outputTank != null ? outputTank.getStored()*i / MAX_GAS : 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setActive(boolean active)
|
||||
{
|
||||
|
|
|
@ -10,6 +10,7 @@ import mekanism.api.gas.Gas;
|
|||
import mekanism.api.gas.GasRegistry;
|
||||
import mekanism.api.gas.GasStack;
|
||||
import mekanism.api.gas.GasTank;
|
||||
import mekanism.api.gas.GasTransmission;
|
||||
import mekanism.api.gas.IGasHandler;
|
||||
import mekanism.api.gas.ITubeConnection;
|
||||
import mekanism.common.Mekanism;
|
||||
|
@ -26,6 +27,7 @@ import mekanism.common.util.MekanismUtils;
|
|||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.biome.BiomeGenDesert;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class TileEntitySolarNeutronActivator extends TileEntityContainerBlock implements IRedstoneControl, IBoundingBlock, IGasHandler, ITubeConnection, IActiveState, ISustainedData, IDropperHandler
|
||||
|
@ -34,6 +36,7 @@ public class TileEntitySolarNeutronActivator extends TileEntityContainerBlock im
|
|||
public GasTank outputTank = new GasTank(MAX_GAS);
|
||||
|
||||
public static final int MAX_GAS = 10000;
|
||||
public static final int TICKS_REQUIRED = 20;
|
||||
|
||||
public int updateDelay;
|
||||
|
||||
|
@ -43,6 +46,8 @@ public class TileEntitySolarNeutronActivator extends TileEntityContainerBlock im
|
|||
|
||||
public int gasOutput = 256;
|
||||
|
||||
public int recipeTicks = 0;
|
||||
|
||||
public SolarNeutronRecipe cachedRecipe;
|
||||
|
||||
/** This machine's current RedstoneControl type. */
|
||||
|
@ -80,18 +85,36 @@ public class TileEntitySolarNeutronActivator extends TileEntityContainerBlock im
|
|||
}
|
||||
}
|
||||
|
||||
//Buckets
|
||||
if(inventory[0] != null && (inputTank.getGas() == null || inputTank.getStored() < inputTank.getMaxGas()))
|
||||
{
|
||||
inputTank.receive(GasTransmission.removeGas(inventory[0], inputTank.getGasType(), inputTank.getNeeded()), true);
|
||||
}
|
||||
|
||||
if(inventory[1] != null && outputTank.getGas() != null)
|
||||
{
|
||||
outputTank.draw(GasTransmission.addGas(inventory[1], outputTank.getGas()), true);
|
||||
}
|
||||
|
||||
SolarNeutronRecipe recipe = getRecipe();
|
||||
|
||||
if(canOperate(recipe) && MekanismUtils.canFunction(this))
|
||||
boolean sky = ((!worldObj.isRaining() && !worldObj.isThundering()) || isDesert()) && !worldObj.provider.hasNoSky && worldObj.canBlockSeeTheSky(xCoord, yCoord+1, zCoord);
|
||||
|
||||
if(worldObj.isDaytime() && sky && canOperate(recipe) && MekanismUtils.canFunction(this))
|
||||
{
|
||||
setActive(true);
|
||||
|
||||
operate(recipe);
|
||||
if(recipeTicks == TICKS_REQUIRED)
|
||||
{
|
||||
operate(recipe);
|
||||
recipeTicks = 0;
|
||||
}
|
||||
else {
|
||||
recipeTicks++;
|
||||
}
|
||||
}
|
||||
else {
|
||||
setActive(false);
|
||||
recipeTicks = 0;
|
||||
}
|
||||
|
||||
if(outputTank.getGas() != null)
|
||||
|
@ -111,6 +134,11 @@ public class TileEntitySolarNeutronActivator extends TileEntityContainerBlock im
|
|||
}
|
||||
}
|
||||
|
||||
public boolean isDesert()
|
||||
{
|
||||
return worldObj.provider.getBiomeGenForCoords(xCoord >> 4, zCoord >> 4) instanceof BiomeGenDesert;
|
||||
}
|
||||
|
||||
public SolarNeutronRecipe getRecipe()
|
||||
{
|
||||
GasInput input = getInput();
|
||||
|
@ -144,6 +172,7 @@ public class TileEntitySolarNeutronActivator extends TileEntityContainerBlock im
|
|||
super.handlePacketData(dataStream);
|
||||
|
||||
isActive = dataStream.readBoolean();
|
||||
recipeTicks = dataStream.readInt();
|
||||
controlType = RedstoneControl.values()[dataStream.readInt()];
|
||||
|
||||
if(dataStream.readBoolean())
|
||||
|
@ -171,6 +200,7 @@ public class TileEntitySolarNeutronActivator extends TileEntityContainerBlock im
|
|||
super.getNetworkedData(data);
|
||||
|
||||
data.add(isActive);
|
||||
data.add(recipeTicks);
|
||||
data.add(controlType.ordinal());
|
||||
|
||||
if(inputTank.getGas() != null)
|
||||
|
@ -202,6 +232,7 @@ public class TileEntitySolarNeutronActivator extends TileEntityContainerBlock im
|
|||
super.readFromNBT(nbtTags);
|
||||
|
||||
isActive = nbtTags.getBoolean("isActive");
|
||||
recipeTicks = nbtTags.getInteger("recipeTicks");
|
||||
controlType = RedstoneControl.values()[nbtTags.getInteger("controlType")];
|
||||
|
||||
inputTank.read(nbtTags.getCompoundTag("inputTank"));
|
||||
|
@ -214,6 +245,7 @@ public class TileEntitySolarNeutronActivator extends TileEntityContainerBlock im
|
|||
super.writeToNBT(nbtTags);
|
||||
|
||||
nbtTags.setBoolean("isActive", isActive);
|
||||
nbtTags.setInteger("recipeTicks", recipeTicks);
|
||||
nbtTags.setInteger("controlType", controlType.ordinal());
|
||||
|
||||
nbtTags.setTag("inputTank", inputTank.write(new NBTTagCompound()));
|
||||
|
@ -242,25 +274,35 @@ public class TileEntitySolarNeutronActivator extends TileEntityContainerBlock im
|
|||
@Override
|
||||
public int receiveGas(ForgeDirection side, GasStack stack, boolean doTransfer)
|
||||
{
|
||||
if(canReceiveGas(side, stack != null ? stack.getGas() : null))
|
||||
{
|
||||
return inputTank.receive(stack, doTransfer);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public GasStack drawGas(ForgeDirection side, int amount, boolean doTransfer)
|
||||
{
|
||||
if(canDrawGas(side, null))
|
||||
{
|
||||
return outputTank.draw(amount, doTransfer);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canReceiveGas(ForgeDirection side, Gas type)
|
||||
{
|
||||
return false;
|
||||
return side == ForgeDirection.DOWN && inputTank.canReceive(type);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canDrawGas(ForgeDirection side, Gas type)
|
||||
{
|
||||
return false;
|
||||
return side == ForgeDirection.getOrientation(facing) && outputTank.canDraw(type);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -21,7 +21,7 @@ public final class LangUtils
|
|||
return (fluidStack == null || fluidStack.getFluid() == null ) ? null : fluidStack.getFluid().getLocalizedName(fluidStack);
|
||||
}
|
||||
|
||||
public static String localiseGasStack(GasStack gasStack)
|
||||
public static String localizeGasStack(GasStack gasStack)
|
||||
{
|
||||
return (gasStack == null || gasStack.getGas() == null ) ? null : gasStack.getGas().getLocalizedName();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue