Compare commits

..
16 changed files with 96 additions and 202 deletions

No files matched your search

+9 -10
View File
@@ -34,11 +34,10 @@
* For more details, see https://docs.gradle.org/8.0.1/userguide/java_library_plugin.html#sec:java_library_configurations_graph
*/
dependencies {
api('com.github.GTNewHorizons:NotEnoughItems:2.8.60-GTNH:dev')
api('com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-817-GTNH:dev')
api('curse.maven:cofh-core-69162:2388751')
api('com.github.GTNewHorizons:waila:1.19.21:dev')
api("com.github.GTNewHorizons:GTNHLib:0.9.10:dev")
api('com.github.GTNewHorizons:NotEnoughItems:2.8.70-GTNH:dev')
api('com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-845-GTNH:dev')
api('com.github.GTNewHorizons:waila:1.19.22:dev')
api("com.github.GTNewHorizons:GTNHLib:0.9.26:dev")
implementation("com.github.GTNewHorizons:WirelessCraftingTerminal:1.12.12:dev") {
exclude group: 'com.github.GTNewHorizons', module: 'Applied-Energistics-2-Unofficial'
@@ -46,9 +45,9 @@ dependencies {
compileOnly('com.github.GTNewHorizons:Baubles-Expanded:2.2.6-GTNH:dev')
compileOnly('com.github.GTNewHorizons:ExtraCells2:2.5.35:dev') { transitive = false }
compileOnly('com.github.GTNewHorizons:ForestryMC:4.11.4:dev')
compileOnly('com.github.GTNewHorizons:EnderIO:2.10.15:dev')
compileOnly('com.github.GTNewHorizons:GT5-Unofficial:5.09.52.258:dev') {
compileOnly('com.github.GTNewHorizons:ForestryMC:4.11.6:dev')
compileOnly('com.github.GTNewHorizons:EnderIO:2.10.20:dev')
compileOnly('com.github.GTNewHorizons:GT5-Unofficial:5.09.52.308:dev') {
exclude group: 'com.github.GTNewHorizons', module: 'AE2FluidCraft-Rework'
exclude group: 'com.github.GTNewHorizons', module: 'Applied-Energistics-2-Unofficial'
}
@@ -56,7 +55,7 @@ dependencies {
compileOnly('thaumcraft:Thaumcraft:1.7.10-4.2.3.5:dev')
compileOnly('com.gregoriust.gregtech:gregtech_1.7.10:6.14.23:dev') { transitive = false }
compileOnly('com.github.GTNewHorizons:OpenComputers:1.12.16-GTNH:dev') { transitive = false }
compileOnly('com.github.GTNewHorizons:ThaumicEnergistics:1.7.27-GTNH:dev') { transitive = false }
compileOnly('com.github.GTNewHorizons:ThaumicEnergistics:1.7.31-GTNH:dev') { transitive = false }
runtimeOnlyNonPublishable("com.github.GTNewHorizons:DuraDisplay:1.4.0:dev")
runtimeOnlyNonPublishable("com.github.GTNewHorizons:DuraDisplay:1.4.2:dev")
}
+1 -1
View File
@@ -17,7 +17,7 @@ pluginManagement {
}
plugins {
id 'com.gtnewhorizons.gtnhsettingsconvention' version '2.0.19'
id 'com.gtnewhorizons.gtnhsettingsconvention' version '2.0.20'
}
@@ -24,7 +24,7 @@ import cpw.mods.fml.common.network.NetworkRegistry;
modid = FluidCraft.MODID,
version = FluidCraft.VERSION,
name = FluidCraft.MODNAME,
dependencies = "required-after:appliedenergistics2@[rv3-beta-238,);required-after:CoFHCore;after:waila;after:thaumicenergistics;after:ae2wct")
dependencies = "required-after:appliedenergistics2@[rv3-beta-238,);after:waila;after:thaumicenergistics;after:ae2wct")
public class FluidCraft {
public static final String MODID = "ae2fc";
@@ -5,6 +5,7 @@ import java.util.ArrayList;
import java.util.List;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.util.ResourceLocation;
@@ -30,7 +31,6 @@ import appeng.client.gui.slots.VirtualMEPhantomSlot;
import appeng.client.gui.widgets.GuiTabButton;
import appeng.util.calculators.ArithHelper;
import appeng.util.calculators.Calculator;
import cofh.core.render.CoFHFontRenderer;
public class GuiLevelMaintainer extends GuiSub {
@@ -39,14 +39,14 @@ public class GuiLevelMaintainer extends GuiSub {
private final Component[] component = new Component[TileLevelMaintainer.REQ_COUNT];
private final MouseRegionManager mouseRegions = new MouseRegionManager(this);
private Widget focusedWidget;
private final CoFHFontRenderer render;
private final FontRenderer render;
public GuiLevelMaintainer(InventoryPlayer ipl, TileLevelMaintainer tile) {
super(new ContainerLevelMaintainer(ipl, tile));
this.cont = (ContainerLevelMaintainer) inventorySlots;
this.xSize = 195;
this.ySize = 214;
this.render = new CoFHFontRenderer(
this.render = new FontRenderer(
Minecraft.getMinecraft().gameSettings,
TEX_BG,
Minecraft.getMinecraft().getTextureManager(),
@@ -73,7 +73,6 @@ import appeng.integration.IntegrationRegistry;
import appeng.integration.IntegrationType;
import appeng.util.Platform;
import appeng.util.ReadableNumberConverter;
import cpw.mods.fml.common.Loader;
public class GuiLevelTerminal extends FCBaseMEGui implements IDropToFillTextField, IGuiTooltipHandler {
@@ -94,7 +93,6 @@ public class GuiLevelTerminal extends FCBaseMEGui implements IDropToFillTextFiel
private ItemStack tooltipStack;
private boolean online;
private final boolean neiPresent;
private int viewHeight;
protected GuiTabButton craftingStatusBtn;
@@ -115,9 +113,8 @@ public class GuiLevelTerminal extends FCBaseMEGui implements IDropToFillTextFiel
public GuiLevelTerminal(InventoryPlayer inventoryPlayer, Container container) {
super(inventoryPlayer, container);
setScrollBar(new GuiScrollbar());
xSize = 208;
xSize = 209;
ySize = 255;
neiPresent = Loader.isModLoaded("NotEnoughItems");
searchFieldOutputs = new MEGuiTextField(86, 12, ButtonToolTips.SearchFieldOutputs.getLocal()) {
@@ -183,14 +180,14 @@ public class GuiLevelTerminal extends FCBaseMEGui implements IDropToFillTextFiel
terminalStyleBox.xPosition = guiLeft - 18;
terminalStyleBox.yPosition = guiTop + 8;
craftingStatusBtn = new GuiTabButton(
guiLeft + xSize - 24,
guiLeft + xSize - 25,
guiTop - 4,
2 + 11 * 16,
GuiText.CraftingStatus.getLocal(),
itemRender);
craftingStatusBtn.setHideEdge(13);
if (ModAndClassUtil.isSearchBar && (AEConfig.instance.preserveSearchBar || isSubGui())) {
if (AEConfig.instance.preserveSearchBar || isSubGui()) {
setSearchString();
}
buttonList.add(terminalStyleBox);
@@ -251,7 +248,7 @@ public class GuiLevelTerminal extends FCBaseMEGui implements IDropToFillTextFiel
ySize - 96 + 3,
GuiColors.InterfaceTerminalInventory.getColor());
if (!neiPresent && tooltipStack != null) {
if (!ModAndClassUtil.NEI && tooltipStack != null) {
renderToolTip(tooltipStack, mouseX, mouseY);
}
}
@@ -290,7 +287,7 @@ public class GuiLevelTerminal extends FCBaseMEGui implements IDropToFillTextFiel
@Override
protected void actionPerformed(final GuiButton btn) {
if (actionPerformedCustomButtons(btn)) return;
if (ModAndClassUtil.isSaveText && btn == searchStringSave) {
if (btn == searchStringSave) {
final boolean backwards = Mouse.isButtonDown(1);
final GuiImgButton iBtn = (GuiImgButton) btn;
@@ -9,6 +9,7 @@ import com.glodblock.github.util.Util;
import appeng.api.storage.ITerminalHost;
import appeng.container.AEBaseContainer;
import appeng.container.guisync.GuiSync;
import appeng.util.Platform;
public abstract class FCBaseContainer extends AEBaseContainer {
@@ -37,7 +38,7 @@ public abstract class FCBaseContainer extends AEBaseContainer {
if (isWirelessTerminal()) {
if (this.host instanceof IFluidPortableCell) {
final int slotIndex = ((IFluidPortableCell) this.host).getInventorySlot();
if (Util.GuiHelper.decodeInvType(slotIndex).getLeft() == Util.GuiHelper.InvType.PLAYER_INV) {
if (slotIndex <= Platform.baublesSlotsOffset) {
this.lockPlayerInventorySlot(slotIndex);
}
return slotIndex;
@@ -2,7 +2,6 @@ package com.glodblock.github.common.item;
import static appeng.util.Platform.baublesSlotsOffset;
import static appeng.util.Platform.nextEnum;
import static com.glodblock.github.util.Util.GuiHelper.decodeInvType;
import static net.minecraft.client.gui.GuiScreen.isShiftKeyDown;
import java.util.Arrays;
@@ -138,8 +137,7 @@ public class ItemWirelessUltraTerminal extends ItemBaseWirelessTerminal
private void openGui(final ItemStack is, final World w, final EntityPlayer player, final Object mode,
final int slotIndex) {
final GuiBridge aeGui;
final int slot = slotIndex == Integer.MIN_VALUE ? player.inventory.currentItem : slotIndex;
final ImmutablePair<Util.GuiHelper.InvType, Integer> invSlotPair = decodeInvType(slotIndex);
final int slot = slotIndex == Integer.MIN_VALUE ? player.inventory.currentItem : slotIndex;;
switch (mode instanceof UltraTerminalModes utm ? utm : getMode(is)) {
case CRAFTING -> aeGui = GuiBridge.GUI_CRAFTING_TERMINAL;
@@ -161,13 +159,7 @@ public class ItemWirelessUltraTerminal extends ItemBaseWirelessTerminal
default -> aeGui = GuiBridge.GUI_ME;
}
Platform.openGUI(
player,
null,
null,
aeGui,
invSlotPair.getLeft() == Util.GuiHelper.InvType.PLAYER_INV ? slotIndex
: invSlotPair.getRight() + baublesSlotsOffset);
Platform.openGUI(player, null, null, aeGui, slotIndex);
}
@Override
@@ -191,12 +183,7 @@ public class ItemWirelessUltraTerminal extends ItemBaseWirelessTerminal
if (handler != null) {
for (int i = 0; i < handler.getSizeInventory(); ++i) {
if (handler.getStackInSlot(i) == itemStack) {
onUpdate(
itemStack,
null,
player,
Util.GuiHelper.encodeType(i, Util.GuiHelper.InvType.PLAYER_BAUBLES),
false);
onUpdate(itemStack, null, player, i + baublesSlotsOffset, false);
}
}
}
@@ -9,10 +9,10 @@ import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import com.glodblock.github.inventory.item.IItemInventory;
import com.glodblock.github.util.Util;
import appeng.container.AEBaseContainer;
import appeng.container.ContainerOpenContext;
import appeng.util.Platform;
public abstract class ItemGuiFactory<T> implements IGuiFactory {
@@ -30,7 +30,7 @@ public abstract class ItemGuiFactory<T> implements IGuiFactory {
@Nullable
@Override
public Object createServerGui(EntityPlayer player, World world, int x, int y, int z, ForgeDirection face) {
ItemStack item = Util.getWirelessTerminal(player, x);
ItemStack item = Platform.getItemFromPlayerInventoryBySlotIndex(player, x);
if (item == null || !(item.getItem() instanceof IItemInventory)) {
return null;
}
@@ -57,7 +57,7 @@ public abstract class ItemGuiFactory<T> implements IGuiFactory {
@Nullable
@Override
public Object createClientGui(EntityPlayer player, World world, int x, int y, int z, ForgeDirection face) {
ItemStack item = Util.getWirelessTerminal(player, x);
ItemStack item = Platform.getItemFromPlayerInventoryBySlotIndex(player, x);
if (item == null || !(item.getItem() instanceof IItemInventory)) {
return null;
}
@@ -14,6 +14,7 @@ import com.glodblock.github.util.Util;
import appeng.container.AEBaseContainer;
import appeng.container.ContainerOpenContext;
import appeng.util.Platform;
public abstract class PartOrItemGuiFactory<T> extends PartGuiFactory<T> {
@@ -31,7 +32,7 @@ public abstract class PartOrItemGuiFactory<T> extends PartGuiFactory<T> {
public Object createServerGui(EntityPlayer player, World world, int x, int y, int z, ForgeDirection face) {
ImmutablePair<Util.GuiHelper.GuiType, Integer> result = Util.GuiHelper.decodeType(y);
if (result.getLeft() == Util.GuiHelper.GuiType.ITEM) {
ItemStack item = Util.getWirelessTerminal(player, x);
ItemStack item = Platform.getItemFromPlayerInventoryBySlotIndex(player, x);
if (item == null || !(item.getItem() instanceof IItemInventory)) {
return null;
}
@@ -62,7 +63,7 @@ public abstract class PartOrItemGuiFactory<T> extends PartGuiFactory<T> {
public Object createClientGui(EntityPlayer player, World world, int x, int y, int z, ForgeDirection face) {
ImmutablePair<Util.GuiHelper.GuiType, Integer> result = Util.GuiHelper.decodeType(y);
if (result.left == Util.GuiHelper.GuiType.ITEM) {
ItemStack item = Util.getWirelessTerminal(player, x);
ItemStack item = Platform.getItemFromPlayerInventoryBySlotIndex(player, x);
if (item == null || !(item.getItem() instanceof IItemInventory)) {
return null;
}
@@ -231,21 +231,19 @@ public class WirelessMagnetCardFilterInventory extends BaseWirelessInventory imp
.sameOre(OreHelper.INSTANCE.isOre(is), OreHelper.INSTANCE.isOre(inputItemStack)))
return true;
}
boolean match;
if (ignoreMeta && ignoreNbt) {
// ignore meta & nbt
return is.getItem().equals(inputItemStack.getItem());
match = is.getItem().equals(inputItemStack.getItem());
} else if (ignoreMeta) {
// ignore meta only
return ItemStack.areItemStackTagsEqual(is, inputItemStack)
match = ItemStack.areItemStackTagsEqual(is, inputItemStack)
&& is.getItem() == inputItemStack.getItem();
} else if (ignoreNbt) {
// ignore nbt only
return is.getItem() == inputItemStack.getItem()
match = is.getItem() == inputItemStack.getItem()
&& is.getItemDamage() == inputItemStack.getItemDamage();
} else {
// ignore nothing/don't use oredict--must be exact match
return is.isItemEqual(inputItemStack) && ItemStack.areItemStackTagsEqual(is, inputItemStack);
match = is.isItemEqual(inputItemStack) && ItemStack.areItemStackTagsEqual(is, inputItemStack);
}
if (match) return true;
}
}
return false;
@@ -266,7 +264,7 @@ public class WirelessMagnetCardFilterInventory extends BaseWirelessInventory imp
public static WirelessMagnetCardFilterInventory getFilter(ItemStack is, int slot, IGridNode gridNode,
EntityPlayer player) {
WirelessMagnetCardFilterInventory cachedInv = cache.get(player.getUniqueID());
if (cachedInv != null && cachedInv.checkCache(is)) {
if (cachedInv != null && cachedInv.checkCache(is) && gridNode == cachedInv.grid) {
return cachedInv;
} else {
WirelessMagnetCardFilterInventory newInv = new WirelessMagnetCardFilterInventory(
@@ -182,8 +182,6 @@ public class RecipeLoader implements Runnable {
GameRegistry.findItem("appliedenergistics2", "item.ItemMultiMaterial"),
1,
43);
public static final ItemStack THE_WIRELESS_TERM = GameRegistry
.findItemStack("thaumicenergistics", "wireless.essentia.terminal", 1);
private static final ItemStack WCT_WIRELESS_TERM = GameRegistry
.findItemStack("ae2wct", "wirelessCraftingTerminal", 1);
public static final ItemStack BUCKET = new ItemStack(Items.bucket, 1);
@@ -748,7 +746,7 @@ public class RecipeLoader implements Runnable {
}
ItemStack[] term = { AE2_WIRELESS_TERMINAL, WIRELESS_PATTERN_TERM.stack(), WIRELESS_INTERFACE_TERM.stack(),
WIRELESS_LEVEL_TERM.stack(), THE_WIRELESS_TERM, WCT_WIRELESS_TERM };
WIRELESS_LEVEL_TERM.stack(), WCT_WIRELESS_TERM };
GameRegistry.addShapelessRecipe(
WIRELESS_ULTRA_TERM.stack(),
Arrays.stream(term).filter(Objects::nonNull).toArray());
@@ -94,11 +94,9 @@ public class CommonProxy {
if (ModAndClassUtil.ThE) {
ThaumicEnergisticsCrafting.postInit();
}
if (ModAndClassUtil.isBigInterface) {
Upgrades.PATTERN_CAPACITY.registerItem(new ItemStack(ItemAndBlockHolder.FLUID_INTERFACE), 3);
Upgrades.PATTERN_CAPACITY.registerItem(new ItemStack(ItemAndBlockHolder.INTERFACE), 3);
Upgrades.PATTERN_CAPACITY.registerItem(new ItemStack(ItemAndBlockHolder.FLUID_INTERFACE_P2P), 3);
}
Upgrades.PATTERN_CAPACITY.registerItem(new ItemStack(ItemAndBlockHolder.FLUID_INTERFACE), 3);
Upgrades.PATTERN_CAPACITY.registerItem(new ItemStack(ItemAndBlockHolder.INTERFACE), 3);
Upgrades.PATTERN_CAPACITY.registerItem(new ItemStack(ItemAndBlockHolder.FLUID_INTERFACE_P2P), 3);
Upgrades.CRAFTING.registerItem(new ItemStack(ItemAndBlockHolder.FLUID_INTERFACE), 1);
Upgrades.CRAFTING.registerItem(new ItemStack(ItemAndBlockHolder.INTERFACE), 1);
Upgrades.CRAFTING.registerItem(new ItemStack(ItemAndBlockHolder.FLUID_INTERFACE_P2P), 1);
@@ -3,7 +3,9 @@ package com.glodblock.github.util;
import static appeng.util.item.AEFluidStackType.FLUID_STACK_TYPE;
import static appeng.util.item.AEItemStackType.ITEM_STACK_TYPE;
import java.util.IdentityHashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import net.minecraft.inventory.IInventory;
@@ -16,6 +18,9 @@ import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.FluidTankInfo;
import net.minecraftforge.fluids.IFluidHandler;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import com.glodblock.github.common.item.ItemFluidDrop;
import com.glodblock.github.common.item.ItemFluidPacket;
import com.glodblock.github.inventory.AEFluidInventory;
@@ -38,8 +43,10 @@ import appeng.api.networking.ticking.TickingRequest;
import appeng.api.storage.IMEInventory;
import appeng.api.storage.IMEMonitor;
import appeng.api.storage.IStorageMonitorable;
import appeng.api.storage.data.AEStackTypeRegistry;
import appeng.api.storage.data.IAEFluidStack;
import appeng.api.storage.data.IAEItemStack;
import appeng.api.storage.data.IAEStackType;
import appeng.api.util.IConfigManager;
import appeng.core.settings.TickRates;
import appeng.helpers.IInterfaceHost;
@@ -67,12 +74,7 @@ public class DualityFluidInterface implements IGridTickable, IStorageMonitorable
private final AEFluidInventory config = new AEFluidInventory(this, NUMBER_OF_TANKS, Integer.MAX_VALUE);
private final IAEFluidStack[] requireWork;
private int isWorking = -1;
private final MEMonitorPassThrough<IAEItemStack> items = new MEMonitorPassThrough<IAEItemStack>(
new NullInventory<>(),
ITEM_STACK_TYPE);
private final MEMonitorPassThrough<IAEFluidStack> fluids = new MEMonitorPassThrough<IAEFluidStack>(
new NullInventory<>(),
FLUID_STACK_TYPE);
private final Map<IAEStackType<?>, MEMonitorPassThrough<?>> monitorMap;
private boolean resetConfigCache = true;
public DualityFluidInterface(final AENetworkProxy networkProxy, final IInterfaceHost ih) {
@@ -80,8 +82,14 @@ public class DualityFluidInterface implements IGridTickable, IStorageMonitorable
this.gridProxy.setFlags(GridFlags.REQUIRE_CHANNEL);
this.iHost = ih;
this.mySource = new MachineSource(this.iHost);
this.fluids.setChangeSource(this.mySource);
this.items.setChangeSource(this.mySource);
this.monitorMap = new IdentityHashMap<>();
for (IAEStackType<?> type : AEStackTypeRegistry.getAllTypes()) {
MEMonitorPassThrough<?> monitor = new MEMonitorPassThrough(new NullInventory<>(), type);
monitor.setChangeSource(mySource);
this.monitorMap.put(type, monitor);
}
this.requireWork = new IAEFluidStack[6];
for (int i = 0; i < 6; ++i) {
@@ -113,13 +121,18 @@ public class DualityFluidInterface implements IGridTickable, IStorageMonitorable
this.notifyNeighbors();
}
@SuppressWarnings({ "unchecked", "rawtypes" })
public void gridChanged() {
try {
this.items.setInternal(this.gridProxy.getStorage().getItemInventory());
this.fluids.setInternal(this.gridProxy.getStorage().getFluidInventory());
} catch (GridAccessException var2) {
this.items.setInternal(new NullInventory<>());
this.fluids.setInternal(new NullInventory<>());
for (var entry : this.monitorMap.entrySet()) {
MEMonitorPassThrough<?> monitor = entry.getValue();
IMEMonitor internal = this.gridProxy.getStorage().getMEMonitor(entry.getKey());
monitor.setInternal(internal);
}
} catch (final GridAccessException gae) {
for (var monitor : this.monitorMap.values()) {
monitor.setInternal(new NullInventory<>());
}
}
this.notifyNeighbors();
}
@@ -198,14 +211,16 @@ public class DualityFluidInterface implements IGridTickable, IStorageMonitorable
}
@Override
@SuppressWarnings("unchecked")
public IMEMonitor<IAEItemStack> getItemInventory() {
if (this.hasConfig) {
return null;
}
return this.items;
return (IMEMonitor<IAEItemStack>) this.monitorMap.get(ITEM_STACK_TYPE);
}
@Override
@SuppressWarnings("unchecked")
public IMEMonitor<IAEFluidStack> getFluidInventory() {
if (this.hasConfig) {
if (this.resetConfigCache) {
@@ -213,7 +228,23 @@ public class DualityFluidInterface implements IGridTickable, IStorageMonitorable
return new InterfaceInventory(this);
}
}
return this.fluids;
return (IMEMonitor<IAEFluidStack>) this.monitorMap.get(FLUID_STACK_TYPE);
}
@Override
@Nullable
public IMEMonitor<?> getMEMonitor(@NotNull IAEStackType<?> type) {
if (type == ITEM_STACK_TYPE) {
return this.getItemInventory();
} else if (type == FLUID_STACK_TYPE) {
return this.getFluidInventory();
}
if (this.hasConfig) {
return null;
}
return this.monitorMap.get(type);
}
@Override
@@ -1,13 +1,5 @@
package com.glodblock.github.util;
import java.lang.reflect.Field;
import appeng.api.config.ActionItems;
import appeng.api.config.Settings;
import appeng.api.config.Upgrades;
import appeng.core.AEConfig;
import appeng.core.localization.ButtonToolTips;
import appeng.core.localization.GuiText;
import cpw.mods.fml.common.Loader;
public final class ModAndClassUtil {
@@ -29,97 +21,16 @@ public final class ModAndClassUtil {
public static boolean WCT = false;
public static boolean IC2 = false;
public static boolean NEI = false;
public static boolean COFH = false;
public static boolean GTPP = false;
public static boolean WAILA = false;
public static boolean WAILA_PLUGINS = false;
public static boolean AVARITIA = false;
public static boolean NEW_HORIZONS_CORE_MOD = false;
public static boolean isV2;
public static boolean isDoubleButton;
public static boolean isSaveText;
public static boolean isSearchStringTooltip;
public static boolean isCraftStatus;
public static boolean isSearchBar;
public static boolean isShiftTooltip;
public static boolean isBigInterface;
public static boolean isBeSubstitutionsButton;
public static boolean BAUBLES = false;
@SuppressWarnings("all")
public static void init() {
try {
Field d = Upgrades.class.getDeclaredField("PATTERN_CAPACITY");
if (d == null) isBigInterface = false;
isBigInterface = true;
} catch (NoSuchFieldException e) {
isBigInterface = false;
}
try {
Field d = GuiText.class.getDeclaredField("HoldShiftForTooltip");
if (d == null) isShiftTooltip = false;
isShiftTooltip = true;
} catch (NoSuchFieldException e) {
isShiftTooltip = false;
}
try {
Field d = AEConfig.instance.getClass().getDeclaredField("preserveSearchBar");
if (d == null) isSearchBar = false;
isSearchBar = true;
} catch (NoSuchFieldException e) {
isSearchBar = false;
}
try {
Field d = ActionItems.class.getDeclaredField("DOUBLE");
if (d == null) isDoubleButton = false;
isDoubleButton = true;
} catch (NoSuchFieldException e) {
isDoubleButton = false;
}
try {
Field d = ButtonToolTips.class.getDeclaredField("BeSubstitutionsDescEnabled");
isBeSubstitutionsButton = true;
} catch (NoSuchFieldException e) {
isBeSubstitutionsButton = false;
}
try {
Field d = Settings.class.getDeclaredField("SAVE_SEARCH");
if (d == null) isSaveText = false;
isSaveText = true;
} catch (NoSuchFieldException e) {
isSaveText = false;
}
try {
Field d = ButtonToolTips.class.getDeclaredField("SearchStringTooltip");
if (d == null) isSearchStringTooltip = false;
isSearchStringTooltip = true;
} catch (NoSuchFieldException e) {
isSearchStringTooltip = false;
}
try {
Field d = Settings.class.getDeclaredField("CRAFTING_STATUS");
if (d == null) isCraftStatus = false;
isCraftStatus = true;
} catch (NoSuchFieldException e) {
isCraftStatus = false;
}
try {
Class<?> calculatorV2 = Class.forName("appeng.crafting.v2.CraftingCalculations");
if (calculatorV2 == null) isV2 = false;
isV2 = true;
} catch (ClassNotFoundException e) {
isV2 = false;
}
if (Loader.isModLoaded("gregtech") && !Loader.isModLoaded("gregapi")) {
try {
Class.forName("gregtech.api.recipe.RecipeMap");
@@ -137,11 +48,11 @@ public final class ModAndClassUtil {
if (Loader.isModLoaded("ae2wct")) WCT = true;
if (Loader.isModLoaded("IC2")) IC2 = true;
if (Loader.isModLoaded("NotEnoughItems")) NEI = true;
if (Loader.isModLoaded("CoFHCore")) COFH = true;
if (Loader.isModLoaded("miscutils")) GTPP = true;
if (Loader.isModLoaded("Waila")) WAILA = true;
if (Loader.isModLoaded("wailaplugins")) WAILA_PLUGINS = true;
if (Loader.isModLoaded("Avaritia")) AVARITIA = true;
if (Loader.isModLoaded("dreamcraft")) NEW_HORIZONS_CORE_MOD = true;
if (Loader.isModLoaded("Baubles")) BAUBLES = true;
}
}
@@ -61,29 +61,24 @@ import appeng.util.item.AEFluidStack;
import appeng.util.item.AEItemStack;
import baubles.api.BaublesApi;
import codechicken.nei.recipe.StackInfo;
import cpw.mods.fml.common.Loader;
import cpw.mods.fml.common.ModContainer;
import cpw.mods.fml.common.registry.GameData;
import io.netty.buffer.ByteBuf;
public final class Util {
public static boolean isBaublesLoaded = Loader.isModLoaded("Baubles");
public static int drainItemPower(AEBaseContainer c, InventoryPlayer ip, int slot, int ticks, double pm,
IFluidPortableCell wt) {
if (slot != -1) {
final ItemStack currentItem = getWirelessTerminal(ip.player, slot);
final ItemStack currentItem = Platform.getItemFromPlayerInventoryBySlotIndex(ip.player, slot);
if (wt != null) {
if (currentItem != wt.getItemStack()) {
if (currentItem != null) {
if (Platform.isSameItem(wt.getItemStack(), currentItem)) {
if (GuiHelper.decodeInvType(slot).getLeft() == GuiHelper.InvType.PLAYER_INV) {
if (slot <= Platform.baublesSlotsOffset) {
ip.setInventorySlotContents(slot, wt.getItemStack());
} else {
BaublesApi.getBaubles(ip.player).setInventorySlotContents(
GuiHelper.decodeInvType(slot).getRight(),
wt.getItemStack());
BaublesApi.getBaubles(ip.player).setInventorySlotContents(slot, wt.getItemStack());
}
} else {
c.setValidContainer(false);
@@ -193,15 +188,6 @@ public final class Util {
return new NullInventory<>();
}
public static ItemStack getWirelessTerminal(EntityPlayer player, int x) {
ImmutablePair<GuiHelper.InvType, Integer> result = GuiHelper.decodeInvType(x);
if (result.getLeft() == GuiHelper.InvType.PLAYER_INV) {
return player.inventory.getStackInSlot(result.getRight());
} else {
return BaublesApi.getBaubles(player).getStackInSlot(result.getRight());
}
}
public static ImmutablePair<Integer, ItemStack> getUltraWirelessTerm(EntityPlayer player) {
int invSize = player.inventory.getSizeInventory();
@@ -215,14 +201,14 @@ public final class Util {
}
}
if (isBaublesLoaded) {
if (ModAndClassUtil.BAUBLES) {
IInventory handler = BaublesApi.getBaubles(player);
if (handler != null) {
invSize = handler.getSizeInventory();
for (int i = 0; i < invSize; ++i) {
ItemStack is = handler.getStackInSlot(i);
if (is != null && is.getItem() instanceof ItemWirelessUltraTerminal) {
return new ImmutablePair<>(GuiHelper.encodeType(i, GuiHelper.InvType.PLAYER_BAUBLES), is);
return new ImmutablePair<>(i + Platform.baublesSlotsOffset, is);
}
}
}
@@ -470,13 +456,6 @@ public final class Util {
return value | (type.ordinal() << 29) | y;
}
public static int encodeType(int x, InvType type) {
if (Math.abs(x) > (1 << 28)) {
throw new IllegalArgumentException("out of range");
}
return value | (type.ordinal() << 29) | x;
}
public static ImmutablePair<GuiType, Integer> decodeType(int y) {
if (Math.abs(y) > (1 << 28)) {
return new ImmutablePair<>(GuiType.values()[y >> 29 & 1], y - (3 << 29 & y));
@@ -484,14 +463,6 @@ public final class Util {
return new ImmutablePair<>(GuiType.TILE, y);
}
}
public static ImmutablePair<InvType, Integer> decodeInvType(int x) {
if (Math.abs(x) > (1 << 28)) {
return new ImmutablePair<>(InvType.values()[x >> 29 & 1], x - (3 << 29 & x));
} else {
return new ImmutablePair<>(InvType.PLAYER_INV, x);
}
}
}
public static int clamp(int value, int min, int max) {
+2
View File
@@ -9,3 +9,5 @@ public net.minecraft.client.gui.inventory.GuiContainer field_147006_u #theSlot
public net.minecraft.client.renderer.texture.TextureMap field_110574_e # mapRegisteredSprites
protected net.minecraft.client.gui.inventory.GuiContainer func_146975_c(II)Lnet.minecraft.inventory.Slot; # getSlotAtPosition
public net.minecraft.client.gui.FontRenderer func_78280_d(Ljava/lang/String;I)Ljava/lang/String;