Merge branch '1.11' of github.com:aidancbrady/Mekanism into 1.11

This commit is contained in:
Tom Elfring committed 2017-08-07 20:00:52 +02:00
commit 29615cc6a9
83 files changed
+502 -559

No files matched your search

@@ -9,6 +9,7 @@ import mekanism.api.EnumColor;
import mekanism.client.gui.element.GuiScrollList;
import mekanism.client.gui.element.GuiSideConfigurationTab;
import mekanism.client.gui.element.GuiTransporterConfigTab;
import mekanism.client.gui.element.GuiUpgradeTab;
import mekanism.client.sound.SoundHandler;
import mekanism.common.Mekanism;
import mekanism.common.frequency.Frequency;
@@ -61,6 +62,7 @@ public class GuiQuantumEntangloporter extends GuiMekanism
guiElements.add(scrollList = new GuiScrollList(this, resource, 28, 37, 120, 4));
guiElements.add(new GuiSideConfigurationTab(this, tileEntity, MekanismUtils.getResource(ResourceType.GUI, "GuiTeleporter.png")));
guiElements.add(new GuiTransporterConfigTab(this, 34, tileEntity, MekanismUtils.getResource(ResourceType.GUI, "GuiTeleporter.png")));
guiElements.add(new GuiUpgradeTab(this, tileEntity, resource));
if(tileEntity.frequency != null)
{
@@ -8,11 +8,18 @@ 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.GuiGauge;
import mekanism.client.gui.element.GuiProgress.ProgressBar;
import mekanism.client.jei.gas.GasStackRenderer;
import mekanism.client.render.MekanismRenderer;
import mekanism.client.render.MekanismRenderer.FluidType;
import mekanism.common.util.LangUtils;
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.IGuiIngredientGroup;
import mezz.jei.api.gui.ITickTimer;
import mezz.jei.api.recipe.IRecipeCategory;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
@@ -27,6 +34,8 @@ public abstract class BaseRecipeCategory implements IRecipeCategory, IGuiWrapper
{
public static final GuiDummy gui = new GuiDummy();
public IGuiHelper guiHelper;
public String recipeName;
public String unlocalizedName;
@@ -34,12 +43,17 @@ public abstract class BaseRecipeCategory implements IRecipeCategory, IGuiWrapper
public ResourceLocation guiLocation;
public ProgressBar progressBar;
public ITickTimer timer;
public int xOffset = 28;
public int yOffset = 16;
public BaseRecipeCategory(String gui, String name, String unlocalized, ProgressBar progress)
public IDrawable fluidOverlayLarge;
public IDrawable fluidOverlaySmall;
public BaseRecipeCategory(IGuiHelper helper, String gui, String name, String unlocalized, ProgressBar progress)
{
guiHelper = helper;
guiTexture = gui;
guiLocation = new ResourceLocation(guiTexture);
@@ -48,6 +62,11 @@ public abstract class BaseRecipeCategory implements IRecipeCategory, IGuiWrapper
recipeName = name;
unlocalizedName = unlocalized;
timer = helper.createTickTimer(20, 20, false);
fluidOverlayLarge = guiHelper.createDrawable(MekanismUtils.getResource(ResourceType.GUI_ELEMENT, GuiGauge.Type.STANDARD.textureLocation), 19, 1, 16, 59);
fluidOverlaySmall = guiHelper.createDrawable(MekanismUtils.getResource(ResourceType.GUI_ELEMENT, GuiGauge.Type.STANDARD.textureLocation), 19, 1, 16, 29);
addGuiElements();
}
@@ -183,4 +202,16 @@ public abstract class BaseRecipeCategory implements IRecipeCategory, IGuiWrapper
{
return Collections.emptyList();
}
protected void initGas(IGuiIngredientGroup<GasStack> group, int slot, boolean input, int x, int y, int width, int height, GasStack stack, boolean overlay)
{
if(stack == null) return;
IDrawable fluidOverlay = height > 50 ? fluidOverlayLarge : fluidOverlaySmall;
GasStackRenderer renderer = new GasStackRenderer(stack.amount, false, width, height, overlay ? fluidOverlay : null);
group.init(slot, input, renderer, x, y, width, height, 0, 0);
group.set(slot, stack);
group.addTooltipCallback((index, isInput, ingredient, tooltip) -> tooltip.remove(1));
}
}
@@ -102,6 +102,8 @@ import net.minecraftforge.fluids.Fluid;
@JEIPlugin
public class MekanismJEI extends BlankModPlugin
{
public static GasStackRenderer GAS_RENDERER;
public static ISubtypeInterpreter NBT_INTERPRETER = new ISubtypeInterpreter() {
@Override
public String getSubtypeInfo(ItemStack itemStack)
@@ -140,7 +142,7 @@ public class MekanismJEI extends BlankModPlugin
public void registerIngredients(IModIngredientRegistration registry)
{
List<GasStack> list = GasRegistry.getRegisteredGasses().stream().filter(g -> g.isVisible()).map(g -> new GasStack(g, Fluid.BUCKET_VOLUME)).collect(Collectors.toList());
registry.register(GasStack.class, list, new GasStackHelper(), new GasStackRenderer());
registry.register(GasStack.class, list, new GasStackHelper(), GAS_RENDERER = new GasStackRenderer());
}
@Override
@@ -1,7 +1,5 @@
package mekanism.client.jei.machine;
import java.util.List;
import mekanism.api.gas.GasStack;
import mekanism.client.gui.element.GuiPowerBar;
import mekanism.client.gui.element.GuiPowerBar.IPowerInfoHandler;
@@ -19,18 +17,15 @@ 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.IGuiIngredientGroup;
import mezz.jei.api.gui.IGuiItemStackGroup;
import mezz.jei.api.gui.IRecipeLayout;
import mezz.jei.api.gui.ITickTimer;
import mezz.jei.api.ingredients.IIngredients;
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;
@@ -38,15 +33,10 @@ public class AdvancedMachineRecipeCategory extends BaseRecipeCategory
public AdvancedMachineRecipe tempRecipe;
public ITickTimer timer;
public AdvancedMachineRecipeCategory(IGuiHelper helper, String name, String unlocalized, ProgressBar progress)
{
super("mekanism:gui/GuiAdvancedMachine.png", name, unlocalized, progress);
super(helper, "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);
}
@@ -74,19 +64,6 @@ public class AdvancedMachineRecipeCategory extends BaseRecipeCategory
}
}, 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()
@@ -113,5 +90,9 @@ public class AdvancedMachineRecipeCategory extends BaseRecipeCategory
itemStacks.set(0, input.itemStack);
itemStacks.set(1, ((ItemStackOutput)tempRecipe.recipeOutput).output);
itemStacks.set(2, ((AdvancedMachineRecipeWrapper)recipeWrapper).getFuelStacks(input.gasType));
IGuiIngredientGroup gasStacks = recipeLayout.getIngredientsGroup(GasStack.class);
initGas(gasStacks, 0, true, 33, 21, 6, 12, new GasStack(input.gasType, 1), false);
}
}
@@ -1,11 +1,9 @@
package mekanism.client.jei.machine;
import java.util.ArrayList;
import java.util.List;
import javax.annotation.Nullable;
import mekanism.api.gas.Gas;
import mekanism.api.gas.GasStack;
import mekanism.common.recipe.inputs.AdvancedMachineInput;
import mekanism.common.recipe.machines.AdvancedMachineRecipe;
import mekanism.common.recipe.outputs.ItemStackOutput;
@@ -28,23 +26,10 @@ public abstract class AdvancedMachineRecipeWrapper extends BaseRecipeWrapper
public void getIngredients(IIngredients ingredients)
{
ingredients.setInput(ItemStack.class, ((AdvancedMachineInput)recipe.getInput()).itemStack);
ingredients.setInput(GasStack.class, new GasStack(((AdvancedMachineInput)recipe.getInput()).gasType, 1));
ingredients.setOutput(ItemStack.class, ((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;
}
@Override
public AdvancedMachineRecipeCategory getCategory()
{
@@ -27,22 +27,14 @@ 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);
super(helper, "mekanism:gui/GuiBasicMachine.png", name, unlocalized, progress);
background = guiHelper.createDrawable(new ResourceLocation(guiTexture), 28, 16, 144, 54);
}
@@ -26,21 +26,13 @@ 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);
super(helper, "mekanism:gui/GuiBasicMachine.png", name, unlocalized, progress);
background = guiHelper.createDrawable(new ResourceLocation(guiTexture), 28, 16, 144, 54);
}
@@ -5,9 +5,9 @@ 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.IGuiIngredientGroup;
import mezz.jei.api.gui.IGuiItemStackGroup;
import mezz.jei.api.gui.IRecipeLayout;
import mezz.jei.api.gui.ITickTimer;
import mezz.jei.api.ingredients.IIngredients;
import mezz.jei.api.recipe.IRecipeWrapper;
import net.minecraft.client.Minecraft;
@@ -15,22 +15,14 @@ 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);
super(helper, "mekanism:gui/nei/GuiChemicalCrystallizer.png", "chemical_crystallizer", "tile.MachineBlock2.ChemicalCrystallizer.name", null);
xOffset = 5;
yOffset = 3;
@@ -41,16 +33,9 @@ public class ChemicalCrystallizerRecipeCategory extends BaseRecipeCategory
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
@@ -70,7 +55,10 @@ public class ChemicalCrystallizerRecipeCategory extends BaseRecipeCategory
IGuiItemStackGroup itemStacks = recipeLayout.getItemStacks();
itemStacks.init(0, false, 130-xOffset, 56-yOffset);
itemStacks.set(0, tempRecipe.getOutput().output);
IGuiIngredientGroup gasStacks = recipeLayout.getIngredientsGroup(GasStack.class);
initGas(gasStacks, 0, true, 6-xOffset, 5-yOffset, 16, 58, tempRecipe.getInput().ingredient, true);
}
}
@@ -31,20 +31,6 @@ public class ChemicalCrystallizerRecipeWrapper extends BaseRecipeWrapper
ingredients.setOutput(ItemStack.class, recipe.recipeOutput.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;
}
@Override
public ChemicalCrystallizerRecipeCategory getCategory()
{
@@ -6,9 +6,9 @@ import mekanism.common.MekanismFluids;
import mekanism.common.recipe.machines.DissolutionRecipe;
import mezz.jei.api.IGuiHelper;
import mezz.jei.api.gui.IDrawable;
import mezz.jei.api.gui.IGuiIngredientGroup;
import mezz.jei.api.gui.IGuiItemStackGroup;
import mezz.jei.api.gui.IRecipeLayout;
import mezz.jei.api.gui.ITickTimer;
import mezz.jei.api.ingredients.IIngredients;
import mezz.jei.api.recipe.IRecipeWrapper;
import net.minecraft.client.Minecraft;
@@ -16,22 +16,14 @@ 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);
super(helper, "mekanism:gui/nei/GuiChemicalDissolutionChamber.png", "chemical_dissolution_chamber", "gui.chemicalDissolutionChamber.short", null);
xOffset = 3;
yOffset = 3;
@@ -42,18 +34,9 @@ public class ChemicalDissolutionChamberRecipeCategory extends BaseRecipeCategory
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(MekanismFluids.SulfuricAcid, 1));
if(gas != null)
{
displayGauge(58, 134-xOffset, 14-yOffset, 176, 4, 58, null, gas);
}
}
@Override
@@ -73,7 +56,11 @@ public class ChemicalDissolutionChamberRecipeCategory extends BaseRecipeCategory
IGuiItemStackGroup itemStacks = recipeLayout.getItemStacks();
itemStacks.init(0, true, 25-xOffset, 35-yOffset);
itemStacks.set(0, tempRecipe.getInput().ingredient);
IGuiIngredientGroup gasStacks = recipeLayout.getIngredientsGroup(GasStack.class);
initGas(gasStacks, 0, true, 6-xOffset, 5-yOffset, 16, 58, new GasStack(MekanismFluids.SulfuricAcid, 1), true);
initGas(gasStacks, 1, false, 134-xOffset, 14-yOffset, 16, 58, tempRecipe.getOutput().output, true);
}
}
@@ -1,15 +1,9 @@
package mekanism.client.jei.machine.chemical;
import java.util.ArrayList;
import java.util.List;
import javax.annotation.Nullable;
import mekanism.api.gas.GasStack;
import mekanism.client.jei.machine.BaseRecipeWrapper;
import mekanism.common.MekanismFluids;
import mekanism.common.recipe.machines.DissolutionRecipe;
import mekanism.common.util.LangUtils;
import mezz.jei.api.ingredients.IIngredients;
import net.minecraft.item.ItemStack;
@@ -33,24 +27,6 @@ public class ChemicalDissolutionChamberRecipeWrapper extends BaseRecipeWrapper
ingredients.setOutput(GasStack.class, recipe.recipeOutput.output);
}
@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(MekanismFluids.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;
}
@Override
public ChemicalDissolutionChamberRecipeCategory getCategory()
{
@@ -1,11 +1,12 @@
package mekanism.client.jei.machine.chemical;
import mekanism.api.gas.GasStack;
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.IGuiIngredientGroup;
import mezz.jei.api.gui.IRecipeLayout;
import mezz.jei.api.gui.ITickTimer;
import mezz.jei.api.ingredients.IIngredients;
import mezz.jei.api.recipe.IRecipeWrapper;
import net.minecraft.client.Minecraft;
@@ -13,22 +14,14 @@ 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);
super(helper, "mekanism:gui/nei/GuiChemicalInfuser.png", "chemical_infuser", "tile.MachineBlock2.ChemicalInfuser.name", null);
xOffset = 3;
yOffset = 3;
@@ -42,21 +35,6 @@ public class ChemicalInfuserRecipeCategory extends BaseRecipeCategory
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
@@ -72,5 +50,11 @@ public class ChemicalInfuserRecipeCategory extends BaseRecipeCategory
{
tempRecipe = ((ChemicalInfuserRecipeWrapper)recipeWrapper).recipe;
}
IGuiIngredientGroup gasStacks = recipeLayout.getIngredientsGroup(GasStack.class);
initGas(gasStacks, 0, true, 26-xOffset, 14-yOffset, 16, 58, tempRecipe.getInput().leftGas, true);
initGas(gasStacks, 1, true, 134-xOffset, 14-yOffset, 16, 58, tempRecipe.getInput().rightGas, true);
initGas(gasStacks, 2, false, 80-xOffset, 5-yOffset, 16, 58, tempRecipe.getOutput().output, true);
}
}
@@ -1,15 +1,10 @@
package mekanism.client.jei.machine.chemical;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import javax.annotation.Nullable;
import mekanism.api.gas.GasStack;
import mekanism.client.jei.machine.BaseRecipeWrapper;
import mekanism.common.recipe.machines.ChemicalInfuserRecipe;
import mekanism.common.util.LangUtils;
import mezz.jei.api.ingredients.IIngredients;
public class ChemicalInfuserRecipeWrapper extends BaseRecipeWrapper
@@ -31,28 +26,6 @@ public class ChemicalInfuserRecipeWrapper extends BaseRecipeWrapper
ingredients.setOutput(GasStack.class, recipe.recipeOutput.output);
}
@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;
}
@Override
public ChemicalInfuserRecipeCategory getCategory()
{
@@ -1,5 +1,6 @@
package mekanism.client.jei.machine.chemical;
import mekanism.api.gas.GasStack;
import mekanism.client.gui.element.GuiGasGauge;
import mekanism.client.gui.element.GuiGauge;
import mekanism.client.gui.element.GuiProgress;
@@ -13,34 +14,25 @@ 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.IGuiIngredientGroup;
import mezz.jei.api.gui.IGuiItemStackGroup;
import mezz.jei.api.gui.IRecipeLayout;
import mezz.jei.api.gui.ITickTimer;
import mezz.jei.api.ingredients.IIngredients;
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);
super(helper, "mekanism:gui/GuiChemicalOxidizer.png", "chemical_oxidizer", "tile.MachineBlock2.ChemicalOxidizer.name", ProgressBar.LARGE_RIGHT);
xOffset = 20;
yOffset = 12;
@@ -64,18 +56,6 @@ public class ChemicalOxidizerRecipeCategory extends BaseRecipeCategory
}, 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()
{
@@ -94,5 +74,9 @@ public class ChemicalOxidizerRecipeCategory extends BaseRecipeCategory
itemStacks.init(0, true, 25-xOffset, 35-yOffset);
itemStacks.set(0, tempRecipe.getInput().ingredient);
IGuiIngredientGroup gasStacks = recipeLayout.getIngredientsGroup(GasStack.class);
initGas(gasStacks, 0, false, 134-xOffset, 14-yOffset, 16, 58, tempRecipe.recipeOutput.output, true);
}
}
@@ -1,14 +1,8 @@
package mekanism.client.jei.machine.chemical;
import java.util.ArrayList;
import java.util.List;
import javax.annotation.Nullable;
import mekanism.api.gas.GasStack;
import mekanism.client.jei.machine.BaseRecipeWrapper;
import mekanism.common.recipe.machines.OxidationRecipe;
import mekanism.common.util.LangUtils;
import mezz.jei.api.ingredients.IIngredients;
import net.minecraft.item.ItemStack;
@@ -31,20 +25,6 @@ public class ChemicalOxidizerRecipeWrapper extends BaseRecipeWrapper
ingredients.setOutput(GasStack.class, recipe.recipeOutput.output);
}
@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;
}
@Override
public ChemicalOxidizerRecipeCategory getCategory()
{
@@ -1,15 +1,14 @@
package mekanism.client.jei.machine.chemical;
import java.util.List;
import mekanism.api.gas.GasStack;
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.IGuiIngredientGroup;
import mezz.jei.api.gui.IRecipeLayout;
import mezz.jei.api.gui.ITickTimer;
import mezz.jei.api.gui.ITooltipCallback;
import mezz.jei.api.ingredients.IIngredients;
import mezz.jei.api.recipe.IRecipeWrapper;
import net.minecraft.client.Minecraft;
@@ -18,10 +17,7 @@ import net.minecraftforge.fluids.FluidStack;
public class ChemicalWasherRecipeCategory extends BaseRecipeCategory
{
public IGuiHelper guiHelper;
public IDrawable background;
public IDrawable fluidOverlay;
public WasherRecipe tempRecipe;
@@ -29,17 +25,12 @@ public class ChemicalWasherRecipeCategory extends BaseRecipeCategory
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);
super(helper, "mekanism:gui/nei/GuiChemicalWasher.png", "chemical_washer", "tile.MachineBlock2.ChemicalWasher.name", null);
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
@@ -48,16 +39,6 @@ public class ChemicalWasherRecipeCategory extends BaseRecipeCategory
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
@@ -76,15 +57,13 @@ public class ChemicalWasherRecipeCategory extends BaseRecipeCategory
IGuiFluidStackGroup fluidStacks = recipeLayout.getFluidStacks();
fluidStacks.init(0, true, 6-xOffset, 5-yOffset, 16, 58, 1000, false, fluidOverlay);
fluidStacks.init(0, true, 6-xOffset, 5-yOffset, 16, 58, 1000, false, fluidOverlayLarge);
fluidStacks.set(0, ingredients.getInputs(FluidStack.class).get(0));
fluidStacks.addTooltipCallback(new ITooltipCallback<FluidStack>() {
@Override
public void onTooltip(int slotIndex, boolean input, FluidStack ingredient, List<String> tooltip)
{
tooltip.remove(1);
}
});
fluidStacks.addTooltipCallback((index, input, ingredient, tooltip) -> tooltip.remove(1));
IGuiIngredientGroup gasStacks = recipeLayout.getIngredientsGroup(GasStack.class);
initGas(gasStacks, 0, true, 27-xOffset, 14-yOffset, 16, 58, tempRecipe.getInput().ingredient, true);
initGas(gasStacks, 1, false, 134-xOffset, 14-yOffset, 16, 58, tempRecipe.getOutput().output, true);
}
}
@@ -33,24 +33,6 @@ public class ChemicalWasherRecipeWrapper extends BaseRecipeWrapper
ingredients.setOutput(GasStack.class, recipe.recipeOutput.output);
}
@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;
}
@Override
public ChemicalWasherRecipeCategory getCategory()
{
@@ -1,8 +1,6 @@
package mekanism.client.jei.machine.other;
import java.util.ArrayList;
import java.util.List;
import mekanism.api.gas.GasStack;
import mekanism.client.gui.element.GuiFluidGauge;
import mekanism.client.gui.element.GuiGasGauge;
import mekanism.client.gui.element.GuiGauge;
@@ -21,42 +19,30 @@ 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.IGuiIngredientGroup;
import mezz.jei.api.gui.IRecipeLayout;
import mezz.jei.api.gui.ITickTimer;
import mezz.jei.api.gui.ITooltipCallback;
import mezz.jei.api.ingredients.IIngredients;
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);
super(helper, "mekanism:gui/GuiElectrolyticSeparator.png", "electrolytic_separator", "tile.MachineBlock2.ElectrolyticSeparator.name", ProgressBar.BI);
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
@@ -88,26 +74,6 @@ public class ElectrolyticSeparatorRecipeCategory extends BaseRecipeCategory
}, 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()
{
@@ -124,15 +90,13 @@ public class ElectrolyticSeparatorRecipeCategory extends BaseRecipeCategory
IGuiFluidStackGroup fluidStacks = recipeLayout.getFluidStacks();
fluidStacks.init(0, true, 2, 2, 16, 58, tempRecipe.getInput().ingredient.amount, false, fluidOverlay);
fluidStacks.init(0, true, 2, 2, 16, 58, tempRecipe.getInput().ingredient.amount, false, fluidOverlayLarge);
fluidStacks.set(0, ingredients.getInputs(FluidStack.class).get(0));
fluidStacks.addTooltipCallback(new ITooltipCallback<FluidStack>() {
@Override
public void onTooltip(int slotIndex, boolean input, FluidStack ingredient, List<String> tooltip)
{
tooltip.remove(1);
}
});
fluidStacks.addTooltipCallback((index, input, ingredient, tooltip) -> tooltip.remove(1));
IGuiIngredientGroup gasStacks = recipeLayout.getIngredientsGroup(GasStack.class);
initGas(gasStacks, 0, false, 59-xOffset, 19-yOffset, 16, 28, tempRecipe.recipeOutput.leftGas, true);
initGas(gasStacks, 1, false, 101-xOffset, 19-yOffset, 16, 28, tempRecipe.recipeOutput.rightGas, true);
}
}
@@ -1,10 +1,6 @@
package mekanism.client.jei.machine.other;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import javax.annotation.Nullable;
import mekanism.api.gas.GasStack;
import mekanism.client.jei.machine.BaseRecipeWrapper;
@@ -31,24 +27,6 @@ public class ElectrolyticSeparatorRecipeWrapper extends BaseRecipeWrapper
ingredients.setOutputs(GasStack.class, Arrays.asList(recipe.recipeOutput.leftGas, recipe.recipeOutput.rightGas));
}
@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;
}
@Override
public ElectrolyticSeparatorRecipeCategory getCategory()
{
@@ -33,22 +33,14 @@ 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);
super(helper, "mekanism:gui/GuiMetallurgicInfuser.png", "metallurgic_infuser", "tile.MachineBlock.MetallurgicInfuser.name", ProgressBar.MEDIUM);
xOffset = 5;
yOffset = 16;
@@ -2,6 +2,7 @@ package mekanism.client.jei.machine.other;
import java.util.List;
import mekanism.api.gas.GasStack;
import mekanism.client.gui.element.GuiFluidGauge;
import mekanism.client.gui.element.GuiGasGauge;
import mekanism.client.gui.element.GuiGauge;
@@ -20,6 +21,7 @@ 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.IGuiIngredientGroup;
import mezz.jei.api.gui.IGuiItemStackGroup;
import mezz.jei.api.gui.IRecipeLayout;
import mezz.jei.api.gui.ITickTimer;
@@ -32,31 +34,21 @@ 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);
super(helper, "mekanism:gui/nei/GuiPRC.png", "pressurized_reaction_chamber", "tile.MachineBlock2.PressurizedReactionChamber.short.name", ProgressBar.MEDIUM);
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
@@ -87,24 +79,6 @@ public class PRCRecipeCategory extends BaseRecipeCategory
}, 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()
{
@@ -129,14 +103,13 @@ public class PRCRecipeCategory extends BaseRecipeCategory
IGuiFluidStackGroup fluidStacks = recipeLayout.getFluidStacks();
fluidStacks.init(0, true, 3, 0, 16, 58, tempRecipe.getInput().getFluid().amount, false, fluidOverlay);
fluidStacks.init(0, true, 3, 0, 16, 58, tempRecipe.getInput().getFluid().amount, false, fluidOverlayLarge);
fluidStacks.set(0, tempRecipe.recipeInput.getFluid());
fluidStacks.addTooltipCallback(new ITooltipCallback<FluidStack>() {
@Override
public void onTooltip(int slotIndex, boolean input, FluidStack ingredient, List<String> tooltip)
{
tooltip.remove(1);
}
});
fluidStacks.addTooltipCallback((index, input, ingredient, tooltip) -> tooltip.remove(1));
IGuiIngredientGroup gasStacks = recipeLayout.getIngredientsGroup(GasStack.class);
initGas(gasStacks, 0, true, 29-xOffset, 11-yOffset, 16, 58, tempRecipe.recipeInput.getGas(), true);
initGas(gasStacks, 1, false, 141-xOffset, 41-yOffset, 16, 28, tempRecipe.recipeOutput.getGasOutput(), true);
}
}
@@ -1,14 +1,8 @@
package mekanism.client.jei.machine.other;
import java.util.ArrayList;
import java.util.List;
import javax.annotation.Nullable;
import mekanism.api.gas.GasStack;
import mekanism.client.jei.machine.BaseRecipeWrapper;
import mekanism.common.recipe.machines.PressurizedRecipe;
import mekanism.common.util.LangUtils;
import mezz.jei.api.ingredients.IIngredients;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fluids.FluidStack;
@@ -35,24 +29,6 @@ public class PRCRecipeWrapper extends BaseRecipeWrapper
ingredients.setOutput(GasStack.class, recipe.recipeOutput.getGasOutput());
}
@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;
}
@Override
public PRCRecipeCategory getCategory()
{
@@ -1,14 +1,12 @@
package mekanism.client.jei.machine.other;
import java.util.List;
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.IGuiIngredientGroup;
import mezz.jei.api.gui.IRecipeLayout;
import mezz.jei.api.gui.ITickTimer;
import mezz.jei.api.ingredients.IIngredients;
import mezz.jei.api.recipe.IRecipeWrapper;
import net.minecraft.client.Minecraft;
@@ -17,28 +15,18 @@ import net.minecraftforge.fluids.FluidStack;
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);
super(helper, "mekanism:gui/nei/GuiRotaryCondensentrator.png", "rotary_condensentrator", "nei.rotaryCondensentrator", null);
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
@@ -53,11 +41,6 @@ public class RotaryCondensentratorRecipeCategory extends BaseRecipeCategory
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
@@ -75,14 +58,17 @@ public class RotaryCondensentratorRecipeCategory extends BaseRecipeCategory
}
IGuiFluidStackGroup fluidStacks = recipeLayout.getFluidStacks();
IGuiIngredientGroup gasStacks = recipeLayout.getIngredientsGroup(GasStack.class);
fluidStacks.init(0, !tempRecipe.condensentrating, 134-xOffset, 14-yOffset, 16, 58, 1000, false, fluidOverlay);
fluidStacks.init(0, !tempRecipe.condensentrating, 134-xOffset, 14-yOffset, 16, 58, 1000, false, fluidOverlayLarge);
if(tempRecipe.condensentrating)
{
initGas(gasStacks, 0, true, 26-xOffset, 14-yOffset, 16, 58, new GasStack(tempRecipe.gasType, 1), true);
fluidStacks.set(0, ingredients.getOutputs(FluidStack.class).get(0));
}
else {
initGas(gasStacks, 0, false, 26-xOffset, 14-yOffset, 16, 58, new GasStack(tempRecipe.gasType, 1), true);
fluidStacks.set(0, ingredients.getInputs(FluidStack.class).get(0));
}
}
@@ -1,10 +1,6 @@
package mekanism.client.jei.machine.other;
import java.util.ArrayList;
import java.util.List;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import mekanism.api.gas.Gas;
import mekanism.api.gas.GasStack;
@@ -55,20 +51,6 @@ public class RotaryCondensentratorRecipeWrapper extends BaseRecipeWrapper
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;
}
@Override
public RotaryCondensentratorRecipeCategory getCategory()
{
@@ -1,13 +1,12 @@
package mekanism.client.jei.machine.other;
import java.util.List;
import mekanism.api.gas.GasStack;
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.IGuiIngredientGroup;
import mezz.jei.api.gui.IRecipeLayout;
import mezz.jei.api.gui.ITickTimer;
import mezz.jei.api.ingredients.IIngredients;
import mezz.jei.api.recipe.IRecipeWrapper;
import net.minecraft.client.Minecraft;
@@ -15,22 +14,14 @@ 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);
super(helper, "mekanism:gui/nei/GuiSolarNeutronActivator.png", "solar_neutron_activator", "tile.MachineBlock3.SolarNeutronActivator.name", null);
xOffset = 3;
yOffset = 12;
@@ -43,16 +34,6 @@ public class SolarNeutronRecipeCategory extends BaseRecipeCategory
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
@@ -68,5 +49,10 @@ public class SolarNeutronRecipeCategory extends BaseRecipeCategory
{
tempRecipe = ((SolarNeutronRecipeWrapper)recipeWrapper).recipe;
}
IGuiIngredientGroup gasStacks = recipeLayout.getIngredientsGroup(GasStack.class);
initGas(gasStacks, 0, true, 26-xOffset, 14-yOffset, 16, 58, tempRecipe.recipeInput.ingredient, true);
initGas(gasStacks, 1, false, 134-xOffset, 14-yOffset, 16, 58, tempRecipe.recipeOutput.output, true);
}
}
@@ -1,14 +1,8 @@
package mekanism.client.jei.machine.other;
import java.util.ArrayList;
import java.util.List;
import javax.annotation.Nullable;
import mekanism.api.gas.GasStack;
import mekanism.client.jei.machine.BaseRecipeWrapper;
import mekanism.common.recipe.machines.SolarNeutronRecipe;
import mekanism.common.util.LangUtils;
import mezz.jei.api.ingredients.IIngredients;
public class SolarNeutronRecipeWrapper extends BaseRecipeWrapper
@@ -30,24 +24,6 @@ public class SolarNeutronRecipeWrapper extends BaseRecipeWrapper
ingredients.setOutput(GasStack.class, recipe.getOutput().output);
}
@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;
}
@Override
public SolarNeutronRecipeCategory getCategory()
{
@@ -18,28 +18,18 @@ 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);
super(helper, "mekanism:gui/nei/GuiThermalEvaporationController.png", "thermal_evaporation_plant", "gui.thermalEvaporationController.short", null);
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
@@ -66,18 +56,11 @@ public class ThermalEvaporationRecipeCategory extends BaseRecipeCategory
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.init(0, true, 7-xOffset, 14-yOffset, 16, 58, tempRecipe.getInput().ingredient.amount, false, fluidOverlayLarge);
fluidStacks.init(1, false, 153-xOffset, 14-yOffset, 16, 58, tempRecipe.getOutput().output.amount, false, fluidOverlayLarge);
fluidStacks.set(0, tempRecipe.recipeInput.ingredient);
fluidStacks.set(1, tempRecipe.recipeOutput.output);
fluidStacks.addTooltipCallback(new ITooltipCallback<FluidStack>() {
@Override
public void onTooltip(int slotIndex, boolean input, FluidStack ingredient, List<String> tooltip)
{
tooltip.remove(1);
}
});
fluidStacks.addTooltipCallback((index, input, ingredient, tooltip) -> tooltip.remove(1));
}
}
@@ -19,13 +19,12 @@ import mekanism.common.base.ISustainedInventory;
import mekanism.common.base.ISustainedTank;
import mekanism.common.base.ITierItem;
import mekanism.common.base.IUpgradeTile;
import mekanism.common.block.states.BlockStateBasic;
import mekanism.common.block.states.BlockStateBasic.BasicBlockType;
import mekanism.common.block.states.BlockStateFacing;
import mekanism.common.block.states.BlockStateMachine;
import mekanism.common.block.states.BlockStateMachine.MachineBlock;
import mekanism.common.block.states.BlockStateMachine.MachineType;
import mekanism.common.config.MekanismConfig.client;
import mekanism.common.content.entangloporter.InventoryFrequency;
import mekanism.common.item.ItemBlockMachine;
import mekanism.common.network.PacketLogisticalSorterGui.LogisticalSorterGuiMessage;
import mekanism.common.network.PacketLogisticalSorterGui.SorterGuiPacket;
@@ -36,6 +35,7 @@ import mekanism.common.tile.TileEntityFluidTank;
import mekanism.common.tile.TileEntityLaser;
import mekanism.common.tile.TileEntityLaserAmplifier;
import mekanism.common.tile.TileEntityLogisticalSorter;
import mekanism.common.tile.TileEntityQuantumEntangloporter;
import mekanism.common.tile.TileEntityMetallurgicInfuser;
import mekanism.common.tile.TileEntityPersonalChest;
import mekanism.common.tile.prefab.TileEntityBasicBlock;
@@ -78,7 +78,6 @@ import net.minecraft.util.math.Vec3d;
import net.minecraft.world.Explosion;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.common.property.IExtendedBlockState;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.FluidUtil;
import net.minecraftforge.fluids.capability.IFluidHandlerItem;
@@ -916,6 +915,15 @@ public abstract class BlockMachine extends BlockContainer
factoryItem.setRecipeType(((TileEntityFactory)tileEntity).recipeType.ordinal(), itemStack);
}
if (tileEntity instanceof TileEntityQuantumEntangloporter)
{
InventoryFrequency frequency = ((TileEntityQuantumEntangloporter) tileEntity).frequency;
if (frequency != null)
{
ItemDataUtils.setCompound(itemStack, "entangleporter_frequency", frequency.getIdentity().serialise());
}
}
return itemStack;
}
@@ -8,6 +8,7 @@ import java.util.UUID;
import mekanism.api.gas.GasStack;
import mekanism.api.gas.GasTank;
import mekanism.common.PacketHandler;
import mekanism.common.Tier;
import mekanism.common.frequency.Frequency;
import mekanism.common.util.InventoryUtils;
import net.minecraft.item.ItemStack;
@@ -23,8 +24,10 @@ public class InventoryFrequency extends Frequency
{
public static final String ENTANGLOPORTER = "Entangloporter";
public static final double MAX_ENERGY = 1000000;
public static final double MAX_ENERGY = Tier.EnergyCubeTier.ULTIMATE.output;
public static final int FLUID_TANK_SIZE = Tier.FluidTankTier.ULTIMATE.output;
public static final int GAS_TANK_SIZE = Tier.GasTankTier.ULTIMATE.output;
public double storedEnergy;
public FluidTank storedFluid;
public GasTank storedGas;
@@ -35,8 +38,8 @@ public class InventoryFrequency extends Frequency
{
super(n, uuid);
storedFluid = new FluidTank(1000);
storedGas = new GasTank(1000);
storedFluid = new FluidTank(FLUID_TANK_SIZE);
storedGas = new GasTank(GAS_TANK_SIZE);
}
public InventoryFrequency(NBTTagCompound nbtTags)
@@ -89,8 +92,8 @@ public class InventoryFrequency extends Frequency
{
super.read(nbtTags);
storedFluid = new FluidTank(1000);
storedGas = new GasTank(1000);
storedFluid = new FluidTank(FLUID_TANK_SIZE);
storedGas = new GasTank(GAS_TANK_SIZE);
storedEnergy = nbtTags.getDouble("storedEnergy");
@@ -156,8 +159,8 @@ public class InventoryFrequency extends Frequency
{
super.read(dataStream);
storedFluid = new FluidTank(1000);
storedGas = new GasTank(1000);
storedFluid = new FluidTank(FLUID_TANK_SIZE);
storedGas = new GasTank(GAS_TANK_SIZE);
storedEnergy = dataStream.readDouble();
@@ -13,6 +13,8 @@ import mekanism.common.util.MekanismUtils;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.common.UsernameCache;
import javax.annotation.Nullable;
public class Frequency
{
public static final String TELEPORTER = "Teleporter";
@@ -147,4 +149,36 @@ public class Frequency
return obj instanceof Frequency && ((Frequency)obj).name.equals(name)
&& ((Frequency)obj).ownerUUID.equals(ownerUUID) && ((Frequency)obj).publicFreq == publicFreq;
}
public Identity getIdentity(){
return new Identity(this.name, this.publicFreq);
}
public static class Identity {
public String name;
public boolean publicFreq;
private Identity(String name, boolean publicFreq)
{
this.name = name;
this.publicFreq = publicFreq;
}
@Nullable
public static Identity load(NBTTagCompound data)
{
if (!data.getString("name").isEmpty()){
return new Identity(data.getString("name"), data.getBoolean("publicFreq"));
}
return null;
}
public NBTTagCompound serialise()
{
NBTTagCompound tag = new NBTTagCompound();
tag.setString("name", this.name);
tag.setBoolean("publicFreq", this.publicFreq);
return tag;
}
}
}
@@ -0,0 +1,198 @@
package mekanism.common.inventory;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.ItemStackHelper;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.NonNullList;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.TextComponentString;
import net.minecraft.util.text.TextComponentTranslation;
/*Copied & modified from net.minecraft.inventory.InventoryBasic */
public class InventoryList implements IInventory
{
private String inventoryTitle;
private final int slotsCount;
private final NonNullList<ItemStack> inventoryContents;
private final TileEntity te;
public InventoryList(NonNullList<ItemStack> list, TileEntity parent)
{
this.inventoryTitle = "Proxy";
this.slotsCount = list.size();
this.inventoryContents = list;
this.te = parent;
}
/**
* Returns the stack in the given slot.
*/
public ItemStack getStackInSlot(int index)
{
return index >= 0 && index < this.inventoryContents.size() ? (ItemStack)this.inventoryContents.get(index) : ItemStack.EMPTY;
}
/**
* Removes up to a specified number of items from an inventory slot and returns them in a new stack.
*/
public ItemStack decrStackSize(int index, int count)
{
ItemStack itemstack = ItemStackHelper.getAndSplit(this.inventoryContents, index, count);
if (!itemstack.isEmpty())
{
this.markDirty();
}
return itemstack;
}
/**
* Removes a stack from the given slot and returns it.
*/
public ItemStack removeStackFromSlot(int index)
{
ItemStack itemstack = (ItemStack)this.inventoryContents.get(index);
if (itemstack.isEmpty())
{
return ItemStack.EMPTY;
}
else
{
this.inventoryContents.set(index, ItemStack.EMPTY);
return itemstack;
}
}
/**
* Sets the given item stack to the specified slot in the inventory (can be crafting or armor sections).
*/
public void setInventorySlotContents(int index, ItemStack stack)
{
this.inventoryContents.set(index, stack);
if (!stack.isEmpty() && stack.getCount() > this.getInventoryStackLimit())
{
stack.setCount(this.getInventoryStackLimit());
}
this.markDirty();
}
/**
* Returns the number of slots in the inventory.
*/
public int getSizeInventory()
{
return this.slotsCount;
}
public boolean isEmpty()
{
for (ItemStack itemstack : this.inventoryContents)
{
if (!itemstack.isEmpty())
{
return false;
}
}
return true;
}
/**
* Get the name of this object. For players this returns their username
*/
public String getName()
{
return this.inventoryTitle;
}
/**
* Returns true if this thing is named
*/
public boolean hasCustomName()
{
return false;
}
/**
* Sets the name of this inventory. This is displayed to the client on opening.
*/
public void setCustomName(String inventoryTitleIn)
{
}
/**
* Get the formatted ChatComponent that will be used for the sender's username in chat
*/
public ITextComponent getDisplayName()
{
return (ITextComponent)(this.hasCustomName() ? new TextComponentString(this.getName()) : new TextComponentTranslation(this.getName(), new Object[0]));
}
/**
* Returns the maximum stack size for a inventory slot. Seems to always be 64, possibly will be extended.
*/
public int getInventoryStackLimit()
{
return 64;
}
/**
* For tile entities, ensures the chunk containing the tile entity is saved to disk later - the game won't think it
* hasn't changed and skip it.
*/
public void markDirty()
{
this.te.markDirty();
}
/**
* Don't rename this method to canInteractWith due to conflicts with Container
*/
public boolean isUsableByPlayer(EntityPlayer player)
{
return true;
}
public void openInventory(EntityPlayer player)
{
}
public void closeInventory(EntityPlayer player)
{
}
/**
* Returns true if automation is allowed to insert the given stack (ignoring stack size) into the given slot. For
* guis use Slot.isItemValid
*/
public boolean isItemValidForSlot(int index, ItemStack stack)
{
return true;
}
public int getField(int id)
{
return 0;
}
public void setField(int id, int value)
{
}
public int getFieldCount()
{
return 0;
}
public void clear()
{
this.inventoryContents.clear();
}
}
@@ -2,13 +2,17 @@ package mekanism.common.inventory.container;
import mekanism.common.base.IUpgradeItem;
import mekanism.common.base.IUpgradeTile;
import mekanism.common.inventory.InventoryList;
import mekanism.common.inventory.slot.SlotMachineUpgrade;
import mekanism.common.tile.TileEntityQuantumEntangloporter;
import mekanism.common.tile.prefab.TileEntityContainerBlock;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
public class ContainerUpgradeManagement extends Container
{
@@ -17,7 +21,19 @@ public class ContainerUpgradeManagement extends Container
public ContainerUpgradeManagement(InventoryPlayer inventory, IUpgradeTile tile)
{
tileEntity = tile;
addSlotToContainer(new SlotMachineUpgrade((TileEntityContainerBlock)tile, tileEntity.getComponent().getUpgradeSlot(), 154, 7));
//Bit of a hack I guess, but we need to give it access to the inventory list, not the Frequency
IInventory upgradeInv;
if (tileEntity instanceof TileEntityQuantumEntangloporter)
{
upgradeInv = new InventoryList(((TileEntityQuantumEntangloporter) tileEntity).inventory, (TileEntity) tileEntity);
}
else
{
upgradeInv = (TileEntityContainerBlock)tile;
}
addSlotToContainer(new SlotMachineUpgrade(upgradeInv, tileEntity.getComponent().getUpgradeSlot(), 154, 7));
int slotY;
@@ -36,6 +36,7 @@ import mekanism.common.block.states.BlockStateMachine.MachineType;
import mekanism.common.capabilities.ItemCapabilityWrapper;
import mekanism.common.config.MekanismConfig.general;
import mekanism.common.integration.MekanismHooks;
import mekanism.common.frequency.Frequency;
import mekanism.common.integration.forgeenergy.ForgeEnergyItemWrapper;
import mekanism.common.integration.ic2.IC2ItemManager;
import mekanism.common.integration.tesla.TeslaItemWrapper;
@@ -46,6 +47,7 @@ import mekanism.common.security.ISecurityTile;
import mekanism.common.security.ISecurityTile.SecurityMode;
import mekanism.common.tile.TileEntityFactory;
import mekanism.common.tile.TileEntityFluidTank;
import mekanism.common.tile.TileEntityQuantumEntangloporter;
import mekanism.common.tile.prefab.TileEntityBasicBlock;
import mekanism.common.tile.prefab.TileEntityElectricBlock;
import mekanism.common.util.ItemDataUtils;
@@ -241,6 +243,15 @@ public class ItemBlockMachine extends ItemBlock implements IEnergizedItem, ISpec
list.add(EnumColor.INDIGO + LangUtils.localize("tooltip.portableTank.bucketMode") + ": " + EnumColor.GREY + LangUtils.transYesNo(getBucketMode(itemstack)));
}
if (type == MachineType.QUANTUM_ENTANGLOPORTER)
{
Frequency.Identity freq = Frequency.Identity.load(ItemDataUtils.getCompound(itemstack, "entangleporter_frequency"));
if (freq != null)
{
list.add(EnumColor.INDIGO + LangUtils.localize("gui.frequency") + ": "+EnumColor.GREY + freq.name + " (" + LangUtils.localize(freq.publicFreq ? "security.public" : "security.private") + ")");
}
}
if(type.isElectric)
{
list.add(EnumColor.BRIGHT_GREEN + LangUtils.localize("tooltip.storedEnergy") + ": " + EnumColor.GREY + MekanismUtils.getEnergyDisplay(getEnergy(itemstack), getMaxEnergy(itemstack)));
@@ -414,6 +425,15 @@ public class ItemBlockMachine extends ItemBlock implements IEnergizedItem, ISpec
((TileEntityElectricBlock)tileEntity).electricityStored = getEnergy(stack);
}
if (tileEntity instanceof TileEntityQuantumEntangloporter && ItemDataUtils.hasData(stack, "entangleporter_frequency"))
{
Frequency.Identity freq = Frequency.Identity.load(ItemDataUtils.getCompound(stack, "entangleporter_frequency"));
if (freq != null)
{
((TileEntityQuantumEntangloporter) tileEntity).setFrequency(freq.name, freq.publicFreq);
}
}
return true;
}
@@ -3,9 +3,11 @@ package mekanism.common.tile;
import io.netty.buffer.ByteBuf;
import java.util.ArrayList;
import java.util.EnumSet;
import java.util.Set;
import java.util.HashSet;
import java.util.List;
import mekanism.api.Chunk3D;
import mekanism.api.Coord4D;
import mekanism.api.IHeatTransfer;
import mekanism.api.gas.Gas;
@@ -16,20 +18,17 @@ import mekanism.api.transmitters.TransmissionType;
import mekanism.common.Mekanism;
import mekanism.common.PacketHandler;
import mekanism.common.SideData.IOState;
import mekanism.common.base.FluidHandlerWrapper;
import mekanism.common.base.IFluidHandlerWrapper;
import mekanism.common.base.ISideConfiguration;
import mekanism.common.base.ITankManager;
import mekanism.common.Upgrade;
import mekanism.common.base.*;
import mekanism.common.capabilities.Capabilities;
import mekanism.common.chunkloading.IChunkLoader;
import mekanism.common.content.entangloporter.InventoryFrequency;
import mekanism.common.frequency.Frequency;
import mekanism.common.frequency.FrequencyManager;
import mekanism.common.frequency.IFrequencyHandler;
import mekanism.common.integration.computer.IComputerIntegration;
import mekanism.common.security.ISecurityTile;
import mekanism.common.tile.component.TileComponentConfig;
import mekanism.common.tile.component.TileComponentEjector;
import mekanism.common.tile.component.TileComponentSecurity;
import mekanism.common.tile.component.*;
import mekanism.common.tile.prefab.TileEntityElectricBlock;
import mekanism.common.util.CableUtils;
import mekanism.common.util.CapabilityUtils;
@@ -39,17 +38,20 @@ import mekanism.common.util.MekanismUtils;
import mekanism.common.util.PipeUtils;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.NonNullList;
import net.minecraft.util.math.ChunkPos;
import net.minecraftforge.common.capabilities.Capability;
import net.minecraftforge.common.util.Constants;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.FluidTankInfo;
import net.minecraftforge.fluids.capability.CapabilityFluidHandler;
import net.minecraftforge.fml.common.FMLCommonHandler;
public class TileEntityQuantumEntangloporter extends TileEntityElectricBlock implements ISideConfiguration, ITankManager, IFluidHandlerWrapper, IFrequencyHandler, IGasHandler, IHeatTransfer, ITubeConnection, IComputerIntegration, ISecurityTile
public class TileEntityQuantumEntangloporter extends TileEntityElectricBlock implements ISideConfiguration, ITankManager, IFluidHandlerWrapper, IFrequencyHandler, IGasHandler, IHeatTransfer, ITubeConnection, IComputerIntegration, ISecurityTile, IChunkLoader, IUpgradeTile
{
public InventoryFrequency frequency;
@@ -64,6 +66,10 @@ public class TileEntityQuantumEntangloporter extends TileEntityElectricBlock imp
public TileComponentEjector ejectorComponent;
public TileComponentConfig configComponent;
public TileComponentSecurity securityComponent;
public TileComponentChunkLoader chunkLoaderComponent;
public TileComponentUpgrade upgradeComponent;
private static final int INV_SIZE = 1;//this.inventory size, used for upgrades. Manually handled
public TileEntityQuantumEntangloporter()
{
@@ -82,7 +88,7 @@ public class TileEntityQuantumEntangloporter extends TileEntityElectricBlock imp
}
}
inventory = NonNullList.withSize(0, ItemStack.EMPTY);
inventory = NonNullList.withSize(INV_SIZE, ItemStack.EMPTY);
configComponent.getOutputs(TransmissionType.ITEM).get(2).availableSlots = new int[] {0};
configComponent.getOutputs(TransmissionType.FLUID).get(2).availableSlots = new int[] {0};
@@ -94,6 +100,11 @@ public class TileEntityQuantumEntangloporter extends TileEntityElectricBlock imp
ejectorComponent.setOutputData(TransmissionType.GAS, configComponent.getOutputs(TransmissionType.GAS).get(2));
securityComponent = new TileComponentSecurity(this);
chunkLoaderComponent = new TileComponentChunkLoader(this);
upgradeComponent = new TileComponentUpgrade(this, 0);
upgradeComponent.clearSupportedTypes();
upgradeComponent.setSupported(Upgrade.ANCHOR);
}
@Override
@@ -241,6 +252,21 @@ public class TileEntityQuantumEntangloporter extends TileEntityElectricBlock imp
frequency = new InventoryFrequency(nbtTags.getCompoundTag("frequency"));
frequency.valid = false;
}
NBTTagList tagList = nbtTags.getTagList("upgradesInv", Constants.NBT.TAG_COMPOUND);
inventory = NonNullList.withSize(INV_SIZE, ItemStack.EMPTY);
for(int tagCount = 0; tagCount < tagList.tagCount(); tagCount++)
{
NBTTagCompound tagCompound = tagList.getCompoundTagAt(tagCount);
byte slotID = tagCompound.getByte("Slot");
if(slotID >= 0 && slotID < inventory.size())
{
inventory.set(slotID, InventoryUtils.loadFromNBT(tagCompound));
}
}
}
@Override
@@ -254,6 +280,21 @@ public class TileEntityQuantumEntangloporter extends TileEntityElectricBlock imp
frequency.write(frequencyTag);
nbtTags.setTag("frequency", frequencyTag);
}
//Upgrades inventory
NBTTagList tagList = new NBTTagList();
for(int slotCount = 0; slotCount < inventory.size(); slotCount++)
{
ItemStack stackInSlot = inventory.get(slotCount);
if(!stackInSlot.isEmpty())
{
NBTTagCompound tagCompound = new NBTTagCompound();
tagCompound.setByte("Slot", (byte)slotCount);
stackInSlot.writeToNBT(tagCompound);
tagList.appendTag(tagCompound);
}
}
nbtTags.setTag("upgradesInv", tagList);
return nbtTags;
}
@@ -410,7 +451,7 @@ public class TileEntityQuantumEntangloporter extends TileEntityElectricBlock imp
@Override
public double getMaxEnergy()
{
return !hasFrequency() ? 0 : frequency.MAX_ENERGY;
return !hasFrequency() ? 0 : InventoryFrequency.MAX_ENERGY;
}
@Override
@@ -706,4 +747,26 @@ public class TileEntityQuantumEntangloporter extends TileEntityElectricBlock imp
throw new NoSuchMethodException();
}
}
@Override
public TileComponentChunkLoader getChunkLoader()
{
return chunkLoaderComponent;
}
@Override
public Set<ChunkPos> getChunkSet()
{
Set<ChunkPos> ret = new HashSet<ChunkPos>();
ret.add(new Chunk3D(Coord4D.get(this)).getPos());
return ret;
}
@Override
public TileComponentUpgrade getComponent()
{
return this.upgradeComponent;
}
}
@@ -55,6 +55,7 @@ public class TileComponentUpgrade implements ITileComponent
upgradeTicks = upgrade.upgradeTicks;
}
// This SHOULD continue to directly use te.inventory, as it is needed for Entangleporter upgrades, since it messes with IInventory.
@Override
public void tick()
{