mirror of
https://github.com/Thorfusion/Mekanism-Community-Edition.git
synced 2026-11-22 04:52:25 +00:00
Merge branch '1.8.9' of github.com:aidancbrady/Mekanism into 1.8.9
This commit is contained in:
commit
87d2305860
232 files changed
+5090
-7888
No files matched your search
@@ -136,7 +136,7 @@ public class Gas
|
||||
{
|
||||
return MekanismRenderer.getFluidTexture(fluid, FluidType.STILL);
|
||||
}
|
||||
|
||||
|
||||
return sprite;
|
||||
}
|
||||
|
||||
@@ -145,13 +145,25 @@ public class Gas
|
||||
* @param i - IIcon to associate with this Gas
|
||||
* @return this Gas object
|
||||
*/
|
||||
public Gas updateIcon(TextureMap map)
|
||||
public Gas registerIcon(TextureMap map)
|
||||
{
|
||||
sprite = map.registerSprite(iconLocation);
|
||||
map.registerSprite(iconLocation);
|
||||
from_fluid = false;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
public Gas updateIcon(TextureMap map)
|
||||
{
|
||||
TextureAtlasSprite tex = map.getTextureExtry(iconLocation.toString());
|
||||
|
||||
if(tex != null)
|
||||
{
|
||||
sprite = tex;
|
||||
}
|
||||
System.out.println(sprite);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the ID associated with this gas.
|
||||
|
||||
@@ -84,10 +84,8 @@ import mekanism.client.render.tileentity.RenderChemicalDissolutionChamber;
|
||||
import mekanism.client.render.tileentity.RenderConfigurableMachine;
|
||||
import mekanism.client.render.tileentity.RenderDigitalMiner;
|
||||
import mekanism.client.render.tileentity.RenderDynamicTank;
|
||||
import mekanism.client.render.tileentity.RenderElectricPump;
|
||||
import mekanism.client.render.tileentity.RenderEnergyCube;
|
||||
import mekanism.client.render.tileentity.RenderFluidTank;
|
||||
import mekanism.client.render.tileentity.RenderFluidicPlenisher;
|
||||
import mekanism.client.render.tileentity.RenderGasTank;
|
||||
import mekanism.client.render.tileentity.RenderLogisticalSorter;
|
||||
import mekanism.client.render.tileentity.RenderPersonalChest;
|
||||
@@ -293,7 +291,6 @@ public class ClientProxy extends CommonProxy
|
||||
ClientRegistry.registerTileEntity(TileEntityMetallurgicInfuser.class, "MetallurgicInfuser", new RenderConfigurableMachine<TileEntityMetallurgicInfuser>());
|
||||
ClientRegistry.registerTileEntity(TileEntityGasTank.class, "GasTank", new RenderGasTank());
|
||||
ClientRegistry.registerTileEntity(TileEntityEnergyCube.class, "EnergyCube", new RenderEnergyCube());
|
||||
ClientRegistry.registerTileEntity(TileEntityElectricPump.class, "ElectricPump", new RenderElectricPump());
|
||||
ClientRegistry.registerTileEntity(TileEntityPersonalChest.class, "PersonalChest", new RenderPersonalChest());
|
||||
ClientRegistry.registerTileEntity(TileEntityDynamicTank.class, "DynamicTank", new RenderDynamicTank());
|
||||
ClientRegistry.registerTileEntity(TileEntityDynamicValve.class, "DynamicValve", new RenderDynamicTank());
|
||||
@@ -309,7 +306,6 @@ public class ClientProxy extends CommonProxy
|
||||
ClientRegistry.registerTileEntity(TileEntitySeismicVibrator.class, "SeismicVibrator", new RenderSeismicVibrator());
|
||||
ClientRegistry.registerTileEntity(TileEntityPRC.class, "PressurizedReactionChamber", new RenderConfigurableMachine<TileEntityPRC>());
|
||||
ClientRegistry.registerTileEntity(TileEntityFluidTank.class, "FluidTank", new RenderFluidTank());
|
||||
ClientRegistry.registerTileEntity(TileEntityFluidicPlenisher.class, "FluidicPlenisher", new RenderFluidicPlenisher());
|
||||
ClientRegistry.registerTileEntity(TileEntitySolarNeutronActivator.class, "SolarNeutronActivator", new RenderSolarNeutronActivator());
|
||||
ClientRegistry.registerTileEntity(TileEntityFormulaicAssemblicator.class, "FormulaicAssemblicator", new RenderConfigurableMachine());
|
||||
ClientRegistry.registerTileEntity(TileEntityResistiveHeater.class, "ResistiveHeater", new RenderResistiveHeater());
|
||||
@@ -371,11 +367,11 @@ public class ClientProxy extends CommonProxy
|
||||
registerItemRender(MekanismItems.Substrate);
|
||||
registerItemRender(MekanismItems.Polyethene);
|
||||
registerItemRender(MekanismItems.BioFuel);
|
||||
// registerItemRender(MekanismItems.GlowPanel);
|
||||
registerItemRender(MekanismItems.Flamethrower);
|
||||
registerItemRender(MekanismItems.GaugeDropper);
|
||||
registerItemRender(MekanismItems.FactoryInstaller);
|
||||
registerItemRender(MekanismItems.OtherDust);
|
||||
registerItemRender(MekanismItems.GlowPanel);
|
||||
|
||||
ModelBakery.registerItemVariants(MekanismItems.WalkieTalkie, ItemWalkieTalkie.OFF_MODEL);
|
||||
|
||||
@@ -855,10 +851,11 @@ public class ClientProxy extends CommonProxy
|
||||
{
|
||||
MekanismRenderer.init();
|
||||
|
||||
ModelLoaderRegistry.registerLoader(new MekanismOBJLoader());
|
||||
ModelLoaderRegistry.registerLoader(MekanismOBJLoader.INSTANCE);
|
||||
|
||||
MinecraftForge.EVENT_BUS.register(new CTMRegistry());
|
||||
MinecraftForge.EVENT_BUS.register(this);
|
||||
MinecraftForge.EVENT_BUS.register(MekanismOBJLoader.INSTANCE);
|
||||
|
||||
//Register entity rendering handlers
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntityObsidianTNT.class, new IRenderFactory<EntityObsidianTNT>() {
|
||||
|
||||
@@ -12,6 +12,7 @@ import mekanism.common.network.PacketNewFilter.NewFilterMessage;
|
||||
import mekanism.common.network.PacketSimpleGui.SimpleGuiMessage;
|
||||
import mekanism.common.tile.TileEntityOredictionificator;
|
||||
import mekanism.common.tile.TileEntityOredictionificator.OredictionificatorFilter;
|
||||
import mekanism.common.util.ItemRegistryUtils;
|
||||
import mekanism.common.util.LangUtils;
|
||||
import mekanism.common.util.MekanismUtils;
|
||||
import mekanism.common.util.MekanismUtils.ResourceType;
|
||||
@@ -176,7 +177,7 @@ public class GuiOredictionificatorFilter extends GuiMekanism
|
||||
{
|
||||
if(renderStack != null)
|
||||
{
|
||||
String name = MekanismUtils.getMod(renderStack);
|
||||
String name = ItemRegistryUtils.getMod(renderStack);
|
||||
String extra = name.equals("null") ? "" : " (" + name + ")";
|
||||
|
||||
drawCreativeTabHoveringText(renderStack.getDisplayName() + extra, xAxis, yAxis);
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package mekanism.client.gui.element;
|
||||
|
||||
import java.awt.Rectangle;
|
||||
import java.util.List;
|
||||
|
||||
import mekanism.api.ObfuscatedNames;
|
||||
@@ -13,8 +14,6 @@ import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public abstract class GuiElement
|
||||
{
|
||||
@@ -145,6 +144,7 @@ public abstract class GuiElement
|
||||
public static class Rectangle4i
|
||||
{
|
||||
public int x, y, width, height;
|
||||
|
||||
public Rectangle4i(int x, int y, int width, int height)
|
||||
{
|
||||
this.x = x;
|
||||
@@ -152,5 +152,10 @@ public abstract class GuiElement
|
||||
this.width = width;
|
||||
this.height = height;
|
||||
}
|
||||
|
||||
public Rectangle toRectangle()
|
||||
{
|
||||
return new Rectangle(x, y, width, height);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,175 @@
|
||||
package mekanism.client.jei;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import mekanism.api.gas.GasStack;
|
||||
import mekanism.client.gui.IGuiWrapper;
|
||||
import mekanism.client.gui.element.GuiElement;
|
||||
import mekanism.client.gui.element.GuiProgress.ProgressBar;
|
||||
import mekanism.client.render.MekanismRenderer;
|
||||
import mekanism.client.render.MekanismRenderer.FluidType;
|
||||
import mekanism.common.util.LangUtils;
|
||||
import mezz.jei.api.recipe.IRecipeCategory;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.client.gui.Gui;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
public abstract class BaseRecipeCategory implements IRecipeCategory, IGuiWrapper
|
||||
{
|
||||
public static final GuiDummy gui = new GuiDummy();
|
||||
|
||||
public String recipeName;
|
||||
public String unlocalizedName;
|
||||
|
||||
public String guiTexture;
|
||||
public ResourceLocation guiLocation;
|
||||
|
||||
public ProgressBar progressBar;
|
||||
|
||||
public int xOffset = 28;
|
||||
public int yOffset = 16;
|
||||
|
||||
public BaseRecipeCategory(String gui, String name, String unlocalized, ProgressBar progress)
|
||||
{
|
||||
guiTexture = gui;
|
||||
guiLocation = new ResourceLocation(guiTexture);
|
||||
|
||||
progressBar = progress;
|
||||
|
||||
recipeName = name;
|
||||
unlocalizedName = unlocalized;
|
||||
|
||||
addGuiElements();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUid()
|
||||
{
|
||||
return "mekanism." + recipeName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTitle()
|
||||
{
|
||||
return LangUtils.localize(unlocalizedName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawExtras(Minecraft minecraft)
|
||||
{
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
changeTexture(guiLocation);
|
||||
|
||||
for(GuiElement e : guiElements)
|
||||
{
|
||||
e.renderBackground(0, 0, -xOffset, -yOffset);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawAnimations(Minecraft minecraft) {}
|
||||
|
||||
@Override
|
||||
public void drawTexturedRect(int x, int y, int u, int v, int w, int h)
|
||||
{
|
||||
gui.drawTexturedModalRect(x, y, u, v, w, h);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawTexturedRectFromIcon(int x, int y, TextureAtlasSprite icon, int w, int h)
|
||||
{
|
||||
gui.drawTexturedModalRect(x, y, icon, w, h);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void displayTooltip(String s, int xAxis, int yAxis) {}
|
||||
|
||||
@Override
|
||||
public void displayTooltips(List<String> list, int xAxis, int yAxis) {}
|
||||
|
||||
@Override
|
||||
public FontRenderer getFont()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public void displayGauge(int length, int xPos, int yPos, int overlayX, int overlayY, int scale, FluidStack fluid, GasStack gas)
|
||||
{
|
||||
if(fluid == null && gas == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
int start = 0;
|
||||
|
||||
while(true)
|
||||
{
|
||||
int renderRemaining = 0;
|
||||
|
||||
if(scale > 16)
|
||||
{
|
||||
renderRemaining = 16;
|
||||
scale -= 16;
|
||||
}
|
||||
else {
|
||||
renderRemaining = scale;
|
||||
scale = 0;
|
||||
}
|
||||
|
||||
changeTexture(MekanismRenderer.getBlocksTexture());
|
||||
|
||||
if(fluid != null)
|
||||
{
|
||||
gui.drawTexturedModalRect(xPos, yPos + length - renderRemaining - start, MekanismRenderer.getFluidTexture(fluid.getFluid(), FluidType.STILL), 16, 16 - (16 - renderRemaining));
|
||||
}
|
||||
else if(gas != null)
|
||||
{
|
||||
gui.drawTexturedModalRect(xPos, yPos + length - renderRemaining - start, gas.getGas().getSprite(), 16, 16 - (16 - renderRemaining));
|
||||
}
|
||||
|
||||
start+=16;
|
||||
|
||||
if(renderRemaining == 0 || scale == 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
changeTexture(guiLocation);
|
||||
gui.drawTexturedModalRect(xPos, yPos, overlayX, overlayY, 16, length+1);
|
||||
}
|
||||
|
||||
public void displayGauge(int xPos, int yPos, int sizeX, int sizeY, GasStack gas)
|
||||
{
|
||||
if(gas == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
changeTexture(MekanismRenderer.getBlocksTexture());
|
||||
gui.drawTexturedModalRect(xPos, yPos, gas.getGas().getSprite(), sizeX, sizeY);
|
||||
}
|
||||
|
||||
public String stripTexture()
|
||||
{
|
||||
return guiTexture.replace("mekanism:gui/", "");
|
||||
}
|
||||
|
||||
public void changeTexture(ResourceLocation texture)
|
||||
{
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(texture);
|
||||
}
|
||||
|
||||
public Set<GuiElement> guiElements = new HashSet<GuiElement>();
|
||||
|
||||
public void addGuiElements() {}
|
||||
|
||||
public static class GuiDummy extends Gui {}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
package mekanism.client.jei;
|
||||
|
||||
import java.awt.Rectangle;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import mekanism.client.gui.GuiMekanism;
|
||||
import mekanism.client.gui.element.GuiElement;
|
||||
import mezz.jei.api.gui.IAdvancedGuiHandler;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
|
||||
public class GuiElementHandler implements IAdvancedGuiHandler
|
||||
{
|
||||
@Override
|
||||
public Class getGuiContainerClass()
|
||||
{
|
||||
return GuiMekanism.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List getGuiExtraAreas(GuiContainer gui)
|
||||
{
|
||||
if(gui instanceof GuiMekanism)
|
||||
{
|
||||
List<Rectangle> list = new ArrayList<Rectangle>();
|
||||
|
||||
GuiMekanism guiMek = (GuiMekanism)gui;
|
||||
|
||||
for(GuiElement element : guiMek.guiElements)
|
||||
{
|
||||
list.add(element.getBounds(guiMek.getXPos(), guiMek.getYPos()).toRectangle());
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,298 @@
|
||||
package mekanism.client.jei;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import mekanism.api.gas.Gas;
|
||||
import mekanism.api.gas.GasRegistry;
|
||||
import mekanism.client.gui.GuiChemicalCrystallizer;
|
||||
import mekanism.client.gui.GuiChemicalDissolutionChamber;
|
||||
import mekanism.client.gui.GuiChemicalInfuser;
|
||||
import mekanism.client.gui.GuiChemicalInjectionChamber;
|
||||
import mekanism.client.gui.GuiChemicalOxidizer;
|
||||
import mekanism.client.gui.GuiChemicalWasher;
|
||||
import mekanism.client.gui.GuiCombiner;
|
||||
import mekanism.client.gui.GuiCrusher;
|
||||
import mekanism.client.gui.GuiElectrolyticSeparator;
|
||||
import mekanism.client.gui.GuiEnrichmentChamber;
|
||||
import mekanism.client.gui.GuiMetallurgicInfuser;
|
||||
import mekanism.client.gui.GuiOsmiumCompressor;
|
||||
import mekanism.client.gui.GuiPRC;
|
||||
import mekanism.client.gui.GuiPrecisionSawmill;
|
||||
import mekanism.client.gui.GuiPurificationChamber;
|
||||
import mekanism.client.gui.GuiRotaryCondensentrator;
|
||||
import mekanism.client.gui.GuiSolarNeutronActivator;
|
||||
import mekanism.client.gui.GuiThermalEvaporationController;
|
||||
import mekanism.client.gui.element.GuiProgress.ProgressBar;
|
||||
import mekanism.client.jei.crafting.ShapedMekanismRecipeHandler;
|
||||
import mekanism.client.jei.crafting.ShapelessMekanismRecipeHandler;
|
||||
import mekanism.client.jei.machine.AdvancedMachineRecipeCategory;
|
||||
import mekanism.client.jei.machine.AdvancedMachineRecipeHandler;
|
||||
import mekanism.client.jei.machine.AdvancedMachineRecipeWrapper;
|
||||
import mekanism.client.jei.machine.ChanceMachineRecipeCategory;
|
||||
import mekanism.client.jei.machine.ChanceMachineRecipeHandler;
|
||||
import mekanism.client.jei.machine.ChanceMachineRecipeWrapper;
|
||||
import mekanism.client.jei.machine.MachineRecipeCategory;
|
||||
import mekanism.client.jei.machine.MachineRecipeHandler;
|
||||
import mekanism.client.jei.machine.MachineRecipeWrapper;
|
||||
import mekanism.client.jei.machine.advanced.ChemicalInjectionChamberRecipeHandler;
|
||||
import mekanism.client.jei.machine.advanced.ChemicalInjectionChamberRecipeWrapper;
|
||||
import mekanism.client.jei.machine.advanced.CombinerRecipeHandler;
|
||||
import mekanism.client.jei.machine.advanced.CombinerRecipeWrapper;
|
||||
import mekanism.client.jei.machine.advanced.OsmiumCompressorRecipeHandler;
|
||||
import mekanism.client.jei.machine.advanced.OsmiumCompressorRecipeWrapper;
|
||||
import mekanism.client.jei.machine.advanced.PurificationChamberRecipeHandler;
|
||||
import mekanism.client.jei.machine.advanced.PurificationChamberRecipeWrapper;
|
||||
import mekanism.client.jei.machine.basic.CrusherRecipeHandler;
|
||||
import mekanism.client.jei.machine.basic.CrusherRecipeWrapper;
|
||||
import mekanism.client.jei.machine.basic.EnrichmentRecipeHandler;
|
||||
import mekanism.client.jei.machine.basic.EnrichmentRecipeWrapper;
|
||||
import mekanism.client.jei.machine.chance.PrecisionSawmillRecipeHandler;
|
||||
import mekanism.client.jei.machine.chance.PrecisionSawmillRecipeWrapper;
|
||||
import mekanism.client.jei.machine.chemical.ChemicalCrystallizerRecipeCategory;
|
||||
import mekanism.client.jei.machine.chemical.ChemicalCrystallizerRecipeHandler;
|
||||
import mekanism.client.jei.machine.chemical.ChemicalCrystallizerRecipeWrapper;
|
||||
import mekanism.client.jei.machine.chemical.ChemicalDissolutionChamberRecipeCategory;
|
||||
import mekanism.client.jei.machine.chemical.ChemicalDissolutionChamberRecipeHandler;
|
||||
import mekanism.client.jei.machine.chemical.ChemicalDissolutionChamberRecipeWrapper;
|
||||
import mekanism.client.jei.machine.chemical.ChemicalInfuserRecipeCategory;
|
||||
import mekanism.client.jei.machine.chemical.ChemicalInfuserRecipeHandler;
|
||||
import mekanism.client.jei.machine.chemical.ChemicalInfuserRecipeWrapper;
|
||||
import mekanism.client.jei.machine.chemical.ChemicalOxidizerRecipeCategory;
|
||||
import mekanism.client.jei.machine.chemical.ChemicalOxidizerRecipeHandler;
|
||||
import mekanism.client.jei.machine.chemical.ChemicalOxidizerRecipeWrapper;
|
||||
import mekanism.client.jei.machine.chemical.ChemicalWasherRecipeCategory;
|
||||
import mekanism.client.jei.machine.chemical.ChemicalWasherRecipeHandler;
|
||||
import mekanism.client.jei.machine.chemical.ChemicalWasherRecipeWrapper;
|
||||
import mekanism.client.jei.machine.other.ElectrolyticSeparatorRecipeCategory;
|
||||
import mekanism.client.jei.machine.other.ElectrolyticSeparatorRecipeHandler;
|
||||
import mekanism.client.jei.machine.other.ElectrolyticSeparatorRecipeWrapper;
|
||||
import mekanism.client.jei.machine.other.MetallurgicInfuserRecipeCategory;
|
||||
import mekanism.client.jei.machine.other.MetallurgicInfuserRecipeHandler;
|
||||
import mekanism.client.jei.machine.other.MetallurgicInfuserRecipeWrapper;
|
||||
import mekanism.client.jei.machine.other.PRCRecipeCategory;
|
||||
import mekanism.client.jei.machine.other.PRCRecipeHandler;
|
||||
import mekanism.client.jei.machine.other.PRCRecipeWrapper;
|
||||
import mekanism.client.jei.machine.other.RotaryCondensentratorRecipeCategory;
|
||||
import mekanism.client.jei.machine.other.RotaryCondensentratorRecipeHandler;
|
||||
import mekanism.client.jei.machine.other.RotaryCondensentratorRecipeWrapper;
|
||||
import mekanism.client.jei.machine.other.SolarNeutronRecipeCategory;
|
||||
import mekanism.client.jei.machine.other.SolarNeutronRecipeHandler;
|
||||
import mekanism.client.jei.machine.other.SolarNeutronRecipeWrapper;
|
||||
import mekanism.client.jei.machine.other.ThermalEvaporationRecipeCategory;
|
||||
import mekanism.client.jei.machine.other.ThermalEvaporationRecipeHandler;
|
||||
import mekanism.client.jei.machine.other.ThermalEvaporationRecipeWrapper;
|
||||
import mekanism.common.MekanismBlocks;
|
||||
import mekanism.common.MekanismItems;
|
||||
import mekanism.common.recipe.RecipeHandler.Recipe;
|
||||
import mekanism.common.recipe.machines.AdvancedMachineRecipe;
|
||||
import mekanism.common.recipe.machines.BasicMachineRecipe;
|
||||
import mekanism.common.recipe.machines.ChanceMachineRecipe;
|
||||
import mekanism.common.recipe.machines.ChemicalInfuserRecipe;
|
||||
import mekanism.common.recipe.machines.CrystallizerRecipe;
|
||||
import mekanism.common.recipe.machines.DissolutionRecipe;
|
||||
import mekanism.common.recipe.machines.MachineRecipe;
|
||||
import mekanism.common.recipe.machines.MetallurgicInfuserRecipe;
|
||||
import mekanism.common.recipe.machines.OxidationRecipe;
|
||||
import mekanism.common.recipe.machines.PressurizedRecipe;
|
||||
import mekanism.common.recipe.machines.SeparatorRecipe;
|
||||
import mekanism.common.recipe.machines.SolarNeutronRecipe;
|
||||
import mekanism.common.recipe.machines.ThermalEvaporationRecipe;
|
||||
import mekanism.common.recipe.machines.WasherRecipe;
|
||||
import mekanism.common.util.ItemDataUtils;
|
||||
import mezz.jei.api.IItemRegistry;
|
||||
import mezz.jei.api.IJeiHelpers;
|
||||
import mezz.jei.api.IJeiRuntime;
|
||||
import mezz.jei.api.IModPlugin;
|
||||
import mezz.jei.api.IModRegistry;
|
||||
import mezz.jei.api.IRecipeRegistry;
|
||||
import mezz.jei.api.JEIPlugin;
|
||||
import mezz.jei.api.recipe.IRecipeCategory;
|
||||
import mezz.jei.api.recipe.IRecipeWrapper;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
@JEIPlugin
|
||||
public class MekanismJEI implements IModPlugin
|
||||
{
|
||||
public static final String[] UNUSED_TAGS = new String[] {ItemDataUtils.DATA_ID};
|
||||
|
||||
@Override
|
||||
public void register(IModRegistry registry)
|
||||
{
|
||||
registry.addAdvancedGuiHandlers(new GuiElementHandler());
|
||||
|
||||
registry.addRecipeHandlers(new ShapedMekanismRecipeHandler());
|
||||
registry.addRecipeHandlers(new ShapelessMekanismRecipeHandler());
|
||||
|
||||
registry.getJeiHelpers().getItemBlacklist().addItemToBlacklist(new ItemStack(MekanismItems.ItemProxy));
|
||||
registry.getJeiHelpers().getItemBlacklist().addItemToBlacklist(new ItemStack(MekanismBlocks.BoundingBlock));
|
||||
|
||||
registry.getJeiHelpers().getNbtIgnoreList().ignoreNbtTagNames(Item.getItemFromBlock(MekanismBlocks.EnergyCube), UNUSED_TAGS);
|
||||
registry.getJeiHelpers().getNbtIgnoreList().ignoreNbtTagNames(Item.getItemFromBlock(MekanismBlocks.MachineBlock), UNUSED_TAGS);
|
||||
registry.getJeiHelpers().getNbtIgnoreList().ignoreNbtTagNames(Item.getItemFromBlock(MekanismBlocks.MachineBlock2), UNUSED_TAGS);
|
||||
registry.getJeiHelpers().getNbtIgnoreList().ignoreNbtTagNames(Item.getItemFromBlock(MekanismBlocks.MachineBlock3), UNUSED_TAGS);
|
||||
registry.getJeiHelpers().getNbtIgnoreList().ignoreNbtTagNames(Item.getItemFromBlock(MekanismBlocks.BasicBlock), UNUSED_TAGS);
|
||||
registry.getJeiHelpers().getNbtIgnoreList().ignoreNbtTagNames(Item.getItemFromBlock(MekanismBlocks.BasicBlock2), UNUSED_TAGS);
|
||||
registry.getJeiHelpers().getNbtIgnoreList().ignoreNbtTagNames(Item.getItemFromBlock(MekanismBlocks.GasTank), UNUSED_TAGS);
|
||||
registry.getJeiHelpers().getNbtIgnoreList().ignoreNbtTagNames(Item.getItemFromBlock(MekanismBlocks.CardboardBox), UNUSED_TAGS);
|
||||
|
||||
try {
|
||||
registerBasicMachine(registry, Recipe.ENRICHMENT_CHAMBER, "tile.MachineBlock.EnrichmentChamber.name", ProgressBar.BLUE, EnrichmentRecipeHandler.class, EnrichmentRecipeWrapper.class);
|
||||
registerBasicMachine(registry, Recipe.CRUSHER, "tile.MachineBlock.Crusher.name", ProgressBar.CRUSH, CrusherRecipeHandler.class, CrusherRecipeWrapper.class);
|
||||
|
||||
registerAdvancedMachine(registry, Recipe.COMBINER, "tile.MachineBlock.Combiner.name", ProgressBar.STONE, CombinerRecipeHandler.class, CombinerRecipeWrapper.class);
|
||||
registerAdvancedMachine(registry, Recipe.PURIFICATION_CHAMBER, "tile.MachineBlock.PurificationChamber.name", ProgressBar.RED, PurificationChamberRecipeHandler.class, PurificationChamberRecipeWrapper.class);
|
||||
registerAdvancedMachine(registry, Recipe.OSMIUM_COMPRESSOR, "tile.MachineBlock.OsmiumCompressor.name", ProgressBar.RED, OsmiumCompressorRecipeHandler.class, OsmiumCompressorRecipeWrapper.class);
|
||||
registerAdvancedMachine(registry, Recipe.CHEMICAL_INJECTION_CHAMBER, "nei.chemicalInjectionChamber", ProgressBar.YELLOW, ChemicalInjectionChamberRecipeHandler.class, ChemicalInjectionChamberRecipeWrapper.class);
|
||||
|
||||
registerChanceMachine(registry, Recipe.PRECISION_SAWMILL, "tile.MachineBlock2.PrecisionSawmill.name", ProgressBar.PURPLE, PrecisionSawmillRecipeHandler.class, PrecisionSawmillRecipeWrapper.class);
|
||||
|
||||
MetallurgicInfuserRecipeCategory metallurgicInfuserCategory = new MetallurgicInfuserRecipeCategory(registry.getJeiHelpers().getGuiHelper());
|
||||
registry.addRecipeCategories(metallurgicInfuserCategory);
|
||||
registry.addRecipeHandlers(new MetallurgicInfuserRecipeHandler(metallurgicInfuserCategory));
|
||||
addRecipes(registry, Recipe.METALLURGIC_INFUSER, metallurgicInfuserCategory, MetallurgicInfuserRecipe.class, MetallurgicInfuserRecipeCategory.class, MetallurgicInfuserRecipeWrapper.class);
|
||||
|
||||
ChemicalCrystallizerRecipeCategory chemicalCrystallizerCategory = new ChemicalCrystallizerRecipeCategory(registry.getJeiHelpers().getGuiHelper());
|
||||
registry.addRecipeCategories(chemicalCrystallizerCategory);
|
||||
registry.addRecipeHandlers(new ChemicalCrystallizerRecipeHandler(chemicalCrystallizerCategory));
|
||||
addRecipes(registry, Recipe.CHEMICAL_CRYSTALLIZER, chemicalCrystallizerCategory, CrystallizerRecipe.class, ChemicalCrystallizerRecipeCategory.class, ChemicalCrystallizerRecipeWrapper.class);
|
||||
|
||||
ChemicalDissolutionChamberRecipeCategory chemicalDissolutionChamberCategory = new ChemicalDissolutionChamberRecipeCategory(registry.getJeiHelpers().getGuiHelper());
|
||||
registry.addRecipeCategories(chemicalDissolutionChamberCategory);
|
||||
registry.addRecipeHandlers(new ChemicalDissolutionChamberRecipeHandler(chemicalDissolutionChamberCategory));
|
||||
addRecipes(registry, Recipe.CHEMICAL_DISSOLUTION_CHAMBER, chemicalDissolutionChamberCategory, DissolutionRecipe.class, ChemicalDissolutionChamberRecipeCategory.class, ChemicalDissolutionChamberRecipeWrapper.class);
|
||||
|
||||
ChemicalInfuserRecipeCategory chemicalInfuserCategory = new ChemicalInfuserRecipeCategory(registry.getJeiHelpers().getGuiHelper());
|
||||
registry.addRecipeCategories(chemicalInfuserCategory);
|
||||
registry.addRecipeHandlers(new ChemicalInfuserRecipeHandler(chemicalInfuserCategory));
|
||||
addRecipes(registry, Recipe.CHEMICAL_INFUSER, chemicalInfuserCategory, ChemicalInfuserRecipe.class, ChemicalInfuserRecipeCategory.class, ChemicalInfuserRecipeWrapper.class);
|
||||
|
||||
ChemicalOxidizerRecipeCategory chemicalOxidizerCategory = new ChemicalOxidizerRecipeCategory(registry.getJeiHelpers().getGuiHelper());
|
||||
registry.addRecipeCategories(chemicalOxidizerCategory);
|
||||
registry.addRecipeHandlers(new ChemicalOxidizerRecipeHandler(chemicalOxidizerCategory));
|
||||
addRecipes(registry, Recipe.CHEMICAL_OXIDIZER, chemicalOxidizerCategory, OxidationRecipe.class, ChemicalOxidizerRecipeCategory.class, ChemicalOxidizerRecipeWrapper.class);
|
||||
|
||||
ChemicalWasherRecipeCategory chemicalWasherCategory = new ChemicalWasherRecipeCategory(registry.getJeiHelpers().getGuiHelper());
|
||||
registry.addRecipeCategories(chemicalWasherCategory);
|
||||
registry.addRecipeHandlers(new ChemicalWasherRecipeHandler(chemicalWasherCategory));
|
||||
addRecipes(registry, Recipe.CHEMICAL_WASHER, chemicalWasherCategory, WasherRecipe.class, ChemicalWasherRecipeCategory.class, ChemicalWasherRecipeWrapper.class);
|
||||
|
||||
SolarNeutronRecipeCategory solarNeutronCategory = new SolarNeutronRecipeCategory(registry.getJeiHelpers().getGuiHelper());
|
||||
registry.addRecipeCategories(solarNeutronCategory);
|
||||
registry.addRecipeHandlers(new SolarNeutronRecipeHandler(solarNeutronCategory));
|
||||
addRecipes(registry, Recipe.SOLAR_NEUTRON_ACTIVATOR, solarNeutronCategory, SolarNeutronRecipe.class, SolarNeutronRecipeCategory.class, SolarNeutronRecipeWrapper.class);
|
||||
|
||||
ElectrolyticSeparatorRecipeCategory electrolyticSeparatorCategory = new ElectrolyticSeparatorRecipeCategory(registry.getJeiHelpers().getGuiHelper());
|
||||
registry.addRecipeCategories(electrolyticSeparatorCategory);
|
||||
registry.addRecipeHandlers(new ElectrolyticSeparatorRecipeHandler(electrolyticSeparatorCategory));
|
||||
addRecipes(registry, Recipe.ELECTROLYTIC_SEPARATOR, electrolyticSeparatorCategory, SeparatorRecipe.class, ElectrolyticSeparatorRecipeCategory.class, ElectrolyticSeparatorRecipeWrapper.class);
|
||||
|
||||
ThermalEvaporationRecipeCategory thermalEvaporationCategory = new ThermalEvaporationRecipeCategory(registry.getJeiHelpers().getGuiHelper());
|
||||
registry.addRecipeCategories(thermalEvaporationCategory);
|
||||
registry.addRecipeHandlers(new ThermalEvaporationRecipeHandler(thermalEvaporationCategory));
|
||||
addRecipes(registry, Recipe.THERMAL_EVAPORATION_PLANT, thermalEvaporationCategory, ThermalEvaporationRecipe.class, ThermalEvaporationRecipeCategory.class, ThermalEvaporationRecipeWrapper.class);
|
||||
|
||||
PRCRecipeCategory prcCategory = new PRCRecipeCategory(registry.getJeiHelpers().getGuiHelper());
|
||||
registry.addRecipeCategories(prcCategory);
|
||||
registry.addRecipeHandlers(new PRCRecipeHandler(prcCategory));
|
||||
addRecipes(registry, Recipe.PRESSURIZED_REACTION_CHAMBER, prcCategory, PressurizedRecipe.class, PRCRecipeCategory.class, PRCRecipeWrapper.class);
|
||||
} catch(Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
registry.addRecipeClickArea(GuiEnrichmentChamber.class, 79, 40, 24, 7, "mekanism.enrichment_chamber");
|
||||
registry.addRecipeClickArea(GuiCrusher.class, 79, 40, 24, 7, "mekanism.crusher");
|
||||
registry.addRecipeClickArea(GuiCombiner.class, 79, 40, 24, 7, "mekanism.combiner");
|
||||
registry.addRecipeClickArea(GuiPurificationChamber.class, 79, 40, 24, 7, "mekanism.purification_chamber");
|
||||
registry.addRecipeClickArea(GuiOsmiumCompressor.class, 79, 40, 24, 7, "mekanism.osmium_compressor");
|
||||
registry.addRecipeClickArea(GuiChemicalInjectionChamber.class, 79, 40, 24, 7, "mekanism.chemical_injection_chamber");
|
||||
registry.addRecipeClickArea(GuiPrecisionSawmill.class, 79, 40, 24, 7, "mekanism.precision_sawmill");
|
||||
registry.addRecipeClickArea(GuiMetallurgicInfuser.class, 72, 47, 32, 8, "mekanism.metallurgic_infuser");
|
||||
registry.addRecipeClickArea(GuiChemicalCrystallizer.class, 53, 62, 48, 8, "mekanism.chemical_crystallizer");
|
||||
registry.addRecipeClickArea(GuiChemicalDissolutionChamber.class, 64, 40, 48, 8, "mekanism.chemical_dissolution_chamber");
|
||||
registry.addRecipeClickArea(GuiChemicalInfuser.class, 47, 39, 28, 8, "mekanism.chemical_infuser");
|
||||
registry.addRecipeClickArea(GuiChemicalInfuser.class, 101, 39, 28, 8, "mekanism.chemical_infuser");
|
||||
registry.addRecipeClickArea(GuiChemicalOxidizer.class, 64, 40, 48, 8, "mekanism.chemical_oxidizer");
|
||||
registry.addRecipeClickArea(GuiChemicalWasher.class, 61, 39, 55, 8, "mekanism.chemical_washer");
|
||||
registry.addRecipeClickArea(GuiSolarNeutronActivator.class, 64, 39, 48, 8, "mekanism.solar_neutron_activator");
|
||||
registry.addRecipeClickArea(GuiElectrolyticSeparator.class, 80, 30, 16, 6, "mekanism.electrolytic_separator");
|
||||
registry.addRecipeClickArea(GuiThermalEvaporationController.class, 49, 20, 78, 38, "mekanism.thermal_evaporation_plant");
|
||||
registry.addRecipeClickArea(GuiPRC.class, 75, 37, 36, 10, "mekanism.pressurized_reaction_chamber");
|
||||
registry.addRecipeClickArea(GuiRotaryCondensentrator.class, 64, 39, 48, 8, "mekanism.rotary_condensentrator");
|
||||
|
||||
List<RotaryCondensentratorRecipeWrapper> condensentratorRecipes = new ArrayList<RotaryCondensentratorRecipeWrapper>();
|
||||
|
||||
RotaryCondensentratorRecipeCategory rotaryCondensentratorCategory = new RotaryCondensentratorRecipeCategory(registry.getJeiHelpers().getGuiHelper());
|
||||
registry.addRecipeCategories(rotaryCondensentratorCategory);
|
||||
registry.addRecipeHandlers(new RotaryCondensentratorRecipeHandler(rotaryCondensentratorCategory));
|
||||
|
||||
for(Gas gas : GasRegistry.getRegisteredGasses())
|
||||
{
|
||||
if(gas.hasFluid())
|
||||
{
|
||||
condensentratorRecipes.add(new RotaryCondensentratorRecipeWrapper(gas.getFluid(), gas, true, rotaryCondensentratorCategory));
|
||||
condensentratorRecipes.add(new RotaryCondensentratorRecipeWrapper(gas.getFluid(), gas, false, rotaryCondensentratorCategory));
|
||||
}
|
||||
}
|
||||
|
||||
registry.addRecipes(condensentratorRecipes);
|
||||
}
|
||||
|
||||
private void registerBasicMachine(IModRegistry registry, Recipe recipe, String unlocalized, ProgressBar bar, Class<? extends MachineRecipeHandler> handler, Class<? extends MachineRecipeWrapper> wrapper) throws Exception
|
||||
{
|
||||
MachineRecipeCategory category = new MachineRecipeCategory(registry.getJeiHelpers().getGuiHelper(), recipe.name().toLowerCase(), unlocalized, bar);
|
||||
|
||||
registry.addRecipeCategories(category);
|
||||
registry.addRecipeHandlers(handler.getConstructor(MachineRecipeCategory.class).newInstance(category));
|
||||
|
||||
addRecipes(registry, recipe, category, BasicMachineRecipe.class, MachineRecipeCategory.class, wrapper);
|
||||
}
|
||||
|
||||
private void registerAdvancedMachine(IModRegistry registry, Recipe recipe, String unlocalized, ProgressBar bar, Class<? extends AdvancedMachineRecipeHandler> handler, Class<? extends AdvancedMachineRecipeWrapper> wrapper) throws Exception
|
||||
{
|
||||
AdvancedMachineRecipeCategory category = new AdvancedMachineRecipeCategory(registry.getJeiHelpers().getGuiHelper(), recipe.name().toLowerCase(), unlocalized, bar);
|
||||
|
||||
registry.addRecipeCategories(category);
|
||||
registry.addRecipeHandlers(handler.getConstructor(AdvancedMachineRecipeCategory.class).newInstance(category));
|
||||
|
||||
addRecipes(registry, recipe, category, AdvancedMachineRecipe.class, AdvancedMachineRecipeCategory.class, wrapper);
|
||||
}
|
||||
|
||||
private void registerChanceMachine(IModRegistry registry, Recipe recipe, String unlocalized, ProgressBar bar, Class<? extends ChanceMachineRecipeHandler> handler, Class<? extends ChanceMachineRecipeWrapper> wrapper) throws Exception
|
||||
{
|
||||
ChanceMachineRecipeCategory category = new ChanceMachineRecipeCategory(registry.getJeiHelpers().getGuiHelper(), recipe.name().toLowerCase(), unlocalized, bar);
|
||||
|
||||
registry.addRecipeCategories(category);
|
||||
registry.addRecipeHandlers(handler.getConstructor(ChanceMachineRecipeCategory.class).newInstance(category));
|
||||
|
||||
addRecipes(registry, recipe, category, ChanceMachineRecipe.class, ChanceMachineRecipeCategory.class, wrapper);
|
||||
}
|
||||
|
||||
private void addRecipes(IModRegistry registry, Recipe type, IRecipeCategory cat, Class recipe, Class category, Class<? extends IRecipeWrapper> wrapper) throws Exception
|
||||
{
|
||||
List<IRecipeWrapper> recipes = new ArrayList<IRecipeWrapper>();
|
||||
|
||||
for(Object obj : type.get().values())
|
||||
{
|
||||
if(obj instanceof MachineRecipe)
|
||||
{
|
||||
recipes.add(wrapper.getConstructor(recipe, category).newInstance(obj, cat));
|
||||
}
|
||||
}
|
||||
|
||||
registry.addRecipes(recipes);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onItemRegistryAvailable(IItemRegistry registry) {}
|
||||
|
||||
@Override
|
||||
public void onJeiHelpersAvailable(IJeiHelpers helpers) {}
|
||||
|
||||
@Override
|
||||
public void onRecipeRegistryAvailable(IRecipeRegistry registry) {}
|
||||
|
||||
@Override
|
||||
public void onRuntimeAvailable(IJeiRuntime runtime) {}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package mekanism.client.jei.crafting;
|
||||
|
||||
import mekanism.common.recipe.ShapedMekanismRecipe;
|
||||
import mezz.jei.api.recipe.IRecipeHandler;
|
||||
import mezz.jei.api.recipe.IRecipeWrapper;
|
||||
import mezz.jei.api.recipe.VanillaRecipeCategoryUid;
|
||||
|
||||
public class ShapedMekanismRecipeHandler implements IRecipeHandler<ShapedMekanismRecipe>
|
||||
{
|
||||
@Override
|
||||
public String getRecipeCategoryUid()
|
||||
{
|
||||
return VanillaRecipeCategoryUid.CRAFTING;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<ShapedMekanismRecipe> getRecipeClass()
|
||||
{
|
||||
return ShapedMekanismRecipe.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IRecipeWrapper getRecipeWrapper(ShapedMekanismRecipe recipe)
|
||||
{
|
||||
return new ShapedMekanismRecipeWrapper(recipe);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isRecipeValid(ShapedMekanismRecipe recipe)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
package mekanism.client.jei.crafting;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import mekanism.common.recipe.ShapedMekanismRecipe;
|
||||
import mezz.jei.api.recipe.BlankRecipeWrapper;
|
||||
import mezz.jei.api.recipe.wrapper.IShapedCraftingRecipeWrapper;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class ShapedMekanismRecipeWrapper extends BlankRecipeWrapper implements IShapedCraftingRecipeWrapper
|
||||
{
|
||||
@Nonnull
|
||||
private final ShapedMekanismRecipe recipe;
|
||||
|
||||
public ShapedMekanismRecipeWrapper(@Nonnull ShapedMekanismRecipe r)
|
||||
{
|
||||
recipe = r;
|
||||
|
||||
for(Object input : this.recipe.getInput())
|
||||
{
|
||||
if(input instanceof ItemStack)
|
||||
{
|
||||
ItemStack itemStack = (ItemStack)input;
|
||||
|
||||
if(itemStack.stackSize != 1)
|
||||
{
|
||||
itemStack.stackSize = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public List getInputs()
|
||||
{
|
||||
return Arrays.asList(recipe.getInput());
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public List<ItemStack> getOutputs()
|
||||
{
|
||||
return Collections.singletonList(recipe.getRecipeOutput());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getWidth()
|
||||
{
|
||||
return recipe.width;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getHeight()
|
||||
{
|
||||
return recipe.height;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package mekanism.client.jei.crafting;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import mekanism.common.recipe.ShapelessMekanismRecipe;
|
||||
import mezz.jei.api.recipe.IRecipeHandler;
|
||||
import mezz.jei.api.recipe.IRecipeWrapper;
|
||||
import mezz.jei.api.recipe.VanillaRecipeCategoryUid;
|
||||
|
||||
public class ShapelessMekanismRecipeHandler implements IRecipeHandler<ShapelessMekanismRecipe>
|
||||
{
|
||||
@Override
|
||||
@Nonnull
|
||||
public Class<ShapelessMekanismRecipe> getRecipeClass()
|
||||
{
|
||||
return ShapelessMekanismRecipe.class;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getRecipeCategoryUid()
|
||||
{
|
||||
return VanillaRecipeCategoryUid.CRAFTING;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nonnull
|
||||
public IRecipeWrapper getRecipeWrapper(@Nonnull ShapelessMekanismRecipe recipe)
|
||||
{
|
||||
return new ShapelessMekanismRecipeWrapper(recipe);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isRecipeValid(@Nonnull ShapelessMekanismRecipe recipe)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
package mekanism.client.jei.crafting;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import mekanism.common.recipe.ShapelessMekanismRecipe;
|
||||
import mezz.jei.api.recipe.BlankRecipeWrapper;
|
||||
import mezz.jei.api.recipe.wrapper.ICraftingRecipeWrapper;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class ShapelessMekanismRecipeWrapper extends BlankRecipeWrapper implements ICraftingRecipeWrapper
|
||||
{
|
||||
@Nonnull
|
||||
private final ShapelessMekanismRecipe recipe;
|
||||
|
||||
public ShapelessMekanismRecipeWrapper(@Nonnull ShapelessMekanismRecipe r)
|
||||
{
|
||||
recipe = r;
|
||||
|
||||
for(Object input : recipe.getInput())
|
||||
{
|
||||
if(input instanceof ItemStack)
|
||||
{
|
||||
ItemStack itemStack = (ItemStack)input;
|
||||
|
||||
if(itemStack.stackSize != 1)
|
||||
{
|
||||
itemStack.stackSize = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public List getInputs()
|
||||
{
|
||||
return recipe.getInput();
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public List<ItemStack> getOutputs()
|
||||
{
|
||||
return Collections.singletonList(recipe.getRecipeOutput());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package mekanism.client.jei.gas;
|
||||
|
||||
|
||||
public class GasStackHelper// implements IIngredientHelper<GasStack>
|
||||
{
|
||||
/*@Override
|
||||
public Collection<GasStack> expandSubtypes(Collection<GasStack> contained) {
|
||||
return contained;
|
||||
}
|
||||
|
||||
@Override
|
||||
public GasStack getMatch(Iterable<GasStack> ingredients, @Nonnull Focus toMatch) {
|
||||
if (toMatch.getGas() == null) {
|
||||
return null;
|
||||
}
|
||||
for (GasStack GasStack : ingredients) {
|
||||
if (toMatch.getGas() == GasStack.getGas()) {
|
||||
return GasStack;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public Focus createFocus(@Nonnull GasStack ingredient) {
|
||||
return new Focus(ingredient.getGas());
|
||||
}*/
|
||||
}
|
||||
@@ -0,0 +1,113 @@
|
||||
package mekanism.client.jei.machine;
|
||||
|
||||
import mekanism.api.gas.GasStack;
|
||||
import mekanism.client.gui.element.GuiPowerBar;
|
||||
import mekanism.client.gui.element.GuiPowerBar.IPowerInfoHandler;
|
||||
import mekanism.client.gui.element.GuiProgress;
|
||||
import mekanism.client.gui.element.GuiProgress.IProgressInfoHandler;
|
||||
import mekanism.client.gui.element.GuiProgress.ProgressBar;
|
||||
import mekanism.client.gui.element.GuiSlot;
|
||||
import mekanism.client.gui.element.GuiSlot.SlotOverlay;
|
||||
import mekanism.client.gui.element.GuiSlot.SlotType;
|
||||
import mekanism.client.jei.BaseRecipeCategory;
|
||||
import mekanism.common.recipe.inputs.AdvancedMachineInput;
|
||||
import mekanism.common.recipe.machines.AdvancedMachineRecipe;
|
||||
import mekanism.common.util.MekanismUtils;
|
||||
import mekanism.common.util.MekanismUtils.ResourceType;
|
||||
import mezz.jei.api.IGuiHelper;
|
||||
import mezz.jei.api.gui.IDrawable;
|
||||
import mezz.jei.api.gui.IGuiItemStackGroup;
|
||||
import mezz.jei.api.gui.IRecipeLayout;
|
||||
import mezz.jei.api.gui.ITickTimer;
|
||||
import mezz.jei.api.recipe.IRecipeWrapper;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
public class AdvancedMachineRecipeCategory extends BaseRecipeCategory
|
||||
{
|
||||
public IGuiHelper guiHelper;
|
||||
|
||||
public String recipeName;
|
||||
public String unlocalizedName;
|
||||
|
||||
public IDrawable background;
|
||||
|
||||
public AdvancedMachineRecipe tempRecipe;
|
||||
|
||||
public ITickTimer timer;
|
||||
|
||||
public AdvancedMachineRecipeCategory(IGuiHelper helper, String name, String unlocalized, ProgressBar progress)
|
||||
{
|
||||
super("mekanism:gui/GuiAdvancedMachine.png", name, unlocalized, progress);
|
||||
|
||||
guiHelper = helper;
|
||||
|
||||
timer = helper.createTickTimer(20, 20, false);
|
||||
background = guiHelper.createDrawable(new ResourceLocation(guiTexture), 28, 16, 144, 54);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addGuiElements()
|
||||
{
|
||||
guiElements.add(new GuiSlot(SlotType.INPUT, this, MekanismUtils.getResource(ResourceType.GUI, stripTexture()), 55, 16));
|
||||
guiElements.add(new GuiSlot(SlotType.POWER, this, MekanismUtils.getResource(ResourceType.GUI, stripTexture()), 30, 34).with(SlotOverlay.POWER));
|
||||
guiElements.add(new GuiSlot(SlotType.EXTRA, this, MekanismUtils.getResource(ResourceType.GUI, stripTexture()), 55, 52));
|
||||
guiElements.add(new GuiSlot(SlotType.OUTPUT_LARGE, this, MekanismUtils.getResource(ResourceType.GUI, stripTexture()), 111, 30));
|
||||
|
||||
guiElements.add(new GuiPowerBar(this, new IPowerInfoHandler() {
|
||||
@Override
|
||||
public double getLevel()
|
||||
{
|
||||
return 1F;
|
||||
}
|
||||
}, MekanismUtils.getResource(ResourceType.GUI, stripTexture()), 164, 15));
|
||||
guiElements.add(new GuiProgress(new IProgressInfoHandler()
|
||||
{
|
||||
@Override
|
||||
public double getProgress()
|
||||
{
|
||||
return (double)timer.getValue() / 20F;
|
||||
}
|
||||
}, progressBar, this, MekanismUtils.getResource(ResourceType.GUI, stripTexture()), 77, 37));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawExtras(Minecraft minecraft)
|
||||
{
|
||||
super.drawExtras(minecraft);
|
||||
|
||||
AdvancedMachineInput input = (AdvancedMachineInput)tempRecipe.getInput();
|
||||
|
||||
if(input.gasType != null)
|
||||
{
|
||||
displayGauge(33, 21, 6, 12, new GasStack(input.gasType, 1));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public IDrawable getBackground()
|
||||
{
|
||||
return background;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRecipe(IRecipeLayout recipeLayout, IRecipeWrapper recipeWrapper)
|
||||
{
|
||||
if(recipeWrapper instanceof AdvancedMachineRecipeWrapper)
|
||||
{
|
||||
tempRecipe = ((AdvancedMachineRecipeWrapper)recipeWrapper).recipe;
|
||||
}
|
||||
|
||||
AdvancedMachineInput input = (AdvancedMachineInput)tempRecipe.recipeInput;
|
||||
|
||||
IGuiItemStackGroup itemStacks = recipeLayout.getItemStacks();
|
||||
|
||||
itemStacks.init(0, true, 27, 0);
|
||||
itemStacks.init(1, false, 87, 18);
|
||||
itemStacks.init(2, false, 27, 36);
|
||||
|
||||
itemStacks.setFromRecipe(0, recipeWrapper.getInputs());
|
||||
itemStacks.setFromRecipe(1, recipeWrapper.getOutputs());
|
||||
itemStacks.set(2, ((AdvancedMachineRecipeWrapper)recipeWrapper).getFuelStacks(input.gasType));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
package mekanism.client.jei.machine;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import mezz.jei.api.recipe.IRecipeHandler;
|
||||
import mezz.jei.api.recipe.IRecipeWrapper;
|
||||
|
||||
public class AdvancedMachineRecipeHandler<T extends AdvancedMachineRecipeWrapper> implements IRecipeHandler<T>
|
||||
{
|
||||
private final AdvancedMachineRecipeCategory category;
|
||||
|
||||
public Class<T> wrapperClass;
|
||||
|
||||
public AdvancedMachineRecipeHandler(AdvancedMachineRecipeCategory c, Class<T> wrapper)
|
||||
{
|
||||
category = c;
|
||||
|
||||
wrapperClass = wrapper;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<T> getRecipeClass()
|
||||
{
|
||||
return wrapperClass;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getRecipeCategoryUid()
|
||||
{
|
||||
return category.getUid();
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public IRecipeWrapper getRecipeWrapper(@Nonnull T recipe)
|
||||
{
|
||||
return recipe;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isRecipeValid(@Nonnull T recipe)
|
||||
{
|
||||
return recipe.category == category;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
package mekanism.client.jei.machine;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import mekanism.api.gas.Gas;
|
||||
import mekanism.common.recipe.inputs.AdvancedMachineInput;
|
||||
import mekanism.common.recipe.machines.AdvancedMachineRecipe;
|
||||
import mekanism.common.recipe.outputs.ItemStackOutput;
|
||||
import mezz.jei.api.recipe.BlankRecipeWrapper;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public abstract class AdvancedMachineRecipeWrapper extends BlankRecipeWrapper
|
||||
{
|
||||
public AdvancedMachineRecipe recipe;
|
||||
|
||||
public AdvancedMachineRecipeCategory category;
|
||||
|
||||
public AdvancedMachineRecipeWrapper(AdvancedMachineRecipe r, AdvancedMachineRecipeCategory c)
|
||||
{
|
||||
recipe = r;
|
||||
category = c;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public List<ItemStack> getInputs()
|
||||
{
|
||||
return Arrays.asList(((AdvancedMachineInput)recipe.getInput()).itemStack);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public List<ItemStack> getOutputs()
|
||||
{
|
||||
return Arrays.asList(((ItemStackOutput)recipe.getOutput()).output);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public List<String> getTooltipStrings(int mouseX, int mouseY)
|
||||
{
|
||||
List<String> currenttip = new ArrayList<String>();
|
||||
|
||||
if(mouseX >= 33 && mouseX <= 39 && mouseY >= 22 && mouseY <= 34)
|
||||
{
|
||||
currenttip.add(((AdvancedMachineInput)recipe.getInput()).gasType.getLocalizedName());
|
||||
}
|
||||
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
public abstract List<ItemStack> getFuelStacks(Gas gasType);
|
||||
}
|
||||
@@ -0,0 +1,103 @@
|
||||
package mekanism.client.jei.machine;
|
||||
|
||||
import mekanism.client.gui.element.GuiPowerBar;
|
||||
import mekanism.client.gui.element.GuiPowerBar.IPowerInfoHandler;
|
||||
import mekanism.client.gui.element.GuiProgress;
|
||||
import mekanism.client.gui.element.GuiProgress.IProgressInfoHandler;
|
||||
import mekanism.client.gui.element.GuiProgress.ProgressBar;
|
||||
import mekanism.client.gui.element.GuiSlot;
|
||||
import mekanism.client.gui.element.GuiSlot.SlotOverlay;
|
||||
import mekanism.client.gui.element.GuiSlot.SlotType;
|
||||
import mekanism.client.jei.BaseRecipeCategory;
|
||||
import mekanism.common.recipe.machines.ChanceMachineRecipe;
|
||||
import mekanism.common.recipe.outputs.ChanceOutput;
|
||||
import mekanism.common.util.MekanismUtils;
|
||||
import mekanism.common.util.MekanismUtils.ResourceType;
|
||||
import mezz.jei.api.IGuiHelper;
|
||||
import mezz.jei.api.gui.IDrawable;
|
||||
import mezz.jei.api.gui.IGuiItemStackGroup;
|
||||
import mezz.jei.api.gui.IRecipeLayout;
|
||||
import mezz.jei.api.gui.ITickTimer;
|
||||
import mezz.jei.api.recipe.IRecipeWrapper;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
public class ChanceMachineRecipeCategory extends BaseRecipeCategory
|
||||
{
|
||||
public IGuiHelper guiHelper;
|
||||
|
||||
public IDrawable background;
|
||||
|
||||
public ChanceMachineRecipe tempRecipe;
|
||||
|
||||
public ITickTimer timer;
|
||||
|
||||
public ChanceMachineRecipeCategory(IGuiHelper helper, String name, String unlocalized, ProgressBar progress)
|
||||
{
|
||||
super("mekanism:gui/GuiBasicMachine.png", name, unlocalized, progress);
|
||||
|
||||
guiHelper = helper;
|
||||
|
||||
timer = helper.createTickTimer(20, 20, false);
|
||||
|
||||
background = guiHelper.createDrawable(new ResourceLocation(guiTexture), 28, 16, 144, 54);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addGuiElements()
|
||||
{
|
||||
guiElements.add(new GuiSlot(SlotType.INPUT, this, MekanismUtils.getResource(ResourceType.GUI, stripTexture()), 55, 16));
|
||||
guiElements.add(new GuiSlot(SlotType.POWER, this, MekanismUtils.getResource(ResourceType.GUI, stripTexture()), 55, 52).with(SlotOverlay.POWER));
|
||||
guiElements.add(new GuiSlot(SlotType.OUTPUT_WIDE, this, MekanismUtils.getResource(ResourceType.GUI, stripTexture()), 111, 30));
|
||||
|
||||
guiElements.add(new GuiPowerBar(this, new IPowerInfoHandler() {
|
||||
@Override
|
||||
public double getLevel()
|
||||
{
|
||||
return 1F;
|
||||
}
|
||||
}, MekanismUtils.getResource(ResourceType.GUI, stripTexture()), 164, 15));
|
||||
guiElements.add(new GuiProgress(new IProgressInfoHandler()
|
||||
{
|
||||
@Override
|
||||
public double getProgress()
|
||||
{
|
||||
return (double)timer.getValue() / 20F;
|
||||
}
|
||||
}, progressBar, this, MekanismUtils.getResource(ResourceType.GUI, stripTexture()), 77, 37));
|
||||
}
|
||||
|
||||
@Override
|
||||
public IDrawable getBackground()
|
||||
{
|
||||
return background;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRecipe(IRecipeLayout recipeLayout, IRecipeWrapper recipeWrapper)
|
||||
{
|
||||
if(recipeWrapper instanceof ChanceMachineRecipeWrapper)
|
||||
{
|
||||
tempRecipe = ((ChanceMachineRecipeWrapper)recipeWrapper).recipe;
|
||||
}
|
||||
|
||||
IGuiItemStackGroup itemStacks = recipeLayout.getItemStacks();
|
||||
|
||||
itemStacks.init(0, true, 27, 0);
|
||||
itemStacks.init(1, false, 87, 18);
|
||||
itemStacks.init(2, false, 103, 18);
|
||||
|
||||
itemStacks.setFromRecipe(0, recipeWrapper.getInputs());
|
||||
|
||||
ChanceOutput output = (ChanceOutput)tempRecipe.getOutput();
|
||||
|
||||
if(output.hasPrimary())
|
||||
{
|
||||
itemStacks.setFromRecipe(1, output.primaryOutput);
|
||||
}
|
||||
|
||||
if(output.hasSecondary())
|
||||
{
|
||||
itemStacks.set(2, output.secondaryOutput);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
package mekanism.client.jei.machine;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import mezz.jei.api.recipe.IRecipeHandler;
|
||||
import mezz.jei.api.recipe.IRecipeWrapper;
|
||||
|
||||
public class ChanceMachineRecipeHandler<T extends ChanceMachineRecipeWrapper> implements IRecipeHandler<T>
|
||||
{
|
||||
private final ChanceMachineRecipeCategory category;
|
||||
|
||||
public Class<T> wrapperClass;
|
||||
|
||||
public ChanceMachineRecipeHandler(ChanceMachineRecipeCategory c, Class<T> wrapper)
|
||||
{
|
||||
category = c;
|
||||
|
||||
wrapperClass = wrapper;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<T> getRecipeClass()
|
||||
{
|
||||
return wrapperClass;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getRecipeCategoryUid()
|
||||
{
|
||||
return category.getUid();
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public IRecipeWrapper getRecipeWrapper(@Nonnull T recipe)
|
||||
{
|
||||
return recipe;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isRecipeValid(@Nonnull T recipe)
|
||||
{
|
||||
return recipe.category == category;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
package mekanism.client.jei.machine;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import mekanism.common.recipe.inputs.ItemStackInput;
|
||||
import mekanism.common.recipe.machines.ChanceMachineRecipe;
|
||||
import mekanism.common.recipe.outputs.ChanceOutput;
|
||||
import mezz.jei.api.recipe.BlankRecipeWrapper;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class ChanceMachineRecipeWrapper extends BlankRecipeWrapper
|
||||
{
|
||||
public ChanceMachineRecipe recipe;
|
||||
|
||||
public ChanceMachineRecipeCategory category;
|
||||
|
||||
public ChanceMachineRecipeWrapper(ChanceMachineRecipe r, ChanceMachineRecipeCategory c)
|
||||
{
|
||||
recipe = r;
|
||||
category = c;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public List<ItemStack> getInputs()
|
||||
{
|
||||
return Arrays.asList(((ItemStackInput)recipe.getInput()).ingredient);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public List<ItemStack> getOutputs()
|
||||
{
|
||||
ChanceOutput output = (ChanceOutput)recipe.getOutput();
|
||||
|
||||
return Arrays.asList(output.primaryOutput, output.secondaryOutput);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawInfo(@Nonnull Minecraft minecraft, int recipeWidth, int recipeHeight, int mouseX, int mouseY)
|
||||
{
|
||||
ChanceOutput output = (ChanceOutput)recipe.getOutput();
|
||||
|
||||
if(output.hasSecondary())
|
||||
{
|
||||
FontRenderer fontRendererObj = minecraft.fontRendererObj;
|
||||
fontRendererObj.drawString(Math.round(output.secondaryChance*100) + "%", 104, 41, 0x404040, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
package mekanism.client.jei.machine;
|
||||
|
||||
import mekanism.client.gui.element.GuiPowerBar;
|
||||
import mekanism.client.gui.element.GuiPowerBar.IPowerInfoHandler;
|
||||
import mekanism.client.gui.element.GuiProgress;
|
||||
import mekanism.client.gui.element.GuiProgress.IProgressInfoHandler;
|
||||
import mekanism.client.gui.element.GuiProgress.ProgressBar;
|
||||
import mekanism.client.gui.element.GuiSlot;
|
||||
import mekanism.client.gui.element.GuiSlot.SlotOverlay;
|
||||
import mekanism.client.gui.element.GuiSlot.SlotType;
|
||||
import mekanism.client.jei.BaseRecipeCategory;
|
||||
import mekanism.common.recipe.machines.BasicMachineRecipe;
|
||||
import mekanism.common.util.MekanismUtils;
|
||||
import mekanism.common.util.MekanismUtils.ResourceType;
|
||||
import mezz.jei.api.IGuiHelper;
|
||||
import mezz.jei.api.gui.IDrawable;
|
||||
import mezz.jei.api.gui.IGuiItemStackGroup;
|
||||
import mezz.jei.api.gui.IRecipeLayout;
|
||||
import mezz.jei.api.gui.ITickTimer;
|
||||
import mezz.jei.api.recipe.IRecipeWrapper;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
public class MachineRecipeCategory extends BaseRecipeCategory
|
||||
{
|
||||
public IGuiHelper guiHelper;
|
||||
|
||||
public IDrawable background;
|
||||
|
||||
public BasicMachineRecipe tempRecipe;
|
||||
|
||||
public ITickTimer timer;
|
||||
|
||||
public MachineRecipeCategory(IGuiHelper helper, String name, String unlocalized, ProgressBar progress)
|
||||
{
|
||||
super("mekanism:gui/GuiBasicMachine.png", name, unlocalized, progress);
|
||||
|
||||
guiHelper = helper;
|
||||
|
||||
timer = helper.createTickTimer(20, 20, false);
|
||||
|
||||
background = guiHelper.createDrawable(new ResourceLocation(guiTexture), 28, 16, 144, 54);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addGuiElements()
|
||||
{
|
||||
guiElements.add(new GuiSlot(SlotType.INPUT, this, MekanismUtils.getResource(ResourceType.GUI, stripTexture()), 55, 16));
|
||||
guiElements.add(new GuiSlot(SlotType.POWER, this, MekanismUtils.getResource(ResourceType.GUI, stripTexture()), 55, 52).with(SlotOverlay.POWER));
|
||||
guiElements.add(new GuiSlot(SlotType.OUTPUT_LARGE, this, MekanismUtils.getResource(ResourceType.GUI, stripTexture()), 111, 30));
|
||||
|
||||
guiElements.add(new GuiPowerBar(this, new IPowerInfoHandler() {
|
||||
@Override
|
||||
public double getLevel()
|
||||
{
|
||||
return 1F;
|
||||
}
|
||||
}, MekanismUtils.getResource(ResourceType.GUI, stripTexture()), 164, 15));
|
||||
guiElements.add(new GuiProgress(new IProgressInfoHandler()
|
||||
{
|
||||
@Override
|
||||
public double getProgress()
|
||||
{
|
||||
return (double)timer.getValue() / 20F;
|
||||
}
|
||||
}, progressBar, this, MekanismUtils.getResource(ResourceType.GUI, stripTexture()), 77, 37));
|
||||
}
|
||||
|
||||
@Override
|
||||
public IDrawable getBackground()
|
||||
{
|
||||
return background;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRecipe(IRecipeLayout recipeLayout, IRecipeWrapper recipeWrapper)
|
||||
{
|
||||
if(recipeWrapper instanceof MachineRecipeWrapper)
|
||||
{
|
||||
tempRecipe = ((MachineRecipeWrapper)recipeWrapper).recipe;
|
||||
}
|
||||
|
||||
IGuiItemStackGroup itemStacks = recipeLayout.getItemStacks();
|
||||
|
||||
itemStacks.init(0, true, 27, 0);
|
||||
itemStacks.init(1, false, 87, 18);
|
||||
|
||||
itemStacks.setFromRecipe(0, recipeWrapper.getInputs());
|
||||
itemStacks.setFromRecipe(1, recipeWrapper.getOutputs());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
package mekanism.client.jei.machine;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import mezz.jei.api.recipe.IRecipeHandler;
|
||||
import mezz.jei.api.recipe.IRecipeWrapper;
|
||||
|
||||
public class MachineRecipeHandler<T extends MachineRecipeWrapper> implements IRecipeHandler<T>
|
||||
{
|
||||
private final MachineRecipeCategory category;
|
||||
|
||||
public Class<T> wrapperClass;
|
||||
|
||||
public MachineRecipeHandler(MachineRecipeCategory c, Class<T> wrapper)
|
||||
{
|
||||
category = c;
|
||||
|
||||
wrapperClass = wrapper;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<T> getRecipeClass()
|
||||
{
|
||||
return wrapperClass;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getRecipeCategoryUid()
|
||||
{
|
||||
return category.getUid();
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public IRecipeWrapper getRecipeWrapper(@Nonnull T recipe)
|
||||
{
|
||||
return recipe;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isRecipeValid(@Nonnull T recipe)
|
||||
{
|
||||
return recipe.category == category;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
package mekanism.client.jei.machine;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import mekanism.common.recipe.inputs.ItemStackInput;
|
||||
import mekanism.common.recipe.machines.BasicMachineRecipe;
|
||||
import mekanism.common.recipe.outputs.ItemStackOutput;
|
||||
import mezz.jei.api.recipe.BlankRecipeWrapper;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class MachineRecipeWrapper extends BlankRecipeWrapper
|
||||
{
|
||||
public BasicMachineRecipe recipe;
|
||||
|
||||
public MachineRecipeCategory category;
|
||||
|
||||
public MachineRecipeWrapper(BasicMachineRecipe r, MachineRecipeCategory c)
|
||||
{
|
||||
recipe = r;
|
||||
category = c;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public List<ItemStack> getInputs()
|
||||
{
|
||||
return Arrays.asList(((ItemStackInput)recipe.getInput()).ingredient);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public List<ItemStack> getOutputs()
|
||||
{
|
||||
return Arrays.asList(((ItemStackOutput)recipe.getOutput()).output);
|
||||
}
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
package mekanism.client.jei.machine.advanced;
|
||||
|
||||
import mekanism.client.jei.machine.AdvancedMachineRecipeCategory;
|
||||
import mekanism.client.jei.machine.AdvancedMachineRecipeHandler;
|
||||
|
||||
public class ChemicalInjectionChamberRecipeHandler extends AdvancedMachineRecipeHandler
|
||||
{
|
||||
public ChemicalInjectionChamberRecipeHandler(AdvancedMachineRecipeCategory c)
|
||||
{
|
||||
super(c, ChemicalInjectionChamberRecipeWrapper.class);
|
||||
}
|
||||
}
|
||||
+50
@@ -0,0 +1,50 @@
|
||||
package mekanism.client.jei.machine.advanced;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import mekanism.api.gas.Gas;
|
||||
import mekanism.api.gas.GasRegistry;
|
||||
import mekanism.api.util.ListUtils;
|
||||
import mekanism.client.jei.machine.AdvancedMachineRecipeCategory;
|
||||
import mekanism.client.jei.machine.AdvancedMachineRecipeWrapper;
|
||||
import mekanism.common.Tier.GasTankTier;
|
||||
import mekanism.common.recipe.machines.AdvancedMachineRecipe;
|
||||
import mekanism.common.util.MekanismUtils;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
public class ChemicalInjectionChamberRecipeWrapper extends AdvancedMachineRecipeWrapper
|
||||
{
|
||||
public ChemicalInjectionChamberRecipeWrapper(AdvancedMachineRecipe r, AdvancedMachineRecipeCategory c)
|
||||
{
|
||||
super(r, c);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ItemStack> getFuelStacks(Gas gasType)
|
||||
{
|
||||
if(gasType == GasRegistry.getGas("sulfuricAcid"))
|
||||
{
|
||||
List<ItemStack> fuels = new ArrayList<ItemStack>();
|
||||
fuels.addAll(OreDictionary.getOres("dustSulfur"));
|
||||
fuels.add(MekanismUtils.getFullGasTank(GasTankTier.BASIC, GasRegistry.getGas("sulfuricAcid")));
|
||||
|
||||
return fuels;
|
||||
}
|
||||
else if(gasType == GasRegistry.getGas("water"))
|
||||
{
|
||||
return ListUtils.asList(MekanismUtils.getFullGasTank(GasTankTier.BASIC, GasRegistry.getGas("water")));
|
||||
}
|
||||
else if(gasType == GasRegistry.getGas("hydrogenChloride"))
|
||||
{
|
||||
List<ItemStack> fuels = new ArrayList<ItemStack>();
|
||||
fuels.addAll(OreDictionary.getOres("dustSalt"));
|
||||
fuels.add(MekanismUtils.getFullGasTank(GasTankTier.BASIC, GasRegistry.getGas("hydrogenChloride")));
|
||||
|
||||
return fuels;
|
||||
}
|
||||
|
||||
return new ArrayList<ItemStack>();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package mekanism.client.jei.machine.advanced;
|
||||
|
||||
import mekanism.client.jei.machine.AdvancedMachineRecipeCategory;
|
||||
import mekanism.client.jei.machine.AdvancedMachineRecipeHandler;
|
||||
|
||||
public class CombinerRecipeHandler extends AdvancedMachineRecipeHandler
|
||||
{
|
||||
public CombinerRecipeHandler(AdvancedMachineRecipeCategory c)
|
||||
{
|
||||
super(c, CombinerRecipeWrapper.class);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package mekanism.client.jei.machine.advanced;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import mekanism.api.gas.Gas;
|
||||
import mekanism.api.util.ListUtils;
|
||||
import mekanism.client.jei.machine.AdvancedMachineRecipeCategory;
|
||||
import mekanism.client.jei.machine.AdvancedMachineRecipeWrapper;
|
||||
import mekanism.common.recipe.machines.AdvancedMachineRecipe;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class CombinerRecipeWrapper extends AdvancedMachineRecipeWrapper
|
||||
{
|
||||
public CombinerRecipeWrapper(AdvancedMachineRecipe r, AdvancedMachineRecipeCategory c)
|
||||
{
|
||||
super(r, c);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ItemStack> getFuelStacks(Gas gasType)
|
||||
{
|
||||
return ListUtils.asList(new ItemStack(Blocks.cobblestone));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package mekanism.client.jei.machine.advanced;
|
||||
|
||||
import mekanism.client.jei.machine.AdvancedMachineRecipeCategory;
|
||||
import mekanism.client.jei.machine.AdvancedMachineRecipeHandler;
|
||||
|
||||
public class OsmiumCompressorRecipeHandler extends AdvancedMachineRecipeHandler
|
||||
{
|
||||
public OsmiumCompressorRecipeHandler(AdvancedMachineRecipeCategory c)
|
||||
{
|
||||
super(c, OsmiumCompressorRecipeWrapper.class);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package mekanism.client.jei.machine.advanced;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import mekanism.api.gas.Gas;
|
||||
import mekanism.api.util.ListUtils;
|
||||
import mekanism.client.jei.machine.AdvancedMachineRecipeCategory;
|
||||
import mekanism.client.jei.machine.AdvancedMachineRecipeWrapper;
|
||||
import mekanism.common.MekanismItems;
|
||||
import mekanism.common.recipe.machines.AdvancedMachineRecipe;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class OsmiumCompressorRecipeWrapper extends AdvancedMachineRecipeWrapper
|
||||
{
|
||||
public OsmiumCompressorRecipeWrapper(AdvancedMachineRecipe r, AdvancedMachineRecipeCategory c)
|
||||
{
|
||||
super(r, c);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ItemStack> getFuelStacks(Gas gasType)
|
||||
{
|
||||
return ListUtils.asList(new ItemStack(MekanismItems.Ingot, 1, 1));
|
||||
}
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
package mekanism.client.jei.machine.advanced;
|
||||
|
||||
import mekanism.client.jei.machine.AdvancedMachineRecipeCategory;
|
||||
import mekanism.client.jei.machine.AdvancedMachineRecipeHandler;
|
||||
|
||||
public class PurificationChamberRecipeHandler extends AdvancedMachineRecipeHandler
|
||||
{
|
||||
public PurificationChamberRecipeHandler(AdvancedMachineRecipeCategory c)
|
||||
{
|
||||
super(c, PurificationChamberRecipeWrapper.class);
|
||||
}
|
||||
}
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
package mekanism.client.jei.machine.advanced;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import mekanism.api.gas.Gas;
|
||||
import mekanism.api.gas.GasRegistry;
|
||||
import mekanism.api.util.ListUtils;
|
||||
import mekanism.client.jei.machine.AdvancedMachineRecipeCategory;
|
||||
import mekanism.client.jei.machine.AdvancedMachineRecipeWrapper;
|
||||
import mekanism.common.Tier.GasTankTier;
|
||||
import mekanism.common.recipe.machines.AdvancedMachineRecipe;
|
||||
import mekanism.common.util.MekanismUtils;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class PurificationChamberRecipeWrapper extends AdvancedMachineRecipeWrapper
|
||||
{
|
||||
public PurificationChamberRecipeWrapper(AdvancedMachineRecipe r, AdvancedMachineRecipeCategory c)
|
||||
{
|
||||
super(r, c);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ItemStack> getFuelStacks(Gas gasType)
|
||||
{
|
||||
if(gasType == GasRegistry.getGas("oxygen"))
|
||||
{
|
||||
return ListUtils.asList(new ItemStack(Items.flint), MekanismUtils.getFullGasTank(GasTankTier.BASIC, GasRegistry.getGas("oxygen")));
|
||||
}
|
||||
|
||||
return new ArrayList<ItemStack>();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package mekanism.client.jei.machine.basic;
|
||||
|
||||
import mekanism.client.jei.machine.MachineRecipeCategory;
|
||||
import mekanism.client.jei.machine.MachineRecipeHandler;
|
||||
|
||||
public class CrusherRecipeHandler extends MachineRecipeHandler
|
||||
{
|
||||
public CrusherRecipeHandler(MachineRecipeCategory c)
|
||||
{
|
||||
super(c, CrusherRecipeWrapper.class);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package mekanism.client.jei.machine.basic;
|
||||
|
||||
import mekanism.client.jei.machine.MachineRecipeCategory;
|
||||
import mekanism.client.jei.machine.MachineRecipeWrapper;
|
||||
import mekanism.common.recipe.machines.BasicMachineRecipe;
|
||||
|
||||
public class CrusherRecipeWrapper extends MachineRecipeWrapper
|
||||
{
|
||||
public CrusherRecipeWrapper(BasicMachineRecipe r, MachineRecipeCategory c)
|
||||
{
|
||||
super(r, c);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package mekanism.client.jei.machine.basic;
|
||||
|
||||
import mekanism.client.jei.machine.MachineRecipeCategory;
|
||||
import mekanism.client.jei.machine.MachineRecipeHandler;
|
||||
|
||||
public class EnrichmentRecipeHandler extends MachineRecipeHandler
|
||||
{
|
||||
public EnrichmentRecipeHandler(MachineRecipeCategory c)
|
||||
{
|
||||
super(c, EnrichmentRecipeWrapper.class);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package mekanism.client.jei.machine.basic;
|
||||
|
||||
import mekanism.client.jei.machine.MachineRecipeCategory;
|
||||
import mekanism.client.jei.machine.MachineRecipeWrapper;
|
||||
import mekanism.common.recipe.machines.BasicMachineRecipe;
|
||||
|
||||
public class EnrichmentRecipeWrapper extends MachineRecipeWrapper
|
||||
{
|
||||
public EnrichmentRecipeWrapper(BasicMachineRecipe r, MachineRecipeCategory c)
|
||||
{
|
||||
super(r, c);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package mekanism.client.jei.machine.chance;
|
||||
|
||||
import mekanism.client.jei.machine.ChanceMachineRecipeCategory;
|
||||
import mekanism.client.jei.machine.ChanceMachineRecipeHandler;
|
||||
|
||||
public class PrecisionSawmillRecipeHandler extends ChanceMachineRecipeHandler
|
||||
{
|
||||
public PrecisionSawmillRecipeHandler(ChanceMachineRecipeCategory c)
|
||||
{
|
||||
super(c, PrecisionSawmillRecipeWrapper.class);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package mekanism.client.jei.machine.chance;
|
||||
|
||||
import mekanism.client.jei.machine.ChanceMachineRecipeCategory;
|
||||
import mekanism.client.jei.machine.ChanceMachineRecipeWrapper;
|
||||
import mekanism.common.recipe.machines.ChanceMachineRecipe;
|
||||
|
||||
public class PrecisionSawmillRecipeWrapper extends ChanceMachineRecipeWrapper
|
||||
{
|
||||
public PrecisionSawmillRecipeWrapper(ChanceMachineRecipe r, ChanceMachineRecipeCategory c)
|
||||
{
|
||||
super(r, c);
|
||||
}
|
||||
}
|
||||
+75
@@ -0,0 +1,75 @@
|
||||
package mekanism.client.jei.machine.chemical;
|
||||
|
||||
import mekanism.api.gas.GasStack;
|
||||
import mekanism.client.jei.BaseRecipeCategory;
|
||||
import mekanism.common.recipe.machines.CrystallizerRecipe;
|
||||
import mezz.jei.api.IGuiHelper;
|
||||
import mezz.jei.api.gui.IDrawable;
|
||||
import mezz.jei.api.gui.IGuiItemStackGroup;
|
||||
import mezz.jei.api.gui.IRecipeLayout;
|
||||
import mezz.jei.api.gui.ITickTimer;
|
||||
import mezz.jei.api.recipe.IRecipeWrapper;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
public class ChemicalCrystallizerRecipeCategory extends BaseRecipeCategory
|
||||
{
|
||||
public IGuiHelper guiHelper;
|
||||
|
||||
public IDrawable background;
|
||||
|
||||
public CrystallizerRecipe tempRecipe;
|
||||
|
||||
public ITickTimer timer;
|
||||
|
||||
public ChemicalCrystallizerRecipeCategory(IGuiHelper helper)
|
||||
{
|
||||
super("mekanism:gui/nei/GuiChemicalCrystallizer.png", "chemical_crystallizer", "tile.MachineBlock2.ChemicalCrystallizer.name", null);
|
||||
|
||||
guiHelper = helper;
|
||||
|
||||
timer = helper.createTickTimer(20, 20, false);
|
||||
|
||||
xOffset = 5;
|
||||
yOffset = 3;
|
||||
|
||||
background = guiHelper.createDrawable(new ResourceLocation(guiTexture), xOffset, yOffset, 147, 79);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawExtras(Minecraft minecraft)
|
||||
{
|
||||
super.drawExtras(minecraft);
|
||||
|
||||
GasStack gas = tempRecipe.getInput().ingredient;
|
||||
|
||||
float f = (float)timer.getValue() / 20F;
|
||||
drawTexturedRect(53-xOffset, 61-yOffset, 176, 63, (int)(48*f), 8);
|
||||
|
||||
if(gas != null)
|
||||
{
|
||||
displayGauge(58, 6-xOffset, 5-yOffset, 176, 4, 58, null, gas);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public IDrawable getBackground()
|
||||
{
|
||||
return background;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRecipe(IRecipeLayout recipeLayout, IRecipeWrapper recipeWrapper)
|
||||
{
|
||||
if(recipeWrapper instanceof ChemicalCrystallizerRecipeWrapper)
|
||||
{
|
||||
tempRecipe = ((ChemicalCrystallizerRecipeWrapper)recipeWrapper).recipe;
|
||||
}
|
||||
|
||||
IGuiItemStackGroup itemStacks = recipeLayout.getItemStacks();
|
||||
|
||||
itemStacks.init(0, false, 130-xOffset, 56-yOffset);
|
||||
|
||||
itemStacks.set(0, tempRecipe.getOutput().output);
|
||||
}
|
||||
}
|
||||
+42
@@ -0,0 +1,42 @@
|
||||
package mekanism.client.jei.machine.chemical;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import mezz.jei.api.recipe.IRecipeHandler;
|
||||
import mezz.jei.api.recipe.IRecipeWrapper;
|
||||
|
||||
public class ChemicalCrystallizerRecipeHandler implements IRecipeHandler<ChemicalCrystallizerRecipeWrapper>
|
||||
{
|
||||
private final ChemicalCrystallizerRecipeCategory category;
|
||||
|
||||
public ChemicalCrystallizerRecipeHandler(ChemicalCrystallizerRecipeCategory c)
|
||||
{
|
||||
category = c;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class getRecipeClass()
|
||||
{
|
||||
return ChemicalCrystallizerRecipeWrapper.class;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getRecipeCategoryUid()
|
||||
{
|
||||
return category.getUid();
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public IRecipeWrapper getRecipeWrapper(@Nonnull ChemicalCrystallizerRecipeWrapper recipe)
|
||||
{
|
||||
return recipe;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isRecipeValid(@Nonnull ChemicalCrystallizerRecipeWrapper recipe)
|
||||
{
|
||||
return recipe.category == category;
|
||||
}
|
||||
}
|
||||
+55
@@ -0,0 +1,55 @@
|
||||
package mekanism.client.jei.machine.chemical;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import mekanism.common.recipe.inputs.AdvancedMachineInput;
|
||||
import mekanism.common.recipe.machines.CrystallizerRecipe;
|
||||
import mekanism.common.util.LangUtils;
|
||||
import mezz.jei.api.recipe.BlankRecipeWrapper;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class ChemicalCrystallizerRecipeWrapper extends BlankRecipeWrapper
|
||||
{
|
||||
public CrystallizerRecipe recipe;
|
||||
|
||||
public ChemicalCrystallizerRecipeCategory category;
|
||||
|
||||
public ChemicalCrystallizerRecipeWrapper(CrystallizerRecipe r, ChemicalCrystallizerRecipeCategory c)
|
||||
{
|
||||
recipe = r;
|
||||
category = c;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public List<ItemStack> getInputs()
|
||||
{
|
||||
return new ArrayList<ItemStack>();
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public List<ItemStack> getOutputs()
|
||||
{
|
||||
return Arrays.asList(recipe.getOutput().output);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public List<String> getTooltipStrings(int mouseX, int mouseY)
|
||||
{
|
||||
List<String> currenttip = new ArrayList<String>();
|
||||
|
||||
if(mouseX >= 1 && mouseX <= 17 && mouseY >= 5-3 && mouseY <= 63-3)
|
||||
{
|
||||
currenttip.add(LangUtils.localizeGasStack(recipe.getInput().ingredient));
|
||||
}
|
||||
|
||||
return currenttip;
|
||||
}
|
||||
}
|
||||
+78
@@ -0,0 +1,78 @@
|
||||
package mekanism.client.jei.machine.chemical;
|
||||
|
||||
import mekanism.api.gas.GasRegistry;
|
||||
import mekanism.api.gas.GasStack;
|
||||
import mekanism.client.jei.BaseRecipeCategory;
|
||||
import mekanism.common.recipe.machines.DissolutionRecipe;
|
||||
import mezz.jei.api.IGuiHelper;
|
||||
import mezz.jei.api.gui.IDrawable;
|
||||
import mezz.jei.api.gui.IGuiItemStackGroup;
|
||||
import mezz.jei.api.gui.IRecipeLayout;
|
||||
import mezz.jei.api.gui.ITickTimer;
|
||||
import mezz.jei.api.recipe.IRecipeWrapper;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
public class ChemicalDissolutionChamberRecipeCategory extends BaseRecipeCategory
|
||||
{
|
||||
public IGuiHelper guiHelper;
|
||||
|
||||
public IDrawable background;
|
||||
|
||||
public DissolutionRecipe tempRecipe;
|
||||
|
||||
public ITickTimer timer;
|
||||
|
||||
public ChemicalDissolutionChamberRecipeCategory(IGuiHelper helper)
|
||||
{
|
||||
super("mekanism:gui/nei/GuiChemicalDissolutionChamber.png", "chemical_dissolution_chamber", "gui.chemicalDissolutionChamber.short", null);
|
||||
|
||||
guiHelper = helper;
|
||||
|
||||
timer = helper.createTickTimer(20, 20, false);
|
||||
|
||||
xOffset = 3;
|
||||
yOffset = 3;
|
||||
|
||||
background = guiHelper.createDrawable(new ResourceLocation(guiTexture), xOffset, yOffset, 170, 79);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawExtras(Minecraft minecraft)
|
||||
{
|
||||
super.drawExtras(minecraft);
|
||||
|
||||
GasStack gas = tempRecipe.getOutput().output;
|
||||
|
||||
float f = (float)timer.getValue() / 20F;
|
||||
drawTexturedRect(64-xOffset, 40-yOffset, 176, 63, (int)(48*f), 8);
|
||||
|
||||
displayGauge(58, 6-xOffset, 5-yOffset, 176, 4, 58, null, new GasStack(GasRegistry.getGas("sulfuricAcid"), 1));
|
||||
|
||||
if(gas != null)
|
||||
{
|
||||
displayGauge(58, 134-xOffset, 14-yOffset, 176, 4, 58, null, gas);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public IDrawable getBackground()
|
||||
{
|
||||
return background;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRecipe(IRecipeLayout recipeLayout, IRecipeWrapper recipeWrapper)
|
||||
{
|
||||
if(recipeWrapper instanceof ChemicalDissolutionChamberRecipeWrapper)
|
||||
{
|
||||
tempRecipe = ((ChemicalDissolutionChamberRecipeWrapper)recipeWrapper).recipe;
|
||||
}
|
||||
|
||||
IGuiItemStackGroup itemStacks = recipeLayout.getItemStacks();
|
||||
|
||||
itemStacks.init(0, true, 25-xOffset, 35-yOffset);
|
||||
|
||||
itemStacks.set(0, tempRecipe.getInput().ingredient);
|
||||
}
|
||||
}
|
||||
+42
@@ -0,0 +1,42 @@
|
||||
package mekanism.client.jei.machine.chemical;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import mezz.jei.api.recipe.IRecipeHandler;
|
||||
import mezz.jei.api.recipe.IRecipeWrapper;
|
||||
|
||||
public class ChemicalDissolutionChamberRecipeHandler implements IRecipeHandler<ChemicalDissolutionChamberRecipeWrapper>
|
||||
{
|
||||
private final ChemicalDissolutionChamberRecipeCategory category;
|
||||
|
||||
public ChemicalDissolutionChamberRecipeHandler(ChemicalDissolutionChamberRecipeCategory c)
|
||||
{
|
||||
category = c;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class getRecipeClass()
|
||||
{
|
||||
return ChemicalDissolutionChamberRecipeWrapper.class;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getRecipeCategoryUid()
|
||||
{
|
||||
return category.getUid();
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public IRecipeWrapper getRecipeWrapper(@Nonnull ChemicalDissolutionChamberRecipeWrapper recipe)
|
||||
{
|
||||
return recipe;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isRecipeValid(@Nonnull ChemicalDissolutionChamberRecipeWrapper recipe)
|
||||
{
|
||||
return recipe.category == category;
|
||||
}
|
||||
}
|
||||
+59
@@ -0,0 +1,59 @@
|
||||
package mekanism.client.jei.machine.chemical;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import mekanism.api.gas.GasRegistry;
|
||||
import mekanism.common.recipe.machines.DissolutionRecipe;
|
||||
import mekanism.common.util.LangUtils;
|
||||
import mezz.jei.api.recipe.BlankRecipeWrapper;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class ChemicalDissolutionChamberRecipeWrapper extends BlankRecipeWrapper
|
||||
{
|
||||
public DissolutionRecipe recipe;
|
||||
|
||||
public ChemicalDissolutionChamberRecipeCategory category;
|
||||
|
||||
public ChemicalDissolutionChamberRecipeWrapper(DissolutionRecipe r, ChemicalDissolutionChamberRecipeCategory c)
|
||||
{
|
||||
recipe = r;
|
||||
category = c;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public List<ItemStack> getInputs()
|
||||
{
|
||||
return Arrays.asList(recipe.getInput().ingredient);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public List<ItemStack> getOutputs()
|
||||
{
|
||||
return new ArrayList<ItemStack>();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public List<String> getTooltipStrings(int mouseX, int mouseY)
|
||||
{
|
||||
List<String> currenttip = new ArrayList<String>();
|
||||
|
||||
if(mouseX >= 6-3 && mouseX <= 22-3 && mouseY >= 5-3 && mouseY <= 63-3)
|
||||
{
|
||||
currenttip.add(GasRegistry.getGas("sulfuricAcid").getLocalizedName());
|
||||
}
|
||||
else if(mouseX >= 134-3 && mouseX <= 150-3 && mouseY >= 14-3 && mouseY <= 72-3)
|
||||
{
|
||||
currenttip.add(LangUtils.localizeGasStack(recipe.getOutput().output));
|
||||
}
|
||||
|
||||
return currenttip;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
package mekanism.client.jei.machine.chemical;
|
||||
|
||||
import mekanism.client.jei.BaseRecipeCategory;
|
||||
import mekanism.common.recipe.machines.ChemicalInfuserRecipe;
|
||||
import mezz.jei.api.IGuiHelper;
|
||||
import mezz.jei.api.gui.IDrawable;
|
||||
import mezz.jei.api.gui.IRecipeLayout;
|
||||
import mezz.jei.api.gui.ITickTimer;
|
||||
import mezz.jei.api.recipe.IRecipeWrapper;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
public class ChemicalInfuserRecipeCategory extends BaseRecipeCategory
|
||||
{
|
||||
public IGuiHelper guiHelper;
|
||||
|
||||
public IDrawable background;
|
||||
|
||||
public ChemicalInfuserRecipe tempRecipe;
|
||||
|
||||
public ITickTimer timer;
|
||||
|
||||
public ChemicalInfuserRecipeCategory(IGuiHelper helper)
|
||||
{
|
||||
super("mekanism:gui/nei/GuiChemicalInfuser.png", "chemical_infuser", "tile.MachineBlock2.ChemicalInfuser.name", null);
|
||||
|
||||
guiHelper = helper;
|
||||
|
||||
timer = helper.createTickTimer(20, 20, false);
|
||||
|
||||
xOffset = 3;
|
||||
yOffset = 3;
|
||||
|
||||
background = guiHelper.createDrawable(new ResourceLocation(guiTexture), xOffset, yOffset, 170, 80);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawExtras(Minecraft minecraft)
|
||||
{
|
||||
super.drawExtras(minecraft);
|
||||
|
||||
drawTexturedRect(47-xOffset, 39-yOffset, 176, 71, 28, 8);
|
||||
drawTexturedRect(101-xOffset, 39-yOffset, 176, 63, 28, 8);
|
||||
|
||||
if(tempRecipe.getInput().leftGas != null)
|
||||
{
|
||||
displayGauge(58, 26-xOffset, 14-yOffset, 176, 4, 58, null, tempRecipe.getInput().leftGas);
|
||||
}
|
||||
|
||||
if(tempRecipe.getOutput().output != null)
|
||||
{
|
||||
displayGauge(58, 80-xOffset, 5-yOffset, 176, 4, 58, null, tempRecipe.getOutput().output);
|
||||
}
|
||||
|
||||
if(tempRecipe.getInput().rightGas != null)
|
||||
{
|
||||
displayGauge(58, 134-xOffset, 14-yOffset, 176, 4, 58, null, tempRecipe.getInput().rightGas);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public IDrawable getBackground()
|
||||
{
|
||||
return background;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRecipe(IRecipeLayout recipeLayout, IRecipeWrapper recipeWrapper)
|
||||
{
|
||||
if(recipeWrapper instanceof ChemicalInfuserRecipeWrapper)
|
||||
{
|
||||
tempRecipe = ((ChemicalInfuserRecipeWrapper)recipeWrapper).recipe;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
package mekanism.client.jei.machine.chemical;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import mezz.jei.api.recipe.IRecipeHandler;
|
||||
import mezz.jei.api.recipe.IRecipeWrapper;
|
||||
|
||||
public class ChemicalInfuserRecipeHandler implements IRecipeHandler<ChemicalInfuserRecipeWrapper>
|
||||
{
|
||||
private final ChemicalInfuserRecipeCategory category;
|
||||
|
||||
public ChemicalInfuserRecipeHandler(ChemicalInfuserRecipeCategory c)
|
||||
{
|
||||
category = c;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class getRecipeClass()
|
||||
{
|
||||
return ChemicalInfuserRecipeWrapper.class;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getRecipeCategoryUid()
|
||||
{
|
||||
return category.getUid();
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public IRecipeWrapper getRecipeWrapper(@Nonnull ChemicalInfuserRecipeWrapper recipe)
|
||||
{
|
||||
return recipe;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isRecipeValid(@Nonnull ChemicalInfuserRecipeWrapper recipe)
|
||||
{
|
||||
return recipe.category == category;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
package mekanism.client.jei.machine.chemical;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import mekanism.common.recipe.machines.ChemicalInfuserRecipe;
|
||||
import mekanism.common.util.LangUtils;
|
||||
import mezz.jei.api.recipe.BlankRecipeWrapper;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class ChemicalInfuserRecipeWrapper extends BlankRecipeWrapper
|
||||
{
|
||||
public ChemicalInfuserRecipe recipe;
|
||||
|
||||
public ChemicalInfuserRecipeCategory category;
|
||||
|
||||
public ChemicalInfuserRecipeWrapper(ChemicalInfuserRecipe r, ChemicalInfuserRecipeCategory c)
|
||||
{
|
||||
recipe = r;
|
||||
category = c;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public List<ItemStack> getInputs()
|
||||
{
|
||||
return new ArrayList<ItemStack>();
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public List<ItemStack> getOutputs()
|
||||
{
|
||||
return new ArrayList<ItemStack>();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public List<String> getTooltipStrings(int mouseX, int mouseY)
|
||||
{
|
||||
List<String> currenttip = new ArrayList<String>();
|
||||
|
||||
if(mouseX >= 26-3 && mouseX <= 42-3 && mouseY >= 14-3 && mouseY <= 72-3)
|
||||
{
|
||||
currenttip.add(LangUtils.localizeGasStack(recipe.getInput().leftGas));
|
||||
}
|
||||
else if(mouseX >= 80-3 && mouseX <= 96-3 && mouseY >= 5-3 && mouseY <= 63-3)
|
||||
{
|
||||
currenttip.add(LangUtils.localizeGasStack(recipe.getOutput().output));
|
||||
}
|
||||
else if(mouseX >= 134-3 && mouseX <= 150-3 && mouseY >= 14-3 && mouseY <= 72-3)
|
||||
{
|
||||
currenttip.add(LangUtils.localizeGasStack(recipe.getInput().rightGas));
|
||||
}
|
||||
|
||||
return currenttip;
|
||||
}
|
||||
}
|
||||
+98
@@ -0,0 +1,98 @@
|
||||
package mekanism.client.jei.machine.chemical;
|
||||
|
||||
import mekanism.client.gui.element.GuiGasGauge;
|
||||
import mekanism.client.gui.element.GuiGauge;
|
||||
import mekanism.client.gui.element.GuiProgress;
|
||||
import mekanism.client.gui.element.GuiProgress.IProgressInfoHandler;
|
||||
import mekanism.client.gui.element.GuiProgress.ProgressBar;
|
||||
import mekanism.client.gui.element.GuiSlot;
|
||||
import mekanism.client.gui.element.GuiSlot.SlotType;
|
||||
import mekanism.client.jei.BaseRecipeCategory;
|
||||
import mekanism.common.recipe.machines.OxidationRecipe;
|
||||
import mekanism.common.util.MekanismUtils;
|
||||
import mekanism.common.util.MekanismUtils.ResourceType;
|
||||
import mezz.jei.api.IGuiHelper;
|
||||
import mezz.jei.api.gui.IDrawable;
|
||||
import mezz.jei.api.gui.IGuiItemStackGroup;
|
||||
import mezz.jei.api.gui.IRecipeLayout;
|
||||
import mezz.jei.api.gui.ITickTimer;
|
||||
import mezz.jei.api.recipe.IRecipeWrapper;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
public class ChemicalOxidizerRecipeCategory extends BaseRecipeCategory
|
||||
{
|
||||
public IGuiHelper guiHelper;
|
||||
|
||||
public IDrawable background;
|
||||
|
||||
public OxidationRecipe tempRecipe;
|
||||
|
||||
public GuiGasGauge gasOutput;
|
||||
|
||||
public ITickTimer timer;
|
||||
|
||||
public ChemicalOxidizerRecipeCategory(IGuiHelper helper)
|
||||
{
|
||||
super("mekanism:gui/GuiChemicalOxidizer.png", "chemical_oxidizer", "tile.MachineBlock2.ChemicalOxidizer.name", ProgressBar.LARGE_RIGHT);
|
||||
|
||||
guiHelper = helper;
|
||||
|
||||
timer = helper.createTickTimer(20, 20, false);
|
||||
|
||||
xOffset = 20;
|
||||
yOffset = 12;
|
||||
|
||||
background = guiHelper.createDrawable(new ResourceLocation(guiTexture), xOffset, yOffset, 132, 62);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addGuiElements()
|
||||
{
|
||||
guiElements.add(gasOutput = GuiGasGauge.getDummy(GuiGauge.Type.STANDARD, this, MekanismUtils.getResource(ResourceType.GUI, "GuiChemicalOxidizer.png"), 133, 13));
|
||||
|
||||
guiElements.add(new GuiSlot(SlotType.NORMAL, this, MekanismUtils.getResource(ResourceType.GUI, "GuiChemicalOxidizer.png"), 25, 35));
|
||||
|
||||
guiElements.add(new GuiProgress(new IProgressInfoHandler()
|
||||
{
|
||||
@Override
|
||||
public double getProgress()
|
||||
{
|
||||
return (double)timer.getValue() / 20F;
|
||||
}
|
||||
}, progressBar, this, MekanismUtils.getResource(ResourceType.GUI, "GuiChemicalOxidizer.png"), 62, 39));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawExtras(Minecraft minecraft)
|
||||
{
|
||||
super.drawExtras(minecraft);
|
||||
|
||||
if(tempRecipe.getOutput().output != null)
|
||||
{
|
||||
gasOutput.setDummyType(tempRecipe.getOutput().output.getGas());
|
||||
gasOutput.renderScale(0, 0, -xOffset, -yOffset);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public IDrawable getBackground()
|
||||
{
|
||||
return background;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRecipe(IRecipeLayout recipeLayout, IRecipeWrapper recipeWrapper)
|
||||
{
|
||||
if(recipeWrapper instanceof ChemicalOxidizerRecipeWrapper)
|
||||
{
|
||||
tempRecipe = ((ChemicalOxidizerRecipeWrapper)recipeWrapper).recipe;
|
||||
}
|
||||
|
||||
IGuiItemStackGroup itemStacks = recipeLayout.getItemStacks();
|
||||
|
||||
itemStacks.init(0, true, 25-xOffset, 35-yOffset);
|
||||
|
||||
itemStacks.set(0, tempRecipe.getInput().ingredient);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
package mekanism.client.jei.machine.chemical;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import mezz.jei.api.recipe.IRecipeHandler;
|
||||
import mezz.jei.api.recipe.IRecipeWrapper;
|
||||
|
||||
public class ChemicalOxidizerRecipeHandler implements IRecipeHandler<ChemicalOxidizerRecipeWrapper>
|
||||
{
|
||||
private final ChemicalOxidizerRecipeCategory category;
|
||||
|
||||
public ChemicalOxidizerRecipeHandler(ChemicalOxidizerRecipeCategory c)
|
||||
{
|
||||
category = c;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class getRecipeClass()
|
||||
{
|
||||
return ChemicalOxidizerRecipeWrapper.class;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getRecipeCategoryUid()
|
||||
{
|
||||
return category.getUid();
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public IRecipeWrapper getRecipeWrapper(@Nonnull ChemicalOxidizerRecipeWrapper recipe)
|
||||
{
|
||||
return recipe;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isRecipeValid(@Nonnull ChemicalOxidizerRecipeWrapper recipe)
|
||||
{
|
||||
return recipe.category == category;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
package mekanism.client.jei.machine.chemical;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import mekanism.api.gas.GasRegistry;
|
||||
import mekanism.common.recipe.machines.OxidationRecipe;
|
||||
import mekanism.common.util.LangUtils;
|
||||
import mezz.jei.api.recipe.BlankRecipeWrapper;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class ChemicalOxidizerRecipeWrapper extends BlankRecipeWrapper
|
||||
{
|
||||
public OxidationRecipe recipe;
|
||||
|
||||
public ChemicalOxidizerRecipeCategory category;
|
||||
|
||||
public ChemicalOxidizerRecipeWrapper(OxidationRecipe r, ChemicalOxidizerRecipeCategory c)
|
||||
{
|
||||
recipe = r;
|
||||
category = c;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public List<ItemStack> getInputs()
|
||||
{
|
||||
return Arrays.asList(recipe.getInput().ingredient);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public List<ItemStack> getOutputs()
|
||||
{
|
||||
return new ArrayList<ItemStack>();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public List<String> getTooltipStrings(int mouseX, int mouseY)
|
||||
{
|
||||
List<String> currenttip = new ArrayList<String>();
|
||||
|
||||
if(mouseX >= 134-20 && mouseX <= 150-20 && mouseY >= 14-12 && mouseY <= 72-12)
|
||||
{
|
||||
currenttip.add(LangUtils.localizeGasStack(recipe.getOutput().output));
|
||||
}
|
||||
|
||||
return currenttip;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
package mekanism.client.jei.machine.chemical;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import mekanism.client.jei.BaseRecipeCategory;
|
||||
import mekanism.common.recipe.machines.WasherRecipe;
|
||||
import mezz.jei.api.IGuiHelper;
|
||||
import mezz.jei.api.gui.IDrawable;
|
||||
import mezz.jei.api.gui.IGuiFluidStackGroup;
|
||||
import mezz.jei.api.gui.IRecipeLayout;
|
||||
import mezz.jei.api.gui.ITickTimer;
|
||||
import mezz.jei.api.gui.ITooltipCallback;
|
||||
import mezz.jei.api.recipe.IRecipeWrapper;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
public class ChemicalWasherRecipeCategory extends BaseRecipeCategory
|
||||
{
|
||||
public IGuiHelper guiHelper;
|
||||
|
||||
public IDrawable background;
|
||||
public IDrawable fluidOverlay;
|
||||
|
||||
public WasherRecipe tempRecipe;
|
||||
|
||||
public ITickTimer timer;
|
||||
|
||||
public ChemicalWasherRecipeCategory(IGuiHelper helper)
|
||||
{
|
||||
super("mekanism:gui/nei/GuiChemicalWasher.png", "chemical_washer", "tile.MachineBlock2.ChemicalWasher.name", null);
|
||||
|
||||
guiHelper = helper;
|
||||
|
||||
timer = helper.createTickTimer(20, 20, false);
|
||||
|
||||
xOffset = 3;
|
||||
yOffset = 3;
|
||||
|
||||
background = guiHelper.createDrawable(new ResourceLocation(guiTexture), xOffset, yOffset, 170, 70);
|
||||
fluidOverlay = guiHelper.createDrawable(new ResourceLocation(guiTexture), 176, 4, 16, 59);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawExtras(Minecraft minecraft)
|
||||
{
|
||||
super.drawExtras(minecraft);
|
||||
|
||||
drawTexturedRect(61-xOffset, 39-yOffset, 176, 63, 55, 8);
|
||||
|
||||
if(tempRecipe.getInput().ingredient != null)
|
||||
{
|
||||
displayGauge(58, 27-xOffset, 14-yOffset, 176, 4, 58, null, tempRecipe.getInput().ingredient);
|
||||
}
|
||||
|
||||
if(tempRecipe.getOutput().output != null)
|
||||
{
|
||||
displayGauge(58, 134-xOffset, 14-yOffset, 176, 4, 58, null, tempRecipe.getOutput().output);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public IDrawable getBackground()
|
||||
{
|
||||
return background;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRecipe(IRecipeLayout recipeLayout, IRecipeWrapper recipeWrapper)
|
||||
{
|
||||
if(recipeWrapper instanceof ChemicalWasherRecipeWrapper)
|
||||
{
|
||||
tempRecipe = ((ChemicalWasherRecipeWrapper)recipeWrapper).recipe;
|
||||
}
|
||||
|
||||
IGuiFluidStackGroup fluidStacks = recipeLayout.getFluidStacks();
|
||||
|
||||
fluidStacks.init(0, true, 6-xOffset, 5-yOffset, 16, 58, 1000, false, fluidOverlay);
|
||||
fluidStacks.set(0, recipeWrapper.getFluidInputs());
|
||||
fluidStacks.addTooltipCallback(new ITooltipCallback<FluidStack>() {
|
||||
|
||||
@Override
|
||||
public void onTooltip(int slotIndex, boolean input, FluidStack ingredient, List<String> tooltip)
|
||||
{
|
||||
tooltip.remove(1);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
package mekanism.client.jei.machine.chemical;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import mezz.jei.api.recipe.IRecipeHandler;
|
||||
import mezz.jei.api.recipe.IRecipeWrapper;
|
||||
|
||||
public class ChemicalWasherRecipeHandler implements IRecipeHandler<ChemicalWasherRecipeWrapper>
|
||||
{
|
||||
private final ChemicalWasherRecipeCategory category;
|
||||
|
||||
public ChemicalWasherRecipeHandler(ChemicalWasherRecipeCategory c)
|
||||
{
|
||||
category = c;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class getRecipeClass()
|
||||
{
|
||||
return ChemicalWasherRecipeWrapper.class;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getRecipeCategoryUid()
|
||||
{
|
||||
return category.getUid();
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public IRecipeWrapper getRecipeWrapper(@Nonnull ChemicalWasherRecipeWrapper recipe)
|
||||
{
|
||||
return recipe;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isRecipeValid(@Nonnull ChemicalWasherRecipeWrapper recipe)
|
||||
{
|
||||
return recipe.category == category;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
package mekanism.client.jei.machine.chemical;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import mekanism.common.recipe.machines.WasherRecipe;
|
||||
import mekanism.common.util.LangUtils;
|
||||
import mezz.jei.api.recipe.BlankRecipeWrapper;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
public class ChemicalWasherRecipeWrapper extends BlankRecipeWrapper
|
||||
{
|
||||
public WasherRecipe recipe;
|
||||
|
||||
public ChemicalWasherRecipeCategory category;
|
||||
|
||||
public ChemicalWasherRecipeWrapper(WasherRecipe r, ChemicalWasherRecipeCategory c)
|
||||
{
|
||||
recipe = r;
|
||||
category = c;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public List<ItemStack> getInputs()
|
||||
{
|
||||
return new ArrayList<ItemStack>();
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public List<FluidStack> getFluidInputs()
|
||||
{
|
||||
return Arrays.asList(new FluidStack(FluidRegistry.WATER, 1000));
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public List<ItemStack> getOutputs()
|
||||
{
|
||||
return new ArrayList<ItemStack>();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public List<String> getTooltipStrings(int mouseX, int mouseY)
|
||||
{
|
||||
List<String> currenttip = new ArrayList<String>();
|
||||
|
||||
if(mouseX >= 27-3 && mouseX <= 43-3 && mouseY >= 14-3 && mouseY <= 72-3)
|
||||
{
|
||||
currenttip.add(LangUtils.localizeGasStack(recipe.getInput().ingredient));
|
||||
}
|
||||
else if(mouseX >= 134-3 && mouseX <= 150-3 && mouseY >= 14-3 && mouseY <= 72-3)
|
||||
{
|
||||
currenttip.add(LangUtils.localizeGasStack(recipe.getOutput().output));
|
||||
}
|
||||
|
||||
return currenttip;
|
||||
}
|
||||
}
|
||||
+136
@@ -0,0 +1,136 @@
|
||||
package mekanism.client.jei.machine.other;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import mekanism.client.gui.element.GuiFluidGauge;
|
||||
import mekanism.client.gui.element.GuiGasGauge;
|
||||
import mekanism.client.gui.element.GuiGauge;
|
||||
import mekanism.client.gui.element.GuiPowerBar;
|
||||
import mekanism.client.gui.element.GuiPowerBar.IPowerInfoHandler;
|
||||
import mekanism.client.gui.element.GuiProgress;
|
||||
import mekanism.client.gui.element.GuiProgress.IProgressInfoHandler;
|
||||
import mekanism.client.gui.element.GuiProgress.ProgressBar;
|
||||
import mekanism.client.gui.element.GuiSlot;
|
||||
import mekanism.client.gui.element.GuiSlot.SlotOverlay;
|
||||
import mekanism.client.gui.element.GuiSlot.SlotType;
|
||||
import mekanism.client.jei.BaseRecipeCategory;
|
||||
import mekanism.common.recipe.machines.SeparatorRecipe;
|
||||
import mekanism.common.util.MekanismUtils;
|
||||
import mekanism.common.util.MekanismUtils.ResourceType;
|
||||
import mezz.jei.api.IGuiHelper;
|
||||
import mezz.jei.api.gui.IDrawable;
|
||||
import mezz.jei.api.gui.IGuiFluidStackGroup;
|
||||
import mezz.jei.api.gui.IRecipeLayout;
|
||||
import mezz.jei.api.gui.ITickTimer;
|
||||
import mezz.jei.api.gui.ITooltipCallback;
|
||||
import mezz.jei.api.recipe.IRecipeWrapper;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
public class ElectrolyticSeparatorRecipeCategory extends BaseRecipeCategory
|
||||
{
|
||||
public IGuiHelper guiHelper;
|
||||
|
||||
public IDrawable background;
|
||||
public IDrawable fluidOverlay;
|
||||
|
||||
public GuiGasGauge leftGas;
|
||||
public GuiGasGauge rightGas;
|
||||
|
||||
public SeparatorRecipe tempRecipe;
|
||||
|
||||
public ITickTimer timer;
|
||||
|
||||
public ElectrolyticSeparatorRecipeCategory(IGuiHelper helper)
|
||||
{
|
||||
super("mekanism:gui/GuiElectrolyticSeparator.png", "electrolytic_separator", "tile.MachineBlock2.ElectrolyticSeparator.name", ProgressBar.BI);
|
||||
|
||||
guiHelper = helper;
|
||||
|
||||
timer = helper.createTickTimer(20, 20, false);
|
||||
|
||||
xOffset = 4;
|
||||
yOffset = 9;
|
||||
|
||||
background = guiHelper.createDrawable(new ResourceLocation(guiTexture), xOffset, yOffset, 167, 62);
|
||||
fluidOverlay = guiHelper.createDrawable(MekanismUtils.getResource(ResourceType.GUI_ELEMENT, GuiGauge.Type.STANDARD.textureLocation), 19, 1, 16, 59);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addGuiElements()
|
||||
{
|
||||
guiElements.add(GuiFluidGauge.getDummy(GuiGauge.Type.STANDARD, this, MekanismUtils.getResource(ResourceType.GUI, "GuiElectrolyticSeparator.png"), 5, 10));
|
||||
guiElements.add(leftGas = GuiGasGauge.getDummy(GuiGauge.Type.SMALL, this, MekanismUtils.getResource(ResourceType.GUI, "GuiElectrolyticSeparator.png"), 58, 18));
|
||||
guiElements.add(rightGas = GuiGasGauge.getDummy(GuiGauge.Type.SMALL, this, MekanismUtils.getResource(ResourceType.GUI, "GuiElectrolyticSeparator.png"), 100, 18));
|
||||
guiElements.add(new GuiPowerBar(this, new IPowerInfoHandler() {
|
||||
@Override
|
||||
public double getLevel()
|
||||
{
|
||||
return 1F;
|
||||
}
|
||||
}, MekanismUtils.getResource(ResourceType.GUI, stripTexture()), 164, 15));
|
||||
|
||||
guiElements.add(new GuiSlot(SlotType.NORMAL, this, MekanismUtils.getResource(ResourceType.GUI, "GuiElectrolyticSeparator.png"), 25, 34));
|
||||
guiElements.add(new GuiSlot(SlotType.NORMAL, this, MekanismUtils.getResource(ResourceType.GUI, "GuiElectrolyticSeparator.png"), 58, 51));
|
||||
guiElements.add(new GuiSlot(SlotType.NORMAL, this, MekanismUtils.getResource(ResourceType.GUI, "GuiElectrolyticSeparator.png"), 100, 51));
|
||||
guiElements.add(new GuiSlot(SlotType.NORMAL, this, MekanismUtils.getResource(ResourceType.GUI, "GuiElectrolyticSeparator.png"), 142, 34).with(SlotOverlay.POWER));
|
||||
|
||||
guiElements.add(new GuiProgress(new IProgressInfoHandler()
|
||||
{
|
||||
@Override
|
||||
public double getProgress()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
}, progressBar, this, MekanismUtils.getResource(ResourceType.GUI, "GuiElectrolyticSeparator.png"), 78, 29));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawExtras(Minecraft minecraft)
|
||||
{
|
||||
super.drawExtras(minecraft);
|
||||
|
||||
if(tempRecipe.getOutput().leftGas != null)
|
||||
{
|
||||
leftGas.setDummyType(tempRecipe.getOutput().leftGas.getGas());
|
||||
leftGas.renderScale(0, 0, -xOffset, -yOffset);
|
||||
}
|
||||
|
||||
if(tempRecipe.getOutput().rightGas != null)
|
||||
{
|
||||
rightGas.setDummyType(tempRecipe.getOutput().rightGas.getGas());
|
||||
rightGas.renderScale(0, 0, -xOffset, -yOffset);
|
||||
}
|
||||
|
||||
changeTexture(guiLocation);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IDrawable getBackground()
|
||||
{
|
||||
return background;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRecipe(IRecipeLayout recipeLayout, IRecipeWrapper recipeWrapper)
|
||||
{
|
||||
if(recipeWrapper instanceof ElectrolyticSeparatorRecipeWrapper)
|
||||
{
|
||||
tempRecipe = ((ElectrolyticSeparatorRecipeWrapper)recipeWrapper).recipe;
|
||||
}
|
||||
|
||||
IGuiFluidStackGroup fluidStacks = recipeLayout.getFluidStacks();
|
||||
|
||||
fluidStacks.init(0, true, 2, 2, 16, 58, tempRecipe.getInput().ingredient.amount, false, fluidOverlay);
|
||||
fluidStacks.set(0, recipeWrapper.getFluidInputs());
|
||||
fluidStacks.addTooltipCallback(new ITooltipCallback<FluidStack>() {
|
||||
|
||||
@Override
|
||||
public void onTooltip(int slotIndex, boolean input, FluidStack ingredient, List<String> tooltip)
|
||||
{
|
||||
tooltip.remove(1);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
+42
@@ -0,0 +1,42 @@
|
||||
package mekanism.client.jei.machine.other;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import mezz.jei.api.recipe.IRecipeHandler;
|
||||
import mezz.jei.api.recipe.IRecipeWrapper;
|
||||
|
||||
public class ElectrolyticSeparatorRecipeHandler implements IRecipeHandler<ElectrolyticSeparatorRecipeWrapper>
|
||||
{
|
||||
private final ElectrolyticSeparatorRecipeCategory category;
|
||||
|
||||
public ElectrolyticSeparatorRecipeHandler(ElectrolyticSeparatorRecipeCategory c)
|
||||
{
|
||||
category = c;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class getRecipeClass()
|
||||
{
|
||||
return ElectrolyticSeparatorRecipeWrapper.class;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getRecipeCategoryUid()
|
||||
{
|
||||
return category.getUid();
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public IRecipeWrapper getRecipeWrapper(@Nonnull ElectrolyticSeparatorRecipeWrapper recipe)
|
||||
{
|
||||
return recipe;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isRecipeValid(@Nonnull ElectrolyticSeparatorRecipeWrapper recipe)
|
||||
{
|
||||
return recipe.category == category;
|
||||
}
|
||||
}
|
||||
+65
@@ -0,0 +1,65 @@
|
||||
package mekanism.client.jei.machine.other;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import mekanism.common.recipe.machines.SeparatorRecipe;
|
||||
import mezz.jei.api.recipe.BlankRecipeWrapper;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
public class ElectrolyticSeparatorRecipeWrapper extends BlankRecipeWrapper
|
||||
{
|
||||
public SeparatorRecipe recipe;
|
||||
|
||||
public ElectrolyticSeparatorRecipeCategory category;
|
||||
|
||||
public ElectrolyticSeparatorRecipeWrapper(SeparatorRecipe r, ElectrolyticSeparatorRecipeCategory c)
|
||||
{
|
||||
recipe = r;
|
||||
category = c;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public List<ItemStack> getInputs()
|
||||
{
|
||||
return new ArrayList<ItemStack>();
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public List<FluidStack> getFluidInputs()
|
||||
{
|
||||
return Arrays.asList(recipe.getInput().ingredient);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public List<ItemStack> getOutputs()
|
||||
{
|
||||
return new ArrayList<ItemStack>();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public List<String> getTooltipStrings(int mouseX, int mouseY)
|
||||
{
|
||||
List<String> currenttip = new ArrayList<String>();
|
||||
|
||||
if(mouseX >= 59-4 && mouseX <= 75-4 && mouseY >= 19-9 && mouseY <= 47-9)
|
||||
{
|
||||
currenttip.add(recipe.getOutput().leftGas.getGas().getLocalizedName());
|
||||
}
|
||||
else if(mouseX >= 101-4 && mouseX <= 117-4 && mouseY >= 19-9 && mouseY <= 47-9)
|
||||
{
|
||||
currenttip.add(recipe.getOutput().rightGas.getGas().getLocalizedName());
|
||||
}
|
||||
|
||||
return currenttip;
|
||||
}
|
||||
}
|
||||
+130
@@ -0,0 +1,130 @@
|
||||
package mekanism.client.jei.machine.other;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import mekanism.api.infuse.InfuseObject;
|
||||
import mekanism.api.infuse.InfuseRegistry;
|
||||
import mekanism.api.infuse.InfuseType;
|
||||
import mekanism.client.gui.element.GuiPowerBar;
|
||||
import mekanism.client.gui.element.GuiPowerBar.IPowerInfoHandler;
|
||||
import mekanism.client.gui.element.GuiProgress;
|
||||
import mekanism.client.gui.element.GuiProgress.IProgressInfoHandler;
|
||||
import mekanism.client.gui.element.GuiProgress.ProgressBar;
|
||||
import mekanism.client.gui.element.GuiSlot;
|
||||
import mekanism.client.gui.element.GuiSlot.SlotOverlay;
|
||||
import mekanism.client.gui.element.GuiSlot.SlotType;
|
||||
import mekanism.client.jei.BaseRecipeCategory;
|
||||
import mekanism.client.render.MekanismRenderer;
|
||||
import mekanism.common.recipe.machines.MetallurgicInfuserRecipe;
|
||||
import mekanism.common.util.MekanismUtils;
|
||||
import mekanism.common.util.MekanismUtils.ResourceType;
|
||||
import mezz.jei.api.IGuiHelper;
|
||||
import mezz.jei.api.gui.IDrawable;
|
||||
import mezz.jei.api.gui.IGuiItemStackGroup;
|
||||
import mezz.jei.api.gui.IRecipeLayout;
|
||||
import mezz.jei.api.gui.ITickTimer;
|
||||
import mezz.jei.api.recipe.IRecipeWrapper;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
public class MetallurgicInfuserRecipeCategory extends BaseRecipeCategory
|
||||
{
|
||||
public IGuiHelper guiHelper;
|
||||
|
||||
public IDrawable background;
|
||||
|
||||
public MetallurgicInfuserRecipe tempRecipe;
|
||||
|
||||
public ITickTimer timer;
|
||||
|
||||
public MetallurgicInfuserRecipeCategory(IGuiHelper helper)
|
||||
{
|
||||
super("mekanism:gui/GuiMetallurgicInfuser.png", "metallurgic_infuser", "tile.MachineBlock.MetallurgicInfuser.name", ProgressBar.MEDIUM);
|
||||
|
||||
guiHelper = helper;
|
||||
|
||||
timer = helper.createTickTimer(20, 20, false);
|
||||
|
||||
xOffset = 5;
|
||||
yOffset = 16;
|
||||
|
||||
background = guiHelper.createDrawable(new ResourceLocation(guiTexture), xOffset, yOffset, 166, 54);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addGuiElements()
|
||||
{
|
||||
guiElements.add(new GuiSlot(SlotType.EXTRA, this, MekanismUtils.getResource(ResourceType.GUI, stripTexture()), 16, 34));
|
||||
guiElements.add(new GuiSlot(SlotType.INPUT, this, MekanismUtils.getResource(ResourceType.GUI, stripTexture()), 50, 42));
|
||||
guiElements.add(new GuiSlot(SlotType.POWER, this, MekanismUtils.getResource(ResourceType.GUI, stripTexture()), 142, 34).with(SlotOverlay.POWER));
|
||||
guiElements.add(new GuiSlot(SlotType.OUTPUT, this, MekanismUtils.getResource(ResourceType.GUI, stripTexture()), 108, 42));
|
||||
|
||||
guiElements.add(new GuiPowerBar(this, new IPowerInfoHandler() {
|
||||
@Override
|
||||
public double getLevel()
|
||||
{
|
||||
return 1F;
|
||||
}
|
||||
}, MekanismUtils.getResource(ResourceType.GUI, stripTexture()), 164, 15));
|
||||
guiElements.add(new GuiProgress(new IProgressInfoHandler() {
|
||||
@Override
|
||||
public double getProgress()
|
||||
{
|
||||
return (double)timer.getValue() / 20F;
|
||||
}
|
||||
}, ProgressBar.MEDIUM, this, MekanismUtils.getResource(ResourceType.GUI, stripTexture()), 70, 46));
|
||||
}
|
||||
|
||||
public static List<ItemStack> getInfuseStacks(InfuseType type)
|
||||
{
|
||||
List<ItemStack> ret = new ArrayList<ItemStack>();
|
||||
|
||||
for(Map.Entry<ItemStack, InfuseObject> obj : InfuseRegistry.getObjectMap().entrySet())
|
||||
{
|
||||
if(obj.getValue().type == type)
|
||||
{
|
||||
ret.add(obj.getKey());
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawExtras(Minecraft minecraft)
|
||||
{
|
||||
super.drawExtras(minecraft);
|
||||
|
||||
InfuseType type = tempRecipe.getInput().infuse.type;
|
||||
changeTexture(MekanismRenderer.getBlocksTexture());
|
||||
drawTexturedRectFromIcon(2, 2, type.sprite, 4, 52);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IDrawable getBackground()
|
||||
{
|
||||
return background;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRecipe(IRecipeLayout recipeLayout, IRecipeWrapper recipeWrapper)
|
||||
{
|
||||
if(recipeWrapper instanceof MetallurgicInfuserRecipeWrapper)
|
||||
{
|
||||
tempRecipe = ((MetallurgicInfuserRecipeWrapper)recipeWrapper).recipe;
|
||||
}
|
||||
|
||||
IGuiItemStackGroup itemStacks = recipeLayout.getItemStacks();
|
||||
|
||||
itemStacks.init(0, true, 45, 26);
|
||||
itemStacks.init(1, false, 103, 26);
|
||||
itemStacks.init(2, true, 11, 18);
|
||||
|
||||
itemStacks.set(0, tempRecipe.getInput().inputStack);
|
||||
itemStacks.setFromRecipe(1, recipeWrapper.getOutputs());
|
||||
itemStacks.set(2, getInfuseStacks(tempRecipe.getInput().infuse.type));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
package mekanism.client.jei.machine.other;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import mezz.jei.api.recipe.IRecipeHandler;
|
||||
import mezz.jei.api.recipe.IRecipeWrapper;
|
||||
|
||||
public class MetallurgicInfuserRecipeHandler implements IRecipeHandler<MetallurgicInfuserRecipeWrapper>
|
||||
{
|
||||
private final MetallurgicInfuserRecipeCategory category;
|
||||
|
||||
public MetallurgicInfuserRecipeHandler(MetallurgicInfuserRecipeCategory c)
|
||||
{
|
||||
category = c;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class getRecipeClass()
|
||||
{
|
||||
return MetallurgicInfuserRecipeWrapper.class;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getRecipeCategoryUid()
|
||||
{
|
||||
return category.getUid();
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public IRecipeWrapper getRecipeWrapper(@Nonnull MetallurgicInfuserRecipeWrapper recipe)
|
||||
{
|
||||
return recipe;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isRecipeValid(@Nonnull MetallurgicInfuserRecipeWrapper recipe)
|
||||
{
|
||||
return recipe.category == category;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
package mekanism.client.jei.machine.other;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import mekanism.common.recipe.machines.MetallurgicInfuserRecipe;
|
||||
import mezz.jei.api.recipe.BlankRecipeWrapper;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class MetallurgicInfuserRecipeWrapper extends BlankRecipeWrapper
|
||||
{
|
||||
public MetallurgicInfuserRecipe recipe;
|
||||
|
||||
public MetallurgicInfuserRecipeCategory category;
|
||||
|
||||
public MetallurgicInfuserRecipeWrapper(MetallurgicInfuserRecipe r, MetallurgicInfuserRecipeCategory c)
|
||||
{
|
||||
recipe = r;
|
||||
category = c;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public List<ItemStack> getInputs()
|
||||
{
|
||||
List<ItemStack> list = new ArrayList<ItemStack>();
|
||||
list.add(recipe.getInput().inputStack);
|
||||
list.addAll(MetallurgicInfuserRecipeCategory.getInfuseStacks(recipe.getInput().infuse.type));
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public List<ItemStack> getOutputs()
|
||||
{
|
||||
return Arrays.asList(recipe.getOutput().output);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,142 @@
|
||||
package mekanism.client.jei.machine.other;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import mekanism.client.gui.element.GuiFluidGauge;
|
||||
import mekanism.client.gui.element.GuiGasGauge;
|
||||
import mekanism.client.gui.element.GuiGauge;
|
||||
import mekanism.client.gui.element.GuiPowerBar;
|
||||
import mekanism.client.gui.element.GuiPowerBar.IPowerInfoHandler;
|
||||
import mekanism.client.gui.element.GuiProgress;
|
||||
import mekanism.client.gui.element.GuiProgress.IProgressInfoHandler;
|
||||
import mekanism.client.gui.element.GuiProgress.ProgressBar;
|
||||
import mekanism.client.gui.element.GuiSlot;
|
||||
import mekanism.client.gui.element.GuiSlot.SlotOverlay;
|
||||
import mekanism.client.gui.element.GuiSlot.SlotType;
|
||||
import mekanism.client.jei.BaseRecipeCategory;
|
||||
import mekanism.common.recipe.machines.PressurizedRecipe;
|
||||
import mekanism.common.util.MekanismUtils;
|
||||
import mekanism.common.util.MekanismUtils.ResourceType;
|
||||
import mezz.jei.api.IGuiHelper;
|
||||
import mezz.jei.api.gui.IDrawable;
|
||||
import mezz.jei.api.gui.IGuiFluidStackGroup;
|
||||
import mezz.jei.api.gui.IGuiItemStackGroup;
|
||||
import mezz.jei.api.gui.IRecipeLayout;
|
||||
import mezz.jei.api.gui.ITickTimer;
|
||||
import mezz.jei.api.gui.ITooltipCallback;
|
||||
import mezz.jei.api.recipe.IRecipeWrapper;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
public class PRCRecipeCategory extends BaseRecipeCategory
|
||||
{
|
||||
public IGuiHelper guiHelper;
|
||||
|
||||
public IDrawable background;
|
||||
public IDrawable fluidOverlay;
|
||||
|
||||
public GuiGasGauge gasInput;
|
||||
public GuiGasGauge gasOutput;
|
||||
|
||||
public PressurizedRecipe tempRecipe;
|
||||
|
||||
public ITickTimer timer;
|
||||
|
||||
public PRCRecipeCategory(IGuiHelper helper)
|
||||
{
|
||||
super("mekanism:gui/nei/GuiPRC.png", "pressurized_reaction_chamber", "tile.MachineBlock2.PressurizedReactionChamber.short.name", ProgressBar.MEDIUM);
|
||||
|
||||
guiHelper = helper;
|
||||
|
||||
timer = helper.createTickTimer(20, 20, false);
|
||||
|
||||
xOffset = 3;
|
||||
yOffset = 11;
|
||||
|
||||
background = guiHelper.createDrawable(new ResourceLocation(guiTexture), xOffset, yOffset, 170, 68);
|
||||
fluidOverlay = guiHelper.createDrawable(MekanismUtils.getResource(ResourceType.GUI_ELEMENT, GuiGauge.Type.STANDARD.textureLocation), 19, 1, 16, 59);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addGuiElements()
|
||||
{
|
||||
guiElements.add(new GuiSlot(SlotType.INPUT, this, guiLocation, 53, 34));
|
||||
guiElements.add(new GuiSlot(SlotType.POWER, this, guiLocation, 140, 18).with(SlotOverlay.POWER));
|
||||
guiElements.add(new GuiSlot(SlotType.OUTPUT, this, guiLocation, 115, 34));
|
||||
|
||||
guiElements.add(GuiFluidGauge.getDummy(GuiGauge.Type.STANDARD_YELLOW, this, guiLocation, 5, 10));
|
||||
guiElements.add(gasInput = GuiGasGauge.getDummy(GuiGauge.Type.STANDARD_RED, this, guiLocation, 28, 10));
|
||||
guiElements.add(gasOutput = GuiGasGauge.getDummy(GuiGauge.Type.SMALL_BLUE, this, guiLocation, 140, 40));
|
||||
|
||||
guiElements.add(new GuiPowerBar(this, new IPowerInfoHandler() {
|
||||
@Override
|
||||
public double getLevel()
|
||||
{
|
||||
return 1F;
|
||||
}
|
||||
}, guiLocation, 164, 15));
|
||||
guiElements.add(new GuiProgress(new IProgressInfoHandler()
|
||||
{
|
||||
@Override
|
||||
public double getProgress()
|
||||
{
|
||||
return (float)timer.getValue() / 20F;
|
||||
}
|
||||
}, progressBar, this, guiLocation, 75, 37));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawExtras(Minecraft minecraft)
|
||||
{
|
||||
super.drawExtras(minecraft);
|
||||
|
||||
if(tempRecipe.getInput().getGas() != null)
|
||||
{
|
||||
gasInput.setDummyType(tempRecipe.getInput().getGas().getGas());
|
||||
gasInput.renderScale(0, 0, -xOffset, -yOffset);
|
||||
}
|
||||
|
||||
if(tempRecipe.getOutput().getGasOutput() != null)
|
||||
{
|
||||
gasOutput.setDummyType(tempRecipe.getOutput().getGasOutput().getGas());
|
||||
gasOutput.renderScale(0, 0, -xOffset, -yOffset);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public IDrawable getBackground()
|
||||
{
|
||||
return background;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRecipe(IRecipeLayout recipeLayout, IRecipeWrapper recipeWrapper)
|
||||
{
|
||||
if(recipeWrapper instanceof PRCRecipeWrapper)
|
||||
{
|
||||
tempRecipe = ((PRCRecipeWrapper)recipeWrapper).recipe;
|
||||
}
|
||||
|
||||
IGuiItemStackGroup itemStacks = recipeLayout.getItemStacks();
|
||||
|
||||
itemStacks.init(0, true, 53-xOffset, 34-yOffset);
|
||||
itemStacks.init(1, false, 115-xOffset, 34-yOffset);
|
||||
|
||||
itemStacks.set(0, recipeWrapper.getInputs());
|
||||
itemStacks.set(1, recipeWrapper.getOutputs());
|
||||
|
||||
IGuiFluidStackGroup fluidStacks = recipeLayout.getFluidStacks();
|
||||
|
||||
fluidStacks.init(0, true, 3, 0, 16, 58, tempRecipe.getInput().getFluid().amount, false, fluidOverlay);
|
||||
fluidStacks.set(0, recipeWrapper.getFluidInputs());
|
||||
fluidStacks.addTooltipCallback(new ITooltipCallback<FluidStack>() {
|
||||
|
||||
@Override
|
||||
public void onTooltip(int slotIndex, boolean input, FluidStack ingredient, List<String> tooltip)
|
||||
{
|
||||
tooltip.remove(1);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
package mekanism.client.jei.machine.other;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import mezz.jei.api.recipe.IRecipeHandler;
|
||||
import mezz.jei.api.recipe.IRecipeWrapper;
|
||||
|
||||
public class PRCRecipeHandler implements IRecipeHandler<PRCRecipeWrapper>
|
||||
{
|
||||
private final PRCRecipeCategory category;
|
||||
|
||||
public PRCRecipeHandler(PRCRecipeCategory c)
|
||||
{
|
||||
category = c;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class getRecipeClass()
|
||||
{
|
||||
return PRCRecipeWrapper.class;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getRecipeCategoryUid()
|
||||
{
|
||||
return category.getUid();
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public IRecipeWrapper getRecipeWrapper(@Nonnull PRCRecipeWrapper recipe)
|
||||
{
|
||||
return recipe;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isRecipeValid(@Nonnull PRCRecipeWrapper recipe)
|
||||
{
|
||||
return recipe.category == category;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
package mekanism.client.jei.machine.other;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import mekanism.common.recipe.machines.PressurizedRecipe;
|
||||
import mekanism.common.util.LangUtils;
|
||||
import mezz.jei.api.recipe.BlankRecipeWrapper;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
public class PRCRecipeWrapper extends BlankRecipeWrapper
|
||||
{
|
||||
public PressurizedRecipe recipe;
|
||||
|
||||
public PRCRecipeCategory category;
|
||||
|
||||
public PRCRecipeWrapper(PressurizedRecipe r, PRCRecipeCategory c)
|
||||
{
|
||||
recipe = r;
|
||||
category = c;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public List<ItemStack> getInputs()
|
||||
{
|
||||
return Arrays.asList(recipe.getInput().getSolid());
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public List<FluidStack> getFluidInputs()
|
||||
{
|
||||
return Arrays.asList(recipe.getInput().getFluid());
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public List<ItemStack> getOutputs()
|
||||
{
|
||||
return Arrays.asList(recipe.getOutput().getItemOutput());
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public List<String> getTooltipStrings(int mouseX, int mouseY)
|
||||
{
|
||||
List<String> currenttip = new ArrayList<String>();
|
||||
|
||||
if(mouseX >= 29-3 && mouseX <= 45-3 && mouseY >= 11-12 && mouseY <= 69-12)
|
||||
{
|
||||
currenttip.add(LangUtils.localizeGasStack(recipe.getInput().getGas()));
|
||||
}
|
||||
else if(mouseX >= 141-3 && mouseX <= 157-3 && mouseY >= 41-12 && mouseY <= 69-12)
|
||||
{
|
||||
currenttip.add(LangUtils.localizeGasStack(recipe.getOutput().getGasOutput()));
|
||||
}
|
||||
|
||||
return currenttip;
|
||||
}
|
||||
}
|
||||
+78
@@ -0,0 +1,78 @@
|
||||
package mekanism.client.jei.machine.other;
|
||||
|
||||
import mekanism.api.gas.GasStack;
|
||||
import mekanism.client.jei.BaseRecipeCategory;
|
||||
import mezz.jei.api.IGuiHelper;
|
||||
import mezz.jei.api.gui.IDrawable;
|
||||
import mezz.jei.api.gui.IGuiFluidStackGroup;
|
||||
import mezz.jei.api.gui.IRecipeLayout;
|
||||
import mezz.jei.api.gui.ITickTimer;
|
||||
import mezz.jei.api.recipe.IRecipeWrapper;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
public class RotaryCondensentratorRecipeCategory extends BaseRecipeCategory
|
||||
{
|
||||
public IGuiHelper guiHelper;
|
||||
|
||||
public IDrawable background;
|
||||
public IDrawable fluidOverlay;
|
||||
|
||||
public RotaryCondensentratorRecipeWrapper tempRecipe;
|
||||
|
||||
public ITickTimer timer;
|
||||
|
||||
public RotaryCondensentratorRecipeCategory(IGuiHelper helper)
|
||||
{
|
||||
super("mekanism:gui/nei/GuiRotaryCondensentrator.png", "rotary_condensentrator", "nei.rotaryCondensentrator", null);
|
||||
|
||||
guiHelper = helper;
|
||||
|
||||
timer = helper.createTickTimer(20, 20, false);
|
||||
|
||||
xOffset = 3;
|
||||
yOffset = 12;
|
||||
|
||||
background = guiHelper.createDrawable(new ResourceLocation(guiTexture), xOffset, yOffset, 170, 71);
|
||||
fluidOverlay = guiHelper.createDrawable(new ResourceLocation(guiTexture), 176, 40, 16, 59);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawExtras(Minecraft minecraft)
|
||||
{
|
||||
super.drawExtras(minecraft);
|
||||
|
||||
if(tempRecipe.condensentrating)
|
||||
{
|
||||
drawTexturedRect(64-xOffset, 39-yOffset, 176, 123, 48, 8);
|
||||
}
|
||||
else {
|
||||
drawTexturedRect(64-xOffset, 39-yOffset, 176, 115, 48, 8);
|
||||
}
|
||||
|
||||
if(tempRecipe.gasType != null)
|
||||
{
|
||||
displayGauge(58, 26-xOffset, 14-yOffset, 176, 40, 58, null, new GasStack(tempRecipe.gasType, 1));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public IDrawable getBackground()
|
||||
{
|
||||
return background;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRecipe(IRecipeLayout recipeLayout, IRecipeWrapper recipeWrapper)
|
||||
{
|
||||
if(recipeWrapper instanceof RotaryCondensentratorRecipeWrapper)
|
||||
{
|
||||
tempRecipe = (RotaryCondensentratorRecipeWrapper)recipeWrapper;
|
||||
}
|
||||
|
||||
IGuiFluidStackGroup fluidStacks = recipeLayout.getFluidStacks();
|
||||
|
||||
fluidStacks.init(0, !tempRecipe.condensentrating, 134-xOffset, 14-yOffset, 16, 58, 1000, false, fluidOverlay);
|
||||
fluidStacks.set(0, tempRecipe.condensentrating ? recipeWrapper.getFluidOutputs() : recipeWrapper.getFluidInputs());
|
||||
}
|
||||
}
|
||||
+42
@@ -0,0 +1,42 @@
|
||||
package mekanism.client.jei.machine.other;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import mezz.jei.api.recipe.IRecipeHandler;
|
||||
import mezz.jei.api.recipe.IRecipeWrapper;
|
||||
|
||||
public class RotaryCondensentratorRecipeHandler implements IRecipeHandler<RotaryCondensentratorRecipeWrapper>
|
||||
{
|
||||
private final RotaryCondensentratorRecipeCategory category;
|
||||
|
||||
public RotaryCondensentratorRecipeHandler(RotaryCondensentratorRecipeCategory c)
|
||||
{
|
||||
category = c;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class getRecipeClass()
|
||||
{
|
||||
return RotaryCondensentratorRecipeWrapper.class;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getRecipeCategoryUid()
|
||||
{
|
||||
return category.getUid();
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public IRecipeWrapper getRecipeWrapper(@Nonnull RotaryCondensentratorRecipeWrapper recipe)
|
||||
{
|
||||
return recipe;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isRecipeValid(@Nonnull RotaryCondensentratorRecipeWrapper recipe)
|
||||
{
|
||||
return recipe.category == category;
|
||||
}
|
||||
}
|
||||
+97
@@ -0,0 +1,97 @@
|
||||
package mekanism.client.jei.machine.other;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import mekanism.api.gas.Gas;
|
||||
import mekanism.common.util.LangUtils;
|
||||
import mezz.jei.api.recipe.BlankRecipeWrapper;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
public class RotaryCondensentratorRecipeWrapper extends BlankRecipeWrapper
|
||||
{
|
||||
public Fluid fluidType;
|
||||
public Gas gasType;
|
||||
|
||||
public boolean condensentrating = true;
|
||||
|
||||
public RotaryCondensentratorRecipeCategory category;
|
||||
|
||||
public RotaryCondensentratorRecipeWrapper(Fluid fluid, Gas gas, boolean b, RotaryCondensentratorRecipeCategory c)
|
||||
{
|
||||
fluidType = fluid;
|
||||
gasType = gas;
|
||||
|
||||
condensentrating = b;
|
||||
category = c;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public List<ItemStack> getInputs()
|
||||
{
|
||||
return new ArrayList<ItemStack>();
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public List<FluidStack> getFluidInputs()
|
||||
{
|
||||
if(condensentrating)
|
||||
{
|
||||
return new ArrayList<FluidStack>();
|
||||
}
|
||||
else {
|
||||
return Arrays.asList(new FluidStack(fluidType, 1000));
|
||||
}
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public List<ItemStack> getOutputs()
|
||||
{
|
||||
return new ArrayList<ItemStack>();
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public List<FluidStack> getFluidOutputs()
|
||||
{
|
||||
if(condensentrating)
|
||||
{
|
||||
return Arrays.asList(new FluidStack(fluidType, 1000));
|
||||
}
|
||||
else {
|
||||
return new ArrayList<FluidStack>();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawInfo(@Nonnull Minecraft minecraft, int recipeWidth, int recipeHeight, int mouseX, int mouseY)
|
||||
{
|
||||
FontRenderer fontRendererObj = minecraft.fontRendererObj;
|
||||
fontRendererObj.drawString(condensentrating ? LangUtils.localize("gui.condensentrating") : LangUtils.localize("gui.decondensentrating"), 6-3, 74-12, 0x404040, false);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public List<String> getTooltipStrings(int mouseX, int mouseY)
|
||||
{
|
||||
List<String> currenttip = new ArrayList<String>();
|
||||
|
||||
if(mouseX >= 26-3 && mouseX <= 42-3 && mouseY >= 14-12 && mouseY <= 72-12)
|
||||
{
|
||||
currenttip.add(gasType.getLocalizedName());
|
||||
}
|
||||
|
||||
return currenttip;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
package mekanism.client.jei.machine.other;
|
||||
|
||||
import mekanism.client.jei.BaseRecipeCategory;
|
||||
import mekanism.common.recipe.machines.SolarNeutronRecipe;
|
||||
import mezz.jei.api.IGuiHelper;
|
||||
import mezz.jei.api.gui.IDrawable;
|
||||
import mezz.jei.api.gui.IRecipeLayout;
|
||||
import mezz.jei.api.gui.ITickTimer;
|
||||
import mezz.jei.api.recipe.IRecipeWrapper;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
public class SolarNeutronRecipeCategory extends BaseRecipeCategory
|
||||
{
|
||||
public IGuiHelper guiHelper;
|
||||
|
||||
public IDrawable background;
|
||||
|
||||
public SolarNeutronRecipe tempRecipe;
|
||||
|
||||
public ITickTimer timer;
|
||||
|
||||
public SolarNeutronRecipeCategory(IGuiHelper helper)
|
||||
{
|
||||
super("mekanism:gui/nei/GuiSolarNeutronActivator.png", "solar_neutron_activator", "tile.MachineBlock3.SolarNeutronActivator.name", null);
|
||||
|
||||
guiHelper = helper;
|
||||
|
||||
timer = helper.createTickTimer(20, 20, false);
|
||||
|
||||
xOffset = 3;
|
||||
yOffset = 12;
|
||||
|
||||
background = guiHelper.createDrawable(new ResourceLocation(guiTexture), xOffset, yOffset, 170, 70);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawExtras(Minecraft minecraft)
|
||||
{
|
||||
super.drawExtras(minecraft);
|
||||
|
||||
drawTexturedRect(64-xOffset, 39-yOffset, 176, 58, 55, 8);
|
||||
|
||||
if(tempRecipe.getInput().ingredient != null)
|
||||
{
|
||||
displayGauge(58, 26-xOffset, 14-yOffset, 176, 0, 58, null, tempRecipe.getInput().ingredient);
|
||||
}
|
||||
|
||||
if(tempRecipe.getOutput().output != null)
|
||||
{
|
||||
displayGauge(58, 134-xOffset, 14-yOffset, 176, 0, 58, null, tempRecipe.getOutput().output);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public IDrawable getBackground()
|
||||
{
|
||||
return background;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRecipe(IRecipeLayout recipeLayout, IRecipeWrapper recipeWrapper)
|
||||
{
|
||||
if(recipeWrapper instanceof SolarNeutronRecipeWrapper)
|
||||
{
|
||||
tempRecipe = ((SolarNeutronRecipeWrapper)recipeWrapper).recipe;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
package mekanism.client.jei.machine.other;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import mezz.jei.api.recipe.IRecipeHandler;
|
||||
import mezz.jei.api.recipe.IRecipeWrapper;
|
||||
|
||||
public class SolarNeutronRecipeHandler implements IRecipeHandler<SolarNeutronRecipeWrapper>
|
||||
{
|
||||
private final SolarNeutronRecipeCategory category;
|
||||
|
||||
public SolarNeutronRecipeHandler(SolarNeutronRecipeCategory c)
|
||||
{
|
||||
category = c;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class getRecipeClass()
|
||||
{
|
||||
return SolarNeutronRecipeWrapper.class;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getRecipeCategoryUid()
|
||||
{
|
||||
return category.getUid();
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public IRecipeWrapper getRecipeWrapper(@Nonnull SolarNeutronRecipeWrapper recipe)
|
||||
{
|
||||
return recipe;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isRecipeValid(@Nonnull SolarNeutronRecipeWrapper recipe)
|
||||
{
|
||||
return recipe.category == category;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
package mekanism.client.jei.machine.other;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import mekanism.common.recipe.machines.SolarNeutronRecipe;
|
||||
import mekanism.common.util.LangUtils;
|
||||
import mezz.jei.api.recipe.BlankRecipeWrapper;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class SolarNeutronRecipeWrapper extends BlankRecipeWrapper
|
||||
{
|
||||
public SolarNeutronRecipe recipe;
|
||||
|
||||
public SolarNeutronRecipeCategory category;
|
||||
|
||||
public SolarNeutronRecipeWrapper(SolarNeutronRecipe r, SolarNeutronRecipeCategory c)
|
||||
{
|
||||
recipe = r;
|
||||
category = c;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public List<ItemStack> getInputs()
|
||||
{
|
||||
return new ArrayList<ItemStack>();
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public List<ItemStack> getOutputs()
|
||||
{
|
||||
return new ArrayList<ItemStack>();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public List<String> getTooltipStrings(int mouseX, int mouseY)
|
||||
{
|
||||
List<String> currenttip = new ArrayList<String>();
|
||||
|
||||
if(mouseX >= 26-3 && mouseX <= 42-3 && mouseY >= 14-12 && mouseY <= 72-12)
|
||||
{
|
||||
currenttip.add(LangUtils.localizeGasStack(recipe.getInput().ingredient));
|
||||
}
|
||||
else if(mouseX >= 134-3 && mouseX <= 150-3 && mouseY >= 14-12 && mouseY <= 72-12)
|
||||
{
|
||||
currenttip.add(LangUtils.localizeGasStack(recipe.getOutput().output));
|
||||
}
|
||||
|
||||
return currenttip;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
package mekanism.client.jei.machine.other;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import mekanism.client.jei.BaseRecipeCategory;
|
||||
import mekanism.common.recipe.machines.ThermalEvaporationRecipe;
|
||||
import mezz.jei.api.IGuiHelper;
|
||||
import mezz.jei.api.gui.IDrawable;
|
||||
import mezz.jei.api.gui.IGuiFluidStackGroup;
|
||||
import mezz.jei.api.gui.IRecipeLayout;
|
||||
import mezz.jei.api.gui.ITickTimer;
|
||||
import mezz.jei.api.gui.ITooltipCallback;
|
||||
import mezz.jei.api.recipe.IRecipeWrapper;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
public class ThermalEvaporationRecipeCategory extends BaseRecipeCategory
|
||||
{
|
||||
public IGuiHelper guiHelper;
|
||||
|
||||
public IDrawable background;
|
||||
public IDrawable fluidOverlay;
|
||||
|
||||
public ThermalEvaporationRecipe tempRecipe;
|
||||
|
||||
public ITickTimer timer;
|
||||
|
||||
public ThermalEvaporationRecipeCategory(IGuiHelper helper)
|
||||
{
|
||||
super("mekanism:gui/nei/GuiThermalEvaporationController.png", "thermal_evaporation_plant", "gui.thermalEvaporationController.short", null);
|
||||
|
||||
guiHelper = helper;
|
||||
|
||||
timer = helper.createTickTimer(20, 20, false);
|
||||
|
||||
xOffset = 3;
|
||||
yOffset = 12;
|
||||
|
||||
background = guiHelper.createDrawable(new ResourceLocation(guiTexture), xOffset, yOffset, 170, 62);
|
||||
fluidOverlay = guiHelper.createDrawable(new ResourceLocation(guiTexture), 176, 0, 16, 59);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawExtras(Minecraft minecraft)
|
||||
{
|
||||
super.drawExtras(minecraft);
|
||||
|
||||
drawTexturedRect(49-xOffset, 64-yOffset, 176, 59, 78, 8);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IDrawable getBackground()
|
||||
{
|
||||
return background;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRecipe(IRecipeLayout recipeLayout, IRecipeWrapper recipeWrapper)
|
||||
{
|
||||
if(recipeWrapper instanceof ThermalEvaporationRecipeWrapper)
|
||||
{
|
||||
tempRecipe = ((ThermalEvaporationRecipeWrapper)recipeWrapper).recipe;
|
||||
}
|
||||
|
||||
IGuiFluidStackGroup fluidStacks = recipeLayout.getFluidStacks();
|
||||
|
||||
fluidStacks.init(0, true, 7-xOffset, 14-yOffset, 16, 58, tempRecipe.getInput().ingredient.amount, false, fluidOverlay);
|
||||
fluidStacks.init(1, false, 153-xOffset, 14-yOffset, 16, 58, tempRecipe.getOutput().output.amount, false, fluidOverlay);
|
||||
|
||||
fluidStacks.set(0, recipeWrapper.getFluidInputs());
|
||||
fluidStacks.set(1, recipeWrapper.getFluidOutputs());
|
||||
|
||||
fluidStacks.addTooltipCallback(new ITooltipCallback<FluidStack>() {
|
||||
|
||||
@Override
|
||||
public void onTooltip(int slotIndex, boolean input, FluidStack ingredient, List<String> tooltip)
|
||||
{
|
||||
tooltip.remove(1);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
package mekanism.client.jei.machine.other;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import mezz.jei.api.recipe.IRecipeHandler;
|
||||
import mezz.jei.api.recipe.IRecipeWrapper;
|
||||
|
||||
public class ThermalEvaporationRecipeHandler implements IRecipeHandler<ThermalEvaporationRecipeWrapper>
|
||||
{
|
||||
private final ThermalEvaporationRecipeCategory category;
|
||||
|
||||
public ThermalEvaporationRecipeHandler(ThermalEvaporationRecipeCategory c)
|
||||
{
|
||||
category = c;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class getRecipeClass()
|
||||
{
|
||||
return ThermalEvaporationRecipeWrapper.class;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getRecipeCategoryUid()
|
||||
{
|
||||
return category.getUid();
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public IRecipeWrapper getRecipeWrapper(@Nonnull ThermalEvaporationRecipeWrapper recipe)
|
||||
{
|
||||
return recipe;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isRecipeValid(@Nonnull ThermalEvaporationRecipeWrapper recipe)
|
||||
{
|
||||
return recipe.category == category;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package mekanism.client.jei.machine.other;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import mekanism.common.recipe.machines.ThermalEvaporationRecipe;
|
||||
import mezz.jei.api.recipe.BlankRecipeWrapper;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
public class ThermalEvaporationRecipeWrapper extends BlankRecipeWrapper
|
||||
{
|
||||
public ThermalEvaporationRecipe recipe;
|
||||
|
||||
public ThermalEvaporationRecipeCategory category;
|
||||
|
||||
public ThermalEvaporationRecipeWrapper(ThermalEvaporationRecipe r, ThermalEvaporationRecipeCategory c)
|
||||
{
|
||||
recipe = r;
|
||||
category = c;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public List<FluidStack> getFluidInputs()
|
||||
{
|
||||
return Arrays.asList(recipe.getInput().ingredient);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public List<FluidStack> getFluidOutputs()
|
||||
{
|
||||
return Arrays.asList(recipe.getOutput().output);
|
||||
}
|
||||
}
|
||||
@@ -1,189 +0,0 @@
|
||||
package mekanism.client.model;
|
||||
|
||||
import net.minecraft.client.model.ModelBase;
|
||||
import net.minecraft.client.model.ModelRenderer;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class ModelElectricPump extends ModelBase
|
||||
{
|
||||
ModelRenderer pumpRingTop;
|
||||
ModelRenderer pumpPortTop;
|
||||
ModelRenderer pumpCasing;
|
||||
ModelRenderer pumpBase;
|
||||
ModelRenderer powerPort;
|
||||
ModelRenderer powerConnector;
|
||||
ModelRenderer powerConnectorFrame4;
|
||||
ModelRenderer powerConnectorFrame3;
|
||||
ModelRenderer powerConnectorFrame2;
|
||||
ModelRenderer powerConnectorFrame1;
|
||||
ModelRenderer pipeToggleBack;
|
||||
ModelRenderer pipeToggleRingBack;
|
||||
ModelRenderer pipeTogglePortBack;
|
||||
ModelRenderer pipeToggleLeft;
|
||||
ModelRenderer pipeToggleRingLeft;
|
||||
ModelRenderer pipeTogglePortLeft;
|
||||
ModelRenderer pipeToggleRight;
|
||||
ModelRenderer pipeToggleRingRight;
|
||||
ModelRenderer pipeTogglePortRight;
|
||||
ModelRenderer pumpPipe;
|
||||
|
||||
public ModelElectricPump()
|
||||
{
|
||||
textureWidth = 128;
|
||||
textureHeight = 64;
|
||||
|
||||
pumpRingTop = new ModelRenderer(this, 68, 9);
|
||||
pumpRingTop.addBox(0F, 0F, 0F, 8, 1, 8);
|
||||
pumpRingTop.setRotationPoint(-4F, 10F, -4F);
|
||||
pumpRingTop.setTextureSize(128, 64);
|
||||
pumpRingTop.mirror = true;
|
||||
setRotation(pumpRingTop, 0F, 0F, 0F);
|
||||
pumpPortTop = new ModelRenderer(this, 68, 0);
|
||||
pumpPortTop.addBox(0F, 0F, 0F, 8, 1, 8);
|
||||
pumpPortTop.setRotationPoint(-4F, 8F, -4F);
|
||||
pumpPortTop.setTextureSize(128, 64);
|
||||
pumpPortTop.mirror = true;
|
||||
setRotation(pumpPortTop, 0F, 0F, 0F);
|
||||
pumpCasing = new ModelRenderer(this, 0, 0);
|
||||
pumpCasing.addBox(0F, 0F, 0F, 7, 12, 7);
|
||||
pumpCasing.setRotationPoint(-3.5F, 11F, -3.5F);
|
||||
pumpCasing.setTextureSize(128, 64);
|
||||
pumpCasing.mirror = true;
|
||||
setRotation(pumpCasing, 0F, 0F, 0F);
|
||||
pumpBase = new ModelRenderer(this, 28, 0);
|
||||
pumpBase.addBox(0F, 0F, 0F, 6, 15, 6);
|
||||
pumpBase.setRotationPoint(-3F, 9F, -3F);
|
||||
pumpBase.setTextureSize(128, 64);
|
||||
pumpBase.mirror = true;
|
||||
setRotation(pumpBase, 0F, 0F, 0F);
|
||||
powerPort = new ModelRenderer(this, 38, 29);
|
||||
powerPort.addBox(0F, 0F, 0F, 8, 8, 1);
|
||||
powerPort.setRotationPoint(-4F, 12F, -8F);
|
||||
powerPort.setTextureSize(128, 64);
|
||||
powerPort.mirror = true;
|
||||
setRotation(powerPort, 0F, 0F, 0F);
|
||||
powerConnector = new ModelRenderer(this, 0, 29);
|
||||
powerConnector.addBox(0F, 0F, 0F, 5, 5, 4);
|
||||
powerConnector.setRotationPoint(-2.5F, 13.5F, -7F);
|
||||
powerConnector.setTextureSize(128, 64);
|
||||
powerConnector.mirror = true;
|
||||
setRotation(powerConnector, 0F, 0F, 0F);
|
||||
powerConnectorFrame4 = new ModelRenderer(this, 38, 21);
|
||||
powerConnectorFrame4.addBox(0F, 0F, 0F, 1, 1, 4);
|
||||
powerConnectorFrame4.setRotationPoint(2F, 18F, -7F);
|
||||
powerConnectorFrame4.setTextureSize(128, 64);
|
||||
powerConnectorFrame4.mirror = true;
|
||||
setRotation(powerConnectorFrame4, 0F, 0F, 0F);
|
||||
powerConnectorFrame3 = new ModelRenderer(this, 38, 21);
|
||||
powerConnectorFrame3.addBox(0F, 0F, 0F, 1, 1, 4);
|
||||
powerConnectorFrame3.setRotationPoint(-3F, 18F, -7F);
|
||||
powerConnectorFrame3.setTextureSize(128, 64);
|
||||
powerConnectorFrame3.mirror = true;
|
||||
setRotation(powerConnectorFrame3, 0F, 0F, 0F);
|
||||
powerConnectorFrame2 = new ModelRenderer(this, 38, 21);
|
||||
powerConnectorFrame2.addBox(0F, 0F, 0F, 1, 1, 4);
|
||||
powerConnectorFrame2.setRotationPoint(2F, 13F, -7F);
|
||||
powerConnectorFrame2.setTextureSize(128, 64);
|
||||
powerConnectorFrame2.mirror = true;
|
||||
setRotation(powerConnectorFrame2, 0F, 0F, 0F);
|
||||
powerConnectorFrame1 = new ModelRenderer(this, 38, 21);
|
||||
powerConnectorFrame1.addBox(0F, 0F, 0F, 1, 1, 4);
|
||||
powerConnectorFrame1.setRotationPoint(-3F, 13F, -7F);
|
||||
powerConnectorFrame1.setTextureSize(128, 64);
|
||||
powerConnectorFrame1.mirror = true;
|
||||
setRotation(powerConnectorFrame1, 0F, 0F, 0F);
|
||||
pipeToggleBack = new ModelRenderer(this, 0, 19);
|
||||
pipeToggleBack.addBox(0F, 0F, 0F, 6, 6, 4);
|
||||
pipeToggleBack.setRotationPoint(-3F, 13F, 3F);
|
||||
pipeToggleBack.setTextureSize(128, 64);
|
||||
pipeToggleBack.mirror = true;
|
||||
setRotation(pipeToggleBack, 0F, 0F, 0F);
|
||||
pipeToggleRingBack = new ModelRenderer(this, 18, 30);
|
||||
pipeToggleRingBack.addBox(0F, 0F, 0F, 7, 7, 1);
|
||||
pipeToggleRingBack.setRotationPoint(-3.5F, 12.5F, 5F);
|
||||
pipeToggleRingBack.setTextureSize(128, 64);
|
||||
pipeToggleRingBack.mirror = true;
|
||||
setRotation(pipeToggleRingBack, 0F, 0F, 0F);
|
||||
pipeTogglePortBack = new ModelRenderer(this, 20, 21);
|
||||
pipeTogglePortBack.addBox(0F, 0F, 0F, 8, 8, 1);
|
||||
pipeTogglePortBack.setRotationPoint(-4F, 12F, 7F);
|
||||
pipeTogglePortBack.setTextureSize(128, 64);
|
||||
pipeTogglePortBack.mirror = true;
|
||||
setRotation(pipeTogglePortBack, 0F, 0F, 0F);
|
||||
pipeToggleLeft = new ModelRenderer(this, 34, 38);
|
||||
pipeToggleLeft.addBox(0F, 0F, 0F, 4, 6, 6);
|
||||
pipeToggleLeft.setRotationPoint(3F, 13F, -3F);
|
||||
pipeToggleLeft.setTextureSize(128, 64);
|
||||
pipeToggleLeft.mirror = true;
|
||||
setRotation(pipeToggleLeft, 0F, 0F, 0F);
|
||||
pipeToggleRingLeft = new ModelRenderer(this, 18, 38);
|
||||
pipeToggleRingLeft.addBox(0F, 0F, 0F, 1, 7, 7);
|
||||
pipeToggleRingLeft.setRotationPoint(5F, 12.5F, -3.5F);
|
||||
pipeToggleRingLeft.setTextureSize(128, 64);
|
||||
pipeToggleRingLeft.mirror = true;
|
||||
setRotation(pipeToggleRingLeft, 0F, 0F, 0F);
|
||||
pipeTogglePortLeft = new ModelRenderer(this, 0, 38);
|
||||
pipeTogglePortLeft.addBox(0F, 0F, 0F, 1, 8, 8);
|
||||
pipeTogglePortLeft.setRotationPoint(7F, 12F, -4F);
|
||||
pipeTogglePortLeft.setTextureSize(128, 64);
|
||||
pipeTogglePortLeft.mirror = true;
|
||||
setRotation(pipeTogglePortLeft, 0F, 0F, 0F);
|
||||
pipeToggleRight = new ModelRenderer(this, 34, 38);
|
||||
pipeToggleRight.mirror = true;
|
||||
pipeToggleRight.addBox(0F, 0F, 0F, 4, 6, 6);
|
||||
pipeToggleRight.setRotationPoint(-7F, 13F, -3F);
|
||||
pipeToggleRight.setTextureSize(128, 64);
|
||||
setRotation(pipeToggleRight, 0F, 0F, 0F);
|
||||
pipeToggleRingRight = new ModelRenderer(this, 18, 38);
|
||||
pipeToggleRingRight.addBox(0F, 0F, 0F, 1, 7, 7);
|
||||
pipeToggleRingRight.setRotationPoint(-6F, 12.5F, -3.5F);
|
||||
pipeToggleRingRight.setTextureSize(128, 64);
|
||||
pipeToggleRingRight.mirror = true;
|
||||
setRotation(pipeToggleRingRight, 0F, 0F, 0F);
|
||||
pipeTogglePortRight = new ModelRenderer(this, 0, 38);
|
||||
pipeTogglePortRight.addBox(0F, 0F, 0F, 1, 8, 8);
|
||||
pipeTogglePortRight.setRotationPoint(-8F, 12F, -4F);
|
||||
pipeTogglePortRight.setTextureSize(128, 64);
|
||||
pipeTogglePortRight.mirror = true;
|
||||
setRotation(pipeTogglePortRight, 0F, 0F, 0F);
|
||||
pumpPipe = new ModelRenderer(this, 52, 0);
|
||||
pumpPipe.addBox(0F, 0F, 0F, 4, 8, 4);
|
||||
pumpPipe.setRotationPoint(-2F, 24F, -2F);
|
||||
pumpPipe.setTextureSize(128, 64);
|
||||
pumpPipe.mirror = true;
|
||||
setRotation(pumpPipe, 0F, 0F, 0F);
|
||||
}
|
||||
|
||||
public void render(float size)
|
||||
{
|
||||
pumpRingTop.render(size);
|
||||
pumpPortTop.render(size);
|
||||
pumpCasing.render(size);
|
||||
pumpBase.render(size);
|
||||
powerPort.render(size);
|
||||
powerConnector.render(size);
|
||||
powerConnectorFrame4.render(size);
|
||||
powerConnectorFrame3.render(size);
|
||||
powerConnectorFrame2.render(size);
|
||||
powerConnectorFrame1.render(size);
|
||||
/*pipeToggleBack.render(size);
|
||||
pipeToggleRingBack.render(size);
|
||||
pipeTogglePortBack.render(size);
|
||||
pipeToggleLeft.render(size);
|
||||
pipeToggleRingLeft.render(size);
|
||||
pipeTogglePortLeft.render(size);
|
||||
pipeToggleRight.render(size);
|
||||
pipeToggleRingRight.render(size);
|
||||
pipeTogglePortRight.render(size);
|
||||
pumpPipe.render(size);*/
|
||||
}
|
||||
|
||||
private void setRotation(ModelRenderer model, float x, float y, float z)
|
||||
{
|
||||
model.rotateAngleX = x;
|
||||
model.rotateAngleY = y;
|
||||
model.rotateAngleZ = z;
|
||||
}
|
||||
}
|
||||
@@ -1,149 +0,0 @@
|
||||
package mekanism.client.model;
|
||||
|
||||
import net.minecraft.client.model.ModelBase;
|
||||
import net.minecraft.client.model.ModelRenderer;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class ModelFluidicPlenisher extends ModelBase
|
||||
{
|
||||
ModelRenderer bearingRight;
|
||||
ModelRenderer ringTank;
|
||||
ModelRenderer portTop;
|
||||
ModelRenderer portBack;
|
||||
ModelRenderer Connector;
|
||||
ModelRenderer pipeToggle;
|
||||
ModelRenderer ringTop;
|
||||
ModelRenderer ringBottom;
|
||||
ModelRenderer tank;
|
||||
ModelRenderer bearingLeft;
|
||||
ModelRenderer connectorRing;
|
||||
ModelRenderer rod4;
|
||||
ModelRenderer rod3;
|
||||
ModelRenderer rod2;
|
||||
ModelRenderer rod1;
|
||||
|
||||
public ModelFluidicPlenisher()
|
||||
{
|
||||
textureWidth = 64;
|
||||
textureHeight = 64;
|
||||
|
||||
bearingRight = new ModelRenderer(this, 44, 26);
|
||||
bearingRight.mirror = true;
|
||||
bearingRight.addBox(0F, 0F, 0F, 1, 4, 4);
|
||||
bearingRight.setRotationPoint(4F, 14F, -2F);
|
||||
bearingRight.setTextureSize(64, 64);
|
||||
setRotation(bearingRight, 0F, 0F, 0F);
|
||||
ringTank = new ModelRenderer(this, 0, 32);
|
||||
ringTank.addBox(0F, 0F, 0F, 11, 1, 11);
|
||||
ringTank.setRotationPoint(-5.5F, 10F, -5.5F);
|
||||
ringTank.setTextureSize(64, 64);
|
||||
ringTank.mirror = true;
|
||||
setRotation(ringTank, 0F, 0F, 0F);
|
||||
portTop = new ModelRenderer(this, 0, 21);
|
||||
portTop.addBox(0F, 0F, 0F, 10, 1, 10);
|
||||
portTop.setRotationPoint(-5F, 8F, -5F);
|
||||
portTop.setTextureSize(64, 64);
|
||||
portTop.mirror = true;
|
||||
setRotation(portTop, 0F, 0F, 0F);
|
||||
portBack = new ModelRenderer(this, 36, 0);
|
||||
portBack.addBox(0F, 0F, 0F, 8, 8, 1);
|
||||
portBack.setRotationPoint(-4F, 12F, 7F);
|
||||
portBack.setTextureSize(64, 64);
|
||||
portBack.mirror = true;
|
||||
setRotation(portBack, 0F, 0F, 0F);
|
||||
Connector = new ModelRenderer(this, 36, 9);
|
||||
Connector.addBox(0F, 0F, 0F, 5, 5, 4);
|
||||
Connector.setRotationPoint(-2.5F, 13.5F, 3F);
|
||||
Connector.setTextureSize(64, 64);
|
||||
Connector.mirror = true;
|
||||
setRotation(Connector, 0F, 0F, 0F);
|
||||
pipeToggle = new ModelRenderer(this, 32, 44);
|
||||
pipeToggle.addBox(0F, 0F, 0F, 6, 8, 6);
|
||||
pipeToggle.setRotationPoint(-3F, 24F, -3F);
|
||||
pipeToggle.setTextureSize(64, 64);
|
||||
pipeToggle.mirror = true;
|
||||
setRotation(pipeToggle, 0F, 0F, 0F);
|
||||
ringTop = new ModelRenderer(this, 0, 44);
|
||||
ringTop.addBox(0F, 0F, 0F, 8, 1, 8);
|
||||
ringTop.setRotationPoint(-4F, 9F, -4F);
|
||||
ringTop.setTextureSize(64, 64);
|
||||
ringTop.mirror = true;
|
||||
setRotation(ringTop, 0F, 0F, 0F);
|
||||
ringBottom = new ModelRenderer(this, 0, 53);
|
||||
ringBottom.addBox(0F, 0F, 0F, 8, 1, 8);
|
||||
ringBottom.setRotationPoint(-4F, 23F, -4F);
|
||||
ringBottom.setTextureSize(64, 64);
|
||||
ringBottom.mirror = true;
|
||||
setRotation(ringBottom, 0F, 0F, 0F);
|
||||
tank = new ModelRenderer(this, 0, 0);
|
||||
tank.addBox(0F, 0F, 0F, 9, 12, 9);
|
||||
tank.setRotationPoint(-4.5F, 11F, -4.5F);
|
||||
tank.setTextureSize(64, 64);
|
||||
tank.mirror = true;
|
||||
setRotation(tank, 0F, 0F, 0F);
|
||||
bearingLeft = new ModelRenderer(this, 44, 26);
|
||||
bearingLeft.addBox(0F, 0F, 0F, 1, 4, 4);
|
||||
bearingLeft.setRotationPoint(-5F, 14F, -2F);
|
||||
bearingLeft.setTextureSize(64, 64);
|
||||
bearingLeft.mirror = true;
|
||||
setRotation(bearingLeft, 0F, 0F, 0F);
|
||||
connectorRing = new ModelRenderer(this, 40, 18);
|
||||
connectorRing.addBox(0F, 0F, 0F, 7, 7, 1);
|
||||
connectorRing.setRotationPoint(-3.5F, 12.5F, 5F);
|
||||
connectorRing.setTextureSize(64, 64);
|
||||
connectorRing.mirror = true;
|
||||
setRotation(connectorRing, 0F, 0F, 0F);
|
||||
rod4 = new ModelRenderer(this, 0, 0);
|
||||
rod4.addBox(0F, 0F, 0F, 1, 1, 3);
|
||||
rod4.setRotationPoint(2F, 18F, 4F);
|
||||
rod4.setTextureSize(64, 64);
|
||||
rod4.mirror = true;
|
||||
setRotation(rod4, 0F, 0F, 0F);
|
||||
rod3 = new ModelRenderer(this, 0, 0);
|
||||
rod3.addBox(0F, 0F, 0F, 1, 1, 3);
|
||||
rod3.setRotationPoint(-3F, 18F, 4F);
|
||||
rod3.setTextureSize(64, 64);
|
||||
rod3.mirror = true;
|
||||
setRotation(rod3, 0F, 0F, 0F);
|
||||
rod2 = new ModelRenderer(this, 0, 0);
|
||||
rod2.addBox(0F, 0F, 0F, 1, 1, 3);
|
||||
rod2.setRotationPoint(2F, 13F, 4F);
|
||||
rod2.setTextureSize(64, 64);
|
||||
rod2.mirror = true;
|
||||
setRotation(rod2, 0F, 0F, 0F);
|
||||
rod1 = new ModelRenderer(this, 0, 0);
|
||||
rod1.addBox(0F, 0F, 0F, 1, 1, 3);
|
||||
rod1.setRotationPoint(-3F, 13F, 4F);
|
||||
rod1.setTextureSize(64, 64);
|
||||
rod1.mirror = true;
|
||||
setRotation(rod1, 0F, 0F, 0F);
|
||||
}
|
||||
|
||||
public void render(float size)
|
||||
{
|
||||
bearingRight.render(size);
|
||||
ringTank.render(size);
|
||||
portTop.render(size);
|
||||
portBack.render(size);
|
||||
Connector.render(size);
|
||||
//pipeToggle.render(size);
|
||||
ringTop.render(size);
|
||||
ringBottom.render(size);
|
||||
tank.render(size);
|
||||
bearingLeft.render(size);
|
||||
connectorRing.render(size);
|
||||
rod4.render(size);
|
||||
rod3.render(size);
|
||||
rod2.render(size);
|
||||
rod1.render(size);
|
||||
}
|
||||
|
||||
private void setRotation(ModelRenderer model, float x, float y, float z)
|
||||
{
|
||||
model.rotateAngleX = x;
|
||||
model.rotateAngleY = y;
|
||||
model.rotateAngleZ = z;
|
||||
}
|
||||
}
|
||||
@@ -103,7 +103,7 @@ public class MekanismRenderer
|
||||
|
||||
for(Gas gas : GasRegistry.getRegisteredGasses())
|
||||
{
|
||||
gas.updateIcon(event.map);
|
||||
gas.registerIcon(event.map);
|
||||
}
|
||||
|
||||
for(InfuseType type : InfuseRegistry.getInfuseMap().values())
|
||||
@@ -127,6 +127,11 @@ public class MekanismRenderer
|
||||
public void onStitch(TextureStitchEvent.Post event)
|
||||
{
|
||||
initFluidTextures(event.map);
|
||||
|
||||
for(Gas gas : GasRegistry.getRegisteredGasses())
|
||||
{
|
||||
gas.updateIcon(event.map);
|
||||
}
|
||||
}
|
||||
|
||||
public static void registerItemRender(String domain, Item item)
|
||||
|
||||
+13
-13
@@ -9,50 +9,50 @@ import net.minecraft.util.EnumWorldBlockLayer;
|
||||
/**
|
||||
* Chisel Face, basically a list of IChiselTexture's
|
||||
*/
|
||||
public final class ChiselFace {
|
||||
public final class CTMFace {
|
||||
|
||||
private List<ChiselTextureCTM> textureList;
|
||||
private List<TextureCTM> textureList;
|
||||
|
||||
private List<ChiselFace> childFaces;
|
||||
private List<CTMFace> childFaces;
|
||||
|
||||
private EnumWorldBlockLayer layer;
|
||||
|
||||
public ChiselFace() {
|
||||
public CTMFace() {
|
||||
this(new ArrayList<>(), new ArrayList<>());
|
||||
}
|
||||
|
||||
public ChiselFace(EnumWorldBlockLayer layer) {
|
||||
public CTMFace(EnumWorldBlockLayer layer) {
|
||||
this();
|
||||
setLayer(layer);
|
||||
}
|
||||
|
||||
public ChiselFace(List<ChiselTextureCTM> textureList, List<ChiselFace> childFaces) {
|
||||
public CTMFace(List<TextureCTM> textureList, List<CTMFace> childFaces) {
|
||||
this.textureList = textureList;
|
||||
this.childFaces = childFaces;
|
||||
}
|
||||
|
||||
public List<ChiselTextureCTM> getTextureList(){
|
||||
List<ChiselTextureCTM> list = new ArrayList<>();
|
||||
public List<TextureCTM> getTextureList(){
|
||||
List<TextureCTM> list = new ArrayList<>();
|
||||
list.addAll(this.textureList);
|
||||
for (ChiselFace face : childFaces){
|
||||
for (CTMFace face : childFaces){
|
||||
list.addAll(face.getTextureList());
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public void addTexture(ChiselTextureCTM texture){
|
||||
public void addTexture(TextureCTM texture){
|
||||
this.textureList.add(texture);
|
||||
}
|
||||
|
||||
public void addChildFace(ChiselFace face){
|
||||
public void addChildFace(CTMFace face){
|
||||
this.childFaces.add(face);
|
||||
}
|
||||
|
||||
public boolean removeTexture(ChiselTextureCTM texture){
|
||||
public boolean removeTexture(TextureCTM texture){
|
||||
return this.textureList.remove(texture);
|
||||
}
|
||||
|
||||
public boolean removeChildFace(ChiselFace face){
|
||||
public boolean removeChildFace(CTMFace face){
|
||||
return this.childFaces.remove(face);
|
||||
}
|
||||
|
||||
@@ -131,7 +131,7 @@ public class CTMModelFactory implements ISmartBlockModel, ISmartItemModel, IPers
|
||||
|
||||
for(EnumFacing facing : EnumFacing.VALUES)
|
||||
{
|
||||
ChiselTextureCTM face = model.getFace(facing);
|
||||
TextureCTM face = model.getFace(facing);
|
||||
ICTMBlock block = (ICTMBlock)state.getBlock();
|
||||
CTMData data = block.getCTMData(state);
|
||||
|
||||
@@ -151,7 +151,7 @@ public class CTMModelFactory implements ISmartBlockModel, ISmartItemModel, IPers
|
||||
return new CTMModelFactory(faceQuads, generalQuads, model);
|
||||
}
|
||||
|
||||
private void addAllQuads(List<BakedQuad> from, ChiselTextureCTM tex, @Nullable CTMBlockRenderContext ctx, IBlockState state, int quadGoal, List<BakedQuad> to)
|
||||
private void addAllQuads(List<BakedQuad> from, TextureCTM tex, @Nullable CTMBlockRenderContext ctx, IBlockState state, int quadGoal, List<BakedQuad> to)
|
||||
{
|
||||
for(BakedQuad q : from)
|
||||
{
|
||||
|
||||
@@ -30,7 +30,7 @@ public class CTMRegistry
|
||||
|
||||
public static List<Pair<String, String>> ctmTypes = new ArrayList<Pair<String, String>>();
|
||||
|
||||
public static Map<String, ChiselTextureCTM> textureCache = new HashMap<String, ChiselTextureCTM>();
|
||||
public static Map<String, TextureCTM> textureCache = new HashMap<String, TextureCTM>();
|
||||
|
||||
@SubscribeEvent
|
||||
public void onTextureStitch(TextureStitchEvent.Pre event)
|
||||
@@ -69,7 +69,7 @@ public class CTMRegistry
|
||||
textures.add(callback);
|
||||
}
|
||||
|
||||
public static ChiselTextureCTM createTexture(String domain, String name)
|
||||
public static TextureCTM createTexture(String domain, String name)
|
||||
{
|
||||
TextureSpriteCallback[] callbacks = new TextureSpriteCallback[CTM.REQUIRED_TEXTURES];
|
||||
|
||||
@@ -79,6 +79,6 @@ public class CTMRegistry
|
||||
register(callbacks[0]);
|
||||
register(callbacks[1]);
|
||||
|
||||
return new ChiselTextureCTM(EnumWorldBlockLayer.SOLID, callbacks);
|
||||
return new TextureCTM(EnumWorldBlockLayer.SOLID, callbacks);
|
||||
}
|
||||
}
|
||||
@@ -26,8 +26,8 @@ public class ModelCTM implements IModel
|
||||
{
|
||||
private Map<EnumFacing, String> overrides = Maps.newHashMap();
|
||||
|
||||
private transient ChiselTextureCTM faceObj;
|
||||
private transient Map<EnumFacing, ChiselTextureCTM> overridesObj = new EnumMap<>(EnumFacing.class);
|
||||
private transient TextureCTM faceObj;
|
||||
private transient Map<EnumFacing, TextureCTM> overridesObj = new EnumMap<>(EnumFacing.class);
|
||||
|
||||
private transient IBakedModel modelObj;
|
||||
|
||||
@@ -77,12 +77,12 @@ public class ModelCTM implements IModel
|
||||
overridesObj.values().forEach(t -> textures.addAll(t.getTextures()));
|
||||
}
|
||||
|
||||
public ChiselTextureCTM getDefaultFace()
|
||||
public TextureCTM getDefaultFace()
|
||||
{
|
||||
return faceObj;
|
||||
}
|
||||
|
||||
public ChiselTextureCTM getFace(EnumFacing facing)
|
||||
public TextureCTM getFace(EnumFacing facing)
|
||||
{
|
||||
return overridesObj.getOrDefault(facing, faceObj);
|
||||
}
|
||||
|
||||
+2
-2
@@ -13,13 +13,13 @@ import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
|
||||
import net.minecraft.util.EnumWorldBlockLayer;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
public class ChiselTextureCTM
|
||||
public class TextureCTM
|
||||
{
|
||||
protected EnumWorldBlockLayer layer;
|
||||
|
||||
public TextureSpriteCallback[] sprites;
|
||||
|
||||
public ChiselTextureCTM(EnumWorldBlockLayer layer, TextureSpriteCallback[] sprites)
|
||||
public TextureCTM(EnumWorldBlockLayer layer, TextureSpriteCallback[] sprites)
|
||||
{
|
||||
this.layer = layer;
|
||||
this.sprites = sprites;
|
||||
@@ -51,12 +51,15 @@ import net.minecraft.block.Block;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.model.ModelChest;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.WorldRenderer;
|
||||
import net.minecraft.client.renderer.block.model.BakedQuad;
|
||||
import net.minecraft.client.renderer.block.model.ItemCameraTransforms;
|
||||
import net.minecraft.client.renderer.block.model.ItemCameraTransforms.TransformType;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.client.renderer.texture.TextureMap;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
|
||||
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
|
||||
import net.minecraft.client.renderer.vertex.VertexFormat;
|
||||
import net.minecraft.client.resources.model.IBakedModel;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -75,6 +78,8 @@ public class BakedCustomItemModel implements IBakedModel, IPerspectiveAwareModel
|
||||
private IBakedModel baseModel;
|
||||
private ItemStack stack;
|
||||
|
||||
private TransformType prevTransform;
|
||||
|
||||
private Minecraft mc = Minecraft.getMinecraft();
|
||||
|
||||
private static final RenderFluidTank fluidTankRenderer = (RenderFluidTank)TileEntityRendererDispatcher.instance.mapSpecialRenderers.get(TileEntityFluidTank.class);
|
||||
@@ -393,11 +398,33 @@ public class BakedCustomItemModel implements IBakedModel, IPerspectiveAwareModel
|
||||
@Override
|
||||
public List<BakedQuad> getGeneralQuads()
|
||||
{
|
||||
Tessellator tessellator = Tessellator.getInstance();
|
||||
tessellator.draw();
|
||||
|
||||
List<BakedQuad> generalQuads = new LinkedList<BakedQuad>();
|
||||
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.translate(0.5F, 0.5F, 0.5F);
|
||||
doRender(prevTransform);
|
||||
GlStateManager.enableLighting();
|
||||
GlStateManager.enableLight(0);
|
||||
GlStateManager.enableLight(1);
|
||||
GlStateManager.enableColorMaterial();
|
||||
GlStateManager.colorMaterial(1032, 5634);
|
||||
Minecraft.getMinecraft().getTextureManager().bindTexture(TextureMap.locationBlocksTexture);
|
||||
GlStateManager.popMatrix();
|
||||
|
||||
WorldRenderer worldrenderer = tessellator.getWorldRenderer();
|
||||
worldrenderer.begin(7, DefaultVertexFormats.ITEM);
|
||||
|
||||
if(Block.getBlockFromItem(stack.getItem()) != null)
|
||||
{
|
||||
generalQuads.addAll(baseModel.getGeneralQuads());
|
||||
MachineType machineType = MachineType.get(stack);
|
||||
|
||||
if(machineType != MachineType.DIGITAL_MINER)
|
||||
{
|
||||
generalQuads.addAll(baseModel.getGeneralQuads());
|
||||
}
|
||||
}
|
||||
|
||||
return generalQuads;
|
||||
@@ -441,22 +468,13 @@ public class BakedCustomItemModel implements IBakedModel, IPerspectiveAwareModel
|
||||
|
||||
@Override
|
||||
public Pair<? extends IFlexibleBakedModel, Matrix4f> handlePerspective(ItemCameraTransforms.TransformType cameraTransformType)
|
||||
{
|
||||
{
|
||||
prevTransform = cameraTransformType;
|
||||
|
||||
if(cameraTransformType == TransformType.THIRD_PERSON)
|
||||
{
|
||||
ForgeHooksClient.multiplyCurrentGlMatrix(CTMModelFactory.DEFAULT_BLOCK_THIRD_PERSON_MATRIX);
|
||||
}
|
||||
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.scale(0.5F, 0.5F, 0.5F);
|
||||
doRender(cameraTransformType);
|
||||
GlStateManager.scale(2.0F, 2.0F, 2.0F);
|
||||
GlStateManager.enableLighting();
|
||||
GlStateManager.enableLight(0);
|
||||
GlStateManager.enableLight(1);
|
||||
GlStateManager.enableColorMaterial();
|
||||
GlStateManager.colorMaterial(1032, 5634);
|
||||
GlStateManager.popMatrix();
|
||||
|
||||
return Pair.of(this, null);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,335 @@
|
||||
package mekanism.client.render.obj;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.vecmath.Matrix4f;
|
||||
|
||||
import mcmultipart.client.multipart.ISmartMultipartModel;
|
||||
import mekanism.api.EnumColor;
|
||||
import mekanism.client.render.ctm.CTMModelFactory;
|
||||
import mekanism.common.multipart.GlowPanelBlockState;
|
||||
import mekanism.common.multipart.PartGlowPanel;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.renderer.block.model.BakedQuad;
|
||||
import net.minecraft.client.renderer.block.model.ItemCameraTransforms;
|
||||
import net.minecraft.client.renderer.block.model.ItemCameraTransforms.TransformType;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.client.renderer.vertex.VertexFormat;
|
||||
import net.minecraft.client.resources.model.IBakedModel;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.client.model.IFlexibleBakedModel;
|
||||
import net.minecraftforge.client.model.IModelState;
|
||||
import net.minecraftforge.client.model.IPerspectiveAwareModel;
|
||||
import net.minecraftforge.client.model.ModelLoader;
|
||||
import net.minecraftforge.client.model.TRSRTransformation;
|
||||
import net.minecraftforge.client.model.obj.OBJModel;
|
||||
import net.minecraftforge.client.model.obj.OBJModel.Face;
|
||||
import net.minecraftforge.client.model.obj.OBJModel.Group;
|
||||
import net.minecraftforge.client.model.obj.OBJModel.Normal;
|
||||
import net.minecraftforge.client.model.obj.OBJModel.OBJBakedModel;
|
||||
import net.minecraftforge.client.model.obj.OBJModel.OBJState;
|
||||
import net.minecraftforge.client.model.obj.OBJModel.TextureCoordinate;
|
||||
import net.minecraftforge.client.model.obj.OBJModel.Vertex;
|
||||
import net.minecraftforge.client.model.pipeline.LightUtil;
|
||||
import net.minecraftforge.client.model.pipeline.UnpackedBakedQuad;
|
||||
import net.minecraftforge.common.property.IExtendedBlockState;
|
||||
|
||||
import org.apache.commons.lang3.tuple.ImmutablePair;
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
|
||||
import com.google.common.base.Optional;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.common.collect.Lists;
|
||||
|
||||
public class GlowPanelModel extends OBJBakedModel implements ISmartMultipartModel
|
||||
{
|
||||
private IBakedModel baseModel;
|
||||
|
||||
private HashMap<TransformType, Matrix4f> transformationMap = new HashMap<TransformType, Matrix4f>();
|
||||
|
||||
private static Map<Integer, GlowPanelModel> glowPanelCache = new HashMap<Integer, GlowPanelModel>();
|
||||
private static Map<Integer, GlowPanelModel> glowPanelItemCache = new HashMap<Integer, GlowPanelModel>();
|
||||
|
||||
private Set<BakedQuad> bakedQuads;
|
||||
private IBlockState tempState;
|
||||
private TextureAtlasSprite tempSprite;
|
||||
private ItemStack tempStack;
|
||||
|
||||
public GlowPanelModel(IBakedModel base, OBJModel model, IModelState state, VertexFormat format, ImmutableMap<String, TextureAtlasSprite> textures, HashMap<TransformType, Matrix4f> transform)
|
||||
{
|
||||
model.super(model, state, format, textures);
|
||||
baseModel = base;
|
||||
transformationMap = transform;
|
||||
}
|
||||
|
||||
public EnumColor getColor()
|
||||
{
|
||||
if(tempStack != null)
|
||||
{
|
||||
return EnumColor.DYES[tempStack.getItemDamage()];
|
||||
}
|
||||
|
||||
if(tempState != null)
|
||||
{
|
||||
return ((IExtendedBlockState)tempState).getValue(GlowPanelBlockState.colorState).color;
|
||||
}
|
||||
|
||||
return EnumColor.WHITE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public OBJBakedModel handlePartState(IBlockState state)
|
||||
{
|
||||
int hash = PartGlowPanel.hash((IExtendedBlockState)state);
|
||||
EnumColor color = ((IExtendedBlockState)state).getValue(GlowPanelBlockState.colorState).color;
|
||||
|
||||
if(!glowPanelCache.containsKey(hash))
|
||||
{
|
||||
GlowPanelModel model = new GlowPanelModel(baseModel, getModel(), getState(), getFormat(), getTextures(), transformationMap);
|
||||
model.tempState = state;
|
||||
glowPanelCache.put(hash, model);
|
||||
}
|
||||
|
||||
return glowPanelCache.get(hash);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBakedModel handleItemState(ItemStack stack)
|
||||
{
|
||||
if(glowPanelItemCache.containsKey(stack.getItemDamage()))
|
||||
return glowPanelItemCache.get(stack.getItemDamage());
|
||||
|
||||
ImmutableMap.Builder<String, TextureAtlasSprite> builder = ImmutableMap.builder();
|
||||
builder.put(ModelLoader.White.loc.toString(), ModelLoader.White.instance);
|
||||
TextureAtlasSprite missing = Minecraft.getMinecraft().getTextureMapBlocks().getAtlasSprite(new ResourceLocation("missingno").toString());
|
||||
|
||||
for(String s : getModel().getMatLib().getMaterialNames())
|
||||
{
|
||||
TextureAtlasSprite sprite = null;
|
||||
|
||||
if(sprite==null)
|
||||
sprite = Minecraft.getMinecraft().getTextureMapBlocks().getAtlasSprite(getModel().getMatLib().getMaterial(s).getTexture().getTextureLocation().toString());
|
||||
if(sprite==null)
|
||||
sprite = missing;
|
||||
|
||||
builder.put(s, sprite);
|
||||
}
|
||||
|
||||
builder.put("missingno", missing);
|
||||
GlowPanelModel bakedModel = new GlowPanelModel(baseModel, getModel(), getState(), getFormat(), builder.build(), transformationMap);
|
||||
bakedModel.tempStack = stack;
|
||||
glowPanelItemCache.put(stack.getItemDamage(), bakedModel);
|
||||
|
||||
return bakedModel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<BakedQuad> getGeneralQuads()
|
||||
{
|
||||
if(bakedQuads == null)
|
||||
{
|
||||
bakedQuads = Collections.synchronizedSet(new LinkedHashSet<BakedQuad>());
|
||||
Set<Face> faces = Collections.synchronizedSet(new LinkedHashSet<Face>());
|
||||
Optional<TRSRTransformation> transform = Optional.absent();
|
||||
Set<Face> coloredFaces = new HashSet<Face>();
|
||||
|
||||
for(Group g : getModel().getMatLib().getGroups().values())
|
||||
{
|
||||
if(getState() instanceof OBJState)
|
||||
{
|
||||
OBJState state = (OBJState)getState();
|
||||
|
||||
if(state.parent != null)
|
||||
{
|
||||
transform = state.parent.apply(Optional.absent());
|
||||
}
|
||||
|
||||
if(state.getGroupsWithVisibility(true).contains(g.getName()))
|
||||
{
|
||||
LinkedHashSet<Face> tempFaces = g.applyTransform(transform);
|
||||
faces.addAll(tempFaces);
|
||||
|
||||
if(g.getName().equals("light"))
|
||||
{
|
||||
coloredFaces.addAll(tempFaces);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
transform = getState().apply(Optional.absent());
|
||||
LinkedHashSet<Face> tempFaces = g.applyTransform(transform);
|
||||
faces.addAll(tempFaces);
|
||||
|
||||
if(g.getName().equals("light"))
|
||||
{
|
||||
coloredFaces.addAll(tempFaces);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for(Face f : faces)
|
||||
{
|
||||
if(getModel().getMatLib().getMaterial(f.getMaterialName()).isWhite())
|
||||
{
|
||||
for(Vertex v : f.getVertices())
|
||||
{
|
||||
if(!v.getMaterial().equals(this.getModel().getMatLib().getMaterial(v.getMaterial().getName())))
|
||||
{
|
||||
v.setMaterial(this.getModel().getMatLib().getMaterial(v.getMaterial().getName()));
|
||||
}
|
||||
}
|
||||
|
||||
tempSprite = ModelLoader.White.instance;
|
||||
}
|
||||
else {
|
||||
tempSprite = Minecraft.getMinecraft().getTextureMapBlocks().getAtlasSprite(this.getModel().getMatLib().getMaterial(f.getMaterialName()).getTexture().getTextureLocation().toString());
|
||||
}
|
||||
|
||||
float[] color = new float[] { 1, 1, 1, 1 };
|
||||
|
||||
if(coloredFaces.contains(f))
|
||||
{
|
||||
EnumColor c = getColor();
|
||||
color = new float[] {c.getColor(0), c.getColor(1), c.getColor(2), 1};
|
||||
}
|
||||
|
||||
UnpackedBakedQuad.Builder builder = new UnpackedBakedQuad.Builder(getFormat());
|
||||
builder.setQuadOrientation(EnumFacing.getFacingFromVector(f.getNormal().x, f.getNormal().y, f.getNormal().z));
|
||||
builder.setQuadColored();
|
||||
builder.setQuadTint(0);
|
||||
|
||||
Normal faceNormal = f.getNormal();
|
||||
putVertexData(builder, f.getVertices()[0], faceNormal, TextureCoordinate.getDefaultUVs()[0], tempSprite, color);
|
||||
putVertexData(builder, f.getVertices()[1], faceNormal, TextureCoordinate.getDefaultUVs()[1], tempSprite, color);
|
||||
putVertexData(builder, f.getVertices()[2], faceNormal, TextureCoordinate.getDefaultUVs()[2], tempSprite, color);
|
||||
putVertexData(builder, f.getVertices()[3], faceNormal, TextureCoordinate.getDefaultUVs()[3], tempSprite, color);
|
||||
|
||||
bakedQuads.add(builder.build());
|
||||
}
|
||||
}
|
||||
|
||||
List<BakedQuad> quadList = Collections.synchronizedList(Lists.newArrayList(bakedQuads));
|
||||
|
||||
return quadList;
|
||||
}
|
||||
|
||||
private final void putVertexData(UnpackedBakedQuad.Builder builder, Vertex v, Normal faceNormal, TextureCoordinate defUV, TextureAtlasSprite sprite, float[] color)
|
||||
{
|
||||
for(int e = 0; e < getFormat().getElementCount(); e++)
|
||||
{
|
||||
switch(getFormat().getElement(e).getUsage())
|
||||
{
|
||||
case POSITION:
|
||||
builder.put(e, v.getPos().x, v.getPos().y, v.getPos().z, v.getPos().w);
|
||||
break;
|
||||
case COLOR:
|
||||
float d;
|
||||
|
||||
if(v.hasNormal())
|
||||
{
|
||||
d = LightUtil.diffuseLight(v.getNormal().x, v.getNormal().y, v.getNormal().z);
|
||||
}
|
||||
else {
|
||||
d = LightUtil.diffuseLight(faceNormal.x, faceNormal.y, faceNormal.z);
|
||||
}
|
||||
|
||||
if(v.getMaterial() != null)
|
||||
{
|
||||
builder.put(e, d * v.getMaterial().getColor().x * color[0], d * v.getMaterial().getColor().y * color[1], d * v.getMaterial().getColor().z * color[2], v.getMaterial().getColor().w * color[3]);
|
||||
}
|
||||
else {
|
||||
builder.put(e, d, d, d, 1);
|
||||
}
|
||||
|
||||
break;
|
||||
case UV:
|
||||
if(!v.hasTextureCoordinate())
|
||||
{
|
||||
builder.put(e, sprite.getInterpolatedU(defUV.u * 16), sprite.getInterpolatedV((1 - defUV.v) * 16), 0, 1);
|
||||
}
|
||||
else {
|
||||
builder.put(e, sprite.getInterpolatedU(v.getTextureCoordinate().u * 16), sprite.getInterpolatedV((1 - v.getTextureCoordinate().v) * 16), 0, 1);
|
||||
}
|
||||
|
||||
break;
|
||||
case NORMAL:
|
||||
if(!v.hasNormal())
|
||||
{
|
||||
builder.put(e, faceNormal.x, faceNormal.y, faceNormal.z, 0);
|
||||
}
|
||||
else {
|
||||
builder.put(e, v.getNormal().x, v.getNormal().y, v.getNormal().z, 0);
|
||||
}
|
||||
|
||||
break;
|
||||
default:
|
||||
builder.put(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static Field f_textures;
|
||||
|
||||
public static ImmutableMap<String, TextureAtlasSprite> getTexturesForOBJModel(IBakedModel model)
|
||||
{
|
||||
try {
|
||||
if(f_textures == null)
|
||||
{
|
||||
f_textures = OBJBakedModel.class.getDeclaredField("textures");
|
||||
f_textures.setAccessible(true);
|
||||
}
|
||||
|
||||
return (ImmutableMap<String, TextureAtlasSprite>)f_textures.get(model);
|
||||
} catch(Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public ImmutableMap<String, TextureAtlasSprite> getTextures()
|
||||
{
|
||||
return getTexturesForOBJModel(this);
|
||||
}
|
||||
|
||||
private Pair<IPerspectiveAwareModel, Matrix4f> thirdPersonTransform;
|
||||
|
||||
@Override
|
||||
public Pair<? extends IFlexibleBakedModel, Matrix4f> handlePerspective(ItemCameraTransforms.TransformType cameraTransformType)
|
||||
{
|
||||
if(cameraTransformType == TransformType.GUI)
|
||||
{
|
||||
GlStateManager.translate(0.3F, 0.25F, 0.0F);
|
||||
GlStateManager.rotate(90, 1, 0, 0);
|
||||
GlStateManager.scale(1.6F, 1.6F, 1.6F);
|
||||
}
|
||||
else if(cameraTransformType == TransformType.FIRST_PERSON)
|
||||
{
|
||||
GlStateManager.translate(0.0F, 0.3F, 0.0F);
|
||||
}
|
||||
else if(cameraTransformType == TransformType.THIRD_PERSON)
|
||||
{
|
||||
GlStateManager.translate(0.0F, -0.1F, 0.0F);
|
||||
|
||||
if(thirdPersonTransform == null)
|
||||
{
|
||||
thirdPersonTransform = ImmutablePair.of(this, CTMModelFactory.DEFAULT_BLOCK_THIRD_PERSON_MATRIX);
|
||||
}
|
||||
|
||||
return thirdPersonTransform;
|
||||
}
|
||||
|
||||
return Pair.of(this, null);
|
||||
}
|
||||
}
|
||||
@@ -4,16 +4,96 @@ import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.vecmath.Matrix4f;
|
||||
|
||||
import mekanism.client.render.obj.MekanismOBJModel.OBJModelType;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.block.model.ItemCameraTransforms.TransformType;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
|
||||
import net.minecraft.client.renderer.vertex.VertexFormat;
|
||||
import net.minecraft.client.resources.model.IBakedModel;
|
||||
import net.minecraft.client.resources.model.ModelResourceLocation;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.client.event.ModelBakeEvent;
|
||||
import net.minecraftforge.client.model.IModel;
|
||||
import net.minecraftforge.client.model.IModelState;
|
||||
import net.minecraftforge.client.model.ModelLoader;
|
||||
import net.minecraftforge.client.model.ModelLoaderRegistry;
|
||||
import net.minecraftforge.client.model.obj.OBJLoader;
|
||||
import net.minecraftforge.client.model.obj.OBJModel;
|
||||
import net.minecraftforge.client.model.obj.OBJModel.OBJBakedModel;
|
||||
import net.minecraftforge.fml.common.FMLLog;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
|
||||
import com.google.common.base.Function;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.common.collect.Lists;
|
||||
|
||||
public class MekanismOBJLoader extends OBJLoader
|
||||
{
|
||||
public static final MekanismOBJLoader INSTANCE = new MekanismOBJLoader();
|
||||
|
||||
private final Map<ResourceLocation, MekanismOBJModel> modelCache = new HashMap<ResourceLocation, MekanismOBJModel>();
|
||||
|
||||
private static final ImmutableMap<String, String> flipData = ImmutableMap.of("flip-v", String.valueOf(true));
|
||||
|
||||
public static final String[] OBJ_RENDERS = new String[] {"glow_panel"};
|
||||
|
||||
@SubscribeEvent
|
||||
public void onModelBake(ModelBakeEvent event) throws IOException
|
||||
{
|
||||
for(String s : OBJ_RENDERS)
|
||||
{
|
||||
ModelResourceLocation model = new ModelResourceLocation("mekanism:" + s, "inventory");
|
||||
Object obj = event.modelRegistry.getObject(model);
|
||||
|
||||
if(obj instanceof IBakedModel)
|
||||
{
|
||||
event.modelRegistry.putObject(model, createBakedObjItemModel((IBakedModel)obj, "mekanism:models/block/" + s + ".obj.mek", new OBJModel.OBJState(Lists.newArrayList(OBJModel.Group.ALL), true), DefaultVertexFormats.ITEM));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public OBJBakedModel createBakedObjItemModel(IBakedModel existingModel, String name, IModelState state, VertexFormat format)
|
||||
{
|
||||
try {
|
||||
Function<ResourceLocation, TextureAtlasSprite> textureGetter = new Function<ResourceLocation, TextureAtlasSprite>() {
|
||||
public TextureAtlasSprite apply(ResourceLocation location)
|
||||
{
|
||||
return Minecraft.getMinecraft().getTextureMapBlocks().getAtlasSprite(location.toString());
|
||||
}
|
||||
};
|
||||
|
||||
ResourceLocation modelLocation = new ResourceLocation(name);
|
||||
OBJModel objModel = (OBJModel)OBJLoader.instance.loadModel(modelLocation);
|
||||
objModel = (OBJModel)objModel.process(flipData);
|
||||
ImmutableMap.Builder<String, TextureAtlasSprite> builder = ImmutableMap.builder();
|
||||
builder.put(ModelLoader.White.loc.toString(), ModelLoader.White.instance);
|
||||
TextureAtlasSprite missing = textureGetter.apply(new ResourceLocation("missingno"));
|
||||
|
||||
for(String s : objModel.getMatLib().getMaterialNames())
|
||||
{
|
||||
if(objModel.getMatLib().getMaterial(s).getTexture().getTextureLocation().getResourcePath().startsWith("#"))
|
||||
{
|
||||
FMLLog.severe("OBJLoader: Unresolved texture '%s' for obj model '%s'", objModel.getMatLib().getMaterial(s).getTexture().getTextureLocation().getResourcePath(), modelLocation);
|
||||
builder.put(s, missing);
|
||||
}
|
||||
else {
|
||||
builder.put(s, textureGetter.apply(objModel.getMatLib().getMaterial(s).getTexture().getTextureLocation()));
|
||||
}
|
||||
}
|
||||
|
||||
builder.put("missingno", missing);
|
||||
|
||||
return new GlowPanelModel(existingModel, objModel, state, format, builder.build(), new HashMap<TransformType, Matrix4f>());
|
||||
} catch(Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean accepts(ResourceLocation modelLocation)
|
||||
{
|
||||
@@ -29,8 +109,11 @@ public class MekanismOBJLoader extends OBJLoader
|
||||
|
||||
if(model instanceof OBJModel)
|
||||
{
|
||||
MekanismOBJModel mekModel = new MekanismOBJModel(((OBJModel)model).getMatLib(), loc);
|
||||
modelCache.put(loc, mekModel);
|
||||
if(loc.getResourcePath().contains("glow_panel"))
|
||||
{
|
||||
MekanismOBJModel mekModel = new MekanismOBJModel(OBJModelType.GLOW_PANEL, ((OBJModel)model).getMatLib(), loc);
|
||||
modelCache.put(loc, mekModel);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -11,15 +11,30 @@ import com.google.common.base.Function;
|
||||
|
||||
public class MekanismOBJModel extends OBJModel
|
||||
{
|
||||
public MekanismOBJModel(MaterialLibrary matLib, ResourceLocation modelLocation)
|
||||
public OBJModelType modelType;
|
||||
|
||||
public MekanismOBJModel(OBJModelType type, MaterialLibrary matLib, ResourceLocation modelLocation)
|
||||
{
|
||||
super(matLib, modelLocation);
|
||||
|
||||
modelType = type;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IFlexibleBakedModel bake(IModelState state, VertexFormat format, Function<ResourceLocation, TextureAtlasSprite> bakedTextureGetter)
|
||||
{
|
||||
IFlexibleBakedModel preBaked = super.bake(state, format, bakedTextureGetter);
|
||||
return new MekanismSmartOBJModel(preBaked, this, state, format, MekanismSmartOBJModel.getTexturesForOBJModel(preBaked), null);
|
||||
|
||||
if(modelType == OBJModelType.GLOW_PANEL)
|
||||
{
|
||||
return new GlowPanelModel(preBaked, this, state, format, GlowPanelModel.getTexturesForOBJModel(preBaked), null);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static enum OBJModelType
|
||||
{
|
||||
GLOW_PANEL
|
||||
}
|
||||
}
|
||||
@@ -1,96 +0,0 @@
|
||||
package mekanism.client.render.obj;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import mekanism.api.EnumColor;
|
||||
import mekanism.common.multipart.GlowPanelBlockState;
|
||||
import mekanism.common.multipart.PartGlowPanel;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.renderer.block.model.BakedQuad;
|
||||
import net.minecraft.client.renderer.block.model.ItemCameraTransforms.TransformType;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.client.renderer.vertex.VertexFormat;
|
||||
import net.minecraft.client.resources.model.IBakedModel;
|
||||
import net.minecraftforge.client.model.IModelState;
|
||||
import net.minecraftforge.client.model.obj.OBJModel;
|
||||
import net.minecraftforge.client.model.obj.OBJModel.Group;
|
||||
import net.minecraftforge.client.model.obj.OBJModel.OBJBakedModel;
|
||||
import codechicken.lib.vec.Matrix4;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
|
||||
public class MekanismSmartOBJModel extends OBJBakedModel
|
||||
{
|
||||
private IBakedModel baseModel;
|
||||
|
||||
private HashMap<TransformType, Matrix4> transformationMap = new HashMap<TransformType, Matrix4>();
|
||||
|
||||
private static Map<EnumColor, MekanismSmartOBJModel> glowPanelCache = new HashMap<EnumColor, MekanismSmartOBJModel>();
|
||||
|
||||
private IBlockState tempState;
|
||||
|
||||
public MekanismSmartOBJModel(IBakedModel base, OBJModel model, IModelState state, VertexFormat format, ImmutableMap<String, TextureAtlasSprite> textures, HashMap<TransformType, Matrix4> transform)
|
||||
{
|
||||
model.super(model, state, format, textures);
|
||||
baseModel = base;
|
||||
transformationMap = transform;
|
||||
}
|
||||
|
||||
@Override
|
||||
public OBJBakedModel handleBlockState(IBlockState state)
|
||||
{
|
||||
if(state instanceof GlowPanelBlockState)
|
||||
{
|
||||
EnumColor color = state.getValue(PartGlowPanel.colorProperty);
|
||||
|
||||
if(!glowPanelCache.containsKey(color))
|
||||
{
|
||||
MekanismSmartOBJModel model = new MekanismSmartOBJModel(baseModel, getModel(), getState(), getFormat(), getTextures(), transformationMap);
|
||||
model.tempState = state;
|
||||
glowPanelCache.put(color, model);
|
||||
}
|
||||
|
||||
return glowPanelCache.get(color);
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<BakedQuad> getGeneralQuads()
|
||||
{
|
||||
for(Map.Entry<String, Group> g : getModel().getMatLib().getGroups().entrySet())
|
||||
{
|
||||
System.out.println("BAKED " + g.getKey() + " " + g.getValue().getName() + " " + g.getValue().getFaces());
|
||||
}
|
||||
|
||||
return super.getGeneralQuads();
|
||||
}
|
||||
|
||||
private static Field f_textures;
|
||||
|
||||
public static ImmutableMap<String, TextureAtlasSprite> getTexturesForOBJModel(IBakedModel model)
|
||||
{
|
||||
try {
|
||||
if(f_textures == null)
|
||||
{
|
||||
f_textures = OBJBakedModel.class.getDeclaredField("textures");
|
||||
f_textures.setAccessible(true);
|
||||
}
|
||||
|
||||
return (ImmutableMap<String, TextureAtlasSprite>)f_textures.get(model);
|
||||
} catch(Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public ImmutableMap<String, TextureAtlasSprite> getTextures()
|
||||
{
|
||||
return getTexturesForOBJModel(this);
|
||||
}
|
||||
}
|
||||
@@ -1,39 +0,0 @@
|
||||
package mekanism.client.render.tileentity;
|
||||
|
||||
import mekanism.client.model.ModelElectricPump;
|
||||
import mekanism.common.tile.TileEntityElectricPump;
|
||||
import mekanism.common.util.MekanismUtils;
|
||||
import mekanism.common.util.MekanismUtils.ResourceType;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class RenderElectricPump extends TileEntitySpecialRenderer<TileEntityElectricPump>
|
||||
{
|
||||
private ModelElectricPump model = new ModelElectricPump();
|
||||
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntityElectricPump tileEntity, double x, double y, double z, float partialTick, int destroyStage)
|
||||
{
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.translate((float)x + 0.5F, (float)y + 1.5F, (float)z + 1.5F);
|
||||
|
||||
bindTexture(MekanismUtils.getResource(ResourceType.RENDER, "ElectricPump.png"));
|
||||
|
||||
switch(tileEntity.facing.ordinal()) /*TODO: switch the enum*/
|
||||
{
|
||||
case 2: GlStateManager.rotate(180, 0.0F, 1.0F, 0.0F); break;
|
||||
case 3: GlStateManager.rotate(0, 0.0F, 1.0F, 0.0F); break;
|
||||
case 4: GlStateManager.rotate(270, 0.0F, 1.0F, 0.0F); break;
|
||||
case 5: GlStateManager.rotate(90, 0.0F, 1.0F, 0.0F); break;
|
||||
}
|
||||
|
||||
GlStateManager.rotate(180F, 0.0F, 0.0F, 1.0F);
|
||||
model.render(0.0625F);
|
||||
GlStateManager.popMatrix();
|
||||
}
|
||||
}
|
||||
@@ -1,39 +0,0 @@
|
||||
package mekanism.client.render.tileentity;
|
||||
|
||||
import mekanism.client.model.ModelFluidicPlenisher;
|
||||
import mekanism.common.tile.TileEntityFluidicPlenisher;
|
||||
import mekanism.common.util.MekanismUtils;
|
||||
import mekanism.common.util.MekanismUtils.ResourceType;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class RenderFluidicPlenisher extends TileEntitySpecialRenderer<TileEntityFluidicPlenisher>
|
||||
{
|
||||
private ModelFluidicPlenisher model = new ModelFluidicPlenisher();
|
||||
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntityFluidicPlenisher tileEntity, double x, double y, double z, float partialTick, int destroyStage)
|
||||
{
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.translate((float)x + 0.5F, (float)y + 1.5F, (float)z + 1.5F);
|
||||
|
||||
bindTexture(MekanismUtils.getResource(ResourceType.RENDER, "FluidicPlenisher.png"));
|
||||
|
||||
switch(tileEntity.facing.ordinal()) /*TODO: switch the enum*/
|
||||
{
|
||||
case 2: GlStateManager.rotate(0, 0.0F, 1.0F, 0.0F); break;
|
||||
case 3: GlStateManager.rotate(180, 0.0F, 1.0F, 0.0F); break;
|
||||
case 4: GlStateManager.rotate(90, 0.0F, 1.0F, 0.0F); break;
|
||||
case 5: GlStateManager.rotate(270, 0.0F, 1.0F, 0.0F); break;
|
||||
}
|
||||
|
||||
GlStateManager.rotate(180F, 0.0F, 0.0F, 1.0F);
|
||||
model.render(0.0625F);
|
||||
GlStateManager.popMatrix();
|
||||
}
|
||||
}
|
||||
@@ -63,7 +63,6 @@ import mekanism.common.item.ItemPortableTeleporter;
|
||||
import mekanism.common.network.PacketPortableTeleporter.PortableTeleporterMessage;
|
||||
import mekanism.common.tile.TileEntityAdvancedElectricMachine;
|
||||
import mekanism.common.tile.TileEntityAdvancedFactory;
|
||||
import mekanism.common.tile.TileEntityAmbientAccumulator;
|
||||
import mekanism.common.tile.TileEntityBin;
|
||||
import mekanism.common.tile.TileEntityBoilerCasing;
|
||||
import mekanism.common.tile.TileEntityBoilerValve;
|
||||
@@ -95,9 +94,6 @@ import mekanism.common.tile.TileEntityFormulaicAssemblicator;
|
||||
import mekanism.common.tile.TileEntityFuelwoodHeater;
|
||||
import mekanism.common.tile.TileEntityGasTank;
|
||||
import mekanism.common.tile.TileEntityInductionCasing;
|
||||
import mekanism.common.tile.TileEntityInductionCell;
|
||||
import mekanism.common.tile.TileEntityInductionPort;
|
||||
import mekanism.common.tile.TileEntityInductionProvider;
|
||||
import mekanism.common.tile.TileEntityLaserAmplifier;
|
||||
import mekanism.common.tile.TileEntityLaserTractorBeam;
|
||||
import mekanism.common.tile.TileEntityLogisticalSorter;
|
||||
@@ -115,7 +111,6 @@ import mekanism.common.tile.TileEntityRotaryCondensentrator;
|
||||
import mekanism.common.tile.TileEntitySecurityDesk;
|
||||
import mekanism.common.tile.TileEntitySeismicVibrator;
|
||||
import mekanism.common.tile.TileEntitySolarNeutronActivator;
|
||||
import mekanism.common.tile.TileEntityStructuralGlass;
|
||||
import mekanism.common.tile.TileEntityTeleporter;
|
||||
import mekanism.common.tile.TileEntityThermalEvaporationController;
|
||||
import net.minecraft.block.Block;
|
||||
@@ -164,7 +159,6 @@ public class CommonProxy implements IGuiProvider
|
||||
GameRegistry.registerTileEntity(TileEntityMetallurgicInfuser.class, "MetallurgicInfuser");
|
||||
GameRegistry.registerTileEntity(TileEntityGasTank.class, "GasTank");
|
||||
GameRegistry.registerTileEntity(TileEntityEnergyCube.class, "EnergyCube");
|
||||
GameRegistry.registerTileEntity(TileEntityElectricPump.class, "ElectricPump");
|
||||
GameRegistry.registerTileEntity(TileEntityPersonalChest.class, "PersonalChest");
|
||||
GameRegistry.registerTileEntity(TileEntityDynamicTank.class, "DynamicTank");
|
||||
GameRegistry.registerTileEntity(TileEntityDynamicValve.class, "DynamicValve");
|
||||
@@ -182,7 +176,6 @@ public class CommonProxy implements IGuiProvider
|
||||
GameRegistry.registerTileEntity(TileEntitySeismicVibrator.class, "SeismicVibrator");
|
||||
GameRegistry.registerTileEntity(TileEntityPRC.class, "PressurizedReactionChamber");
|
||||
GameRegistry.registerTileEntity(TileEntityFluidTank.class, "FluidTank");
|
||||
GameRegistry.registerTileEntity(TileEntityFluidicPlenisher.class, "FluidicPlenisher");
|
||||
GameRegistry.registerTileEntity(TileEntitySolarNeutronActivator.class, "SolarNeutronActivator");
|
||||
GameRegistry.registerTileEntity(TileEntityFormulaicAssemblicator.class, "FormulaicAssemblicator");
|
||||
GameRegistry.registerTileEntity(TileEntityResistiveHeater.class, "ResistiveHeater");
|
||||
|
||||
@@ -84,7 +84,9 @@ import mekanism.common.tile.TileEntityChemicalInfuser;
|
||||
import mekanism.common.tile.TileEntityChemicalOxidizer;
|
||||
import mekanism.common.tile.TileEntityChemicalWasher;
|
||||
import mekanism.common.tile.TileEntityElectricBlock;
|
||||
import mekanism.common.tile.TileEntityElectricPump;
|
||||
import mekanism.common.tile.TileEntityElectrolyticSeparator;
|
||||
import mekanism.common.tile.TileEntityFluidicPlenisher;
|
||||
import mekanism.common.tile.TileEntityFuelwoodHeater;
|
||||
import mekanism.common.tile.TileEntityInductionCasing;
|
||||
import mekanism.common.tile.TileEntityInductionCell;
|
||||
@@ -159,7 +161,7 @@ import com.mojang.authlib.GameProfile;
|
||||
*
|
||||
*/
|
||||
@Mod(modid = "Mekanism", name = "Mekanism", version = "9.0.0", guiFactory = "mekanism.client.gui.ConfigGuiFactory",
|
||||
dependencies = "after:ForgeMultipart;after:BuildCraft;after:BuildCraftAPI;after:IC2;after:CoFHCore;" +
|
||||
dependencies = "after:JEI;after:BuildCraft;after:BuildCraftAPI;after:IC2;after:CoFHCore;" +
|
||||
"after:ComputerCraft;after:Galacticraft API;after:MetallurgyCore")
|
||||
public class Mekanism
|
||||
{
|
||||
@@ -757,11 +759,9 @@ public class Mekanism
|
||||
CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(new ItemStack(MekanismBlocks.PlasticBlock, 4, i),
|
||||
"SSS", "SDS", "SSS", Character.valueOf('S'), new ItemStack(MekanismItems.Polyethene, 1, 2), Character.valueOf('D'), "dye" + EnumColor.DYES[i].dyeName
|
||||
));
|
||||
/*
|
||||
CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(new ItemStack(MekanismItems.GlowPanel, 2, i),
|
||||
"PSP", "SDS", "GSG", Character.valueOf('P'), "paneGlass", Character.valueOf('S'), new ItemStack(MekanismItems.Polyethene, 1, 2), Character.valueOf('D'), "dye" + EnumColor.DYES[i].dyeName, Character.valueOf('G'), Items.glowstone_dust
|
||||
));
|
||||
*/
|
||||
}
|
||||
|
||||
for(int i = 0; i < EnumColor.DYES.length; i++)
|
||||
@@ -788,11 +788,9 @@ public class Mekanism
|
||||
CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(new ItemStack(MekanismBlocks.ReinforcedPlasticBlock, 4, i),
|
||||
" P ", "PDP", " P ", Character.valueOf('P'), new ItemStack(MekanismBlocks.ReinforcedPlasticBlock, 1, j), Character.valueOf('D'), "dye" + EnumColor.DYES[i].dyeName
|
||||
));
|
||||
/*
|
||||
CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(new ItemStack(MekanismItems.GlowPanel, 4, i),
|
||||
" P ", "PDP", " P ", Character.valueOf('P'), new ItemStack(MekanismItems.GlowPanel, 1, j), Character.valueOf('D'), "dye" + EnumColor.DYES[i].dyeName
|
||||
));
|
||||
*/
|
||||
}
|
||||
|
||||
CraftingManager.getInstance().getRecipeList().add(new ShapelessMekanismRecipe(new ItemStack(MekanismBlocks.GlowPlasticBlock, 3, i),
|
||||
@@ -1202,6 +1200,8 @@ public class Mekanism
|
||||
GameRegistry.registerTileEntity(TileEntityChemicalOxidizer.class, "ChemicalOxidizer");
|
||||
GameRegistry.registerTileEntity(TileEntityChemicalInfuser.class, "ChemicalInfuser");
|
||||
GameRegistry.registerTileEntity(TileEntityRotaryCondensentrator.class, "RotaryCondensentrator");
|
||||
GameRegistry.registerTileEntity(TileEntityElectricPump.class, "ElectricPump");
|
||||
GameRegistry.registerTileEntity(TileEntityFluidicPlenisher.class, "FluidicPlenisher");
|
||||
|
||||
//Load tile entities that have special renderers.
|
||||
proxy.registerSpecialTileEntities();
|
||||
|
||||
@@ -5,7 +5,7 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import mekanism.api.util.ItemInfo;
|
||||
import mekanism.common.util.MekanismUtils;
|
||||
import mekanism.common.util.ItemRegistryUtils;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
@@ -122,7 +122,7 @@ public final class OreDictCache
|
||||
for(ItemStack stack : OreDictionary.getOres(key))
|
||||
{
|
||||
ItemStack toAdd = stack.copy();
|
||||
String s = MekanismUtils.getMod(toAdd);
|
||||
String s = ItemRegistryUtils.getMod(toAdd);
|
||||
|
||||
if(!stacks.contains(stack) && toAdd.getItem() instanceof ItemBlock)
|
||||
{
|
||||
|
||||
@@ -46,6 +46,7 @@ import mekanism.common.tile.TileEntityLaserAmplifier;
|
||||
import mekanism.common.tile.TileEntityLogisticalSorter;
|
||||
import mekanism.common.tile.TileEntityMetallurgicInfuser;
|
||||
import mekanism.common.tile.TileEntityPersonalChest;
|
||||
import mekanism.common.util.ItemDataUtils;
|
||||
import mekanism.common.util.MekanismUtils;
|
||||
import mekanism.common.util.SecurityUtils;
|
||||
import net.minecraft.block.Block;
|
||||
@@ -864,14 +865,15 @@ public abstract class BlockMachine extends BlockContainer implements ICTMBlock
|
||||
|
||||
if(tileEntity instanceof IUpgradeTile)
|
||||
{
|
||||
((IUpgradeTile)tileEntity).getComponent().write(itemStack.getTagCompound());
|
||||
((IUpgradeTile)tileEntity).getComponent().write(ItemDataUtils.getDataMap(itemStack));
|
||||
}
|
||||
|
||||
if(tileEntity instanceof ISideConfiguration)
|
||||
{
|
||||
ISideConfiguration config = (ISideConfiguration)tileEntity;
|
||||
|
||||
config.getConfig().write(itemStack.getTagCompound());
|
||||
config.getConfig().write(ItemDataUtils.getDataMap(itemStack));
|
||||
config.getEjector().write(ItemDataUtils.getDataMap(itemStack));
|
||||
}
|
||||
|
||||
if(tileEntity instanceof ISustainedData)
|
||||
@@ -882,7 +884,7 @@ public abstract class BlockMachine extends BlockContainer implements ICTMBlock
|
||||
if(tileEntity instanceof IRedstoneControl)
|
||||
{
|
||||
IRedstoneControl control = (IRedstoneControl)tileEntity;
|
||||
itemStack.getTagCompound().setInteger("controlType", control.getControlType().ordinal());
|
||||
ItemDataUtils.setInt(itemStack, "controlType", control.getControlType().ordinal());
|
||||
}
|
||||
|
||||
if(tileEntity instanceof IStrictEnergyStorage)
|
||||
|
||||
@@ -259,20 +259,19 @@ public class BlockStateBasic extends ExtendedBlockState
|
||||
{
|
||||
EnumFacing facing = state.getValue(BlockStateFacing.facingProperty);
|
||||
|
||||
if(type.canRotateTo(facing))
|
||||
if(!type.canRotateTo(facing))
|
||||
{
|
||||
if(builder.length() > 0)
|
||||
{
|
||||
builder.append(",");
|
||||
}
|
||||
|
||||
builder.append(BlockStateFacing.facingProperty.getName());
|
||||
builder.append("=");
|
||||
builder.append(facing.getName());
|
||||
facing = EnumFacing.NORTH;
|
||||
}
|
||||
else {
|
||||
return new ModelResourceLocation("builtin/missing", "missing");
|
||||
|
||||
if(builder.length() > 0)
|
||||
{
|
||||
builder.append(",");
|
||||
}
|
||||
|
||||
builder.append(BlockStateFacing.facingProperty.getName());
|
||||
builder.append("=");
|
||||
builder.append(facing.getName());
|
||||
}
|
||||
|
||||
if(type.tiers)
|
||||
|
||||
@@ -433,20 +433,19 @@ public class BlockStateMachine extends ExtendedBlockState
|
||||
{
|
||||
EnumFacing facing = state.getValue(BlockStateFacing.facingProperty);
|
||||
|
||||
if(type.canRotateTo(facing))
|
||||
if(!type.canRotateTo(facing))
|
||||
{
|
||||
if(builder.length() > 0)
|
||||
{
|
||||
builder.append(",");
|
||||
}
|
||||
|
||||
builder.append(BlockStateFacing.facingProperty.getName());
|
||||
builder.append("=");
|
||||
builder.append(facing.getName());
|
||||
facing = EnumFacing.NORTH;
|
||||
}
|
||||
else {
|
||||
return new ModelResourceLocation("builtin/missing", "missing");
|
||||
|
||||
if(builder.length() > 0)
|
||||
{
|
||||
builder.append(",");
|
||||
}
|
||||
|
||||
builder.append(BlockStateFacing.facingProperty.getName());
|
||||
builder.append("=");
|
||||
builder.append(facing.getName());
|
||||
}
|
||||
|
||||
if(type == MachineType.BASIC_FACTORY || type == MachineType.ADVANCED_FACTORY || type == MachineType.ELITE_FACTORY)
|
||||
|
||||
@@ -3,6 +3,7 @@ package mekanism.common.content.transporter;
|
||||
import java.util.List;
|
||||
|
||||
import mekanism.api.util.StackUtils;
|
||||
import mekanism.common.util.ItemRegistryUtils;
|
||||
import mekanism.common.util.MekanismUtils;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
@@ -128,7 +129,7 @@ public abstract class Finder
|
||||
return false;
|
||||
}
|
||||
|
||||
String id = MekanismUtils.getMod(stack);
|
||||
String id = ItemRegistryUtils.getMod(stack);
|
||||
|
||||
if(modID.equals(id) || modID.equals("*"))
|
||||
{
|
||||
|
||||
@@ -4,6 +4,7 @@ import mekanism.api.util.StackUtils;
|
||||
import mekanism.common.Tier.BinTier;
|
||||
import mekanism.common.base.ITierItem;
|
||||
import mekanism.common.block.states.BlockStateBasic.BasicBlockType;
|
||||
import mekanism.common.util.ItemDataUtils;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
@@ -101,22 +102,12 @@ public class InventoryBin
|
||||
|
||||
public int getItemCount()
|
||||
{
|
||||
if(bin.getTagCompound() == null)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
return bin.getTagCompound().getInteger("itemCount");
|
||||
return ItemDataUtils.getInt(bin, "itemCount");
|
||||
}
|
||||
|
||||
public void setItemCount(int count)
|
||||
{
|
||||
if(bin.getTagCompound() == null)
|
||||
{
|
||||
bin.setTagCompound(new NBTTagCompound());
|
||||
}
|
||||
|
||||
bin.getTagCompound().setInteger("itemCount", Math.max(0, count));
|
||||
ItemDataUtils.setInt(bin, "itemCount", Math.max(0, count));
|
||||
|
||||
if(getItemCount() == 0)
|
||||
{
|
||||
@@ -126,29 +117,22 @@ public class InventoryBin
|
||||
|
||||
public ItemStack getItemType()
|
||||
{
|
||||
if(bin.getTagCompound() == null || getItemCount() == 0)
|
||||
if(getItemCount() == 0)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return ItemStack.loadItemStackFromNBT(bin.getTagCompound().getCompoundTag("storedItem"));
|
||||
return ItemStack.loadItemStackFromNBT(ItemDataUtils.getCompound(bin, "storedItem"));
|
||||
}
|
||||
|
||||
public void setItemType(ItemStack stack)
|
||||
{
|
||||
if(bin.getTagCompound() == null)
|
||||
{
|
||||
bin.setTagCompound(new NBTTagCompound());
|
||||
}
|
||||
|
||||
if(stack == null)
|
||||
{
|
||||
bin.getTagCompound().removeTag("storedItem");
|
||||
ItemDataUtils.removeData(bin, "storedItem");
|
||||
return;
|
||||
}
|
||||
|
||||
ItemStack ret = StackUtils.size(stack, 1);
|
||||
|
||||
bin.getTagCompound().setTag("storedItem", StackUtils.size(stack, 1).writeToNBT(new NBTTagCompound()));
|
||||
ItemDataUtils.setCompound(bin, "storedItem", StackUtils.size(stack, 1).writeToNBT(new NBTTagCompound()));
|
||||
}
|
||||
}
|
||||
@@ -10,6 +10,7 @@ import mekanism.api.Coord4D;
|
||||
import mekanism.api.EnumColor;
|
||||
import mekanism.api.MekanismConfig.general;
|
||||
import mekanism.api.util.ListUtils;
|
||||
import mekanism.common.util.ItemDataUtils;
|
||||
import mekanism.common.util.LangUtils;
|
||||
import mekanism.common.util.MekanismUtils;
|
||||
import net.minecraft.block.Block;
|
||||
@@ -18,7 +19,6 @@ import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.ChatComponentText;
|
||||
import net.minecraft.util.DamageSource;
|
||||
@@ -276,12 +276,7 @@ public class ItemAtomicDisassembler extends ItemEnergized
|
||||
|
||||
public int getMode(ItemStack itemStack)
|
||||
{
|
||||
if(itemStack.getTagCompound() == null)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
return itemStack.getTagCompound().getInteger("mode");
|
||||
return ItemDataUtils.getInt(itemStack, "mode");
|
||||
}
|
||||
|
||||
public String getModeName(ItemStack itemStack)
|
||||
@@ -307,12 +302,7 @@ public class ItemAtomicDisassembler extends ItemEnergized
|
||||
|
||||
public void toggleMode(ItemStack itemStack)
|
||||
{
|
||||
if(itemStack.getTagCompound() == null)
|
||||
{
|
||||
itemStack.setTagCompound(new NBTTagCompound());
|
||||
}
|
||||
|
||||
itemStack.getTagCompound().setInteger("mode", getMode(itemStack) < 4 ? getMode(itemStack)+1 : 0);
|
||||
ItemDataUtils.setInt(itemStack, "mode", getMode(itemStack) < 4 ? getMode(itemStack)+1 : 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -24,6 +24,7 @@ import mekanism.common.tile.TileEntityBin;
|
||||
import mekanism.common.tile.TileEntityInductionCell;
|
||||
import mekanism.common.tile.TileEntityInductionProvider;
|
||||
import mekanism.common.tile.TileEntityMultiblock;
|
||||
import mekanism.common.util.ItemDataUtils;
|
||||
import mekanism.common.util.LangUtils;
|
||||
import mekanism.common.util.MekanismUtils;
|
||||
import net.minecraft.block.Block;
|
||||
@@ -189,7 +190,7 @@ public class ItemBlockBasic extends ItemBlock implements IEnergizedItem, ITierIt
|
||||
@Override
|
||||
public boolean hasContainerItem(ItemStack stack)
|
||||
{
|
||||
return BasicBlockType.get(stack) == BasicBlockType.BIN && stack.getTagCompound() != null && stack.getTagCompound().hasKey("newCount");
|
||||
return BasicBlockType.get(stack) == BasicBlockType.BIN && ItemDataUtils.hasData(stack, "newCount");
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -197,16 +198,16 @@ public class ItemBlockBasic extends ItemBlock implements IEnergizedItem, ITierIt
|
||||
{
|
||||
if(BasicBlockType.get(stack) == BasicBlockType.BIN)
|
||||
{
|
||||
if(stack.getTagCompound() == null || !stack.getTagCompound().hasKey("newCount"))
|
||||
if(!ItemDataUtils.hasData(stack, "newCount"))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
int newCount = stack.getTagCompound().getInteger("newCount");
|
||||
stack.getTagCompound().removeTag("newCount");
|
||||
int newCount = ItemDataUtils.getInt(stack, "newCount");
|
||||
ItemDataUtils.removeData(stack, "newCount");
|
||||
|
||||
ItemStack ret = stack.copy();
|
||||
ret.getTagCompound().setInteger("itemCount", newCount);
|
||||
ItemDataUtils.setInt(ret, "itemCount", newCount);
|
||||
|
||||
return ret;
|
||||
}
|
||||
@@ -302,12 +303,7 @@ public class ItemBlockBasic extends ItemBlock implements IEnergizedItem, ITierIt
|
||||
{
|
||||
if(BasicBlockType.get(itemStack) == BasicBlockType.INDUCTION_CELL)
|
||||
{
|
||||
if(itemStack.getTagCompound() == null)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
return itemStack.getTagCompound().getDouble("energyStored");
|
||||
return ItemDataUtils.getDouble(itemStack, "energyStored");
|
||||
}
|
||||
|
||||
return 0;
|
||||
@@ -318,12 +314,7 @@ public class ItemBlockBasic extends ItemBlock implements IEnergizedItem, ITierIt
|
||||
{
|
||||
if(BasicBlockType.get(itemStack) == BasicBlockType.INDUCTION_CELL)
|
||||
{
|
||||
if(itemStack.getTagCompound() == null)
|
||||
{
|
||||
itemStack.setTagCompound(new NBTTagCompound());
|
||||
}
|
||||
|
||||
itemStack.getTagCompound().setDouble("energyStored", Math.max(Math.min(amount, getMaxEnergy(itemStack)), 0));
|
||||
ItemDataUtils.setDouble(itemStack, "energyStored", Math.max(Math.min(amount, getMaxEnergy(itemStack)), 0));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@ import mekanism.api.MekanismAPI;
|
||||
import mekanism.common.MekanismBlocks;
|
||||
import mekanism.common.block.BlockCardboardBox.BlockData;
|
||||
import mekanism.common.tile.TileEntityCardboardBox;
|
||||
import mekanism.common.util.ItemDataUtils;
|
||||
import mekanism.common.util.LangUtils;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
@@ -139,22 +140,17 @@ public class ItemBlockCardboardBox extends ItemBlock
|
||||
|
||||
public void setBlockData(ItemStack itemstack, BlockData data)
|
||||
{
|
||||
if(itemstack.getTagCompound() == null)
|
||||
{
|
||||
itemstack.setTagCompound(new NBTTagCompound());
|
||||
}
|
||||
|
||||
itemstack.getTagCompound().setTag("blockData", data.write(new NBTTagCompound()));
|
||||
ItemDataUtils.setCompound(itemstack, "blockData", data.write(new NBTTagCompound()));
|
||||
}
|
||||
|
||||
public BlockData getBlockData(ItemStack itemstack)
|
||||
{
|
||||
if(itemstack.getTagCompound() == null || !itemstack.getTagCompound().hasKey("blockData"))
|
||||
if(!ItemDataUtils.hasData(itemstack, "blockData"))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return BlockData.read(itemstack.getTagCompound().getCompoundTag("blockData"));
|
||||
return BlockData.read(ItemDataUtils.getCompound(itemstack, "blockData"));
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
|
||||
@@ -24,6 +24,7 @@ import mekanism.common.security.ISecurityItem;
|
||||
import mekanism.common.security.ISecurityTile;
|
||||
import mekanism.common.security.ISecurityTile.SecurityMode;
|
||||
import mekanism.common.tile.TileEntityEnergyCube;
|
||||
import mekanism.common.util.ItemDataUtils;
|
||||
import mekanism.common.util.LangUtils;
|
||||
import mekanism.common.util.MekanismUtils;
|
||||
import mekanism.common.util.SecurityUtils;
|
||||
@@ -39,7 +40,6 @@ import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.Constants.NBT;
|
||||
import net.minecraftforge.fml.common.Optional.Interface;
|
||||
import net.minecraftforge.fml.common.Optional.InterfaceList;
|
||||
import net.minecraftforge.fml.common.Optional.Method;
|
||||
@@ -59,6 +59,7 @@ public class ItemBlockEnergyCube extends ItemBlock implements IEnergizedItem, IS
|
||||
super(block);
|
||||
metaBlock = block;
|
||||
setMaxStackSize(1);
|
||||
setHasSubtypes(true);
|
||||
setNoRepair();
|
||||
setCreativeTab(Mekanism.tabMekanism);
|
||||
}
|
||||
@@ -196,14 +197,7 @@ public class ItemBlockEnergyCube extends ItemBlock implements IEnergizedItem, IS
|
||||
{
|
||||
if(data[0] instanceof ItemStack)
|
||||
{
|
||||
ItemStack itemStack = (ItemStack)data[0];
|
||||
|
||||
if(!itemStack.hasTagCompound())
|
||||
{
|
||||
itemStack.setTagCompound(new NBTTagCompound());
|
||||
}
|
||||
|
||||
itemStack.getTagCompound().setTag("Items", nbtTags);
|
||||
ItemDataUtils.setList((ItemStack)data[0], "Items", nbtTags);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -212,14 +206,7 @@ public class ItemBlockEnergyCube extends ItemBlock implements IEnergizedItem, IS
|
||||
{
|
||||
if(data[0] instanceof ItemStack)
|
||||
{
|
||||
ItemStack itemStack = (ItemStack)data[0];
|
||||
|
||||
if(!itemStack.hasTagCompound())
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return itemStack.getTagCompound().getTagList("Items", NBT.TAG_COMPOUND);
|
||||
return ItemDataUtils.getList((ItemStack)data[0], "Items");
|
||||
}
|
||||
|
||||
return null;
|
||||
@@ -233,7 +220,7 @@ public class ItemBlockEnergyCube extends ItemBlock implements IEnergizedItem, IS
|
||||
return 0;
|
||||
}
|
||||
|
||||
return itemStack.getTagCompound().getDouble("electricity");
|
||||
return ItemDataUtils.getDouble(itemStack, "energyStored");
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -244,13 +231,7 @@ public class ItemBlockEnergyCube extends ItemBlock implements IEnergizedItem, IS
|
||||
return;
|
||||
}
|
||||
|
||||
if(!itemStack.hasTagCompound())
|
||||
{
|
||||
itemStack.setTagCompound(new NBTTagCompound());
|
||||
}
|
||||
|
||||
double electricityStored = Math.max(Math.min(amount, getMaxEnergy(itemStack)), 0);
|
||||
itemStack.getTagCompound().setDouble("electricity", electricityStored);
|
||||
ItemDataUtils.setDouble(itemStack, "energyStored", Math.max(Math.min(amount, getMaxEnergy(itemStack)), 0));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -363,9 +344,9 @@ public class ItemBlockEnergyCube extends ItemBlock implements IEnergizedItem, IS
|
||||
@Override
|
||||
public String getOwner(ItemStack stack)
|
||||
{
|
||||
if(stack.hasTagCompound() && stack.getTagCompound().hasKey("owner"))
|
||||
if(ItemDataUtils.hasData(stack, "owner"))
|
||||
{
|
||||
return stack.getTagCompound().getString("owner");
|
||||
return ItemDataUtils.getString(stack, "owner");
|
||||
}
|
||||
|
||||
return null;
|
||||
@@ -374,40 +355,25 @@ public class ItemBlockEnergyCube extends ItemBlock implements IEnergizedItem, IS
|
||||
@Override
|
||||
public void setOwner(ItemStack stack, String owner)
|
||||
{
|
||||
if(!stack.hasTagCompound())
|
||||
{
|
||||
stack.setTagCompound(new NBTTagCompound());
|
||||
}
|
||||
|
||||
if(owner == null || owner.isEmpty())
|
||||
{
|
||||
stack.getTagCompound().removeTag("owner");
|
||||
ItemDataUtils.removeData(stack, "owner");
|
||||
return;
|
||||
}
|
||||
|
||||
stack.getTagCompound().setString("owner", owner);
|
||||
ItemDataUtils.setString(stack, "owner", owner);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SecurityMode getSecurity(ItemStack stack)
|
||||
{
|
||||
if(!stack.hasTagCompound())
|
||||
{
|
||||
return SecurityMode.PUBLIC;
|
||||
}
|
||||
|
||||
return SecurityMode.values()[stack.getTagCompound().getInteger("security")];
|
||||
return SecurityMode.values()[ItemDataUtils.getInt(stack, "security")];
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSecurity(ItemStack stack, SecurityMode mode)
|
||||
{
|
||||
if(!stack.hasTagCompound())
|
||||
{
|
||||
stack.setTagCompound(new NBTTagCompound());
|
||||
}
|
||||
|
||||
stack.getTagCompound().setInteger("security", mode.ordinal());
|
||||
ItemDataUtils.setInt(stack, "security", mode.ordinal());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -23,6 +23,7 @@ import mekanism.common.security.ISecurityItem;
|
||||
import mekanism.common.security.ISecurityTile;
|
||||
import mekanism.common.security.ISecurityTile.SecurityMode;
|
||||
import mekanism.common.tile.TileEntityGasTank;
|
||||
import mekanism.common.util.ItemDataUtils;
|
||||
import mekanism.common.util.LangUtils;
|
||||
import mekanism.common.util.SecurityUtils;
|
||||
import net.minecraft.block.Block;
|
||||
@@ -38,7 +39,6 @@ import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.Constants.NBT;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
|
||||
public class ItemBlockGasTank extends ItemBlock implements IGasItem, ISustainedInventory, ITierItem, ISecurityItem
|
||||
@@ -147,31 +147,21 @@ public class ItemBlockGasTank extends ItemBlock implements IGasItem, ISustainedI
|
||||
@Override
|
||||
public GasStack getGas(ItemStack itemstack)
|
||||
{
|
||||
if(itemstack.getTagCompound() == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return GasStack.readFromNBT(itemstack.getTagCompound().getCompoundTag("stored"));
|
||||
return GasStack.readFromNBT(ItemDataUtils.getCompound(itemstack, "stored"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setGas(ItemStack itemstack, GasStack stack)
|
||||
{
|
||||
if(itemstack.getTagCompound() == null)
|
||||
{
|
||||
itemstack.setTagCompound(new NBTTagCompound());
|
||||
}
|
||||
|
||||
if(stack == null || stack.amount == 0)
|
||||
{
|
||||
itemstack.getTagCompound().removeTag("stored");
|
||||
ItemDataUtils.removeData(itemstack, "stored");
|
||||
}
|
||||
else {
|
||||
int amount = Math.max(0, Math.min(stack.amount, getMaxGas(itemstack)));
|
||||
GasStack gasStack = new GasStack(stack.getGas(), amount);
|
||||
|
||||
itemstack.getTagCompound().setTag("stored", gasStack.write(new NBTTagCompound()));
|
||||
ItemDataUtils.setCompound(itemstack, "stored", gasStack.write(new NBTTagCompound()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -295,14 +285,7 @@ public class ItemBlockGasTank extends ItemBlock implements IGasItem, ISustainedI
|
||||
{
|
||||
if(data[0] instanceof ItemStack)
|
||||
{
|
||||
ItemStack itemStack = (ItemStack)data[0];
|
||||
|
||||
if(!itemStack.hasTagCompound())
|
||||
{
|
||||
itemStack.setTagCompound(new NBTTagCompound());
|
||||
}
|
||||
|
||||
itemStack.getTagCompound().setTag("Items", nbtTags);
|
||||
ItemDataUtils.setList((ItemStack)data[0], "Items", nbtTags);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -311,14 +294,7 @@ public class ItemBlockGasTank extends ItemBlock implements IGasItem, ISustainedI
|
||||
{
|
||||
if(data[0] instanceof ItemStack)
|
||||
{
|
||||
ItemStack itemStack = (ItemStack)data[0];
|
||||
|
||||
if(!itemStack.hasTagCompound())
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return itemStack.getTagCompound().getTagList("Items", NBT.TAG_COMPOUND);
|
||||
return ItemDataUtils.getList((ItemStack)data[0], "Items");
|
||||
}
|
||||
|
||||
return null;
|
||||
@@ -339,9 +315,9 @@ public class ItemBlockGasTank extends ItemBlock implements IGasItem, ISustainedI
|
||||
@Override
|
||||
public String getOwner(ItemStack stack)
|
||||
{
|
||||
if(stack.getTagCompound() != null && stack.getTagCompound().hasKey("owner"))
|
||||
if(ItemDataUtils.hasData(stack, "owner"))
|
||||
{
|
||||
return stack.getTagCompound().getString("owner");
|
||||
return ItemDataUtils.getString(stack, "owner");
|
||||
}
|
||||
|
||||
return null;
|
||||
@@ -350,40 +326,25 @@ public class ItemBlockGasTank extends ItemBlock implements IGasItem, ISustainedI
|
||||
@Override
|
||||
public void setOwner(ItemStack stack, String owner)
|
||||
{
|
||||
if(stack.getTagCompound() == null)
|
||||
{
|
||||
stack.setTagCompound(new NBTTagCompound());
|
||||
}
|
||||
|
||||
if(owner == null || owner.isEmpty())
|
||||
{
|
||||
stack.getTagCompound().removeTag("owner");
|
||||
ItemDataUtils.removeData(stack, "owner");
|
||||
return;
|
||||
}
|
||||
|
||||
stack.getTagCompound().setString("owner", owner);
|
||||
ItemDataUtils.setString(stack, "owner", owner);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SecurityMode getSecurity(ItemStack stack)
|
||||
{
|
||||
if(stack.getTagCompound() == null)
|
||||
{
|
||||
return SecurityMode.PUBLIC;
|
||||
}
|
||||
|
||||
return SecurityMode.values()[stack.getTagCompound().getInteger("security")];
|
||||
return SecurityMode.values()[ItemDataUtils.getInt(stack, "security")];
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSecurity(ItemStack stack, SecurityMode mode)
|
||||
{
|
||||
if(stack.getTagCompound() == null)
|
||||
{
|
||||
stack.setTagCompound(new NBTTagCompound());
|
||||
}
|
||||
|
||||
stack.getTagCompound().setInteger("security", mode.ordinal());
|
||||
ItemDataUtils.setInt(stack, "security", mode.ordinal());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -38,6 +38,7 @@ import mekanism.common.tile.TileEntityBasicBlock;
|
||||
import mekanism.common.tile.TileEntityElectricBlock;
|
||||
import mekanism.common.tile.TileEntityFactory;
|
||||
import mekanism.common.tile.TileEntityFluidTank;
|
||||
import mekanism.common.util.ItemDataUtils;
|
||||
import mekanism.common.util.LangUtils;
|
||||
import mekanism.common.util.MekanismUtils;
|
||||
import mekanism.common.util.SecurityUtils;
|
||||
@@ -58,7 +59,6 @@ import net.minecraft.util.EnumParticleTypes;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.Constants.NBT;
|
||||
import net.minecraftforge.fluids.FluidContainerRegistry;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
@@ -235,9 +235,9 @@ public class ItemBlockMachine extends ItemBlock implements IEnergizedItem, ISpec
|
||||
list.add(EnumColor.AQUA + LangUtils.localize("tooltip.inventory") + ": " + EnumColor.GREY + LangUtils.transYesNo(getInventory(itemstack) != null && getInventory(itemstack).tagCount() != 0));
|
||||
}
|
||||
|
||||
if(type.supportsUpgrades && itemstack.getTagCompound() != null && itemstack.getTagCompound().hasKey("upgrades"))
|
||||
if(type.supportsUpgrades && ItemDataUtils.hasData(itemstack, "upgrades"))
|
||||
{
|
||||
Map<Upgrade, Integer> upgrades = Upgrade.buildMap(itemstack.getTagCompound());
|
||||
Map<Upgrade, Integer> upgrades = Upgrade.buildMap(ItemDataUtils.getDataMap(itemstack));
|
||||
|
||||
for(Map.Entry<Upgrade, Integer> entry : upgrades.entrySet())
|
||||
{
|
||||
@@ -326,9 +326,9 @@ public class ItemBlockMachine extends ItemBlock implements IEnergizedItem, ISpec
|
||||
|
||||
if(tileEntity instanceof IUpgradeTile)
|
||||
{
|
||||
if(stack.getTagCompound() != null && stack.getTagCompound().hasKey("upgrades"))
|
||||
if(ItemDataUtils.hasData(stack, "upgrades"))
|
||||
{
|
||||
((IUpgradeTile)tileEntity).getComponent().read(stack.getTagCompound());
|
||||
((IUpgradeTile)tileEntity).getComponent().read(ItemDataUtils.getDataMap(stack));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -336,9 +336,10 @@ public class ItemBlockMachine extends ItemBlock implements IEnergizedItem, ISpec
|
||||
{
|
||||
ISideConfiguration config = (ISideConfiguration)tileEntity;
|
||||
|
||||
if(stack.getTagCompound() != null && stack.getTagCompound().hasKey("sideDataStored"))
|
||||
if(ItemDataUtils.hasData(stack, "sideDataStored"))
|
||||
{
|
||||
config.getConfig().read(stack.getTagCompound());
|
||||
config.getConfig().read(ItemDataUtils.getDataMap(stack));
|
||||
config.getEjector().read(ItemDataUtils.getDataMap(stack));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -352,9 +353,9 @@ public class ItemBlockMachine extends ItemBlock implements IEnergizedItem, ISpec
|
||||
|
||||
if(tileEntity instanceof IRedstoneControl)
|
||||
{
|
||||
if(stack.getTagCompound() != null && stack.getTagCompound().hasKey("controlType"))
|
||||
if(ItemDataUtils.hasData(stack, "controlType"))
|
||||
{
|
||||
((IRedstoneControl)tileEntity).setControlType(RedstoneControl.values()[stack.getTagCompound().getInteger("controlType")]);
|
||||
((IRedstoneControl)tileEntity).setControlType(RedstoneControl.values()[ItemDataUtils.getInt(stack, "controlType")]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -611,14 +612,7 @@ public class ItemBlockMachine extends ItemBlock implements IEnergizedItem, ISpec
|
||||
{
|
||||
if(data[0] instanceof ItemStack)
|
||||
{
|
||||
ItemStack itemStack = (ItemStack)data[0];
|
||||
|
||||
if(itemStack.getTagCompound() == null)
|
||||
{
|
||||
itemStack.setTagCompound(new NBTTagCompound());
|
||||
}
|
||||
|
||||
itemStack.getTagCompound().setTag("Items", nbtTags);
|
||||
ItemDataUtils.setList((ItemStack)data[0], "Items", nbtTags);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -627,14 +621,7 @@ public class ItemBlockMachine extends ItemBlock implements IEnergizedItem, ISpec
|
||||
{
|
||||
if(data[0] instanceof ItemStack)
|
||||
{
|
||||
ItemStack itemStack = (ItemStack)data[0];
|
||||
|
||||
if(itemStack.getTagCompound() == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return itemStack.getTagCompound().getTagList("Items", NBT.TAG_COMPOUND);
|
||||
return ItemDataUtils.getList((ItemStack)data[0], "Items");
|
||||
}
|
||||
|
||||
return null;
|
||||
@@ -646,18 +633,13 @@ public class ItemBlockMachine extends ItemBlock implements IEnergizedItem, ISpec
|
||||
if(data[0] instanceof ItemStack)
|
||||
{
|
||||
ItemStack itemStack = (ItemStack)data[0];
|
||||
|
||||
if(itemStack.getTagCompound() == null)
|
||||
{
|
||||
itemStack.setTagCompound(new NBTTagCompound());
|
||||
}
|
||||
|
||||
if(fluidStack == null || fluidStack.amount == 0 || fluidStack.getFluid() == null)
|
||||
{
|
||||
itemStack.getTagCompound().removeTag("fluidTank");
|
||||
ItemDataUtils.removeData(itemStack, "fluidTank");
|
||||
}
|
||||
else {
|
||||
itemStack.getTagCompound().setTag("fluidTank", fluidStack.writeToNBT(new NBTTagCompound()));
|
||||
ItemDataUtils.setCompound(itemStack, "fluidTank", fluidStack.writeToNBT(new NBTTagCompound()));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -669,15 +651,12 @@ public class ItemBlockMachine extends ItemBlock implements IEnergizedItem, ISpec
|
||||
{
|
||||
ItemStack itemStack = (ItemStack)data[0];
|
||||
|
||||
if(itemStack.getTagCompound() == null)
|
||||
if(!ItemDataUtils.hasData(itemStack, "fluidTank"))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
if(itemStack.getTagCompound().hasKey("fluidTank"))
|
||||
{
|
||||
return FluidStack.loadFluidStackFromNBT(itemStack.getTagCompound().getCompoundTag("fluidTank"));
|
||||
}
|
||||
return FluidStack.loadFluidStackFromNBT(ItemDataUtils.getCompound(itemStack, "fluidTank"));
|
||||
}
|
||||
|
||||
return null;
|
||||
@@ -698,33 +677,23 @@ public class ItemBlockMachine extends ItemBlock implements IEnergizedItem, ISpec
|
||||
|
||||
public void setBucketMode(ItemStack itemStack, boolean bucketMode)
|
||||
{
|
||||
if(itemStack.getTagCompound() == null)
|
||||
{
|
||||
itemStack.setTagCompound(new NBTTagCompound());
|
||||
}
|
||||
|
||||
itemStack.getTagCompound().setBoolean("bucketMode", bucketMode);
|
||||
ItemDataUtils.setBoolean(itemStack, "bucketMode", bucketMode);
|
||||
}
|
||||
|
||||
public boolean getBucketMode(ItemStack itemStack)
|
||||
{
|
||||
if(itemStack.getTagCompound() == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return itemStack.getTagCompound().getBoolean("bucketMode");
|
||||
return ItemDataUtils.getBoolean(itemStack, "bucketMode");
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getEnergy(ItemStack itemStack)
|
||||
{
|
||||
if(itemStack.getTagCompound() == null || !MachineType.get(itemStack).isElectric)
|
||||
if(!MachineType.get(itemStack).isElectric)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
return itemStack.getTagCompound().getDouble("electricity");
|
||||
return ItemDataUtils.getDouble(itemStack, "energyStored");
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -735,13 +704,7 @@ public class ItemBlockMachine extends ItemBlock implements IEnergizedItem, ISpec
|
||||
return;
|
||||
}
|
||||
|
||||
if(itemStack.getTagCompound() == null)
|
||||
{
|
||||
itemStack.setTagCompound(new NBTTagCompound());
|
||||
}
|
||||
|
||||
double electricityStored = Math.max(Math.min(amount, getMaxEnergy(itemStack)), 0);
|
||||
itemStack.getTagCompound().setDouble("electricity", electricityStored);
|
||||
ItemDataUtils.setDouble(itemStack, "energyStored", Math.max(Math.min(amount, getMaxEnergy(itemStack)), 0));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -774,14 +737,14 @@ public class ItemBlockMachine extends ItemBlock implements IEnergizedItem, ISpec
|
||||
if(canReceive(theItem))
|
||||
{
|
||||
double energyNeeded = getMaxEnergy(theItem)-getEnergy(theItem);
|
||||
double toReceive = Math.min(energy* general.FROM_TE, energyNeeded);
|
||||
double toReceive = Math.min(energy*general.FROM_TE, energyNeeded);
|
||||
|
||||
if(!simulate)
|
||||
{
|
||||
setEnergy(theItem, getEnergy(theItem) + toReceive);
|
||||
}
|
||||
|
||||
return (int)Math.round(toReceive* general.TO_TE);
|
||||
return (int)Math.round(toReceive*general.TO_TE);
|
||||
}
|
||||
|
||||
return 0;
|
||||
@@ -793,14 +756,14 @@ public class ItemBlockMachine extends ItemBlock implements IEnergizedItem, ISpec
|
||||
if(canSend(theItem))
|
||||
{
|
||||
double energyRemaining = getEnergy(theItem);
|
||||
double toSend = Math.min((energy* general.FROM_TE), energyRemaining);
|
||||
double toSend = Math.min((energy*general.FROM_TE), energyRemaining);
|
||||
|
||||
if(!simulate)
|
||||
{
|
||||
setEnergy(theItem, getEnergy(theItem) - toSend);
|
||||
}
|
||||
|
||||
return (int)Math.round(toSend* general.TO_TE);
|
||||
return (int)Math.round(toSend*general.TO_TE);
|
||||
}
|
||||
|
||||
return 0;
|
||||
@@ -809,13 +772,13 @@ public class ItemBlockMachine extends ItemBlock implements IEnergizedItem, ISpec
|
||||
@Override
|
||||
public int getEnergyStored(ItemStack theItem)
|
||||
{
|
||||
return (int)(getEnergy(theItem) * general.TO_TE);
|
||||
return (int)(getEnergy(theItem)*general.TO_TE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxEnergyStored(ItemStack theItem)
|
||||
{
|
||||
return (int)(getMaxEnergy(theItem) * general.TO_TE);
|
||||
return (int)(getMaxEnergy(theItem)*general.TO_TE);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -933,9 +896,9 @@ public class ItemBlockMachine extends ItemBlock implements IEnergizedItem, ISpec
|
||||
@Override
|
||||
public String getOwner(ItemStack stack)
|
||||
{
|
||||
if(stack.hasTagCompound() && stack.getTagCompound().hasKey("owner"))
|
||||
if(ItemDataUtils.hasData(stack, "owner"))
|
||||
{
|
||||
return stack.getTagCompound().getString("owner");
|
||||
return ItemDataUtils.getString(stack, "owner");
|
||||
}
|
||||
|
||||
return null;
|
||||
@@ -944,40 +907,25 @@ public class ItemBlockMachine extends ItemBlock implements IEnergizedItem, ISpec
|
||||
@Override
|
||||
public void setOwner(ItemStack stack, String owner)
|
||||
{
|
||||
if(!stack.hasTagCompound())
|
||||
{
|
||||
stack.setTagCompound(new NBTTagCompound());
|
||||
}
|
||||
|
||||
if(owner == null || owner.isEmpty())
|
||||
{
|
||||
stack.getTagCompound().removeTag("owner");
|
||||
ItemDataUtils.removeData(stack, "owner");
|
||||
return;
|
||||
}
|
||||
|
||||
stack.getTagCompound().setString("owner", owner);
|
||||
ItemDataUtils.setString(stack, "owner", owner);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SecurityMode getSecurity(ItemStack stack)
|
||||
{
|
||||
if(stack.getTagCompound() == null)
|
||||
{
|
||||
return SecurityMode.PUBLIC;
|
||||
}
|
||||
|
||||
return SecurityMode.values()[stack.getTagCompound().getInteger("security")];
|
||||
return SecurityMode.values()[ItemDataUtils.getInt(stack, "security")];
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSecurity(ItemStack stack, SecurityMode mode)
|
||||
{
|
||||
if(!stack.hasTagCompound())
|
||||
{
|
||||
stack.setTagCompound(new NBTTagCompound());
|
||||
}
|
||||
|
||||
stack.getTagCompound().setInteger("security", mode.ordinal());
|
||||
ItemDataUtils.setInt(stack, "security", mode.ordinal());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -40,7 +40,7 @@ public class ItemBlockOre extends ItemBlock
|
||||
{
|
||||
if(!MekKeyHandler.getIsKeyPressed(MekanismKeyHandler.sneakKey))
|
||||
{
|
||||
list.add("Hold " + EnumColor.AQUA + GameSettings.getKeyDisplayString(MekanismKeyHandler.sneakKey.getKeyCode()) + EnumColor.GREY + LangUtils.localize("tooltip.forDetails") + ".");
|
||||
list.add("Hold " + EnumColor.AQUA + GameSettings.getKeyDisplayString(MekanismKeyHandler.sneakKey.getKeyCode()) + EnumColor.GREY + " " + LangUtils.localize("tooltip.forDetails") + ".");
|
||||
}
|
||||
else {
|
||||
list.addAll(MekanismUtils.splitTooltip(LangUtils.localize("tooltip." + getUnlocalizedName(itemstack).replace("tile.OreBlock.", "")), itemstack));
|
||||
|
||||
@@ -9,6 +9,7 @@ import mekanism.common.base.IRedstoneControl;
|
||||
import mekanism.common.base.IRedstoneControl.RedstoneControl;
|
||||
import mekanism.common.base.ISideConfiguration;
|
||||
import mekanism.common.tile.TileEntityContainerBlock;
|
||||
import mekanism.common.util.ItemDataUtils;
|
||||
import mekanism.common.util.LangUtils;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -140,35 +141,25 @@ public class ItemConfigurationCard extends ItemMekanism
|
||||
|
||||
public void setData(ItemStack itemstack, NBTTagCompound data)
|
||||
{
|
||||
if(itemstack.hasTagCompound())
|
||||
{
|
||||
itemstack.setTagCompound(new NBTTagCompound());
|
||||
}
|
||||
|
||||
if(data != null)
|
||||
{
|
||||
itemstack.getTagCompound().setTag("data", data);
|
||||
ItemDataUtils.setCompound(itemstack, "data", data);
|
||||
}
|
||||
else {
|
||||
itemstack.getTagCompound().removeTag("data");
|
||||
ItemDataUtils.removeData(itemstack, "data");
|
||||
}
|
||||
}
|
||||
|
||||
public NBTTagCompound getData(ItemStack itemstack)
|
||||
{
|
||||
if(!itemstack.hasTagCompound())
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
NBTTagCompound data = itemstack.getTagCompound().getCompoundTag("data");
|
||||
NBTTagCompound data = ItemDataUtils.getCompound(itemstack, "data");
|
||||
|
||||
if(data.hasNoTags())
|
||||
{
|
||||
return null;
|
||||
}
|
||||
else {
|
||||
return itemstack.getTagCompound().getCompoundTag("data");
|
||||
return ItemDataUtils.getCompound(itemstack, "data");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -19,6 +19,7 @@ import mekanism.common.network.PacketTileEntity.TileEntityMessage;
|
||||
import mekanism.common.tile.TileEntityBasicBlock;
|
||||
import mekanism.common.tile.TileEntityContainerBlock;
|
||||
import mekanism.common.tile.component.TileComponentConfig;
|
||||
import mekanism.common.util.ItemDataUtils;
|
||||
import mekanism.common.util.LangUtils;
|
||||
import mekanism.common.util.MekanismUtils;
|
||||
import mekanism.common.util.SecurityUtils;
|
||||
@@ -238,27 +239,12 @@ public class ItemConfigurator extends ItemEnergized implements IMekWrench, ITool
|
||||
|
||||
public void setState(ItemStack itemstack, ConfiguratorMode state)
|
||||
{
|
||||
if(itemstack.getTagCompound() == null)
|
||||
{
|
||||
itemstack.setTagCompound(new NBTTagCompound());
|
||||
}
|
||||
|
||||
itemstack.getTagCompound().setInteger("state", state.ordinal());
|
||||
ItemDataUtils.setInt(itemstack, "state", state.ordinal());
|
||||
}
|
||||
|
||||
public ConfiguratorMode getState(ItemStack itemstack)
|
||||
{
|
||||
if(itemstack.getTagCompound() == null)
|
||||
{
|
||||
return ConfiguratorMode.CONFIGURATE_ITEMS;
|
||||
}
|
||||
|
||||
if(itemstack.getTagCompound().getTag("state") != null)
|
||||
{
|
||||
return ConfiguratorMode.values()[itemstack.getTagCompound().getInteger("state")];
|
||||
}
|
||||
|
||||
return ConfiguratorMode.CONFIGURATE_ITEMS;
|
||||
return ConfiguratorMode.values()[ItemDataUtils.getInt(itemstack, "state")];
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Loaded 100 of 232 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user