Compare commits

...
14 changed files with 198 additions and 249 deletions

No files matched your search

+8 -8
View File
@@ -1,14 +1,14 @@
// Add your dependencies here
dependencies {
api('com.github.GTNewHorizons:EnderCore:0.5.14: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:NotEnoughItems:2.8.129-GTNH:dev')
api("com.github.GTNewHorizons:GTNHLib:0.11.44:dev")
devOnlyNonPublishable('com.github.GTNewHorizons:NotEnoughItems:2.8.148-GTNH:dev')
api("com.github.GTNewHorizons:GTNHLib:0.11.45: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
shadowImplementation('cglib:cglib-nodep:3.3.0')
api("com.github.GTNewHorizons:TinkersConstruct:1.14.106-GTNH:dev")
api("com.github.GTNewHorizons:TinkersConstruct:1.14.107-GTNH:dev")
devOnlyNonPublishable('com.github.GTNewHorizons:waila:1.19.34:dev') {transitive = false}
compileOnly('ganymedes01.etfuturum:Et-Futurum-Requiem:2.6.48-GTNH:dev') {transitive = false}
@@ -16,12 +16,12 @@ dependencies {
compileOnly("com.github.GTNewHorizons:Backhand:1.8.14:dev") { transitive = false }
compileOnly('com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-999-GTNH:api') {transitive = false}
compileOnly('com.github.GTNewHorizons:Baubles-Expanded:2.2.22-GTNH:dev') {transitive = false}
compileOnly('com.github.GTNewHorizons:GT5-Unofficial:5.09.54.122:dev') {transitive = false}
compileOnly('com.github.GTNewHorizons:GT5-Unofficial:5.09.54.129:dev') {transitive = false}
compileOnly("com.github.GTNewHorizons:ModularUI2:2.3.88-1.7.10:dev") {transitive = false}
compileOnly('com.github.GTNewHorizons:Railcraft:9.17.31:dev') {transitive = false}
compileOnly('com.github.GTNewHorizons:StorageDrawers:2.2.29-GTNH:api') {transitive = false}
compileOnly('com.github.GTNewHorizons:Chisel:2.17.32-GTNH:dev') {transitive = false}
compileOnly('com.github.GTNewHorizons:OpenComputers:1.12.59-GTNH:api') {transitive = false}
compileOnly('com.github.GTNewHorizons:OpenComputers:1.12.61-GTNH:api') {transitive = false}
compileOnly('curse.maven:minefactory-reloaded-66672:2366150') // https://www.curseforge.com/minecraft/mc-mods/minefactory-reloaded/files/2366150
compileOnly('thaumcraft:Thaumcraft:1.7.10-4.2.3.5:dev')
compileOnly('curse.maven:ee3-65509:2305023') // https://www.curseforge.com/minecraft/mc-mods/ee3/files/2305023
@@ -29,7 +29,7 @@ dependencies {
compileOnly(rfg.deobf('curse.maven:mekanism-268560:2475797')) // https://www.curseforge.com/minecraft/mc-mods/mekanism/files/2475797
compileOnly(rfg.deobf('maven.modrinth:immibis-microblocks:59.1.2')) // https://modrinth.com/mod/immibis-microblocks/version/59.1.2
compileOnlyApi('com.github.GTNewHorizons:Angelica:2.2.8:api') {transitive = false}
compileOnly("com.github.GTNewHorizons:Hodgepodge:2.7.194:dev")
compileOnlyApi('com.github.GTNewHorizons:Angelica:2.2.10:api') {transitive = false}
compileOnly("com.github.GTNewHorizons:Hodgepodge:2.7.196:dev")
compileOnly('curse.maven:automagy-222153:2285272')
}
@@ -337,32 +337,18 @@ public class KeyTracker {
}
private void handleNightVision() {
if (nightVisionKey.isPressed()) {
EntityPlayer player = Minecraft.getMinecraft().thePlayer;
if (!DarkSteelController.instance.isNightVisionUpgradeOrEnchEquipped(player)) {
return;
}
boolean isActive = !DarkSteelController.instance.isNightVisionActive();
if (isActive) {
player.worldObj.playSound(
player.posX,
player.posY,
player.posZ,
EnderIO.DOMAIN + ":ds.nightvision.on",
0.1f,
player.worldObj.rand.nextFloat() * 0.4f - 0.2f + 1.0f,
false);
} else {
player.worldObj.playSound(
player.posX,
player.posY,
player.posZ,
EnderIO.DOMAIN + ":ds.nightvision.off",
0.1f,
1.0f,
false);
}
DarkSteelController.instance.setNightVisionActive(isActive);
EntityPlayer player = Minecraft.getMinecraft().thePlayer;
if (nightVisionKey.isPressed() && DarkSteelController.instance.isNightVisionUpgradeOrEnchEquipped(player)) {
boolean turningOn = !DarkSteelController.instance.isActive(player, Type.NIGHT_VISION);
player.worldObj.playSound(
player.posX,
player.posY,
player.posZ,
EnderIO.DOMAIN + (turningOn ? ":ds.nightvision.on" : ":ds.nightvision.off"),
0.1f,
turningOn ? player.worldObj.rand.nextFloat() * 0.4f - 0.2f + 1.0f : 1.0f,
false);
toggleDarkSteelController(Type.NIGHT_VISION, "darksteel.upgrade.nightVision");
}
}
@@ -107,9 +107,6 @@ public class DarkSteelController {
private final Map<UUID, EnumSet<Type>> allActive = new HashMap<>();
private boolean nightVisionActive = false;
private boolean removeNightvision = false;
private DarkSteelController() {
PacketHandler.INSTANCE.registerMessage(
PacketDarkSteelPowerPacket.class,
@@ -196,6 +193,8 @@ public class DarkSteelController {
updateSwim(player);
updateSolar(player);
updateNightvision(player);
}
}
@@ -447,7 +446,6 @@ public class DarkSteelController {
if (player == null) {
return;
}
updateNightvision(player);
if (player.capabilities.isFlying) {
return;
}
@@ -569,16 +567,20 @@ public class DarkSteelController {
}
private void updateNightvision(EntityPlayer player) {
if (isNightVisionUpgradeOrEnchEquipped(player) && nightVisionActive) {
player.addPotionEffect(new PotionEffect(Potion.nightVision.getId(), 210, 0, true));
if (player.worldObj.isRemote) {
return;
}
if (!isNightVisionUpgradeOrEnchEquipped(player) && nightVisionActive) {
nightVisionActive = false;
removeNightvision = true;
}
if (removeNightvision) {
PotionEffect effect = player.getActivePotionEffect(Potion.nightVision);
boolean hasNVUpgrade = isNightVisionUpgradeOrEnchEquipped(player);
boolean isNVUpgradeEnabled = isActive(player, Type.NIGHT_VISION);
if (hasNVUpgrade && isNVUpgradeEnabled) {
// only (re)apply effect if ours is missing or about to expire
if (effect == null || (effect.getIsAmbient() && effect.getDuration() < 220)) {
player.addPotionEffect(new PotionEffect(Potion.nightVision.getId(), 400, 0, true));
}
} else if (effect != null && effect.getIsAmbient() && (hasNVUpgrade || isNVUpgradeEnabled)) {
// if our effect exists and the player removed the upgrade item or toggled it off (both can't be true here)
player.removePotionEffect(Potion.nightVision.getId());
removeNightvision = false;
}
}
@@ -613,21 +615,9 @@ public class DarkSteelController {
return false;
}
// ---
public boolean isNightVisionUpgradeOrEnchEquipped(EntityPlayer player) {
ItemStack helmet = player.getEquipmentInSlot(4);
return (NightVisionUpgrade.loadFromItem(helmet) != null || isNightVisionEnch(helmet));
}
public void setNightVisionActive(boolean isNightVisionActive) {
if (nightVisionActive && !isNightVisionActive) {
removeNightvision = true;
}
this.nightVisionActive = isNightVisionActive;
}
public boolean isNightVisionActive() {
return nightVisionActive;
}
}
@@ -15,7 +15,8 @@ public class PacketUpgradeState implements IMessage, IMessageHandler<PacketUpgra
GLIDE,
SPEED,
STEP_ASSIST,
JUMP
JUMP,
NIGHT_VISION
}
public PacketUpgradeState() {}
@@ -52,7 +52,7 @@ public abstract class AbstractPoweredTaskEntity extends AbstractPowerConsumerEnt
@Override
public boolean isActive() {
return currentTask == null ? false : currentTask.getProgress() >= 0 && hasPower() && redstoneCheckPassed;
return currentTask != null && currentTask.getProgress() >= 0 && hasPower() && redstoneCheckPassed;
}
@Override
@@ -224,7 +224,7 @@ public abstract class AbstractPoweredTaskEntity extends AbstractPowerConsumerEnt
ItemStack copy = item.copy();
// try to add it to existing stacks first
for (ItemStack outStack : outputStacks) {
if (outStack != null && copy != null) {
if (outStack != null) {
int num = getNumCanMerge(outStack, copy);
outStack.stackSize += num;
copy.stackSize -= num;
@@ -322,7 +322,7 @@ public abstract class AbstractPoweredTaskEntity extends AbstractPowerConsumerEnt
}
protected int getNumCanMerge(ItemStack itemStack, ItemStack result) {
if (!itemStack.isItemEqual(result)) {
if (!itemStack.isItemEqual(result) || !ItemStack.areItemStackTagsEqual(itemStack, result)) {
return 0;
}
return Math.min(itemStack.getMaxStackSize() - itemStack.stackSize, result.stackSize);
@@ -152,8 +152,9 @@ public class CrusherRecipeManager {
if (input == null) {
return null;
}
MachineRecipeInput[] machineInputs = { new MachineRecipeInput(0, input) };
for (Recipe recipe : recipes) {
if (recipe.isInputForRecipe(new MachineRecipeInput(0, input))) {
if (recipe.isInputForRecipe(machineInputs)) {
return recipe;
}
}
@@ -15,7 +15,9 @@ import crazypants.enderio.machine.SlotDefinition;
public class TileEntityPainter extends AbstractPoweredTaskEntity implements ISidedInventory {
// private static final short MAX_POWER_USE_PER_TICK = 6;
private static final int SLOT_INPUT = 0;
private static final int SLOT_PAINT_SOURCE = 1;
private static final int SLOT_OUTPUT = 2;
public TileEntityPainter() {
// 0 = input slot, 1 = paint source, 2 = output slot
@@ -24,7 +26,8 @@ public class TileEntityPainter extends AbstractPoweredTaskEntity implements ISid
@Override
public boolean canExtractItem(int i, ItemStack itemstack, int j) {
return super.canExtractItem(i, itemstack, j) && PainterUtil.isMetadataEquivelent(itemstack, inventory[2]);
return super.canExtractItem(i, itemstack, j)
&& PainterUtil.isMetadataEquivelent(itemstack, inventory[SLOT_OUTPUT]);
}
@Override
@@ -32,49 +35,44 @@ public class TileEntityPainter extends AbstractPoweredTaskEntity implements ISid
return "Auto Painter";
}
@Override
public boolean hasCustomInventoryName() {
return false;
}
@Override
public boolean isMachineItemValidForSlot(int i, ItemStack itemStack) {
if (i > 1) {
return false;
}
if (i == 0) {
if (i == SLOT_INPUT) {
List<IMachineRecipe> recipes = MachineRecipeRegistry.instance
.getRecipesForInput(getMachineName(), MachineRecipeInput.create(i, itemStack));
if (inventory[1] == null) {
if (inventory[SLOT_PAINT_SOURCE] == null) {
return !recipes.isEmpty();
} else {
for (IMachineRecipe rec : recipes) {
if (rec instanceof BasicPainterTemplate) {
BasicPainterTemplate temp = (BasicPainterTemplate) rec;
if (temp.isValidPaintSource(inventory[1])) {
if (rec instanceof BasicPainterTemplate temp) {
if (temp.isValidPaintSource(inventory[SLOT_PAINT_SOURCE])) {
return true;
}
}
}
return false;
}
return false;
}
if (inventory[0] == null) {
Map<String, IMachineRecipe> recipes = MachineRecipeRegistry.instance.getRecipesForMachine(getMachineName());
for (IMachineRecipe rec : recipes.values()) {
if (rec instanceof BasicPainterTemplate) {
BasicPainterTemplate temp = (BasicPainterTemplate) rec;
if (temp.isValidPaintSource(itemStack)) {
return true;
} else if (i == SLOT_PAINT_SOURCE) {
if (inventory[SLOT_INPUT] == null) {
Map<String, IMachineRecipe> recipes = MachineRecipeRegistry.instance
.getRecipesForMachine(getMachineName());
for (IMachineRecipe rec : recipes.values()) {
if (rec instanceof BasicPainterTemplate temp) {
if (temp.isValidPaintSource(itemStack)) {
return true;
}
}
}
return PaintSourceValidator.instance.isValidSourceDefault(itemStack);
} else {
return MachineRecipeRegistry.instance.getRecipeForInputs(
getMachineName(),
targetInput(),
MachineRecipeInput.create(SLOT_PAINT_SOURCE, itemStack)) != null;
}
return PaintSourceValidator.instance.isValidSourceDefault(itemStack);
} else {
return false;
}
return MachineRecipeRegistry.instance.getRecipeForInputs(
getMachineName(),
i == 0 ? MachineRecipeInput.create(0, itemStack) : targetInput(),
i == 1 ? MachineRecipeInput.create(1, itemStack) : paintSource()) != null;
}
@Override
@@ -83,27 +81,10 @@ public class TileEntityPainter extends AbstractPoweredTaskEntity implements ISid
}
private MachineRecipeInput targetInput() {
return MachineRecipeInput.create(0, inventory[0]);
return MachineRecipeInput.create(SLOT_INPUT, inventory[SLOT_INPUT]);
}
private MachineRecipeInput paintSource() {
return MachineRecipeInput.create(1, inventory[1]);
}
@Override
protected int getNumCanMerge(ItemStack itemStack, ItemStack result) {
if (result == null || !result.isItemEqual(inventory[2])) {
// next result is a different item type
return 0;
} else if (result.hasTagCompound() && inventory[2].hasTagCompound()) {
if (inventory[2].getTagCompound().hasKey("Items")) return 0; // presence of internal items
String cookedId = result.getTagCompound().getString(BlockPainter.KEY_SOURCE_BLOCK_ID);
String invId = inventory[2].getTagCompound().getString(BlockPainter.KEY_SOURCE_BLOCK_ID);
if (!cookedId.equals(invId)) {
// next result has a different source item than the current one
return 0;
}
}
return Math.min(itemStack.getMaxStackSize() - itemStack.stackSize, result.stackSize);
return MachineRecipeInput.create(SLOT_PAINT_SOURCE, inventory[SLOT_PAINT_SOURCE]);
}
}
@@ -38,38 +38,46 @@ public class Recipe implements IRecipe {
return false;
}
List<RecipeInput> requiredInputs = new ArrayList<>();
for (RecipeInput input : inputs) {
if (input.getFluidInput() != null || input.getInput() != null) {
requiredInputs.add(input.copy());
int[] remaining = new int[inputs.length];
for (int i = 0; i < inputs.length; i++) {
RecipeInput input = inputs[i];
if (input.isFluid()) {
remaining[i] = input.getFluidInput().amount;
} else if (input.getInput() != null) {
remaining[i] = input.getInput().stackSize;
}
}
for (MachineRecipeInput input : machineInputs) {
if (input != null && (input.fluid != null || input.item != null)) {
RecipeInput required = null;
for (int i = 0; i < requiredInputs.size() && required == null; i++) {
RecipeInput tst = requiredInputs.get(i);
if ((tst.isInput(input.item) && tst.getInput().stackSize > 0) || tst.isInput(input.fluid)) {
required = tst;
}
for (MachineRecipeInput machineInput : machineInputs) {
if (machineInput == null || (machineInput.item == null && machineInput.fluid == null)) {
continue;
}
int matchedInput = -1;
for (int i = 0; i < inputs.length; i++) {
if (remaining[i] <= 0) {
continue;
}
if (required == null) {
return false;
}
// reduce the required input quantity by the available amount
if (input.isFluid()) {
required.getFluidInput().amount -= input.fluid.amount;
} else {
required.getInput().stackSize -= input.item.stackSize;
RecipeInput required = inputs[i];
boolean matches = machineInput.isFluid() ? required.isInput(machineInput.fluid)
: required.isInput(machineInput.item);
if (matches) {
matchedInput = i;
break;
}
}
}
for (RecipeInput required : requiredInputs) {
if (required.isFluid() && required.getFluidInput().amount > 0) {
if (matchedInput < 0) {
return false;
} else if (!required.isFluid() && required.getInput().stackSize > 0) {
}
remaining[matchedInput] -= machineInput.isFluid() ? machineInput.fluid.amount : machineInput.item.stackSize;
}
for (int amount : remaining) {
if (amount > 0) {
return false;
}
}
@@ -15,8 +15,14 @@ public class SoulBinderEnderCystalRecipe extends AbstractSoulBinderRecipe {
Config.soulBinderEnderCystalRF,
Config.soulBinderEnderCystalLevels,
"SoulBinderEnderCystalRecipe",
"SpecialMobs.SpecialEnderman",
"Enderman");
"Enderman",
"SpecialMobs.BlindingEnderman",
"SpecialMobs.CursedEnderman",
"SpecialMobs.IcyEnderman",
"SpecialMobs.LightningEnderman",
"SpecialMobs.MiniEnderman",
"SpecialMobs.MirageEnderman",
"SpecialMobs.ThiefEnderman");
}
@Override
@@ -15,8 +15,14 @@ public class SoulBinderPrecientCystalRecipe extends AbstractSoulBinderRecipe {
Config.soulBinderPrecientCystalRF,
Config.soulBinderPrecientCystalLevels,
"SoulBinderPrecientCystalRecipe",
"SpecialMobs.SpecialEnderman",
"Enderman");
"Enderman",
"SpecialMobs.BlindingEnderman",
"SpecialMobs.CursedEnderman",
"SpecialMobs.IcyEnderman",
"SpecialMobs.LightningEnderman",
"SpecialMobs.MiniEnderman",
"SpecialMobs.MirageEnderman",
"SpecialMobs.ThiefEnderman");
}
@Override
@@ -16,7 +16,12 @@ public class SoulBinderReanimationRecipe extends AbstractSoulBinderRecipe {
Config.soulBinderReanimationLevels,
"SoulBinderReanimationRecipe",
"Zombie",
"SpecialMobs.SpecialZombie");
"SpecialMobs.BrutishZombie",
"SpecialMobs.FireZombie",
"SpecialMobs.FishingZombie",
"SpecialMobs.GiantZombie",
"SpecialMobs.HungryZombie",
"SpecialMobs.PlagueZombie");
}
@Override
@@ -16,7 +16,13 @@ public class SoulBinderSentientRecipe extends AbstractSoulBinderRecipe {
Config.soulBinderReanimationLevels,
"SoulBinderSentientRecipe",
"Witch",
"enderzoo.WitherWitch");
"enderzoo.WitherWitch",
"SpecialMobs.DominationWitch",
"SpecialMobs.RageWitch",
"SpecialMobs.ShadowsWitch",
"SpecialMobs.UndeadWitch",
"SpecialMobs.WildsWitch",
"SpecialMobs.WindWitch");
}
@Override
@@ -78,6 +78,16 @@ public class NEIEnderIOConfig implements IConfigureNEI {
API.hideItem(new ItemStack(EnderIO.itemGasConduit));
}
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
@@ -1,6 +1,5 @@
package crazypants.enderio.nei;
import java.awt.Point;
import java.awt.Rectangle;
import java.util.ArrayList;
import java.util.HashMap;
@@ -9,7 +8,6 @@ import java.util.Map;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.StatCollector;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidContainerRegistry;
@@ -17,17 +15,13 @@ import net.minecraftforge.fluids.FluidStack;
import org.lwjgl.opengl.GL11;
import com.enderio.core.client.render.RenderUtil;
import com.enderio.core.common.util.FluidUtil;
import codechicken.lib.gui.GuiDraw;
import codechicken.nei.ItemStackMap;
import codechicken.nei.PositionedStack;
import codechicken.nei.recipe.GuiCraftingRecipe;
import codechicken.nei.recipe.GuiRecipe;
import codechicken.nei.recipe.GuiUsageRecipe;
import codechicken.nei.recipe.StackInfo;
import codechicken.nei.recipe.TemplateRecipeHandler;
import crazypants.enderio.fluid.Fluids;
import crazypants.enderio.gui.GuiContainerBaseEIO;
import crazypants.enderio.machine.recipe.IRecipe;
import crazypants.enderio.machine.recipe.RecipeInput;
@@ -38,9 +32,6 @@ import crazypants.util.ColorUtils;
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() {}
@Override
@@ -94,7 +85,7 @@ public class VatRecipeHandler extends TemplateRecipeHandler {
@Override
public void loadCraftingRecipes(ItemStack result) {
FluidStack fluid = FluidUtil.getFluidFromItem(result);
FluidStack fluid = getFluidFromNeiItem(result);
if (fluid != null) {
loadCraftingRecipes(fluid);
}
@@ -122,7 +113,7 @@ public class VatRecipeHandler extends TemplateRecipeHandler {
@Override
public void loadUsageRecipes(ItemStack ingredient) {
FluidStack fluid = FluidUtil.getFluidFromItem(ingredient);
FluidStack fluid = getFluidFromNeiItem(ingredient);
if (fluid != null) {
loadUsageRecipes(fluid);
}
@@ -159,109 +150,37 @@ public class VatRecipeHandler extends TemplateRecipeHandler {
@Override
public void drawExtras(int 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();
GuiDraw.drawStringC(energyString, 86, 54, ColorUtils.neiEnergyString.getColor(), false);
Fluid outputFluid = rec.result.getFluid();
Fluid outputFluid = rec.resultFluid.getFluid();
List<PositionedStack> stacks = rec.getIngredients();
for (PositionedStack ps : stacks) {
if (ps instanceof PositionedStack.Tank) {
continue;
}
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);
GuiDraw.drawStringC(
"x" + mult,
ps.relx + 8,
ps.rely + 19,
ColorUtils.neiMultiplierString.getColor(),
false);
}
}
@Override
public List<String> handleItemTooltip(GuiRecipe<?> gui, ItemStack stack, List<String> currenttip, int recipeIndex) {
return currenttip;
private static FluidStack getFluidFromNeiItem(ItemStack stack) {
FluidStack fluid = StackInfo.getFluid(stack);
return fluid != null ? fluid : FluidUtil.getFluidFromItem(stack);
}
@Override
public List<String> handleTooltip(GuiRecipe<?> gui, List<String> currenttip, int recipeIndex) {
final InnerVatRecipe rec = (InnerVatRecipe) arecipes.get(recipeIndex);
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;
private static FluidStack withAmount(FluidStack fluid, int amount) {
FluidStack copy = fluid.copy();
copy.amount = amount;
return copy;
}
public List<ItemStack> getInputs(RecipeInput input) {
@@ -279,20 +198,32 @@ public class VatRecipeHandler extends TemplateRecipeHandler {
public class InnerVatRecipe extends TemplateRecipeHandler.CachedRecipe {
private final List<PositionedStack> inputs = new ArrayList<>();
private final ItemStackMap<Float> firstItemMultiplier = new ItemStackMap();
private final ItemStackMap<Float> secondItemMultiplier = new ItemStackMap();
private final ItemStackMap<Float> firstItemMultiplier = new ItemStackMap<Float>();
private final ItemStackMap<Float> secondItemMultiplier = new ItemStackMap<Float>();
private final Map<FluidStack, Float> fluidMultiplier = new HashMap<>();
private final FluidStack resultFluid;
private final int energy;
private final FluidStack result;
private FluidStack inFluid;
private int inTankIndex = -1;
private int lastInputAmount;
private PositionedStack resultTank;
private int lastResultAmount;
public int getEnergy() {
return energy;
}
@Override
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(withAmount(this.inFluid, amount), 25, 1));
}
}
return this.inputs;
}
public int getInputFluidAmount() {
@@ -321,7 +252,12 @@ public class VatRecipeHandler extends TemplateRecipeHandler {
@Override
public PositionedStack getResult() {
return null;
int amount = getResultFluidAmount();
if (amount != this.lastResultAmount || this.resultTank == null) {
this.lastResultAmount = amount;
this.resultTank = createTank(withAmount(this.resultFluid, amount), 127, 1);
}
return this.resultTank;
}
public InnerVatRecipe(int energy, RecipeInput[] ingredients, FluidStack result) {
@@ -355,15 +291,28 @@ public class VatRecipeHandler extends TemplateRecipeHandler {
}
// Item stacks must stay at indices 0/1: getFirstItemMultiplier()/getSecondItemMultiplier() rely on it.
if (!inputsOne.isEmpty()) {
this.inputs.add(new PositionedStack(inputsOne, 51, 1));
}
if (!inputsTwo.isEmpty()) {
this.inputs.add(new PositionedStack(inputsTwo, 100, 1));
}
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(withAmount(this.inFluid, this.lastInputAmount), 25, 1));
}
this.lastResultAmount = getResultFluidAmount();
this.resultTank = createTank(withAmount(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);
}
}
}