Fix more transmitter render issues, also started on PRC NEI module
This commit is contained in:
parent
5c36612146
commit
3a81058cbd
11 changed files with 458 additions and 10 deletions
|
@ -7,9 +7,7 @@ import net.minecraft.item.ItemStack;
|
||||||
|
|
||||||
public class PressurizedProducts
|
public class PressurizedProducts
|
||||||
{
|
{
|
||||||
|
|
||||||
private ItemStack itemOutput;
|
private ItemStack itemOutput;
|
||||||
|
|
||||||
private GasStack gasOutput;
|
private GasStack gasOutput;
|
||||||
|
|
||||||
public PressurizedProducts(ItemStack item, GasStack gas)
|
public PressurizedProducts(ItemStack item, GasStack gas)
|
||||||
|
@ -49,5 +47,4 @@ public class PressurizedProducts
|
||||||
{
|
{
|
||||||
return new PressurizedProducts(itemOutput.copy(), gasOutput.copy());
|
return new PressurizedProducts(itemOutput.copy(), gasOutput.copy());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,6 @@ package mekanism.api;
|
||||||
import mekanism.api.gas.GasStack;
|
import mekanism.api.gas.GasStack;
|
||||||
import mekanism.api.gas.GasTank;
|
import mekanism.api.gas.GasTank;
|
||||||
import mekanism.common.util.StackUtils;
|
import mekanism.common.util.StackUtils;
|
||||||
|
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraftforge.fluids.FluidStack;
|
import net.minecraftforge.fluids.FluidStack;
|
||||||
import net.minecraftforge.fluids.FluidTank;
|
import net.minecraftforge.fluids.FluidTank;
|
||||||
|
@ -123,4 +122,18 @@ public class PressurizedReactants
|
||||||
return new PressurizedReactants(theSolid.copy(), theFluid.copy(), theGas.copy());
|
return new PressurizedReactants(theSolid.copy(), theFluid.copy(), theGas.copy());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ItemStack getSolid()
|
||||||
|
{
|
||||||
|
return theSolid;
|
||||||
|
}
|
||||||
|
|
||||||
|
public FluidStack getFluid()
|
||||||
|
{
|
||||||
|
return theFluid;
|
||||||
|
}
|
||||||
|
|
||||||
|
public GasStack getGas()
|
||||||
|
{
|
||||||
|
return theGas;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -115,6 +115,7 @@ public class Gas
|
||||||
{
|
{
|
||||||
return this.getFluid().getIcon();
|
return this.getFluid().getIcon();
|
||||||
}
|
}
|
||||||
|
|
||||||
return icon;
|
return icon;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -131,7 +132,9 @@ public class Gas
|
||||||
{
|
{
|
||||||
fluid.setIcons(getIcon());
|
fluid.setIcons(getIcon());
|
||||||
}
|
}
|
||||||
|
|
||||||
from_fluid = false;
|
from_fluid = false;
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -202,8 +205,7 @@ public class Gas
|
||||||
fluid = new Fluid(getName()).setGaseous(true);
|
fluid = new Fluid(getName()).setGaseous(true);
|
||||||
FluidRegistry.registerFluid(fluid);
|
FluidRegistry.registerFluid(fluid);
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
fluid = FluidRegistry.getFluid(getName());
|
fluid = FluidRegistry.getFluid(getName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -153,6 +153,7 @@ public abstract class MachineRecipeHandler extends BaseRecipeHandler
|
||||||
public CachedIORecipe(ItemStack itemstack, ItemStack itemstack1)
|
public CachedIORecipe(ItemStack itemstack, ItemStack itemstack1)
|
||||||
{
|
{
|
||||||
super();
|
super();
|
||||||
|
|
||||||
input = new PositionedStack(itemstack, 40, 12);
|
input = new PositionedStack(itemstack, 40, 12);
|
||||||
output = new PositionedStack(itemstack1, 100, 30);
|
output = new PositionedStack(itemstack1, 100, 30);
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,6 +12,7 @@ import mekanism.client.gui.GuiElectrolyticSeparator;
|
||||||
import mekanism.client.gui.GuiEnrichmentChamber;
|
import mekanism.client.gui.GuiEnrichmentChamber;
|
||||||
import mekanism.client.gui.GuiMetallurgicInfuser;
|
import mekanism.client.gui.GuiMetallurgicInfuser;
|
||||||
import mekanism.client.gui.GuiOsmiumCompressor;
|
import mekanism.client.gui.GuiOsmiumCompressor;
|
||||||
|
import mekanism.client.gui.GuiPRC;
|
||||||
import mekanism.client.gui.GuiPrecisionSawmill;
|
import mekanism.client.gui.GuiPrecisionSawmill;
|
||||||
import mekanism.client.gui.GuiPurificationChamber;
|
import mekanism.client.gui.GuiPurificationChamber;
|
||||||
import mekanism.client.gui.GuiRotaryCondensentrator;
|
import mekanism.client.gui.GuiRotaryCondensentrator;
|
||||||
|
@ -77,6 +78,9 @@ public class NEIMekanismConfig implements IConfigureNEI
|
||||||
API.registerRecipeHandler(new ChemicalCrystallizerRecipeHandler());
|
API.registerRecipeHandler(new ChemicalCrystallizerRecipeHandler());
|
||||||
API.registerUsageHandler(new ChemicalCrystallizerRecipeHandler());
|
API.registerUsageHandler(new ChemicalCrystallizerRecipeHandler());
|
||||||
|
|
||||||
|
API.registerRecipeHandler(new PRCRecipeHandler());
|
||||||
|
API.registerUsageHandler(new PRCRecipeHandler());
|
||||||
|
|
||||||
API.setGuiOffset(GuiEnrichmentChamber.class, 16, 6);
|
API.setGuiOffset(GuiEnrichmentChamber.class, 16, 6);
|
||||||
API.setGuiOffset(GuiOsmiumCompressor.class, 16, 6);
|
API.setGuiOffset(GuiOsmiumCompressor.class, 16, 6);
|
||||||
API.setGuiOffset(GuiCrusher.class, 16, 6);
|
API.setGuiOffset(GuiCrusher.class, 16, 6);
|
||||||
|
@ -93,6 +97,7 @@ public class NEIMekanismConfig implements IConfigureNEI
|
||||||
API.setGuiOffset(GuiChemicalDissolutionChamber.class, ChemicalDissolutionChamberRecipeHandler.xOffset, ChemicalDissolutionChamberRecipeHandler.yOffset);
|
API.setGuiOffset(GuiChemicalDissolutionChamber.class, ChemicalDissolutionChamberRecipeHandler.xOffset, ChemicalDissolutionChamberRecipeHandler.yOffset);
|
||||||
API.setGuiOffset(GuiChemicalWasher.class, ChemicalWasherRecipeHandler.xOffset, ChemicalWasherRecipeHandler.yOffset);
|
API.setGuiOffset(GuiChemicalWasher.class, ChemicalWasherRecipeHandler.xOffset, ChemicalWasherRecipeHandler.yOffset);
|
||||||
API.setGuiOffset(GuiChemicalCrystallizer.class, ChemicalCrystallizerRecipeHandler.xOffset, ChemicalCrystallizerRecipeHandler.yOffset);
|
API.setGuiOffset(GuiChemicalCrystallizer.class, ChemicalCrystallizerRecipeHandler.xOffset, ChemicalCrystallizerRecipeHandler.yOffset);
|
||||||
|
API.setGuiOffset(GuiPRC.class, PRCRecipeHandler.xOffset, PRCRecipeHandler.yOffset);
|
||||||
|
|
||||||
API.hideItem(new ItemStack(Mekanism.BoundingBlock));
|
API.hideItem(new ItemStack(Mekanism.BoundingBlock));
|
||||||
API.hideItem(new ItemStack(Mekanism.ItemProxy));
|
API.hideItem(new ItemStack(Mekanism.ItemProxy));
|
||||||
|
|
429
src/main/java/mekanism/client/nei/PRCRecipeHandler.java
Normal file
429
src/main/java/mekanism/client/nei/PRCRecipeHandler.java
Normal file
|
@ -0,0 +1,429 @@
|
||||||
|
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.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Map.Entry;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
import mekanism.api.PressurizedReactants;
|
||||||
|
import mekanism.api.PressurizedRecipe;
|
||||||
|
import mekanism.api.gas.GasStack;
|
||||||
|
import mekanism.client.gui.GuiElement;
|
||||||
|
import mekanism.client.gui.GuiPRC;
|
||||||
|
import mekanism.client.gui.GuiPowerBar;
|
||||||
|
import mekanism.client.gui.GuiPowerBar.IPowerInfoHandler;
|
||||||
|
import mekanism.client.gui.GuiProgress;
|
||||||
|
import mekanism.client.gui.GuiProgress.IProgressInfoHandler;
|
||||||
|
import mekanism.client.gui.GuiProgress.ProgressBar;
|
||||||
|
import mekanism.client.gui.GuiSlot;
|
||||||
|
import mekanism.client.gui.GuiSlot.SlotOverlay;
|
||||||
|
import mekanism.client.gui.GuiSlot.SlotType;
|
||||||
|
import mekanism.client.nei.RotaryCondensentratorRecipeHandler.CachedIORecipe;
|
||||||
|
import mekanism.common.ObfuscatedNames;
|
||||||
|
import mekanism.common.recipe.RecipeHandler.Recipe;
|
||||||
|
import mekanism.common.util.MekanismUtils;
|
||||||
|
import mekanism.common.util.MekanismUtils.ResourceType;
|
||||||
|
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraftforge.fluids.FluidStack;
|
||||||
|
|
||||||
|
import org.lwjgl.opengl.GL11;
|
||||||
|
|
||||||
|
import codechicken.lib.gui.GuiDraw;
|
||||||
|
import codechicken.nei.NEIClientConfig;
|
||||||
|
import codechicken.nei.NEIServerUtils;
|
||||||
|
import codechicken.nei.PositionedStack;
|
||||||
|
import codechicken.nei.recipe.GuiRecipe;
|
||||||
|
import codechicken.nei.recipe.TemplateRecipeHandler;
|
||||||
|
|
||||||
|
public class PRCRecipeHandler extends BaseRecipeHandler
|
||||||
|
{
|
||||||
|
private int ticksPassed;
|
||||||
|
|
||||||
|
public static int xOffset = 5;
|
||||||
|
public static int yOffset = 3;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void addGuiElements()
|
||||||
|
{
|
||||||
|
guiElements.add(new GuiSlot(SlotType.INPUT, this, MekanismUtils.getResource(ResourceType.GUI, getGuiTexture()), 53, 34));
|
||||||
|
guiElements.add(new GuiSlot(SlotType.POWER, this, MekanismUtils.getResource(ResourceType.GUI, getGuiTexture()), 140, 18).with(SlotOverlay.POWER));
|
||||||
|
guiElements.add(new GuiSlot(SlotType.OUTPUT, this, MekanismUtils.getResource(ResourceType.GUI, getGuiTexture()), 115, 34));
|
||||||
|
|
||||||
|
guiElements.add(new GuiPowerBar(this, new IPowerInfoHandler() {
|
||||||
|
@Override
|
||||||
|
public double getLevel()
|
||||||
|
{
|
||||||
|
return ticksPassed <= 20 ? ticksPassed / 20.0F : 1.0F;
|
||||||
|
}
|
||||||
|
}, MekanismUtils.getResource(ResourceType.GUI, getGuiTexture()), 164, 15));
|
||||||
|
guiElements.add(new GuiProgress(new IProgressInfoHandler()
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public double getProgress()
|
||||||
|
{
|
||||||
|
return ticksPassed >= 20 ? (ticksPassed - 20) % 20 / 20.0F : 0.0F;
|
||||||
|
}
|
||||||
|
}, getProgressType(), this, MekanismUtils.getResource(ResourceType.GUI, getGuiTexture()), 75, 37));
|
||||||
|
}
|
||||||
|
|
||||||
|
public ProgressBar getProgressType()
|
||||||
|
{
|
||||||
|
return ProgressBar.MEDIUM;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Set<Entry<PressurizedReactants, PressurizedRecipe>> getRecipes()
|
||||||
|
{
|
||||||
|
return Recipe.PRESSURIZED_REACTION_CHAMBER.get().entrySet();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void drawBackground(int i)
|
||||||
|
{
|
||||||
|
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||||
|
changeTexture(getGuiTexture());
|
||||||
|
drawTexturedModalRect(-2, 0, 3, yOffset, 170, 80);
|
||||||
|
|
||||||
|
for(GuiElement e : guiElements)
|
||||||
|
{
|
||||||
|
e.renderBackground(0, 0, xOffset, yOffset);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void loadTransferRects()
|
||||||
|
{
|
||||||
|
transferRects.add(new TemplateRecipeHandler.RecipeTransferRect(new Rectangle(70, 34, 36, 10), getRecipeId(), new Object[0]));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onUpdate()
|
||||||
|
{
|
||||||
|
super.onUpdate();
|
||||||
|
ticksPassed++;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getRecipeName()
|
||||||
|
{
|
||||||
|
return MekanismUtils.localize("tile.MachineBlock2.PressurizedReactionChamber.name");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Class getGuiClass()
|
||||||
|
{
|
||||||
|
return GuiPRC.class;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getOverlayIdentifier()
|
||||||
|
{
|
||||||
|
return "prc";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int recipiesPerPage()
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getRecipeId()
|
||||||
|
{
|
||||||
|
return "mekanism.prc";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getGuiTexture()
|
||||||
|
{
|
||||||
|
return "nei/GuiPRC.png";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void drawExtras(int i)
|
||||||
|
{
|
||||||
|
CachedIORecipe recipe = (CachedIORecipe)arecipes.get(i);
|
||||||
|
|
||||||
|
drawTexturedModalRect(47-xOffset, 39-yOffset, 176, 71, 28, 8);
|
||||||
|
drawTexturedModalRect(101-xOffset, 39-yOffset, 176, 63, 28, 8);
|
||||||
|
|
||||||
|
if(recipe.pressurizedRecipe.reactants.getFluid() != null)
|
||||||
|
{
|
||||||
|
displayGauge(58, 26-xOffset, 14-yOffset, 176, 4, 58, recipe.pressurizedRecipe.reactants.getFluid(), null);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(recipe.pressurizedRecipe.reactants.getGas() != null)
|
||||||
|
{
|
||||||
|
displayGauge(58, 26-xOffset, 14-yOffset, 176, 4, 58, null, recipe.pressurizedRecipe.reactants.getGas());
|
||||||
|
}
|
||||||
|
|
||||||
|
if(recipe.pressurizedRecipe.products.getGasOutput() != null)
|
||||||
|
{
|
||||||
|
displayGauge(58, 80-xOffset, 5-yOffset, 176, 4, 58, null, recipe.pressurizedRecipe.products.getGasOutput());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void loadCraftingRecipes(String outputId, Object... results)
|
||||||
|
{
|
||||||
|
if(outputId.equals(getRecipeId()))
|
||||||
|
{
|
||||||
|
for(Map.Entry irecipe : getRecipes())
|
||||||
|
{
|
||||||
|
arecipes.add(new CachedIORecipe(irecipe));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if(outputId.equals("gas") && results.length == 1 && results[0] instanceof GasStack)
|
||||||
|
{
|
||||||
|
for(Map.Entry<PressurizedReactants, PressurizedRecipe> irecipe : getRecipes())
|
||||||
|
{
|
||||||
|
if(irecipe.getValue().reactants.containsType((GasStack)results[0]))
|
||||||
|
{
|
||||||
|
arecipes.add(new CachedIORecipe(irecipe));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
super.loadCraftingRecipes(outputId, results);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void loadCraftingRecipes(ItemStack result)
|
||||||
|
{
|
||||||
|
for(Map.Entry<PressurizedReactants, PressurizedRecipe> irecipe : getRecipes())
|
||||||
|
{
|
||||||
|
if(NEIServerUtils.areStacksSameTypeCrafting(irecipe.getValue().products.getItemOutput(), result))
|
||||||
|
{
|
||||||
|
arecipes.add(new CachedIORecipe(irecipe));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void loadUsageRecipes(String inputId, Object... ingredients)
|
||||||
|
{
|
||||||
|
if(inputId.equals("gas") && ingredients.length == 1 && ingredients[0] instanceof GasStack)
|
||||||
|
{
|
||||||
|
for(Map.Entry<PressurizedReactants, PressurizedRecipe> irecipe : getRecipes())
|
||||||
|
{
|
||||||
|
if(irecipe.getKey().containsType((GasStack)ingredients[0]))
|
||||||
|
{
|
||||||
|
arecipes.add(new CachedIORecipe(irecipe));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if(inputId.equals("fluid") && ingredients.length == 1 && ingredients[0] instanceof FluidStack)
|
||||||
|
{
|
||||||
|
for(Map.Entry<PressurizedReactants, PressurizedRecipe> irecipe : getRecipes())
|
||||||
|
{
|
||||||
|
if(irecipe.getKey().containsType((FluidStack)ingredients[0]))
|
||||||
|
{
|
||||||
|
arecipes.add(new CachedIORecipe(irecipe));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
super.loadUsageRecipes(inputId, ingredients);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void loadUsageRecipes(ItemStack ingredient)
|
||||||
|
{
|
||||||
|
for(Map.Entry<PressurizedReactants, PressurizedRecipe> irecipe : getRecipes())
|
||||||
|
{
|
||||||
|
if(NEIServerUtils.areStacksSameTypeCrafting(irecipe.getKey().getSolid(), ingredient))
|
||||||
|
{
|
||||||
|
arecipes.add(new CachedIORecipe(irecipe));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@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 >= 80 && xAxis <= 96 && yAxis >= 5+13 && yAxis <= 63+13)
|
||||||
|
{
|
||||||
|
currenttip.add(((CachedIORecipe)arecipes.get(recipe)).pressurizedRecipe.reactants.getFluid().getFluid().getLocalizedName());
|
||||||
|
}
|
||||||
|
else if(xAxis >= 26 && xAxis <= 42 && yAxis >= 14+13 && yAxis <= 72+13)
|
||||||
|
{
|
||||||
|
currenttip.add(((CachedIORecipe)arecipes.get(recipe)).pressurizedRecipe.reactants.getGas().getGas().getLocalizedName());
|
||||||
|
}
|
||||||
|
else if(xAxis >= 134 && xAxis <= 150 && yAxis >= 14+13 && yAxis <= 72+13)
|
||||||
|
{
|
||||||
|
currenttip.add(((CachedIORecipe)arecipes.get(recipe)).pressurizedRecipe.products.getGasOutput().getGas().getLocalizedName());
|
||||||
|
}
|
||||||
|
|
||||||
|
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;
|
||||||
|
FluidStack fluid = null;
|
||||||
|
|
||||||
|
if(xAxis >= 80 && xAxis <= 96 && yAxis >= 5+13 && yAxis <= 63+13)
|
||||||
|
{
|
||||||
|
fluid = ((CachedIORecipe)arecipes.get(recipe)).pressurizedRecipe.reactants.getFluid();
|
||||||
|
}
|
||||||
|
else if(xAxis >= 26 && xAxis <= 42 && yAxis >= 14+13 && yAxis <= 72+13)
|
||||||
|
{
|
||||||
|
gas = ((CachedIORecipe)arecipes.get(recipe)).pressurizedRecipe.reactants.getGas();
|
||||||
|
}
|
||||||
|
else if(xAxis >= 134 && xAxis <= 150 && yAxis >= 14+13 && yAxis <= 72+13)
|
||||||
|
{
|
||||||
|
gas = ((CachedIORecipe)arecipes.get(recipe)).pressurizedRecipe.products.getGasOutput();
|
||||||
|
}
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if(fluid != null)
|
||||||
|
{
|
||||||
|
if(keyCode == NEIClientConfig.getKeyBinding("gui.recipe"))
|
||||||
|
{
|
||||||
|
if(doFluidLookup(fluid, false))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if(keyCode == NEIClientConfig.getKeyBinding("gui.usage"))
|
||||||
|
{
|
||||||
|
if(doFluidLookup(fluid, 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;
|
||||||
|
FluidStack fluid = null;
|
||||||
|
|
||||||
|
if(xAxis >= 80 && xAxis <= 96 && yAxis >= 5+13 && yAxis <= 63+13)
|
||||||
|
{
|
||||||
|
fluid = ((CachedIORecipe)arecipes.get(recipe)).pressurizedRecipe.reactants.getFluid();
|
||||||
|
}
|
||||||
|
else if(xAxis >= 26 && xAxis <= 42 && yAxis >= 14+13 && yAxis <= 72+13)
|
||||||
|
{
|
||||||
|
gas = ((CachedIORecipe)arecipes.get(recipe)).pressurizedRecipe.reactants.getGas();
|
||||||
|
}
|
||||||
|
else if(xAxis >= 134 && xAxis <= 150 && yAxis >= 14+13 && yAxis <= 72+13)
|
||||||
|
{
|
||||||
|
gas = ((CachedIORecipe)arecipes.get(recipe)).pressurizedRecipe.products.getGasOutput();
|
||||||
|
}
|
||||||
|
|
||||||
|
if(gas != null)
|
||||||
|
{
|
||||||
|
if(button == 0)
|
||||||
|
{
|
||||||
|
if(doGasLookup(gas, false))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if(button == 1)
|
||||||
|
{
|
||||||
|
if(doGasLookup(gas, true))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if(fluid != null)
|
||||||
|
{
|
||||||
|
if(button == 0)
|
||||||
|
{
|
||||||
|
if(doFluidLookup(fluid, false))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if(button == 1)
|
||||||
|
{
|
||||||
|
if(doFluidLookup(fluid, true))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return super.mouseClicked(gui, button, recipe);
|
||||||
|
}
|
||||||
|
|
||||||
|
public class CachedIORecipe extends TemplateRecipeHandler.CachedRecipe
|
||||||
|
{
|
||||||
|
public PressurizedRecipe pressurizedRecipe;
|
||||||
|
|
||||||
|
public PositionedStack input;
|
||||||
|
public PositionedStack output;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PositionedStack getIngredient()
|
||||||
|
{
|
||||||
|
return input;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PositionedStack getResult()
|
||||||
|
{
|
||||||
|
return output;
|
||||||
|
}
|
||||||
|
|
||||||
|
public CachedIORecipe(PressurizedRecipe recipe)
|
||||||
|
{
|
||||||
|
super();
|
||||||
|
|
||||||
|
pressurizedRecipe = recipe;
|
||||||
|
|
||||||
|
input = new PositionedStack(recipe.reactants.getSolid(), 54, 35);
|
||||||
|
output = new PositionedStack(recipe.products.getItemOutput(), 116, 35);
|
||||||
|
}
|
||||||
|
|
||||||
|
public CachedIORecipe(Map.Entry recipe)
|
||||||
|
{
|
||||||
|
this((PressurizedRecipe)recipe.getValue());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -492,6 +492,7 @@ public class RenderPartTransmitter implements IIconSelfRegister
|
||||||
public void renderStatic(PartSidedPipe transmitter)
|
public void renderStatic(PartSidedPipe transmitter)
|
||||||
{
|
{
|
||||||
CCRenderState.reset();
|
CCRenderState.reset();
|
||||||
|
CCRenderState.hasColour = true;
|
||||||
CCRenderState.setBrightness(transmitter.world(), transmitter.x(), transmitter.y(), transmitter.z());
|
CCRenderState.setBrightness(transmitter.world(), transmitter.x(), transmitter.y(), transmitter.z());
|
||||||
|
|
||||||
for(ForgeDirection side : ForgeDirection.VALID_DIRECTIONS)
|
for(ForgeDirection side : ForgeDirection.VALID_DIRECTIONS)
|
||||||
|
|
|
@ -245,7 +245,7 @@ public class PartMechanicalPipe extends PartTransmitter<FluidNetwork> implements
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public void renderDynamic(Vector3 pos, float f, int pass)
|
public void renderDynamic(Vector3 pos, float f, int pass)
|
||||||
{
|
{
|
||||||
if(pass == 1)
|
if(pass == 0)
|
||||||
{
|
{
|
||||||
RenderPartTransmitter.getInstance().renderContents(this, pos);
|
RenderPartTransmitter.getInstance().renderContents(this, pos);
|
||||||
}
|
}
|
||||||
|
|
|
@ -245,7 +245,7 @@ public class PartPressurizedTube extends PartTransmitter<GasNetwork> implements
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public void renderDynamic(Vector3 pos, float f, int pass)
|
public void renderDynamic(Vector3 pos, float f, int pass)
|
||||||
{
|
{
|
||||||
if(pass == 1)
|
if(pass == 0)
|
||||||
{
|
{
|
||||||
RenderPartTransmitter.getInstance().renderContents(this, pos);
|
RenderPartTransmitter.getInstance().renderContents(this, pos);
|
||||||
}
|
}
|
||||||
|
|
|
@ -210,7 +210,7 @@ public class PartUniversalCable extends PartTransmitter<EnergyNetwork> implement
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public void renderDynamic(Vector3 pos, float frame, int pass)
|
public void renderDynamic(Vector3 pos, float frame, int pass)
|
||||||
{
|
{
|
||||||
if(pass == 1 && MekanismClient.fancyUniversalCableRender)
|
if(pass == 0 && MekanismClient.fancyUniversalCableRender)
|
||||||
{
|
{
|
||||||
RenderPartTransmitter.getInstance().renderContents(this, pos);
|
RenderPartTransmitter.getInstance().renderContents(this, pos);
|
||||||
}
|
}
|
||||||
|
|
BIN
src/main/resources/assets/mekanism/gui/nei/GuiPRC.png
Normal file
BIN
src/main/resources/assets/mekanism/gui/nei/GuiPRC.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3 KiB |
Loading…
Reference in a new issue