mirror of
https://github.com/GTNewHorizons/EnderIO.git
synced 2026-11-24 22:14:42 +00:00
Compare commits
5
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4733a801f8 | ||
|
|
5df84d108d | ||
|
|
989c99aaad | ||
|
|
c88cc8fa98 | ||
|
|
07b44d03ca |
No files matched your search
+1
-1
@@ -3,7 +3,7 @@
|
|||||||
dependencies {
|
dependencies {
|
||||||
api('com.github.GTNewHorizons:EnderCore:0.5.15:dev') {transitive = false}
|
api('com.github.GTNewHorizons:EnderCore:0.5.15:dev') {transitive = false}
|
||||||
compileOnly('com.github.GTNewHorizons:ForestryMC:4.11.37:dev')
|
compileOnly('com.github.GTNewHorizons:ForestryMC:4.11.37:dev')
|
||||||
compileOnly('com.github.GTNewHorizons:NotEnoughItems:2.8.130-GTNH:dev')
|
devOnlyNonPublishable('com.github.GTNewHorizons:NotEnoughItems:2.8.148-GTNH:dev')
|
||||||
api("com.github.GTNewHorizons:GTNHLib:0.11.45:dev")
|
api("com.github.GTNewHorizons:GTNHLib:0.11.45:dev")
|
||||||
compileOnly('com.github.GTNewHorizons:BuildCraft:7.1.63:dev')
|
compileOnly('com.github.GTNewHorizons:BuildCraft:7.1.63:dev')
|
||||||
api('curse.maven:cofh-lib-220333:2388748') // https://www.curseforge.com/minecraft/mc-mods/cofh-lib/files/2388748
|
api('curse.maven:cofh-lib-220333:2388748') // https://www.curseforge.com/minecraft/mc-mods/cofh-lib/files/2388748
|
||||||
|
|||||||
@@ -78,6 +78,16 @@ public class NEIEnderIOConfig implements IConfigureNEI {
|
|||||||
API.hideItem(new ItemStack(EnderIO.itemGasConduit));
|
API.hideItem(new ItemStack(EnderIO.itemGasConduit));
|
||||||
}
|
}
|
||||||
API.hideItem(new ItemStack(EnderIO.blockHyperCube));
|
API.hideItem(new ItemStack(EnderIO.blockHyperCube));
|
||||||
|
|
||||||
|
API.hideItem(new ItemStack(EnderIO.blockNutrientDistillation));
|
||||||
|
API.hideItem(new ItemStack(EnderIO.blockHootch));
|
||||||
|
API.hideItem(new ItemStack(EnderIO.blockRocketFuel));
|
||||||
|
API.hideItem(new ItemStack(EnderIO.blockFireWater));
|
||||||
|
API.hideItem(new ItemStack(EnderIO.blockLiquidSunshine));
|
||||||
|
API.hideItem(new ItemStack(EnderIO.blockCloudSeed));
|
||||||
|
API.hideItem(new ItemStack(EnderIO.blockCloudSeedConcentrated));
|
||||||
|
API.hideItem(new ItemStack(EnderIO.blockEnderDistillation));
|
||||||
|
API.hideItem(new ItemStack(EnderIO.blockVapourOfLevity));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
package crazypants.enderio.nei;
|
package crazypants.enderio.nei;
|
||||||
|
|
||||||
import java.awt.Point;
|
|
||||||
import java.awt.Rectangle;
|
import java.awt.Rectangle;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
@@ -9,25 +8,18 @@ import java.util.Map;
|
|||||||
|
|
||||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.util.EnumChatFormatting;
|
|
||||||
import net.minecraft.util.StatCollector;
|
import net.minecraft.util.StatCollector;
|
||||||
import net.minecraftforge.fluids.Fluid;
|
|
||||||
import net.minecraftforge.fluids.FluidContainerRegistry;
|
import net.minecraftforge.fluids.FluidContainerRegistry;
|
||||||
import net.minecraftforge.fluids.FluidStack;
|
import net.minecraftforge.fluids.FluidStack;
|
||||||
|
|
||||||
import org.lwjgl.opengl.GL11;
|
import org.lwjgl.opengl.GL11;
|
||||||
|
|
||||||
import com.enderio.core.client.render.RenderUtil;
|
|
||||||
import com.enderio.core.common.util.FluidUtil;
|
import com.enderio.core.common.util.FluidUtil;
|
||||||
|
|
||||||
import codechicken.lib.gui.GuiDraw;
|
import codechicken.lib.gui.GuiDraw;
|
||||||
import codechicken.nei.ItemStackMap;
|
import codechicken.nei.ItemStackMap;
|
||||||
import codechicken.nei.PositionedStack;
|
import codechicken.nei.PositionedStack;
|
||||||
import codechicken.nei.recipe.GuiCraftingRecipe;
|
|
||||||
import codechicken.nei.recipe.GuiRecipe;
|
|
||||||
import codechicken.nei.recipe.GuiUsageRecipe;
|
|
||||||
import codechicken.nei.recipe.TemplateRecipeHandler;
|
import codechicken.nei.recipe.TemplateRecipeHandler;
|
||||||
import crazypants.enderio.fluid.Fluids;
|
|
||||||
import crazypants.enderio.gui.GuiContainerBaseEIO;
|
import crazypants.enderio.gui.GuiContainerBaseEIO;
|
||||||
import crazypants.enderio.machine.recipe.IRecipe;
|
import crazypants.enderio.machine.recipe.IRecipe;
|
||||||
import crazypants.enderio.machine.recipe.RecipeInput;
|
import crazypants.enderio.machine.recipe.RecipeInput;
|
||||||
@@ -38,9 +30,6 @@ import crazypants.util.ColorUtils;
|
|||||||
|
|
||||||
public class VatRecipeHandler extends TemplateRecipeHandler {
|
public class VatRecipeHandler extends TemplateRecipeHandler {
|
||||||
|
|
||||||
private final Rectangle inTankBounds = new Rectangle(25, 1, 15, 47);
|
|
||||||
private final Rectangle outTankBounds = new Rectangle(127, 1, 15, 47);
|
|
||||||
|
|
||||||
public VatRecipeHandler() {}
|
public VatRecipeHandler() {}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -159,109 +148,23 @@ public class VatRecipeHandler extends TemplateRecipeHandler {
|
|||||||
@Override
|
@Override
|
||||||
public void drawExtras(int recipeIndex) {
|
public void drawExtras(int recipeIndex) {
|
||||||
InnerVatRecipe rec = (InnerVatRecipe) arecipes.get(recipeIndex);
|
InnerVatRecipe rec = (InnerVatRecipe) arecipes.get(recipeIndex);
|
||||||
if (rec.inFluid != null && rec.inFluid.getFluid() != null) {
|
|
||||||
RenderUtil.renderGuiTank(
|
|
||||||
rec.inFluid,
|
|
||||||
FluidContainerRegistry.BUCKET_VOLUME * 8,
|
|
||||||
rec.getInputFluidAmount(),
|
|
||||||
inTankBounds.x,
|
|
||||||
inTankBounds.y,
|
|
||||||
0,
|
|
||||||
inTankBounds.width,
|
|
||||||
inTankBounds.height);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (rec.result != null && rec.result.getFluid() != null) {
|
|
||||||
RenderUtil.renderGuiTank(
|
|
||||||
rec.result,
|
|
||||||
FluidContainerRegistry.BUCKET_VOLUME * 8,
|
|
||||||
rec.getResultFluidAmount(),
|
|
||||||
outTankBounds.x,
|
|
||||||
outTankBounds.y,
|
|
||||||
0,
|
|
||||||
outTankBounds.width,
|
|
||||||
outTankBounds.height);
|
|
||||||
}
|
|
||||||
|
|
||||||
String energyString = PowerDisplayUtil.formatPower(rec.energy) + " " + PowerDisplayUtil.abrevation();
|
String energyString = PowerDisplayUtil.formatPower(rec.energy) + " " + PowerDisplayUtil.abrevation();
|
||||||
GuiDraw.drawStringC(energyString, 86, 54, ColorUtils.neiEnergyString.getColor(), false);
|
GuiDraw.drawStringC(energyString, 86, 54, ColorUtils.neiEnergyString.getColor(), false);
|
||||||
|
|
||||||
Fluid outputFluid = rec.result.getFluid();
|
drawMultiplier(rec.firstStack, rec.getFirstItemMultiplier());
|
||||||
List<PositionedStack> stacks = rec.getIngredients();
|
drawMultiplier(rec.secondStack, rec.getSecondItemMultiplier());
|
||||||
for (PositionedStack ps : stacks) {
|
|
||||||
float mult = VatRecipeManager.getInstance()
|
|
||||||
.getMultiplierForInput(rec.inFluid.getFluid(), ps.item, outputFluid);
|
|
||||||
String str = "x" + mult;
|
|
||||||
GuiDraw.drawStringC(str, ps.relx + 8, ps.rely + 19, ColorUtils.neiMultiplierString.getColor(), false);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
private static void drawMultiplier(PositionedStack stack, float multiplier) {
|
||||||
public List<String> handleItemTooltip(GuiRecipe<?> gui, ItemStack stack, List<String> currenttip, int recipeIndex) {
|
if (stack != null) {
|
||||||
return currenttip;
|
GuiDraw.drawStringC(
|
||||||
}
|
"x" + multiplier,
|
||||||
|
stack.relx + 8,
|
||||||
@Override
|
stack.rely + 19,
|
||||||
public List<String> handleTooltip(GuiRecipe<?> gui, List<String> currenttip, int recipeIndex) {
|
ColorUtils.neiMultiplierString.getColor(),
|
||||||
final InnerVatRecipe rec = (InnerVatRecipe) arecipes.get(recipeIndex);
|
false);
|
||||||
final Point pos = GuiDraw.getMousePosition();
|
|
||||||
final Point offset = gui.getRecipePosition(recipeIndex);
|
|
||||||
final Point relMouse = new Point(pos.x - gui.guiLeft - offset.x, pos.y - gui.guiTop - offset.y);
|
|
||||||
|
|
||||||
if (inTankBounds.contains(relMouse) && rec.inFluid != null && rec.inFluid.getFluid() != null) {
|
|
||||||
currenttip.add(rec.inFluid.getFluid().getLocalizedName(rec.inFluid));
|
|
||||||
currenttip.add(EnumChatFormatting.GRAY.toString() + rec.getInputFluidAmount() + " " + Fluids.MB());
|
|
||||||
} else if (outTankBounds.contains(relMouse) && rec.result != null && rec.result.getFluid() != null) {
|
|
||||||
currenttip.add(rec.result.getFluid().getLocalizedName(rec.result));
|
|
||||||
currenttip.add(EnumChatFormatting.GRAY.toString() + rec.getResultFluidAmount() + " " + Fluids.MB());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return super.handleTooltip(gui, currenttip, recipeIndex);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean mouseClicked(GuiRecipe<?> gui, int button, int recipeIndex) {
|
|
||||||
if (button == 0) {
|
|
||||||
if (this.transferFluidTanks(gui, recipeIndex, false)) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
} else if (button == 1) {
|
|
||||||
if (this.transferFluidTanks(gui, recipeIndex, true)) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return super.mouseClicked(gui, button, recipeIndex);
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean transferFluidTanks(GuiRecipe<?> gui, int recipeIndex, boolean usage) {
|
|
||||||
InnerVatRecipe rec = (InnerVatRecipe) arecipes.get(recipeIndex);
|
|
||||||
Point pos = GuiDraw.getMousePosition();
|
|
||||||
Point offset = gui.getRecipePosition(recipeIndex);
|
|
||||||
Point relMouse = new Point(pos.x - gui.guiLeft - offset.x, pos.y - gui.guiTop - offset.y);
|
|
||||||
|
|
||||||
if (inTankBounds.contains(relMouse)) {
|
|
||||||
transferFluidTank(rec.inFluid, usage);
|
|
||||||
} else if (outTankBounds.contains(relMouse)) {
|
|
||||||
transferFluidTank(rec.result, usage);
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean transferFluidTank(FluidStack tank, boolean usage) {
|
|
||||||
if (tank != null && tank.amount > 0) {
|
|
||||||
if (usage) {
|
|
||||||
if (!GuiUsageRecipe.openRecipeGui("liquid", new Object[] { tank.copy() })) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (!GuiCraftingRecipe.openRecipeGui("liquid", new Object[] { tank.copy() })) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<ItemStack> getInputs(RecipeInput input) {
|
public List<ItemStack> getInputs(RecipeInput input) {
|
||||||
@@ -279,12 +182,19 @@ public class VatRecipeHandler extends TemplateRecipeHandler {
|
|||||||
public class InnerVatRecipe extends TemplateRecipeHandler.CachedRecipe {
|
public class InnerVatRecipe extends TemplateRecipeHandler.CachedRecipe {
|
||||||
|
|
||||||
private final List<PositionedStack> inputs = new ArrayList<>();
|
private final List<PositionedStack> inputs = new ArrayList<>();
|
||||||
private final ItemStackMap<Float> firstItemMultiplier = new ItemStackMap();
|
private final ItemStackMap<Float> firstItemMultiplier = new ItemStackMap<>();
|
||||||
private final ItemStackMap<Float> secondItemMultiplier = new ItemStackMap();
|
private final ItemStackMap<Float> secondItemMultiplier = new ItemStackMap<>();
|
||||||
private final Map<FluidStack, Float> fluidMultiplier = new HashMap<>();
|
private final Map<FluidStack, Float> fluidMultiplier = new HashMap<>();
|
||||||
|
private final FluidStack resultFluid;
|
||||||
private final int energy;
|
private final int energy;
|
||||||
private final FluidStack result;
|
|
||||||
private FluidStack inFluid;
|
private FluidStack inFluid;
|
||||||
|
private PositionedStack firstStack;
|
||||||
|
private PositionedStack secondStack;
|
||||||
|
|
||||||
|
private int inTankIndex = -1;
|
||||||
|
private int lastInputAmount;
|
||||||
|
private PositionedStack resultTank;
|
||||||
|
private int lastResultAmount;
|
||||||
|
|
||||||
public int getEnergy() {
|
public int getEnergy() {
|
||||||
return energy;
|
return energy;
|
||||||
@@ -292,7 +202,14 @@ public class VatRecipeHandler extends TemplateRecipeHandler {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<PositionedStack> getIngredients() {
|
public List<PositionedStack> getIngredients() {
|
||||||
return getCycledIngredients(cycleticks / 30, this.inputs);
|
if (this.inTankIndex >= 0) {
|
||||||
|
int amount = getInputFluidAmount();
|
||||||
|
if (amount != this.lastInputAmount) {
|
||||||
|
this.lastInputAmount = amount;
|
||||||
|
this.inputs.set(this.inTankIndex, createTank(new FluidStack(this.inFluid, amount), 25, 1));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return this.inputs;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getInputFluidAmount() {
|
public int getInputFluidAmount() {
|
||||||
@@ -308,11 +225,11 @@ public class VatRecipeHandler extends TemplateRecipeHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public float getFirstItemMultiplier() {
|
public float getFirstItemMultiplier() {
|
||||||
return this.inputs.isEmpty() ? 1f : this.firstItemMultiplier.getOrDefault(this.inputs.get(0).item, 1f);
|
return this.firstStack == null ? 1f : this.firstItemMultiplier.getOrDefault(this.firstStack.item, 1f);
|
||||||
}
|
}
|
||||||
|
|
||||||
public float getSecondItemMultiplier() {
|
public float getSecondItemMultiplier() {
|
||||||
return this.inputs.size() < 2 ? 1f : this.secondItemMultiplier.getOrDefault(this.inputs.get(1).item, 1f);
|
return this.secondStack == null ? 1f : this.secondItemMultiplier.getOrDefault(this.secondStack.item, 1f);
|
||||||
}
|
}
|
||||||
|
|
||||||
public float getFluidMultiplier() {
|
public float getFluidMultiplier() {
|
||||||
@@ -321,7 +238,12 @@ public class VatRecipeHandler extends TemplateRecipeHandler {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PositionedStack getResult() {
|
public PositionedStack getResult() {
|
||||||
return null;
|
int amount = getResultFluidAmount();
|
||||||
|
if (amount != this.lastResultAmount) {
|
||||||
|
this.lastResultAmount = amount;
|
||||||
|
this.resultTank = createTank(new FluidStack(this.resultFluid, amount), 127, 1);
|
||||||
|
}
|
||||||
|
return this.resultTank;
|
||||||
}
|
}
|
||||||
|
|
||||||
public InnerVatRecipe(int energy, RecipeInput[] ingredients, FluidStack result) {
|
public InnerVatRecipe(int energy, RecipeInput[] ingredients, FluidStack result) {
|
||||||
@@ -356,14 +278,30 @@ public class VatRecipeHandler extends TemplateRecipeHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!inputsOne.isEmpty()) {
|
if (!inputsOne.isEmpty()) {
|
||||||
this.inputs.add(new PositionedStack(inputsOne, 51, 1));
|
this.firstStack = new PositionedStack(inputsOne, 51, 1);
|
||||||
|
this.inputs.add(this.firstStack);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!inputsTwo.isEmpty()) {
|
if (!inputsTwo.isEmpty()) {
|
||||||
this.inputs.add(new PositionedStack(inputsTwo, 100, 1));
|
this.secondStack = new PositionedStack(inputsTwo, 100, 1);
|
||||||
|
this.inputs.add(this.secondStack);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.energy = energy;
|
this.energy = energy;
|
||||||
this.result = result;
|
this.resultFluid = result;
|
||||||
|
|
||||||
|
if (this.inFluid != null) {
|
||||||
|
this.inTankIndex = this.inputs.size();
|
||||||
|
this.lastInputAmount = getInputFluidAmount();
|
||||||
|
this.inputs.add(createTank(new FluidStack(this.inFluid, this.lastInputAmount), 25, 1));
|
||||||
|
}
|
||||||
|
|
||||||
|
this.lastResultAmount = getResultFluidAmount();
|
||||||
|
this.resultTank = createTank(new FluidStack(this.resultFluid, this.lastResultAmount), 127, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static PositionedStack.Tank createTank(FluidStack fluid, int x, int y) {
|
||||||
|
return new PositionedStack.Tank(fluid, x, y, 15, 47, FluidContainerRegistry.BUCKET_VOLUME * 8);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user