mirror of
https://github.com/GTNewHorizons/EnderIO.git
synced 2026-11-15 09:34:50 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
503b90a5d0 | ||
|
|
84052a1c42 |
No files matched your search
+1
-1
@@ -4,7 +4,7 @@ dependencies {
|
||||
api('com.github.GTNewHorizons:EnderCore:0.5.14:dev') {transitive = false}
|
||||
compileOnly('com.github.GTNewHorizons:ForestryMC:4.11.30:dev')
|
||||
compileOnly('com.github.GTNewHorizons:NotEnoughItems:2.8.110-GTNH:dev')
|
||||
api("com.github.GTNewHorizons:GTNHLib:0.11.22:dev")
|
||||
api("com.github.GTNewHorizons:GTNHLib:0.11.30:dev")
|
||||
compileOnly('com.github.GTNewHorizons:BuildCraft:7.1.61: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')
|
||||
|
||||
@@ -6,6 +6,8 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.ISidedInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -425,7 +427,7 @@ public class NetworkedInventory {
|
||||
return inv;
|
||||
}
|
||||
|
||||
public ISidedInventory getInventoryRecheck() {
|
||||
public @Nullable ISidedInventory getInventoryRecheck() {
|
||||
if (isInvalid()) {
|
||||
updateInventory();
|
||||
}
|
||||
|
||||
@@ -16,50 +16,53 @@ class NormalInventory extends AbstractInventory {
|
||||
@Override
|
||||
int scanInventory(InventoryDatabaseServer db) {
|
||||
ISidedInventory inv = ni.getInventoryRecheck();
|
||||
int side = ni.getInventorySide();
|
||||
int[] slotIndices = inv.getAccessibleSlotsFromSide(side);
|
||||
if (slotIndices == null || slotIndices.length == 0) {
|
||||
setEmpty(db);
|
||||
return 0;
|
||||
}
|
||||
int count = slotIndices.length;
|
||||
if (count != slotKeys.length) {
|
||||
reset(db, count);
|
||||
}
|
||||
for (int slot = 0; slot < count; slot++) {
|
||||
int invSlot = slotIndices[slot];
|
||||
ItemStack stack = inv.getStackInSlot(invSlot);
|
||||
if (stack != null && !inv.canExtractItem(invSlot, stack, side)) {
|
||||
stack = null;
|
||||
if (inv != null) {
|
||||
int side = ni.getInventorySide();
|
||||
int[] slotIndices = inv.getAccessibleSlotsFromSide(side);
|
||||
if (slotIndices != null && slotIndices.length > 0) {
|
||||
int count = slotIndices.length;
|
||||
if (count != slotKeys.length) {
|
||||
reset(db, count);
|
||||
}
|
||||
for (int slot = 0; slot < count; slot++) {
|
||||
int invSlot = slotIndices[slot];
|
||||
ItemStack stack = inv.getStackInSlot(invSlot);
|
||||
if (stack != null && !inv.canExtractItem(invSlot, stack, side)) {
|
||||
stack = null;
|
||||
}
|
||||
updateSlot(db, slot, stack);
|
||||
}
|
||||
return count;
|
||||
}
|
||||
updateSlot(db, slot, stack);
|
||||
}
|
||||
return count;
|
||||
|
||||
setEmpty(db);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int extractItem(InventoryDatabaseServer db, ItemEntry entry, int slot, int count) {
|
||||
ISidedInventory inv = ni.getInventoryRecheck();
|
||||
int side = ni.getInventorySide();
|
||||
int[] slotIndices = inv.getAccessibleSlotsFromSide(side);
|
||||
if (slotIndices == null || slot >= slotIndices.length) {
|
||||
return 0;
|
||||
if (inv != null) {
|
||||
int side = ni.getInventorySide();
|
||||
int[] slotIndices = inv.getAccessibleSlotsFromSide(side);
|
||||
if (slotIndices != null && slot < slotIndices.length) {
|
||||
int invSlot = slotIndices[slot];
|
||||
ItemStack stack = inv.getStackInSlot(invSlot);
|
||||
if (stack != null && inv.canExtractItem(invSlot, stack, side)
|
||||
&& db.lookupItem(stack, entry, false) == entry) {
|
||||
int remaining = stack.stackSize;
|
||||
if (count > remaining) {
|
||||
count = remaining;
|
||||
}
|
||||
ni.itemExtracted(invSlot, count);
|
||||
remaining -= count;
|
||||
updateCount(db, slot, entry, remaining);
|
||||
return count;
|
||||
}
|
||||
}
|
||||
}
|
||||
int invSlot = slotIndices[slot];
|
||||
ItemStack stack = inv.getStackInSlot(invSlot);
|
||||
if (stack == null || !inv.canExtractItem(invSlot, stack, side)) {
|
||||
return 0;
|
||||
}
|
||||
if (db.lookupItem(stack, entry, false) != entry) {
|
||||
return 0;
|
||||
}
|
||||
int remaining = stack.stackSize;
|
||||
if (count > remaining) {
|
||||
count = remaining;
|
||||
}
|
||||
ni.itemExtracted(invSlot, count);
|
||||
remaining -= count;
|
||||
updateCount(db, slot, entry, remaining);
|
||||
return count;
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -22,6 +22,7 @@ import crazypants.enderio.machine.alloy.GuiAlloySmelter;
|
||||
import crazypants.enderio.machine.recipe.IRecipe;
|
||||
import crazypants.enderio.machine.recipe.RecipeInput;
|
||||
import crazypants.enderio.power.PowerDisplayUtil;
|
||||
import crazypants.util.ColorUtils;
|
||||
|
||||
public class AlloySmelterRecipeHandler extends TemplateRecipeHandler {
|
||||
|
||||
@@ -114,7 +115,7 @@ public class AlloySmelterRecipeHandler extends TemplateRecipeHandler {
|
||||
drawProgressBar(99, 31, 166, 0, 22, 13, 48, 3);
|
||||
AlloySmelterRecipe recipe = (AlloySmelterRecipe) arecipes.get(recipeIndex);
|
||||
String energyString = PowerDisplayUtil.formatPower(recipe.getEnergy()) + " " + PowerDisplayUtil.abrevation();
|
||||
GuiDraw.drawString(energyString, 100, 52, 0x808080, false);
|
||||
GuiDraw.drawString(energyString, 100, 52, ColorUtils.neiEnergyString.getColor(), false);
|
||||
}
|
||||
|
||||
public List<ItemStack> getInputs(RecipeInput input) {
|
||||
|
||||
@@ -24,6 +24,7 @@ import crazypants.enderio.machine.enchanter.EnchanterRecipeManager;
|
||||
import crazypants.enderio.machine.enchanter.GuiEnchanter;
|
||||
import crazypants.enderio.machine.enchanter.TileEnchanter;
|
||||
import crazypants.enderio.machine.recipe.RecipeInput;
|
||||
import crazypants.util.ColorUtils;
|
||||
|
||||
public class EnchanterRecipeHandler extends TemplateRecipeHandler {
|
||||
|
||||
@@ -113,7 +114,7 @@ public class EnchanterRecipeHandler extends TemplateRecipeHandler {
|
||||
public void drawExtras(int recipeIndex) {
|
||||
EnchanterRecipeNEI recipe = (EnchanterRecipeNEI) arecipes.get(recipeIndex);
|
||||
|
||||
GuiDraw.drawStringC(recipe.getEnchantName(), 83, 10, 0x808080, false);
|
||||
GuiDraw.drawStringC(recipe.getEnchantName(), 83, 10, ColorUtils.neiEnchantString.getColor(), false);
|
||||
|
||||
int level = 1;
|
||||
List<PositionedStack> ingredients = recipe.getIngredients();
|
||||
|
||||
@@ -25,6 +25,7 @@ import crazypants.enderio.machine.recipe.Recipe;
|
||||
import crazypants.enderio.machine.recipe.RecipeInput;
|
||||
import crazypants.enderio.machine.recipe.RecipeOutput;
|
||||
import crazypants.enderio.power.PowerDisplayUtil;
|
||||
import crazypants.util.ColorUtils;
|
||||
|
||||
public class SagMillRecipeHandler extends TemplateRecipeHandler {
|
||||
|
||||
@@ -123,7 +124,7 @@ public class SagMillRecipeHandler extends TemplateRecipeHandler {
|
||||
|
||||
MillRecipe recipe = (MillRecipe) arecipes.get(recipeIndex);
|
||||
String energyString = PowerDisplayUtil.formatPower(recipe.getEnergy()) + " " + PowerDisplayUtil.abrevation();
|
||||
GuiDraw.drawString(energyString, 96, 33, 0x808080, false);
|
||||
GuiDraw.drawString(energyString, 96, 33, ColorUtils.neiEnergyString.getColor(), false);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -22,6 +22,7 @@ import crazypants.enderio.machine.slicensplice.ContainerSliceAndSplice;
|
||||
import crazypants.enderio.machine.slicensplice.GuiSliceAndSplice;
|
||||
import crazypants.enderio.machine.slicensplice.SliceAndSpliceRecipeManager;
|
||||
import crazypants.enderio.power.PowerDisplayUtil;
|
||||
import crazypants.util.ColorUtils;
|
||||
|
||||
public class SliceAndSpliceRecipeHandler extends TemplateRecipeHandler {
|
||||
|
||||
@@ -109,7 +110,7 @@ public class SliceAndSpliceRecipeHandler extends TemplateRecipeHandler {
|
||||
|
||||
SliceAndSpliceRecipe recipe = (SliceAndSpliceRecipe) arecipes.get(recipeIndex);
|
||||
String energyString = PowerDisplayUtil.formatPower(recipe.getEnergy()) + " " + PowerDisplayUtil.abrevation();
|
||||
GuiDraw.drawString(energyString, 100, 57, 0x808080, false);
|
||||
GuiDraw.drawString(energyString, 100, 57, ColorUtils.neiEnergyString.getColor(), false);
|
||||
}
|
||||
|
||||
public List<ItemStack> getInputs(RecipeInput input) {
|
||||
|
||||
@@ -24,6 +24,7 @@ import crazypants.enderio.machine.MachineRecipeRegistry;
|
||||
import crazypants.enderio.machine.soul.GuiSoulBinder;
|
||||
import crazypants.enderio.machine.soul.ISoulBinderRecipe;
|
||||
import crazypants.enderio.power.PowerDisplayUtil;
|
||||
import crazypants.util.ColorUtils;
|
||||
|
||||
public class SoulBinderRecipeHandler extends TemplateRecipeHandler {
|
||||
|
||||
@@ -132,7 +133,7 @@ public class SoulBinderRecipeHandler extends TemplateRecipeHandler {
|
||||
SoulBinderRecipeNEI recipe = (SoulBinderRecipeNEI) arecipes.get(recipeIndex);
|
||||
|
||||
String energyString = PowerDisplayUtil.formatPower(recipe.getEnergy()) + " " + PowerDisplayUtil.abrevation();
|
||||
GuiDraw.drawStringC(energyString, 83, 45, 0x808080, false);
|
||||
GuiDraw.drawStringC(energyString, 83, 45, ColorUtils.neiEnergyString.getColor(), false);
|
||||
|
||||
int cost = recipe.getExperience();
|
||||
if (cost > 0) {
|
||||
|
||||
@@ -34,6 +34,7 @@ import crazypants.enderio.machine.recipe.RecipeInput;
|
||||
import crazypants.enderio.machine.vat.GuiVat;
|
||||
import crazypants.enderio.machine.vat.VatRecipeManager;
|
||||
import crazypants.enderio.power.PowerDisplayUtil;
|
||||
import crazypants.util.ColorUtils;
|
||||
|
||||
public class VatRecipeHandler extends TemplateRecipeHandler {
|
||||
|
||||
@@ -183,7 +184,7 @@ public class VatRecipeHandler extends TemplateRecipeHandler {
|
||||
}
|
||||
|
||||
String energyString = PowerDisplayUtil.formatPower(rec.energy) + " " + PowerDisplayUtil.abrevation();
|
||||
GuiDraw.drawStringC(energyString, 86, 54, 0x808080, false);
|
||||
GuiDraw.drawStringC(energyString, 86, 54, ColorUtils.neiEnergyString.getColor(), false);
|
||||
|
||||
Fluid outputFluid = rec.result.getFluid();
|
||||
List<PositionedStack> stacks = rec.getIngredients();
|
||||
@@ -191,7 +192,7 @@ public class VatRecipeHandler extends TemplateRecipeHandler {
|
||||
float mult = VatRecipeManager.getInstance()
|
||||
.getMultiplierForInput(rec.inFluid.getFluid(), ps.item, outputFluid);
|
||||
String str = "x" + mult;
|
||||
GuiDraw.drawStringC(str, ps.relx + 8, ps.rely + 19, 0x808080, false);
|
||||
GuiDraw.drawStringC(str, ps.relx + 8, ps.rely + 19, ColorUtils.neiMultiplierString.getColor(), false);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -8,7 +8,10 @@ public class ColorUtils {
|
||||
|
||||
public static final ColorResource
|
||||
// spotless:off
|
||||
priorityString = color.rgb("priorityString", "0x000000"),
|
||||
suctionString = color.rgb("suctionString", "0x000000");
|
||||
priorityString = color.rgb("priorityString", "0x000000"),
|
||||
suctionString = color.rgb("suctionString", "0x000000"),
|
||||
neiMultiplierString = color.rgb("neiMultiplierString", "0x808080"),
|
||||
neiEnchantString = color.rgb("neiEnchantString", "0x808080"),
|
||||
neiEnergyString = color.rgb("neiEnergyString", "0x808080");
|
||||
// spotless:on
|
||||
}
|
||||
Reference in new issue
Block a user