Compare commits

..
Author SHA1 Message Date
miozune 1402c043ad updateBuildScript 2023-05-07 23:49:53 +09:00
miozune e683c53e5e Fix fluid animation with Hodgepodge loaded 2023-05-07 23:48:34 +09:00
109 changed files with 752 additions and 757 deletions

No files matched your search

+8 -25
View File
@@ -1,4 +1,4 @@
//version: 1685785062
//version: 1683373797
/*
DO NOT CHANGE THIS FILE!
Also, you may replace this file at any time if there is an update available.
@@ -69,7 +69,7 @@ plugins {
id 'com.diffplug.spotless' version '6.13.0' apply false // 6.13.0 is the last jvm8 supporting version
id 'com.modrinth.minotaur' version '2.+' apply false
id 'com.matthewprenger.cursegradle' version '1.4.0' apply false
id 'com.gtnewhorizons.retrofuturagradle' version '1.3.14'
id 'com.gtnewhorizons.retrofuturagradle' version '1.3.7'
}
print("You might want to check out './gradlew :faq' if your build fails.\n")
@@ -569,10 +569,9 @@ repositories {
def mixinProviderGroup = "io.github.legacymoddingmc"
def mixinProviderModule = "unimixins"
def mixinProviderVersion = "0.1.7.1"
def mixinProviderVersion = "0.1.6"
def mixinProviderSpecNoClassifer = "${mixinProviderGroup}:${mixinProviderModule}:${mixinProviderVersion}"
def mixinProviderSpec = "${mixinProviderSpecNoClassifer}:dev"
ext.mixinProviderSpec = mixinProviderSpec
dependencies {
if (usesMixins.toBoolean()) {
@@ -730,7 +729,7 @@ dependencies {
java17Dependencies("com.github.GTNewHorizons:lwjgl3ify:${lwjgl3ifyVersion}")
}
if (modId != 'hodgepodge') {
java17Dependencies('com.github.GTNewHorizons:Hodgepodge:2.2.13')
java17Dependencies('com.github.GTNewHorizons:Hodgepodge:2.2.8')
}
java17PatchDependencies('net.minecraft:launchwrapper:1.15') {transitive = false}
@@ -823,18 +822,6 @@ public abstract class RunHotswappableMinecraftTask extends RunMinecraftTask {
}
this.classpath(project.java17DependenciesCfg)
}
public void setup(Project project) {
super.setup(project)
if (project.usesMixins.toBoolean()) {
this.extraJvmArgs.addAll(project.provider(() -> {
def mixinCfg = project.configurations.detachedConfiguration(project.dependencies.create(project.mixinProviderSpec))
mixinCfg.canBeConsumed = false
mixinCfg.transitive = false
enableHotswap ? ["-javaagent:" + mixinCfg.singleFile.absolutePath] : []
}))
}
}
}
def runClient17Task = tasks.register("runClient17", RunHotswappableMinecraftTask, Distribution.CLIENT, "runClient")
@@ -1276,14 +1263,10 @@ tasks.register('faq') {
description = 'Prints frequently asked questions about building a project'
doLast {
print("If your build fails to fetch dependencies, run './gradlew updateDependencies'. " +
"Or you can manually check if the versions are still on the distributing sites - " +
"the links can be found in repositories.gradle and build.gradle:repositories, " +
"but not build.gradle:buildscript.repositories - those ones are for gradle plugin metadata.\n\n" +
"If your build fails to recognize the syntax of new Java versions, enable Jabel in your " +
"gradle.properties. See how it's done in GTNH ExampleMod/gradle.properties. " +
"However, keep in mind that Jabel enables only syntax features, but not APIs that were introduced in " +
"Java 9 or later.")
print("If your build fails to fetch dependencies, they might have been deleted and replaced by newer " +
"versions.\nCheck if the versions you try to fetch are still on the distributing sites.\n" +
"The links can be found in repositories.gradle and build.gradle:repositories, " +
"not build.gradle:buildscript.repositories - this one is for gradle plugin metadata.")
}
}
+18 -12
View File
@@ -1,22 +1,28 @@
// Add your dependencies here
dependencies {
api('com.github.GTNewHorizons:NotEnoughItems:2.3.50-GTNH:dev')
api('com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-215-GTNH:dev')
api('com.github.GTNewHorizons:NotEnoughItems:2.3.45-GTNH:dev')
api('com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-203-GTNH:dev')
api('curse.maven:cofh-core-69162:2388751')
api('com.github.GTNewHorizons:waila:1.6.0:dev')
compileOnly('com.github.GTNewHorizons:Baubles:1.0.1.16:dev')
compileOnly('com.github.GTNewHorizons:ExtraCells2:2.5.34:dev') { transitive = false }
api('com.github.GTNewHorizons:waila:1.5.24:dev')
compileOnly('com.github.GTNewHorizons:ExtraCells2:2.5.33:dev') { transitive = false }
compileOnly("com.github.GTNewHorizons:WirelessCraftingTerminal:1.9.0:dev")
compileOnly('com.github.GTNewHorizons:ForestryMC:4.6.7:dev')
compileOnly('com.github.GTNewHorizons:EnderIO:2.4.14:dev')
compileOnly('com.github.GTNewHorizons:GT5-Unofficial:5.09.43.21:dev')
compileOnly('com.github.GTNewHorizons:ForestryMC:4.5.6:dev')
compileOnly('com.github.GTNewHorizons:EnderIO:2.4.11:dev')
compileOnly('com.github.GTNewHorizons:EnderCore:0.2.13:dev')
compileOnly('com.github.GTNewHorizons:GT5-Unofficial:5.09.42.82:dev')
compileOnly('com.github.GTNewHorizons:StructureLib:1.2.6:dev')
compileOnly('net.industrial-craft:industrialcraft-2:2.2.828-experimental:dev')
compileOnly('thaumcraft:Thaumcraft:1.7.10-4.2.3.5:dev')
compileOnly('com.github.GTNewHorizons:AppleCore:3.2.10:dev') { transitive = false }
compileOnly('com.github.GTNewHorizons:BuildCraft:7.1.33:dev') { transitive = false }
compileOnly('com.gregoriust.gregtech:gregtech_1.7.10:6.14.23:dev') { transitive = false }
compileOnly('com.github.GTNewHorizons:OpenComputers:1.9.5-GTNH:dev') { transitive = false }
compileOnly('com.github.GTNewHorizons:ThaumicEnergistics:1.4.2-GTNH:dev') { transitive = false }
compileOnly('com.github.GTNewHorizons:GTplusplus:1.9.4:dev') { transitive = false }
compileOnly('com.github.GTNewHorizons:OpenComputers:1.9.1-GTNH:dev') { transitive = false }
compileOnly('com.github.GTNewHorizons:ThaumicEnergistics:1.4.1-GTNH:dev') { transitive = false }
compileOnly('com.github.GTNewHorizons:GTplusplus:1.8.42:dev') { transitive = false }
compileOnly("com.github.GTNewHorizons:Hodgepodge:2.2.10:dev") { transitive = false }
compileOnly('com.github.GTNewHorizons:KekzTech:0.7.8:dev')
api('com.github.GTNewHorizons:Baubles:1.0.1.16:dev')
}
+1 -5
View File
@@ -21,10 +21,6 @@ forgeVersion = 10.13.4.1614
# Do you need to test how your custom blocks interacts with a player that is not the owner? -> leave name empty
developmentEnvironmentUserName = Developer
# Enables using modern java syntax (up to version 17) via Jabel, while still targetting JVM 8.
# See https://github.com/bsideup/jabel for details on how this works.
enableModernJavaSyntax = true
# Define a source file of your project with:
# public static final String VERSION = "GRADLETOKEN_VERSION";
# The string's content will be replaced with your mods version when compiled. You should use this to specify your mod's
@@ -39,7 +35,7 @@ gradleTokenGroupName = GRADLETOKEN_GROUPNAME
# In case your mod provides an API for other mods to implement you may declare its package here. Otherwise, you can
# leave this property empty.
# Example value: apiPackage = api + modGroup = com.myname.mymodid -> com.myname.mymodid.api
apiPackage = api
apiPackage =
# Specify the configuration file for Forge's access transformers here. I must be placed into /src/main/resources/META-INF/
# Example value: mymodid_at.cfg
@@ -77,7 +77,7 @@ public class FluidCraft {
CalculatorV2PluginLoader.installCalculatorV2Plugins();
}
if (ModAndClassUtil.isTypeFilter) {
AEApi.instance().registries().itemDisplay().addItemFilter(FluidFilter::filter);
FluidFilter.installFilter();
}
proxy.postInit(event);
@@ -1,45 +0,0 @@
package com.glodblock.github.api;
import java.util.HashSet;
import java.util.Set;
import net.minecraftforge.fluids.Fluid;
public final class FluidCraftAPI implements IFluidCraftAPI {
private static final FluidCraftAPI API = new FluidCraftAPI();
/**
* These fluids will not be allowed to be stored in fluid storage cells.
*/
private final Set<Class<? extends Fluid>> blacklistedFluids = new HashSet<>();
/**
* These fluids will not be displayed in a fluid terminal.
*/
private final Set<Class<? extends Fluid>> blacklistedDispFluids = new HashSet<>();
public static FluidCraftAPI instance() {
return API;
}
@Override
public void blacklistFluidInStorage(Class<? extends Fluid> fluid) {
blacklistedFluids.add(fluid);
}
@Override
public void blacklistFluidInDisplay(Class<? extends Fluid> fluid) {
blacklistedDispFluids.add(fluid);
}
@Override
public boolean isBlacklistedInStorage(Class<? extends Fluid> fluid) {
return blacklistedFluids.contains(fluid);
}
@Override
public boolean isBlacklistedInDisplay(Class<? extends Fluid> fluid) {
return blacklistedDispFluids.contains(fluid);
}
}
@@ -1,27 +0,0 @@
package com.glodblock.github.api;
import net.minecraftforge.fluids.Fluid;
@SuppressWarnings("unused")
public interface IFluidCraftAPI {
/**
* Blacklisted fluids will not be allowed to be added to a storage cell.
*/
void blacklistFluidInStorage(Class<? extends Fluid> fluid);
/**
* Blacklisted fluids will not be displayed in fluid terminals.
*/
void blacklistFluidInDisplay(Class<? extends Fluid> fluid);
/**
* Mostly for internal use; queries whether the fluid is blacklisted from storage cells.
*/
boolean isBlacklistedInStorage(Class<? extends Fluid> fluid);
/**
* Mostly for internal use; queries whether the fluid is blacklisted from being displayed.
*/
boolean isBlacklistedInDisplay(Class<? extends Fluid> fluid);
}
@@ -128,12 +128,15 @@ public class GuiDualInterface extends GuiUpgradeable {
@Override
protected String getBackground() {
if (!ModAndClassUtil.isBigInterface) return "guis/interface.png";
return switch (((ContainerInterface) this.cvb).getPatternCapacityCardsInstalled()) {
case 1 -> "guis/interface2.png";
case 2 -> "guis/interface3.png";
case 3 -> "guis/interface4.png";
default -> "guis/interface.png";
};
switch (((ContainerInterface) this.cvb).getPatternCapacityCardsInstalled()) {
case 1:
return "guis/interface2.png";
case 2:
return "guis/interface3.png";
case 3:
return "guis/interface4.png";
}
return "guis/interface.png";
}
@Override
@@ -244,7 +244,9 @@ public class GuiFCImgButton extends GuiButton implements ITooltip {
Math.round(uv_y * 16F * 16F / 3F),
Math.round(16F * 16F / 3F),
Math.round(16F * 16F / 3F));
this.mouseDragged(par1Minecraft, par2, par3);
GL11.glPopMatrix();
} else {
GL11.glPushMatrix();
GL11.glTranslatef(this.xPosition, this.yPosition, 0.0F);
@@ -278,9 +280,9 @@ public class GuiFCImgButton extends GuiButton implements ITooltip {
Math.round(uv_y * 16F * 16F / 3F),
Math.round(16F * 16F / 3F),
Math.round(16F * 16F / 3F));
this.mouseDragged(par1Minecraft, par2, par3);
GL11.glPopMatrix();
}
this.mouseDragged(par1Minecraft, par2, par3);
GL11.glPopMatrix();
}
GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
}
@@ -1,5 +1,7 @@
package com.glodblock.github.client.gui;
import java.util.*;
import net.minecraft.entity.player.InventoryPlayer;
import com.glodblock.github.FluidCraft;
@@ -164,6 +164,7 @@ public class GuiFluidLevelEmitter extends GuiUpgradeable {
FluidCraft.proxy.netHandler.sendToServer(new CPacketValueConfig(result, 0));
} catch (final NumberFormatException e) {
// nope..
this.level.setText("0");
}
}
@@ -10,7 +10,6 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidStack;
@@ -23,9 +22,7 @@ import com.glodblock.github.inventory.InventoryHandler;
import com.glodblock.github.inventory.gui.GuiType;
import com.glodblock.github.network.CPacketFluidUpdate;
import com.glodblock.github.util.Ae2ReflectClient;
import com.glodblock.github.util.ModAndClassUtil;
import com.glodblock.github.util.Util;
import com.mitchej123.hodgepodge.textures.IPatchedTextureAtlasSprite;
import appeng.api.storage.ITerminalHost;
import appeng.api.storage.data.IAEFluidStack;
@@ -97,26 +94,20 @@ public class GuiFluidTerminal extends GuiFluidMonitor {
}
private void drawWidget(int posX, int posY, Fluid fluid) {
if (fluid == null) return;
IIcon icon = fluid.getIcon();
if (icon == null) return;
if (ModAndClassUtil.HODGEPODGE && icon instanceof IPatchedTextureAtlasSprite) {
((IPatchedTextureAtlasSprite) icon).markNeedsAnimationUpdate();
}
Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationBlocksTexture);
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GL11.glColor3f(
(fluid.getColor() >> 16 & 0xFF) / 255.0F,
(fluid.getColor() >> 8 & 0xFF) / 255.0F,
(fluid.getColor() & 0xFF) / 255.0F);
drawTexturedModelRectFromIcon(posX, posY, fluid.getIcon(), 16, 16);
GL11.glColor3f(1, 1, 1);
if (fluid != null && fluid.getIcon() != null) {
GL11.glColor3f(
(fluid.getColor() >> 16 & 0xFF) / 255.0F,
(fluid.getColor() >> 8 & 0xFF) / 255.0F,
(fluid.getColor() & 0xFF) / 255.0F);
drawTexturedModelRectFromIcon(posX, posY, fluid.getIcon(), 16, 16);
}
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glDisable(GL11.GL_BLEND);
GL11.glColor3f(1, 1, 1);
}
@Override
@@ -76,6 +76,7 @@ public class GuiInterfaceTerminalWireless extends FCBaseMEGui implements IDropTo
protected static boolean onlyBrokenRecipes = false;
protected GuiTabButton craftingStatusBtn;
// private final IConfigManager configSrc;
private int rows = 3;
private static final String MOLECULAR_ASSEMBLER = "tile.appliedenergistics2.BlockMolecularAssembler";
@@ -209,7 +210,8 @@ public class GuiInterfaceTerminalWireless extends FCBaseMEGui implements IDropTo
protected void repositionSlots() {
for (final Object obj : this.inventorySlots.inventorySlots) {
if (obj instanceof final AppEngSlot slot) {
if (obj instanceof AppEngSlot) {
final AppEngSlot slot = (AppEngSlot) obj;
slot.yDisplayPosition = this.ySize + slot.getY() - 78 - 7;
}
}
@@ -218,9 +220,7 @@ public class GuiInterfaceTerminalWireless extends FCBaseMEGui implements IDropTo
protected int calculateRowsCount() {
final int maxRows = this.getMaxRows();
final boolean hasNEI = IntegrationRegistry.INSTANCE.isEnabled(IntegrationType.NEI);
final int input = 22;
final int topPanel = 18;
final int NEIPadding = hasNEI ? input + topPanel : 0;
final int NEIPadding = hasNEI ? 22 /* input */ + 18 /* top panel */ : 0;
final int extraSpace = this.height - MAGIC_HEIGHT_NUMBER - NEIPadding;
return Math.max(3, Math.min(maxRows, extraSpace / 18));
@@ -243,7 +243,8 @@ public class GuiInterfaceTerminalWireless extends FCBaseMEGui implements IDropTo
final int ex = getScrollBar().getCurrentScroll();
for (int x = 0; x < this.rows && ex + x < this.lines.size(); x++) {
final Object lineObj = this.lines.get(ex + x);
if (lineObj instanceof final ClientDCInternalInv inv) {
if (lineObj instanceof ClientDCInternalInv) {
final ClientDCInternalInv inv = (ClientDCInternalInv) lineObj;
for (int z = 0; z < inv.getInventory().getSizeInventory(); z++) {
if (this.matchedStacks.contains(inv.getInventory().getStackInSlot(z))) drawRect(
z * 18 + 22,
@@ -252,7 +253,8 @@ public class GuiInterfaceTerminalWireless extends FCBaseMEGui implements IDropTo
1 + offset + 16,
GuiColors.InterfaceTerminalMatch.getColor());
}
} else if (lineObj instanceof String name) {
} else if (lineObj instanceof String) {
String name = (String) lineObj;
final int rows = this.byName.get(name).size();
String postfix = "";
@@ -307,7 +309,8 @@ public class GuiInterfaceTerminalWireless extends FCBaseMEGui implements IDropTo
final int ex = this.getScrollBar().getCurrentScroll();
for (int x = 0; x < this.rows && ex + x < this.lines.size(); x++) {
final Object lineObj = this.lines.get(ex + x);
if (lineObj instanceof final ClientDCInternalInv inv) {
if (lineObj instanceof ClientDCInternalInv) {
final ClientDCInternalInv inv = (ClientDCInternalInv) lineObj;
for (int z = 0; z < inv.getInventory().getSizeInventory(); z++) {
inventorySlots.inventorySlots.add(new SlotDisconnected(inv, z, z * 18 + 22, 1 + offset));
}
@@ -402,7 +405,8 @@ public class GuiInterfaceTerminalWireless extends FCBaseMEGui implements IDropTo
} else if (btn == craftingStatusBtn) {
InventoryHandler.switchGui(GuiType.CRAFTING_STATUS);
} else if (btn instanceof final GuiImgButton iBtn) {
} else if (btn instanceof GuiImgButton) {
final GuiImgButton iBtn = (GuiImgButton) btn;
if (iBtn.getSetting() != Settings.ACTIONS) {
final Enum cv = iBtn.getCurrentValue();
final boolean backwards = Mouse.isButtonDown(1);
@@ -440,7 +444,8 @@ public class GuiInterfaceTerminalWireless extends FCBaseMEGui implements IDropTo
for (int x = 0; x < this.rows && ex + x < this.lines.size(); x++) {
final Object lineObj = this.lines.get(ex + x);
if (lineObj instanceof final ClientDCInternalInv inv) {
if (lineObj instanceof ClientDCInternalInv) {
final ClientDCInternalInv inv = (ClientDCInternalInv) lineObj;
GL11.glColor4f(1, 1, 1, 1);
final int width = inv.getInventory().getSizeInventory() * 18;
@@ -534,7 +539,7 @@ public class GuiInterfaceTerminalWireless extends FCBaseMEGui implements IDropTo
if (this.refreshList) {
this.refreshList = false;
// invalidate caches on refresh
// invalid caches on refresh
this.cachedSearches.clear();
this.refreshList();
}
@@ -364,33 +364,32 @@ public class GuiLevelMaintainer extends AEBaseGui implements INEIGuiHandler {
public void draw() {
this.getQty().draw();
this.getBatch().draw();
ArrayList<String> message = new ArrayList<>();
ArrayList<String> message = new ArrayList<String>();
message.add(NameConst.i18n(NameConst.TT_LEVEL_MAINTAINER_TITLE) + "\n");
switch (this.state) {
case Idling -> {
case Idling:
this.line.setColor(0xFF55FF55);
message.add(
NameConst.i18n(NameConst.TT_LEVEL_MAINTAINER_CURRENT)
+ NameConst.i18n(NameConst.TT_LEVEL_MAINTAINER_IDLE));
}
case Crafting -> {
break;
case Crafting:
this.line.setColor(0xFFFFFF55);
message.add(
NameConst.i18n(NameConst.TT_LEVEL_MAINTAINER_CURRENT)
+ NameConst.i18n(NameConst.TT_LEVEL_MAINTAINER_LINK));
}
case Exporting -> {
break;
case Exporting:
this.line.setColor(0xFFAA00AA);
message.add(
NameConst.i18n(NameConst.TT_LEVEL_MAINTAINER_CURRENT)
+ NameConst.i18n(NameConst.TT_LEVEL_MAINTAINER_EXPORT));
}
default -> {
break;
default:
this.line.setColor(0);
message.add(
NameConst.i18n(NameConst.TT_LEVEL_MAINTAINER_CURRENT)
+ NameConst.i18n(NameConst.TT_LEVEL_MAINTAINER_NONE));
}
}
message.add("");
if (isShiftKeyDown()) {
@@ -431,7 +430,7 @@ public class GuiLevelMaintainer extends AEBaseGui implements INEIGuiHandler {
this.textField = textField;
this.textField.setEnableBackgroundDrawing(false);
this.textField.setText("0");
this.textField.setMaxStringLength(10); // this length is enough to useful
this.textField.setMaxStringLength(10); // it's enough to useful
this.idx = idx;
this.action = action;
this.tooltip = tooltip;
@@ -16,7 +16,7 @@ import appeng.core.localization.GuiText;
public class GuiRenamer extends AEBaseGui implements IDropToFillTextField {
private final MEGuiTextField textField;
private MEGuiTextField textField;
public GuiRenamer(InventoryPlayer ip, ITerminalHost monitorable) {
super(new ContainerRenamer(ip, monitorable));
@@ -41,10 +41,10 @@ public abstract class FCGuiAmount extends AEBaseGui {
@SuppressWarnings("unchecked")
public void initGui() {
super.initGui();
final int a = AEConfig.instance.craftItemsByStackAmounts(0);
final int b = AEConfig.instance.craftItemsByStackAmounts(1);
final int c = AEConfig.instance.craftItemsByStackAmounts(2);
final int d = AEConfig.instance.craftItemsByStackAmounts(3);
final int a = AEConfig.instance.priorityByStacksAmounts(0);
final int b = AEConfig.instance.priorityByStacksAmounts(1);
final int c = AEConfig.instance.priorityByStacksAmounts(2);
final int d = AEConfig.instance.priorityByStacksAmounts(3);
this.buttonList.add(this.plus1 = new GuiButton(0, this.guiLeft + 20, this.guiTop + 26, 22, 20, "+" + a));
this.buttonList.add(this.plus10 = new GuiButton(0, this.guiLeft + 48, this.guiTop + 26, 28, 20, "+" + b));
@@ -29,11 +29,11 @@ import appeng.api.implementations.tiles.IViewCellStorage;
import appeng.api.storage.ITerminalHost;
import appeng.api.storage.data.IAEItemStack;
import appeng.api.storage.data.IAEStack;
import appeng.api.storage.data.IDisplayRepo;
import appeng.api.util.IConfigManager;
import appeng.api.util.IConfigurableObject;
import appeng.client.gui.widgets.*;
import appeng.client.me.InternalSlotME;
import appeng.client.me.ItemRepo;
import appeng.client.me.SlotDisconnected;
import appeng.client.me.SlotME;
import appeng.container.AEBaseContainer;
@@ -67,7 +67,7 @@ public abstract class FCGuiMonitor<T extends IAEStack<T>> extends FCBaseMEGui
protected final ItemStack[] myCurrentViewCells = new ItemStack[5];
public FCContainerMonitor<T> monitorableContainer;
public GuiTabButton craftingStatusBtn;
protected IDisplayRepo repo;
protected ItemRepo repo;
protected GuiImgButton craftingStatusImgBtn;
protected FCGuiTextField searchField;
protected int perRow = 9;
@@ -122,8 +122,9 @@ public abstract class FCGuiMonitor<T extends IAEStack<T>> extends FCBaseMEGui
if (btn == this.craftingStatusBtn || btn == this.craftingStatusImgBtn) {
InventoryHandler.switchGui(GuiType.CRAFTING_STATUS);
}
if (btn instanceof final GuiImgButton iBtn) {
if (btn instanceof GuiImgButton) {
final boolean backwards = Mouse.isButtonDown(1);
final GuiImgButton iBtn = (GuiImgButton) btn;
if (iBtn.getSetting() != Settings.ACTIONS) {
final Enum<?> cv = iBtn.getCurrentValue();
final Enum<?> next = Platform.rotateEnum(cv, backwards, iBtn.getSetting().getPossibleValues());
@@ -272,8 +273,6 @@ public abstract class FCGuiMonitor<T extends IAEStack<T>> extends FCBaseMEGui
AEConfig.instance.settings.getSetting(Settings.TERMINAL_STYLE)));
this.offsetY += 20;
// Right now 80 > offsetX, but that can be changed later.
// noinspection DataFlowIssue
this.searchField = new FCGuiTextField(
this.fontRendererObj,
this.guiLeft + Math.max(80, this.offsetX),
@@ -434,7 +433,7 @@ public abstract class FCGuiMonitor<T extends IAEStack<T>> extends FCBaseMEGui
if (slot instanceof SlotPatternTerm) {
if (mouseButton == 6) {
return; // prevents weird double clicks
return; // prevent weird double clicks..
}
try {
NetworkHandler.instance.sendToServer(((SlotPatternTerm) slot).getRequest(isShiftKeyDown()));
@@ -443,13 +442,13 @@ public abstract class FCGuiMonitor<T extends IAEStack<T>> extends FCBaseMEGui
}
} else if (slot instanceof SlotCraftingTerm) {
if (mouseButton == 6) {
return; // prevents weird double clicks
return; // prevent weird double clicks..
}
InventoryAction action;
if (isShiftKeyDown()) {
action = InventoryAction.CRAFT_SHIFT;
} else {
// Craft a stack on right-click, craft a single one on left-click
// Craft stack on right-click, craft single on left-click
action = (mouseButton == 1) ? InventoryAction.CRAFT_STACK : InventoryAction.CRAFT_ITEM;
}
final PacketInventoryAction p = new PacketInventoryAction(action, slotIdx, 0);
@@ -650,7 +649,7 @@ public abstract class FCGuiMonitor<T extends IAEStack<T>> extends FCBaseMEGui
@Override
public void updateScreen() {
this.repo.setPowered(this.monitorableContainer.isPowered());
this.repo.setPower(this.monitorableContainer.isPowered());
super.updateScreen();
}
@@ -119,6 +119,12 @@ public class ContainerEssentiaMonitor extends ContainerFluidPortableCell {
if (slotIndex == -1) {
out.stackSize = fluidContainer.stackSize;
} else {
if (drainStack != null) {
System.out.print("---------\n");
System.out.print(drainStack.right + "\n");
System.out.print(drainStack.left + "\n");
System.out.print(aeFluidStack.getStackSize() + "\n");
}
out.stackSize = (int) (fluidContainer.stackSize
- (aeFluidStack.getStackSize() / drainStack.left));
}
@@ -222,7 +222,7 @@ public class ContainerFluidMonitor extends FCContainerMonitor<IAEFluidStack> {
}
/**
* The insert operation. For input, we have a filled container stack. For outputs, we have the following: 1.
* The insert operation. For input, we have an filled container stack. For outputs, we have the following: 1.
* Leftover filled container stack - primary output. 2. Empty containers 3. Partially filled container x1 In order
* above, the itemstack at `slotIndex` is transformed into the output.
*/
@@ -345,7 +345,16 @@ public class ContainerFluidMonitor extends FCContainerMonitor<IAEFluidStack> {
private void extractFluid(IAEFluidStack fluid, ItemStack fluidContainer, EntityPlayer player, int heldContainers) {
IAEFluidStack storedFluid = this.monitor.getStorageList().findPrecise(fluid);
if (storedFluid == null || storedFluid.getStackSize() <= 0) return;
int capacity = Util.FluidUtil.getCapacity(fluidContainer, storedFluid.getFluid());
int capacity;
if (fluidContainer.getItem() instanceof IFluidContainerItem) {
capacity = ((IFluidContainerItem) fluidContainer.getItem()).getCapacity(fluidContainer);
} else if (FluidContainerRegistry.isContainer(fluidContainer)) {
// Fill with fluid container registry, or abort if it failed
ItemStack dummy = FluidContainerRegistry.fillFluidContainer(storedFluid.getFluidStack(), fluidContainer);
capacity = FluidContainerRegistry.getContainerCapacity(dummy);
} else {
return;
}
if (capacity == 0) return;
// The fluidstack that we will try to extract from the system.
final IAEFluidStack canExtract = storedFluid.copy();
@@ -353,7 +362,7 @@ public class ContainerFluidMonitor extends FCContainerMonitor<IAEFluidStack> {
// run into issues w/ remainder fluid later.
canExtract.setStackSize((long) capacity * fluidContainer.stackSize);
IAEFluidStack actualExtract = this.host.getFluidInventory()
.extractItems(canExtract, Actionable.MODULATE, this.getActionSource());
.extractItems(canExtract, Actionable.SIMULATE, this.getActionSource());
if (actualExtract == null) return;
// Calculate the number of full fluid containers we extracted
long toExtract = actualExtract.getStackSize();
@@ -393,14 +402,19 @@ public class ContainerFluidMonitor extends FCContainerMonitor<IAEFluidStack> {
if (dummy == null) {
// Failed to fill partial...
partialStack.stackSize = 0;
toExtract -= remainder;
} else {
partialStack = dummy;
toExtract -= FluidContainerRegistry.getContainerCapacity(partialStack);
emptyTanks--;
}
}
} else {
partialStack.stackSize = 0;
}
// Now perform the real extraction.
actualExtract.setStackSize(toExtract);
this.host.getFluidInventory().extractItems(canExtract, Actionable.MODULATE, this.getActionSource());
// Done. Put the output in the inventory or ground, and update stack size.
// We can assume slotIndex == -1, since we don't actually allow extraction via shift click.
@@ -427,7 +441,9 @@ public class ContainerFluidMonitor extends FCContainerMonitor<IAEFluidStack> {
(EntityPlayerMP) player);
} else {
FluidCraft.proxy.netHandler.sendTo(new SPacketFluidUpdate(new HashMap<>()), (EntityPlayerMP) player);
}
}
void adjustStack(ItemStack stack) {
@@ -106,10 +106,7 @@ public class ContainerFluidPatternEncoder extends AEBaseContainer implements IPa
}
private static IAEItemStack[] collectAeInventory(AeStackInventory<IAEItemStack> inv) {
/*
* AE2 API documentation says the input/output arrays can contain nulls, but their use of the API directly
* contradicts that, so we just go by behaviour and filter out nulls.
*/
// see note at top of DensePatternDetails
List<IAEItemStack> acc = new ArrayList<>();
for (IAEItemStack stack : inv) {
if (stack != null) {
@@ -133,20 +130,20 @@ public class ContainerFluidPatternEncoder extends AEBaseContainer implements IPa
if (slot instanceof SlotFluidConvertingFake) {
final ItemStack stack = player.inventory.getItemStack();
switch (action) {
case PICKUP_OR_SET_DOWN -> {
case PICKUP_OR_SET_DOWN:
if (stack == null) {
slot.putStack(null);
} else {
((SlotFluidConvertingFake) slot).putConvertedStack(stack.copy());
}
}
case PLACE_SINGLE -> {
break;
case PLACE_SINGLE:
if (stack != null) {
((SlotFluidConvertingFake) slot)
.putConvertedStack(Objects.requireNonNull(Util.copyStackWithSize(stack, 1)));
}
}
case SPLIT_OR_PLACE_SINGLE -> {
break;
case SPLIT_OR_PLACE_SINGLE:
ItemStack inSlot = slot.getStack();
if (inSlot != null) {
if (stack == null) {
@@ -164,7 +161,7 @@ public class ContainerFluidPatternEncoder extends AEBaseContainer implements IPa
((SlotFluidConvertingFake) slot)
.putConvertedStack(Objects.requireNonNull(Util.copyStackWithSize(stack, 1)));
}
}
break;
}
} else {
super.doAction(player, action, slotId, id);
@@ -42,12 +42,13 @@ import appeng.util.inv.WrapperInvSlot;
public class ContainerInterfaceWireless extends FCBaseContainer {
/**
* this stuff is all server side
* this stuff is all server side..
*/
private static long autoBase = Long.MIN_VALUE;
private final Multimap<IInterfaceHost, ContainerInterfaceWireless.InvTracker> diList = HashMultimap.create();
private final Map<Long, ContainerInterfaceWireless.InvTracker> byId = new HashMap<>();
private final Map<Long, ContainerInterfaceWireless.InvTracker> byId = new HashMap<Long, ContainerInterfaceWireless.InvTracker>();
// private final Map<Long, InvTracker> byId = new HashMap<>();
private IGrid grid;
private NBTTagCompound data = new NBTTagCompound();
@@ -113,7 +114,9 @@ public class ContainerInterfaceWireless extends FCBaseContainer {
try {
NetworkHandler.instance
.sendTo(new PacketCompressedNBT(this.data), (EntityPlayerMP) this.getPlayerInv().player);
} catch (final IOException ignored) {}
} catch (final IOException e) {
// :P
}
this.data = new NBTTagCompound();
}
@@ -137,7 +140,7 @@ public class ContainerInterfaceWireless extends FCBaseContainer {
boolean canInsert = true;
switch (action) {
case PICKUP_OR_SET_DOWN -> {
case PICKUP_OR_SET_DOWN:
if (hasItemInHand) {
for (int s = 0; s < interfaceHandler.getSizeInventory(); s++) {
if (Platform.isSameItemPrecise(
@@ -172,8 +175,9 @@ public class ContainerInterfaceWireless extends FCBaseContainer {
final IInventory mySlot = slotInv.getWrapper(slot + inv.offset);
mySlot.setInventorySlotContents(0, playerHand.addItems(mySlot.getStackInSlot(0)));
}
}
case SPLIT_OR_PLACE_SINGLE -> {
break;
case SPLIT_OR_PLACE_SINGLE:
if (hasItemInHand) {
for (int s = 0; s < interfaceHandler.getSizeInventory(); s++) {
if (Platform.isSameItemPrecise(
@@ -201,28 +205,31 @@ public class ContainerInterfaceWireless extends FCBaseContainer {
interfaceSlot.addItems(extra);
}
}
}
case SHIFT_CLICK -> {
break;
case SHIFT_CLICK:
final IInventory mySlot = slotInv.getWrapper(slot + inv.offset);
final InventoryAdaptor playerInv = InventoryAdaptor.getAdaptor(player, ForgeDirection.UNKNOWN);
mySlot.setInventorySlotContents(0, mergeToPlayerInventory(playerInv, mySlot.getStackInSlot(0)));
}
case MOVE_REGION -> {
break;
case MOVE_REGION:
final InventoryAdaptor playerInvAd = InventoryAdaptor.getAdaptor(player, ForgeDirection.UNKNOWN);
for (int x = 0; x < inv.client.getSizeInventory(); x++) {
inv.server.setInventorySlotContents(
x + inv.offset,
mergeToPlayerInventory(playerInvAd, inv.server.getStackInSlot(x + inv.offset)));
}
}
case CREATIVE_DUPLICATE -> {
break;
case CREATIVE_DUPLICATE:
if (player.capabilities.isCreativeMode && !hasItemInHand) {
player.inventory.setItemStack(is == null ? null : is.copy());
}
}
default -> {
break;
default:
return;
}
}
this.updateHeld(player);
@@ -132,11 +132,11 @@ public abstract class FCContainerEncodeTerminal extends ContainerItemMonitor
&& (stack.getItem() instanceof IFluidContainerItem || FluidContainerRegistry.isContainer(stack))) {
FluidStack fluid = null;
switch (action) {
case PICKUP_OR_SET_DOWN -> {
case PICKUP_OR_SET_DOWN:
fluid = Util.getFluidFromItem(stack);
slot.putStack(ItemFluidPacket.newStack(fluid));
}
case SPLIT_OR_PLACE_SINGLE -> {
break;
case SPLIT_OR_PLACE_SINGLE:
fluid = Util.getFluidFromItem(Util.copyStackWithSize(stack, 1));
FluidStack origin = ItemFluidPacket.getFluidStack(slot.getStack());
if (fluid != null && fluid.equals(origin)) {
@@ -144,7 +144,7 @@ public abstract class FCContainerEncodeTerminal extends ContainerItemMonitor
if (fluid.amount <= 0) fluid = null;
}
slot.putStack(ItemFluidPacket.newStack(fluid));
}
break;
}
if (fluid == null) {
super.doAction(player, action, slotId, id);
@@ -98,7 +98,7 @@ public abstract class FCContainerFluidConfigurable extends ContainerUpgradeable
@Override
protected void standardDetectAndSendChanges() {
if (Platform.isServer()) {
// clear out config items that are no longer valid (for instance, capacity upgrade removed)
// clear out config items that are no longer valid (eg capacity upgrade removed)
final AppEngInternalAEInventory inv = this.getFakeFluidInv();
final Map<Integer, IAEFluidStack> tmp = new HashMap<>();
for (int i = 0; i < inv.getSizeInventory(); ++i) {
@@ -210,7 +210,8 @@ public abstract class FCContainerMonitor<T extends IAEStack<T>> extends FCBaseCo
@Override
public void onListUpdate() {
for (final Object c : this.crafters) {
if (c instanceof final ICrafting cr) {
if (c instanceof ICrafting) {
final ICrafting cr = (ICrafting) c;
this.queueInventory(cr);
}
}
@@ -1,25 +1,17 @@
package com.glodblock.github.client.me;
import java.util.Iterator;
import java.util.regex.Pattern;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidStack;
import com.glodblock.github.common.item.ItemFluidDrop;
import com.glodblock.github.crossmod.thaumcraft.AspectUtil;
import com.glodblock.github.util.FluidSorters;
import appeng.api.config.SearchBoxMode;
import appeng.api.config.Settings;
import appeng.api.config.SortOrder;
import appeng.api.config.ViewItems;
import appeng.api.storage.data.IAEFluidStack;
import appeng.api.storage.data.IAEItemStack;
import appeng.client.gui.widgets.IScrollSource;
import appeng.client.gui.widgets.ISortSource;
import appeng.core.AEConfig;
public class EssentiaRepo extends FluidRepo {
@@ -29,84 +21,7 @@ public class EssentiaRepo extends FluidRepo {
@Override
public void updateView() {
this.view.clear();
this.dsp.clear();
this.view.ensureCapacity(this.list.size());
this.dsp.ensureCapacity(this.list.size());
final Enum<?> viewMode = this.sortSrc.getSortDisplay();
final Enum<?> searchMode = AEConfig.instance.settings.getSetting(Settings.SEARCH_MODE);
if (searchMode == SearchBoxMode.NEI_AUTOSEARCH || searchMode == SearchBoxMode.NEI_MANUAL_SEARCH) {
this.updateNEI(this.searchString);
}
String innerSearch = this.searchString;
if (innerSearch.startsWith("@")) {
innerSearch = innerSearch.substring(1);
}
Pattern m;
try {
m = Pattern.compile(innerSearch.toLowerCase(), Pattern.CASE_INSENSITIVE);
} catch (final Throwable ignore) {
try {
m = Pattern.compile(Pattern.quote(innerSearch.toLowerCase()), Pattern.CASE_INSENSITIVE);
} catch (final Throwable __) {
return;
}
}
for (IAEItemStack is : this.list) {
if (this.myPartitionList != null) {
if (!this.myPartitionList.isListed(is)) {
continue;
}
}
if (viewMode == ViewItems.CRAFTABLE && !is.isCraftable()) {
continue;
}
if (viewMode == ViewItems.CRAFTABLE) {
is = is.copy();
is.setStackSize(0);
}
if (viewMode == ViewItems.STORED && is.getStackSize() == 0) {
continue;
}
Fluid fluid = ItemFluidDrop.getAeFluidStack(is).getFluid();
if (!AspectUtil.isEssentiaGas(fluid)) {
continue;
}
if (m.matcher(fluid.getLocalizedName().toLowerCase()).find()) {
this.view.add(is);
}
}
final Enum<?> SortBy = this.sortSrc.getSortBy();
final Enum<?> SortDir = this.sortSrc.getSortDir();
FluidSorters.setDirection((appeng.api.config.SortDir) SortDir);
FluidSorters.init();
if (SortBy == SortOrder.MOD) {
this.view.sort(FluidSorters.CONFIG_BASED_SORT_BY_MOD);
} else if (SortBy == SortOrder.AMOUNT) {
this.view.sort(FluidSorters.CONFIG_BASED_SORT_BY_SIZE);
} else if (SortBy == SortOrder.INVTWEAKS) {
this.view.sort(FluidSorters.CONFIG_BASED_SORT_BY_INV_TWEAKS);
} else {
this.view.sort(FluidSorters.CONFIG_BASED_SORT_BY_NAME);
}
for (final IAEItemStack is : this.view) {
this.dsp.add(is.getItemStack());
}
super.updateView();
Iterator<IAEItemStack> it1 = this.view.iterator();
while (it1.hasNext()) {
IAEFluidStack fluid = ItemFluidDrop.getAeFluidStack(it1.next());
@@ -20,7 +20,6 @@ import javax.annotation.Nonnull;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fluids.Fluid;
import com.glodblock.github.api.FluidCraftAPI;
import com.glodblock.github.common.item.ItemFluidDrop;
import com.glodblock.github.util.FluidSorters;
import com.glodblock.github.util.Util;
@@ -28,36 +27,36 @@ import com.glodblock.github.util.Util;
import appeng.api.AEApi;
import appeng.api.config.*;
import appeng.api.storage.data.IAEItemStack;
import appeng.api.storage.data.IDisplayRepo;
import appeng.api.storage.data.IItemList;
import appeng.client.gui.widgets.IScrollSource;
import appeng.client.gui.widgets.ISortSource;
import appeng.client.me.ItemRepo;
import appeng.core.AEConfig;
import appeng.items.storage.ItemViewCell;
import appeng.util.prioitylist.IPartitionList;
import cpw.mods.fml.relauncher.ReflectionHelper;
public class FluidRepo implements IDisplayRepo {
public class FluidRepo extends ItemRepo {
protected final IItemList<IAEItemStack> list = AEApi.instance().storage().createItemList();
private final IItemList<IAEItemStack> list = AEApi.instance().storage().createItemList();
protected final ArrayList<IAEItemStack> view = new ArrayList<>();
protected final ArrayList<ItemStack> dsp = new ArrayList<>();
protected final IScrollSource src;
protected final ISortSource sortSrc;
private final IScrollSource src;
private final ISortSource sortSrc;
protected int rowSize = 9;
private int rowSize = 9;
protected String searchString = "";
protected IPartitionList<IAEItemStack> myPartitionList;
private String searchString = "";
private IPartitionList<IAEItemStack> myPartitionList;
private String NEIWord = null;
private boolean hasPower;
public FluidRepo(final IScrollSource src, final ISortSource sortSrc) {
super(src, sortSrc);
this.src = src;
this.sortSrc = sortSrc;
}
@Override
public IAEItemStack getReferenceItem(int idx) {
idx += this.src.getCurrentScroll() * this.rowSize;
@@ -67,7 +66,6 @@ public class FluidRepo implements IDisplayRepo {
return this.view.get(idx);
}
@Override
public ItemStack getItem(int idx) {
idx += this.src.getCurrentScroll() * this.rowSize;
@@ -77,7 +75,10 @@ public class FluidRepo implements IDisplayRepo {
return this.dsp.get(idx);
}
@Override
void setSearch(final String search) {
this.searchString = search == null ? "" : search;
}
public void postUpdate(final IAEItemStack is) {
final IAEItemStack st = this.list.findPrecise(is);
if (st != null) {
@@ -88,13 +89,11 @@ public class FluidRepo implements IDisplayRepo {
}
}
@Override
public void setViewCell(final ItemStack[] list) {
this.myPartitionList = ItemViewCell.createFilter(list);
this.updateView();
}
@Override
public void updateView() {
this.view.clear();
this.dsp.clear();
@@ -146,13 +145,7 @@ public class FluidRepo implements IDisplayRepo {
if (viewMode == ViewItems.STORED && is.getStackSize() == 0) {
continue;
}
Fluid fluid = ItemFluidDrop.getAeFluidStack(is).getFluid();
if (FluidCraftAPI.instance().isBlacklistedInDisplay(fluid.getClass())) {
continue;
}
if (searchMod) {
if (m.matcher(Util.getFluidModID(fluid).toLowerCase()).find()
|| m.matcher(Util.getFluidModName(fluid).toLowerCase()).find()) {
@@ -186,7 +179,7 @@ public class FluidRepo implements IDisplayRepo {
}
}
protected void updateNEI(final String filter) {
private void updateNEI(final String filter) {
try {
if (this.NEIWord == null || !this.NEIWord.equals(filter)) {
final Class<?> c = ReflectionHelper
@@ -206,23 +199,19 @@ public class FluidRepo implements IDisplayRepo {
}
}
@Override
public int size() {
return this.view.size();
}
@Override
public void clear() {
this.list.resetStatus();
}
@Override
public boolean hasPower() {
return this.hasPower;
}
@Override
public void setPowered(final boolean hasPower) {
public void setPower(final boolean hasPower) {
this.hasPower = hasPower;
}
@@ -19,8 +19,6 @@ import com.glodblock.github.FluidCraft;
import com.glodblock.github.client.render.tank.ModelCertusTank;
import com.glodblock.github.common.tile.TileCertusQuartzTank;
import com.glodblock.github.loader.ItemAndBlockHolder;
import com.glodblock.github.util.ModAndClassUtil;
import com.mitchej123.hodgepodge.textures.IPatchedTextureAtlasSprite;
import cpw.mods.fml.client.registry.ClientRegistry;
@@ -68,9 +66,6 @@ public class ItemCertusQuartzTankRender implements IItemRenderer {
if (storedFluid != null && storedFluid.getFluid() != null) {
IIcon fluidIcon = storedFluid.getFluid().getIcon();
if (fluidIcon == null) fluidIcon = FluidRegistry.LAVA.getIcon();
if (ModAndClassUtil.HODGEPODGE && fluidIcon instanceof IPatchedTextureAtlasSprite) {
((IPatchedTextureAtlasSprite) fluidIcon).markNeedsAnimationUpdate();
}
Tessellator tessellator = Tessellator.instance;
RenderBlocks renderer = new RenderBlocks();
GL11.glScalef(1, 1, -1);
@@ -37,12 +37,15 @@ public class ItemWalrusRender implements IItemRenderer {
Minecraft.getMinecraft().renderEngine.bindTexture(this.textureWalrus);
GL11.glPushMatrix();
switch (type) {
case EQUIPPED_FIRST_PERSON -> {
case EQUIPPED_FIRST_PERSON:
GL11.glRotated(180, 0, 1, 0);
GL11.glTranslatef(-1F, 0.5F, -0.5F);
}
case INVENTORY -> GL11.glTranslatef(-0.5F, -0.5F, -0.1F);
default -> {}
break;
case INVENTORY:
GL11.glTranslatef(-0.5F, -0.5F, -0.1F);
break;
default:
break;
}
this.modelWalrus.renderAll();
GL11.glPopMatrix();
@@ -3,11 +3,8 @@ package com.glodblock.github.client.render.tank;
import java.util.HashMap;
import java.util.Map;
import javax.annotation.Nonnull;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.GLAllocation;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.init.Blocks;
import net.minecraft.util.IIcon;
@@ -78,7 +75,7 @@ public class FluidTankRenderer {
return null;
}
Map<Fluid, int[]> cache = flowing ? flowingRenderCache : stillRenderCache;
int[] diplayLists = getCachedData(fluid, cache);
int[] diplayLists = cache.get(fluid);
if (diplayLists != null) {
return diplayLists;
}
@@ -100,7 +97,7 @@ public class FluidTankRenderer {
for (int s = 0; s < DISPLAY_STAGES; ++s) {
diplayLists[s] = GLAllocation.generateDisplayLists(1);
GL11.glNewList(diplayLists[s], GL11.GL_COMPILE);
GL11.glNewList(diplayLists[s], 4864 /* GL_COMPILE */);
liquidBlock.minX = 0.01f;
liquidBlock.minY = 0;
@@ -121,12 +118,4 @@ public class FluidTankRenderer {
return diplayLists;
}
private static int[] getCachedData(@Nonnull Fluid fluid, Map<Fluid, int[]> cache) {
IIcon icon = fluid.getIcon();
if (icon instanceof TextureAtlasSprite sprite && sprite.hasAnimationMetadata()) {
return null;
}
return cache.get(fluid);
}
}
@@ -15,6 +15,7 @@ public class Config {
public static boolean noFluidPacket;
public static boolean fluidIOBus;
public static boolean removeRecipe;
public static boolean blacklistEssentiaGas;
public static double portableCellBattery;
public static int packetSize;
public static int packetRate;
@@ -46,6 +47,11 @@ public class Config {
"Fluid Craft for AE2",
false,
"Disable all recipes, for quick tweaker.");
blacklistEssentiaGas = Config.getBoolean(
"Blacklist Essentia Gas",
"Fluid Craft for AE2",
true,
"Blacklist Essentia Gas from Thaumic Energistics, so they won't be stored in Fluid Storage Cells.");
portableCellBattery = Config.get("Fluid Craft for AE2", "Portable Fluid Cell Battery Capacity", 20000D)
.getDouble();
packetSize = Config.get("Fluid Craft for AE2", "packetSize", 256, "Number of items to be sent per packet")
@@ -56,8 +62,8 @@ public class Config {
.getInt();
if (packetRate <= 0) packetRate = 50;
replaceEC2 = Config.getBoolean(
"replaceEC2",
"Fluid Craft for AE2",
"replaceEC2",
true,
"Set true to handle missing item mappings from EC2. Note to work properly, you must have all relevant parts.");
if (Config.hasChanged()) Config.save();
@@ -78,12 +78,16 @@ public class BlockCertusQuartzTank extends BaseBlockContainer implements IRegist
@Override
public IIcon getIcon(int side, int meta) {
return switch (meta) {
case 1 -> this.sideTopIcon;
case 2 -> this.sideBottomIcon;
case 3 -> this.sideMiddleIcon;
default -> side == 0 ? this.bottomIcon : side == 1 ? this.topIcon : this.sideIcon;
};
switch (meta) {
case 1:
return this.sideTopIcon;
case 2:
return this.sideBottomIcon;
case 3:
return this.sideMiddleIcon;
default:
return side == 0 ? this.bottomIcon : side == 1 ? this.topIcon : this.sideIcon;
}
}
@Override
@@ -99,7 +103,8 @@ public class BlockCertusQuartzTank extends BaseBlockContainer implements IRegist
@Override
public int getLightValue(IBlockAccess world, int x, int y, int z) {
TileEntity tile = world.getTileEntity(x, y, z);
if (tile instanceof TileCertusQuartzTank tank) {
if (tile instanceof TileCertusQuartzTank) {
TileCertusQuartzTank tank = (TileCertusQuartzTank) tile;
return tank.getFluidLightLevel();
}
return super.getLightValue(world, x, y, z);
@@ -76,11 +76,21 @@ public class BlockWalrus extends BaseBlockContainer {
@Override
public void setBlockBoundsBasedOnState(IBlockAccess blockAccess, int x, int y, int z) {
switch (ForgeDirection.getOrientation(blockAccess.getBlockMetadata(x, y, z))) {
case NORTH -> setBlockBounds(0.0F, 0.0F, -1.0F, 1.0F, 1.0F, 1.0F);
case EAST -> setBlockBounds(0.0F, 0.0F, 0.0F, 2.0F, 1.0F, 1.0F);
case SOUTH -> setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 2.0F);
case WEST -> setBlockBounds(-1.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
default -> setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
case NORTH:
setBlockBounds(0.0F, 0.0F, -1.0F, 1.0F, 1.0F, 1.0F);
break;
case EAST:
setBlockBounds(0.0F, 0.0F, 0.0F, 2.0F, 1.0F, 1.0F);
break;
case SOUTH:
setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 2.0F);
break;
case WEST:
setBlockBounds(-1.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
break;
default:
setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
break;
}
}
@@ -14,12 +14,13 @@ import net.minecraft.util.StatCollector;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import com.glodblock.github.api.FluidCraftAPI;
import com.glodblock.github.common.Config;
import com.glodblock.github.common.storage.CellType;
import com.glodblock.github.common.storage.IFluidCellInventory;
import com.glodblock.github.common.storage.IFluidCellInventoryHandler;
import com.glodblock.github.common.storage.IStorageFluidCell;
import com.glodblock.github.loader.ItemAndBlockHolder;
import com.glodblock.github.util.ModAndClassUtil;
import com.glodblock.github.util.NameConst;
import com.google.common.base.Optional;
@@ -86,8 +87,10 @@ public abstract class FCBaseItemCell extends AEBaseItem implements IStorageFluid
@Override
public boolean isBlackListed(ItemStack cellItem, IAEFluidStack requestedAddition) {
return requestedAddition == null || requestedAddition.getFluid() == null
|| FluidCraftAPI.instance().isBlacklistedInStorage(requestedAddition.getFluid().getClass());
if (Config.blacklistEssentiaGas && ModAndClassUtil.ThE && requestedAddition != null) {
return ModAndClassUtil.essentiaGas.isInstance(requestedAddition.getFluid());
}
return false;
}
@Override
@@ -96,7 +99,8 @@ public abstract class FCBaseItemCell extends AEBaseItem implements IStorageFluid
final IMEInventoryHandler<?> inventory = AEApi.instance().registries().cell()
.getCellInventory(stack, null, StorageChannel.FLUIDS);
if (inventory instanceof final IFluidCellInventoryHandler handler) {
if (inventory instanceof IFluidCellInventoryHandler) {
final IFluidCellInventoryHandler handler = (IFluidCellInventoryHandler) inventory;
final IFluidCellInventory cellInventory = handler.getCellInv();
if (cellInventory != null) {
@@ -46,42 +46,41 @@ public class ItemBasicFluidStorageCell extends FCBaseItemCell
setUnlocalizedName(NameConst.ITEM_FLUID_STORAGE + kilobytes);
switch (this.component) {
case Cell1kPart -> {
case Cell1kPart:
this.idleDrain = 0.5;
this.perType = 8;
}
case Cell4kPart -> {
break;
case Cell4kPart:
this.idleDrain = 1.0;
this.perType = 8;
}
case Cell16kPart -> {
break;
case Cell16kPart:
this.idleDrain = 1.5;
this.perType = 8;
}
case Cell64kPart -> {
break;
case Cell64kPart:
this.idleDrain = 2.0;
this.perType = 8;
}
case Cell256kPart -> {
break;
case Cell256kPart:
this.idleDrain = 2.5;
this.perType = 8;
}
case Cell1024kPart -> {
break;
case Cell1024kPart:
this.idleDrain = 3.0;
this.perType = 8;
}
case Cell4096kPart -> {
break;
case Cell4096kPart:
this.idleDrain = 3.5;
this.perType = 8;
}
case Cell16384kPart -> {
break;
case Cell16384kPart:
this.idleDrain = 4.0;
this.perType = 8;
}
default -> {
break;
default:
this.idleDrain = 0.0;
this.perType = 8;
}
}
}
@@ -10,12 +10,13 @@ import net.minecraft.item.ItemStack;
import net.minecraft.util.StatCollector;
import com.glodblock.github.FluidCraft;
import com.glodblock.github.api.FluidCraftAPI;
import com.glodblock.github.common.Config;
import com.glodblock.github.common.storage.IFluidCellInventory;
import com.glodblock.github.common.storage.IFluidCellInventoryHandler;
import com.glodblock.github.common.storage.IStorageFluidCell;
import com.glodblock.github.common.tabs.FluidCraftingTabs;
import com.glodblock.github.loader.IRegister;
import com.glodblock.github.util.ModAndClassUtil;
import com.glodblock.github.util.NameConst;
import appeng.api.AEApi;
@@ -53,8 +54,10 @@ public class ItemCreativeFluidStorageCell extends AEBaseItem
@Override
public boolean isBlackListed(ItemStack cellItem, IAEFluidStack requestedAddition) {
return requestedAddition == null || requestedAddition.getFluid() == null
|| FluidCraftAPI.instance().isBlacklistedInStorage(requestedAddition.getFluid().getClass());
if (Config.blacklistEssentiaGas && ModAndClassUtil.ThE && requestedAddition != null) {
return ModAndClassUtil.essentiaGas.isInstance(requestedAddition.getFluid());
}
return false;
}
@Override
@@ -108,7 +111,8 @@ public class ItemCreativeFluidStorageCell extends AEBaseItem
final IMEInventoryHandler<?> inventory = AEApi.instance().registries().cell()
.getCellInventory(stack, null, StorageChannel.FLUIDS);
if (inventory instanceof final IFluidCellInventoryHandler handler) {
if (inventory instanceof IFluidCellInventoryHandler) {
final IFluidCellInventoryHandler handler = (IFluidCellInventoryHandler) inventory;
final IFluidCellInventory cellInventory = handler.getCellInv();
if (GuiScreen.isCtrlKeyDown()) {
@@ -86,7 +86,6 @@ public class ItemFluidDrop extends FCBaseItem {
shape = aIconRegister.registerIcon(NameConst.RES_KEY + NameConst.ITEM_FLUID_DROP);
}
@Nullable
public static ItemStack newStack(@Nullable FluidStack fluid) {
if (fluid == null || fluid.amount <= 0) {
return null;
@@ -98,7 +97,6 @@ public class ItemFluidDrop extends FCBaseItem {
return stack;
}
@Nullable
public static ItemStack newDisplayStack(FluidStack fluid) {
if (fluid == null) {
return null;
@@ -122,7 +120,6 @@ public class ItemFluidDrop extends FCBaseItem {
return getFluidStack(stack.getItemStack()) != null;
}
@Nullable
public static FluidStack getFluidStack(ItemStack stack) {
if (stack == null || stack.getItem() != ItemAndBlockHolder.DROP || !stack.hasTagCompound()) {
return null;
@@ -142,7 +139,6 @@ public class ItemFluidDrop extends FCBaseItem {
return fluidStack;
}
@Nullable
public static IAEFluidStack getAeFluidStack(@Nullable IAEItemStack stack) {
if (stack == null) {
return null;
@@ -155,7 +151,6 @@ public class ItemFluidDrop extends FCBaseItem {
return fluidStack;
}
@Nullable
public static IAEItemStack newAeStack(@Nullable FluidStack fluid) {
if (fluid == null || fluid.amount <= 0) {
return null;
@@ -168,7 +163,6 @@ public class ItemFluidDrop extends FCBaseItem {
return stack;
}
@Nullable
public static IAEItemStack newAeStack(@Nullable IAEFluidStack fluid) {
if (fluid == null || fluid.getStackSize() <= 0) {
return null;
@@ -34,7 +34,6 @@ public class ItemFluidPacket extends FCBaseItem {
setMaxStackSize(1);
}
@Nullable
public static FluidStack getFluidStack(ItemStack stack) {
if (stack == null || !stack.hasTagCompound()) {
return null;
@@ -83,12 +82,10 @@ public class ItemFluidPacket extends FCBaseItem {
}
}
@Nullable
public static FluidStack getFluidStack(@Nullable IAEItemStack stack) {
return stack != null ? getFluidStack(stack.getItemStack()) : null;
}
@Nullable
public static ItemStack newStack(@Nullable FluidStack fluid) {
if (fluid == null || fluid.amount == 0) {
return null;
@@ -102,7 +99,6 @@ public class ItemFluidPacket extends FCBaseItem {
return stack;
}
@Nullable
public static ItemStack newStack(@Nullable IAEFluidStack fluid) {
if (fluid == null || fluid.getStackSize() == 0) {
return null;
@@ -110,7 +106,6 @@ public class ItemFluidPacket extends FCBaseItem {
return newStack(fluid.getFluidStack());
}
@Nullable
public static ItemStack newDisplayStack(@Nullable FluidStack fluid) {
if (fluid == null) {
return null;
@@ -47,42 +47,41 @@ public class ItemMultiFluidStorageCell extends FCBaseItemCell
setUnlocalizedName(NameConst.ITEM_MULTI_FLUID_STORAGE + kilobytes);
switch (this.component) {
case Cell1kPart -> {
case Cell1kPart:
this.idleDrain = 0.5;
this.perType = 8;
}
case Cell4kPart -> {
break;
case Cell4kPart:
this.idleDrain = 1.0;
this.perType = 32;
}
case Cell16kPart -> {
break;
case Cell16kPart:
this.idleDrain = 1.5;
this.perType = 128;
}
case Cell64kPart -> {
break;
case Cell64kPart:
this.idleDrain = 2.0;
this.perType = 512;
}
case Cell256kPart -> {
break;
case Cell256kPart:
this.idleDrain = 2.5;
this.perType = 2048;
}
case Cell1024kPart -> {
break;
case Cell1024kPart:
this.idleDrain = 3.0;
this.perType = 8192;
}
case Cell4096kPart -> {
break;
case Cell4096kPart:
this.idleDrain = 3.5;
this.perType = 32768;
}
case Cell16384kPart -> {
break;
case Cell16384kPart:
this.idleDrain = 4.0;
this.perType = 131072;
}
default -> {
break;
default:
this.idleDrain = 0.0;
this.perType = 8;
}
}
}
@@ -13,7 +13,6 @@ import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import com.glodblock.github.FluidCraft;
import com.glodblock.github.api.FluidCraftAPI;
import com.glodblock.github.common.Config;
import com.glodblock.github.common.storage.IFluidCellInventory;
import com.glodblock.github.common.storage.IFluidCellInventoryHandler;
@@ -25,6 +24,7 @@ import com.glodblock.github.inventory.item.IItemInventory;
import com.glodblock.github.inventory.item.PortableFluidCellInventory;
import com.glodblock.github.loader.IRegister;
import com.glodblock.github.util.BlockPos;
import com.glodblock.github.util.ModAndClassUtil;
import com.glodblock.github.util.NameConst;
import com.glodblock.github.util.RenderUtil;
import com.google.common.base.Optional;
@@ -78,7 +78,8 @@ public class ItemPortableFluidCell extends AEBasePoweredItem
super.addCheckedInformation(stack, player, lines, displayMoreInfo);
final IMEInventoryHandler<?> inventory = AEApi.instance().registries().cell()
.getCellInventory(stack, null, StorageChannel.FLUIDS);
if (inventory instanceof final IFluidCellInventoryHandler handler) {
if (inventory instanceof IFluidCellInventoryHandler) {
final IFluidCellInventoryHandler handler = (IFluidCellInventoryHandler) inventory;
final IFluidCellInventory cellInventory = handler.getCellInv();
if (cellInventory != null) {
lines.add(
@@ -131,8 +132,10 @@ public class ItemPortableFluidCell extends AEBasePoweredItem
@Override
public boolean isBlackListed(ItemStack cellItem, IAEFluidStack requestedAddition) {
return requestedAddition == null || requestedAddition.getFluid() == null
|| FluidCraftAPI.instance().isBlacklistedInStorage(requestedAddition.getFluid().getClass());
if (Config.blacklistEssentiaGas && ModAndClassUtil.ThE && requestedAddition != null) {
return ModAndClassUtil.essentiaGas.isInstance(requestedAddition.getFluid());
}
return false;
}
@Override
@@ -36,12 +36,10 @@ import appeng.core.localization.PlayerMessages;
import appeng.util.Platform;
import baubles.api.BaubleType;
import baubles.api.IBauble;
import cpw.mods.fml.common.Optional;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@Optional.Interface(iface = "baubles.api.IBauble", modid = "Baubles")
public class ItemWirelessUltraTerminal extends ItemBaseWirelessTerminal
implements IBauble, IRegister<ItemWirelessUltraTerminal> {
@@ -102,7 +102,9 @@ public class PartFluidConversionMonitor extends PartFluidStorageMonitor {
}
}
} catch (final GridAccessException ignored) {}
} catch (final GridAccessException e) {
// :P
}
return true;
}
@@ -151,7 +153,9 @@ public class PartFluidConversionMonitor extends PartFluidStorageMonitor {
player.openContainer.detectAndSendChanges();
}
}
} catch (final GridAccessException ignored) {}
} catch (final GridAccessException e) {
// :P
}
}
}
}
@@ -163,7 +163,9 @@ public class PartFluidExportBus extends FCSharedFluidBus implements ICraftingReq
}
this.updateSchedulingMode(this.getSchedulingMode(), i);
return didSomething ? TickRateModulation.FASTER : TickRateModulation.SLOWER;
} catch (GridAccessException ignored) {}
} catch (GridAccessException e) {
// Ignore
}
}
return TickRateModulation.SLEEP;
@@ -130,16 +130,10 @@ public class PartFluidLevelEmitter extends PartUpgradeable
return false;
}
final Enum<?> redstoneEmitterSetting = this.getConfigManager().getSetting(Settings.REDSTONE_EMITTER);
final boolean result;
if (redstoneEmitterSetting == RedstoneMode.LOW_SIGNAL) {
result = this.reportingValue >= this.lastReportedValue + 1;
} else {
result = this.reportingValue < this.lastReportedValue + 1;
}
return result;
final boolean flipState = this.getConfigManager().getSetting(Settings.REDSTONE_EMITTER)
== RedstoneMode.LOW_SIGNAL;
return flipState ? this.reportingValue >= this.lastReportedValue + 1
: this.reportingValue < this.lastReportedValue + 1;
}
@MENetworkEventSubscribe
@@ -187,7 +181,9 @@ public class PartFluidLevelEmitter extends PartUpgradeable
this.myWatcher.add(myStack);
}
this.updateReportingValue(this.getProxy().getStorage().getFluidInventory());
} catch (final GridAccessException ignored) {}
} catch (final GridAccessException e1) {
// :/
}
}
private void updateReportingValue(final IMEMonitor<IAEFluidStack> monitor) {
@@ -286,7 +282,9 @@ public class PartFluidLevelEmitter extends PartUpgradeable
public void onListUpdate() {
try {
this.updateReportingValue(this.getProxy().getStorage().getFluidInventory());
} catch (final GridAccessException ignored) {}
} catch (final GridAccessException e) {
// ;P
}
}
@Override
@@ -306,23 +304,40 @@ public class PartFluidLevelEmitter extends PartUpgradeable
Tessellator.instance.startDrawingQuads();
this.renderTorchAtAngle(0, -0.5, 0);
Tessellator.instance.draw();
// rh.setBounds( 7, 7, 10, 9, 9, 15 );
// rh.renderInventoryBox( renderer );
}
private void renderTorchAtAngle(double baseX, double baseY, double baseZ) {
final boolean isOn = this.isLevelEmitterOn();
final IIcon offTexture = this.getItemStack().getIconIndex();
final IIcon IIcon = (isOn ? CableBusTextures.LevelEmitterTorchOn.getIcon() : offTexture);
//
this.centerX = baseX + 0.5;
this.centerY = baseY + 0.5;
this.centerZ = baseZ + 0.5;
baseY += 7.0 / 16.0;
// double par11 = 0;
/*
* double d5 = (double)IIcon.func_94209_e(); double d6 = (double)IIcon.func_94206_g(); double d7 =
* (double)IIcon.func_94212_f(); double d8 = (double)IIcon.func_94210_h(); double d9 =
* (double)IIcon.func_94214_a(7.0D); double d10 = (double)IIcon.func_94207_b(6.0D); double d11 =
* (double)IIcon.func_94214_a(9.0D); double d12 = (double)IIcon.func_94207_b(8.0D); double d13 =
* (double)IIcon.func_94214_a(7.0D); double d14 = (double)IIcon.func_94207_b(13.0D); double d15 =
* (double)IIcon.func_94214_a(9.0D); double d16 = (double)IIcon.func_94207_b(15.0D);
*/
final float var16 = IIcon.getMinU();
final float var17 = IIcon.getMaxU();
final float var18 = IIcon.getMinV();
final float var19 = IIcon.getMaxV();
/*
* float var16 = (float)var14 / 256.0F; float var17 = ((float)var14 + 15.99F) / 256.0F; float var18 =
* (float)var15 / 256.0F; float var19 = ((float)var15 + 15.99F) / 256.0F;
*/
final double var20b = offTexture.getInterpolatedU(7.0D);
final double var24b = offTexture.getInterpolatedU(9.0D);
@@ -361,26 +376,56 @@ public class PartFluidLevelEmitter extends PartUpgradeable
final double var44 = 0.0625D;
final double Zero = 0;
final double par10 = 0;
this.addVertexWithUV(
baseX + Zero * (1.0D - TorchLen) - var44,
baseY + TorchLen - toff,
baseZ + par10 * (1.0D - TorchLen) - var44,
var20,
var22);
this.addVertexWithUV(
baseX + Zero * (1.0D - TorchLen) - var44,
baseY + TorchLen - toff,
baseZ + par10 * (1.0D - TorchLen) + var44,
var20,
var26);
this.addVertexWithUV(
baseX + Zero * (1.0D - TorchLen) + var44,
baseY + TorchLen - toff,
baseZ + par10 * (1.0D - TorchLen) + var44,
var24,
var26);
this.addVertexWithUV(
baseX + Zero * (1.0D - TorchLen) + var44,
baseY + TorchLen - toff,
baseZ + par10 * (1.0D - TorchLen) - var44,
var24,
var22);
final double x = baseX + Zero * (1.0D - TorchLen) - var44;
final double x1 = baseX + Zero * (1.0D - TorchLen) + var44;
final double y = baseY + TorchLen - toff;
final double var422 = 0.1915D + 1.0 / 16.0;
final double y1 = baseY + var422;
final double z = baseZ + par10 * (1.0D - TorchLen) - var44;
final double z1 = baseZ + par10 * (1.0D - TorchLen) + var44;
this.addVertexWithUV(x, y, z, var20, var22);
this.addVertexWithUV(x, y, z1, var20, var26);
this.addVertexWithUV(x1, y, z1, var24, var26);
this.addVertexWithUV(x1, y, z, var24, var22);
this.addVertexWithUV(x1, y1, z, var24b, var22b);
this.addVertexWithUV(x1, y1, z1, var24b, var26b);
this.addVertexWithUV(x, y1, z1, var20b, var26b);
this.addVertexWithUV(x, y1, z, var20b, var22b);
this.addVertexWithUV(
baseX + Zero * (1.0D - TorchLen) + var44,
baseY + var422,
baseZ + par10 * (1.0D - TorchLen) - var44,
var24b,
var22b);
this.addVertexWithUV(
baseX + Zero * (1.0D - TorchLen) + var44,
baseY + var422,
baseZ + par10 * (1.0D - TorchLen) + var44,
var24b,
var26b);
this.addVertexWithUV(
baseX + Zero * (1.0D - TorchLen) - var44,
baseY + var422,
baseZ + par10 * (1.0D - TorchLen) + var44,
var20b,
var26b);
this.addVertexWithUV(
baseX + Zero * (1.0D - TorchLen) - var44,
baseY + var422,
baseZ + par10 * (1.0D - TorchLen) - var44,
var20b,
var22b);
this.addVertexWithUV(baseX + var44 + Zero, baseY, baseZ - var44 + par10, var32, var30);
this.addVertexWithUV(baseX + var44 + Zero, baseY, baseZ + var44 + par10, var32, var34);
@@ -458,6 +503,13 @@ public class PartFluidLevelEmitter extends PartUpgradeable
public void renderStatic(final int x, final int y, final int z, final IPartRenderHelper rh,
final RenderBlocks renderer) {
rh.setTexture(this.getItemStack().getIconIndex());
// rh.setTexture( CableBusTextures.ItemPartLevelEmitterOn.getIcon() );
// rh.setBounds( 2, 2, 14, 14, 14, 16 );
// rh.renderBlock( x, y, z, renderer );
// rh.setBounds( 7, 7, 10, 9, 9, 15 );
// rh.renderBlock( x, y, z, renderer );
renderer.renderAllFaces = true;
@@ -471,6 +523,8 @@ public class PartFluidLevelEmitter extends PartUpgradeable
rh.setBounds(7, 7, 11, 9, 9, 12);
this.renderLights(x, y, z, rh, renderer);
// super.renderWorldBlock( world, x, y, z, block, modelId, renderer );
}
@Override
@@ -41,8 +41,9 @@ public class PartFluidPatternTerminal extends FCFluidEncodeTerminal {
final ItemStack removedStack, final ItemStack newStack) {
if (inv == this.pattern && slot == 1) {
final ItemStack is = inv.getStackInSlot(1);
if (is != null && is.getItem() instanceof final ICraftingPatternItem craftingPatternItem) {
final ICraftingPatternDetails details = craftingPatternItem
if (is != null && is.getItem() instanceof ICraftingPatternItem) {
final ICraftingPatternItem pattern = (ICraftingPatternItem) is.getItem();
final ICraftingPatternDetails details = pattern
.getPatternForItem(is, this.getHost().getTile().getWorldObj());
if (details != null) {
final IAEItemStack[] inItems = details.getInputs();
@@ -40,8 +40,9 @@ public class PartFluidPatternTerminalEx extends FCFluidEncodeTerminal {
if (inv == this.pattern && slot == 1) {
final ItemStack is = inv.getStackInSlot(1);
if (is != null && is.getItem() instanceof final ICraftingPatternItem craftingPatternItem) {
final ICraftingPatternDetails details = craftingPatternItem
if (is != null && is.getItem() instanceof ICraftingPatternItem) {
final ICraftingPatternItem pattern = (ICraftingPatternItem) is.getItem();
final ICraftingPatternDetails details = pattern
.getPatternForItem(is, this.getHost().getTile().getWorldObj());
if (details != null) {
@@ -348,7 +348,8 @@ public class PartFluidStorageBus extends PartUpgradeable
if (esh != null) {
final IMEInventory<?> inv = esh
.getInventory(target, this.getSide().getOpposite(), StorageChannel.FLUIDS, this.source);
if (inv instanceof final MEMonitorIFluidHandler h) {
if (inv instanceof MEMonitorIFluidHandler) {
final MEMonitorIFluidHandler h = (MEMonitorIFluidHandler) inv;
h.setMode((StorageFilter) this.getConfigManager().getSetting(Settings.STORAGE_FILTER));
h.setActionSource(new MachineSource(this));
this.monitor = (MEMonitorIFluidHandler) inv;
@@ -179,8 +179,8 @@ public abstract class FCFluidEncodeTerminal extends FCPart implements IItemPatte
@Override
public void sortCraftingItems() {
List<ItemStack> items = new ArrayList<>();
List<ItemStack> fluids = new ArrayList<>();
List<ItemStack> items = new ArrayList<ItemStack>();
List<ItemStack> fluids = new ArrayList<ItemStack>();
for (ItemStack is : this.crafting) {
if (is == null) continue;
if (is.getItem() instanceof ItemFluidPacket) {
@@ -76,7 +76,7 @@ public abstract class FCPart extends AEBasePart
this.getProxy().setFlags(GridFlags.REQUIRE_CHANNEL);
this.getProxy().setIdlePowerUsage(1.0 / 2.0);
} else {
this.getProxy().setIdlePowerUsage(1.0 / 16.0); // lights drain a little
this.getProxy().setIdlePowerUsage(1.0 / 16.0); // lights drain a little bit.
}
this.cm.registerSetting(Settings.SORT_BY, SortOrder.NAME);
this.cm.registerSetting(Settings.VIEW_MODE, ViewItems.ALL);
@@ -163,7 +163,9 @@ public abstract class FCPart extends AEBasePart
if (this.getProxy().getNode().meetsChannelRequirements()) {
this.clientFlags = this.getClientFlags() | FCPart.CHANNEL_FLAG;
}
} catch (final GridAccessException ignored) {}
} catch (final GridAccessException e) {
// um.. nothing.
}
data.writeByte((byte) this.getClientFlags());
}
@@ -193,10 +195,18 @@ public abstract class FCPart extends AEBasePart
}
switch (this.getSpin()) {
case 0 -> this.spin = 1;
case 1 -> this.spin = 3;
case 2 -> this.spin = 0;
case 3 -> this.spin = 2;
case 0:
this.spin = 1;
break;
case 1:
this.spin = 3;
break;
case 2:
this.spin = 0;
break;
case 3:
this.spin = 2;
break;
}
this.getHost().markForUpdate();
@@ -266,7 +276,9 @@ public abstract class FCPart extends AEBasePart
public IMEMonitor<IAEItemStack> getItemInventory() {
try {
return this.getProxy().getStorage().getItemInventory();
} catch (final GridAccessException ignored) {}
} catch (final GridAccessException e) {
// err nope?
}
return null;
}
@@ -274,7 +286,9 @@ public abstract class FCPart extends AEBasePart
public IMEMonitor<IAEFluidStack> getFluidInventory() {
try {
return this.getProxy().getStorage().getFluidInventory();
} catch (final GridAccessException ignored) {}
} catch (final GridAccessException e) {
// err nope?
}
return null;
}
@@ -420,27 +434,27 @@ public abstract class FCPart extends AEBasePart
/**
* The texture used for the bright front layer.
* <p>
* The final texture can overlap any of the texture in no particular order.
* The final texture can overlap any of the the texture in no particular order.
*/
public abstract FCPartsTexture getFrontBright();
/**
* The texture used for the colored (medium) front layer.
* <p>
* The final texture can overlap any of the texture in no particular order.
* The final texture can overlap any of the the texture in no particular order.
*/
public abstract FCPartsTexture getFrontColored();
/**
* The texture used for the dark front layer.
* <p>
* The final texture can overlap any of the texture in no particular order.
* The final texture can overlap any of the the texture in no particular order.
*/
public abstract FCPartsTexture getFrontDark();
/**
* Should the part emit light. This actually only affects the light level, light source use a level of 15 and
* non-light source 9.
* Should the part emit light. This actually only affects the light level, light source use a level of 15 and non
* light source 9.
*/
public abstract boolean isLightSource();
}
@@ -175,7 +175,9 @@ public abstract class FCPartMonitor extends AbstractPartDisplay implements IPart
this.updateReportingValue(this.getProxy().getStorage().getFluidInventory());
}
} catch (final GridAccessException ignored) {}
} catch (final GridAccessException e) {
// >.>
}
}
protected void extractItem(final EntityPlayer player) {}
@@ -246,35 +248,41 @@ public abstract class FCPartMonitor extends AbstractPartDisplay implements IPart
}
private void tesrRenderScreen(final Tessellator tess, final IAEFluidStack ais) {
// GL11.glPushAttrib( GL11.GL_ALL_ATTRIB_BITS );
final ForgeDirection d = this.getSide();
GL11.glTranslated(d.offsetX * 0.77, d.offsetY * 0.77, d.offsetZ * 0.77);
switch (d) {
case UP -> {
case UP:
GL11.glScalef(1.0f, -1.0f, 1.0f);
GL11.glRotatef(90.0f, 1.0f, 0.0f, 0.0f);
GL11.glRotatef(this.getSpin() * 90.0F, 0, 0, 1);
}
case DOWN -> {
break;
case DOWN:
GL11.glScalef(1.0f, -1.0f, 1.0f);
GL11.glRotatef(-90.0f, 1.0f, 0.0f, 0.0f);
GL11.glRotatef(this.getSpin() * -90.0F, 0, 0, 1);
}
case EAST -> {
break;
case EAST:
GL11.glScalef(-1.0f, -1.0f, -1.0f);
GL11.glRotatef(-90.0f, 0.0f, 1.0f, 0.0f);
}
case WEST -> {
break;
case WEST:
GL11.glScalef(-1.0f, -1.0f, -1.0f);
GL11.glRotatef(90.0f, 0.0f, 1.0f, 0.0f);
}
case NORTH -> GL11.glScalef(-1.0f, -1.0f, -1.0f);
case SOUTH -> {
break;
case NORTH:
GL11.glScalef(-1.0f, -1.0f, -1.0f);
break;
case SOUTH:
GL11.glScalef(-1.0f, -1.0f, -1.0f);
GL11.glRotatef(180.0f, 0.0f, 1.0f, 0.0f);
}
default -> {}
break;
default:
break;
}
final ItemStack sis = ItemFluidPacket.newDisplayStack(ais.getFluidStack());
@@ -288,6 +296,7 @@ public abstract class FCPartMonitor extends AbstractPartDisplay implements IPart
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
// RenderHelper.enableGUIStandardItemLighting();
tess.setColorOpaque_F(1.0f, 1.0f, 1.0f);
ClientHelper.proxy.doRenderItem(sis, this.getTile().getWorldObj());
@@ -309,6 +318,7 @@ public abstract class FCPartMonitor extends AbstractPartDisplay implements IPart
GL11.glTranslatef(-0.5f * width, 0.0f, -1.0f);
fr.drawString(renderedStackSize, 0, 0, 0);
}
// GL11.glPopAttrib();
}
@Override
@@ -62,7 +62,9 @@ public abstract class FCSharedFluidBus extends PartUpgradeable implements IGridT
} else {
this.getProxy().getTick().sleepDevice(this.getProxy().getNode());
}
} catch (final GridAccessException ignored) {}
} catch (final GridAccessException e) {
// :P
}
}
@Override
@@ -57,15 +57,24 @@ public enum CellType {
}
public static EnumChatFormatting getTypeColor(CellType type) {
return switch (type) {
case Cell1kPart -> EnumChatFormatting.GOLD;
case Cell4kPart -> EnumChatFormatting.YELLOW;
case Cell16kPart -> EnumChatFormatting.GREEN;
case Cell64kPart -> EnumChatFormatting.AQUA;
case Cell256kPart -> EnumChatFormatting.BLUE;
case Cell1024kPart -> EnumChatFormatting.LIGHT_PURPLE;
case Cell4096kPart -> EnumChatFormatting.RED;
case Cell16384kPart -> EnumChatFormatting.DARK_PURPLE;
};
switch (type) {
case Cell1kPart:
return EnumChatFormatting.GOLD;
case Cell4kPart:
return EnumChatFormatting.YELLOW;
case Cell16kPart:
return EnumChatFormatting.GREEN;
case Cell64kPart:
return EnumChatFormatting.AQUA;
case Cell256kPart:
return EnumChatFormatting.BLUE;
case Cell1024kPart:
return EnumChatFormatting.LIGHT_PURPLE;
case Cell4096kPart:
return EnumChatFormatting.RED;
case Cell16384kPart:
return EnumChatFormatting.DARK_PURPLE;
}
return EnumChatFormatting.WHITE;
}
}
@@ -49,7 +49,8 @@ public class FluidCellHandler implements ICellHandler {
public void openChestGui(final EntityPlayer player, final IChestOrDrive chest, final ICellHandler cellHandler,
final IMEInventoryHandler inv, final ItemStack is, final StorageChannel chan) {
if (chan == StorageChannel.FLUIDS) {
if (chest instanceof TileEntity te) {
if (chest instanceof TileEntity) {
TileEntity te = (TileEntity) chest;
InventoryHandler
.openGui(player, te.getWorldObj(), new BlockPos(te), chest.getUp(), GuiType.FLUID_TERMINAL);
}
@@ -58,7 +59,8 @@ public class FluidCellHandler implements ICellHandler {
@Override
public int getStatusForCell(final ItemStack is, final IMEInventory handler) {
if (handler instanceof final FluidCellInventoryHandler ci) {
if (handler instanceof FluidCellInventoryHandler) {
final FluidCellInventoryHandler ci = (FluidCellInventoryHandler) handler;
return ci.getStatusForCell();
}
return 0;
@@ -99,8 +99,9 @@ public class TileCertusQuartzTank extends TileEntity implements IFluidHandler {
if (drained == null || drained.amount < fluid.amount) {
TileEntity offTE = this.worldObj.getTileEntity(this.xCoord, this.yCoord - 1, this.zCoord);
if (offTE instanceof TileCertusQuartzTank tileCertusQuartzTank) {
FluidStack externallyDrained = tileCertusQuartzTank.drain(
if (offTE instanceof TileCertusQuartzTank) {
TileCertusQuartzTank tank = (TileCertusQuartzTank) offTE;
FluidStack externallyDrained = tank.drain(
new FluidStack(fluid.getFluid(), fluid.amount - (drained != null ? drained.amount : 0)),
doDrain,
false);
@@ -157,18 +158,16 @@ public class TileCertusQuartzTank extends TileEntity implements IFluidHandler {
if (filled < fluid.amount) {
TileEntity offTE = this.worldObj.getTileEntity(this.xCoord, this.yCoord + 1, this.zCoord);
if (offTE instanceof TileCertusQuartzTank tileCertusQuartzTank) {
return filled + tileCertusQuartzTank
.fill(new FluidStack(fluid.getFluid(), fluid.amount - filled), doFill, false);
if (offTE instanceof TileCertusQuartzTank) {
TileCertusQuartzTank tank = (TileCertusQuartzTank) offTE;
return filled + tank.fill(new FluidStack(fluid.getFluid(), fluid.amount - filled), doFill, false);
}
}
return filled;
}
/**
* An override for {@link IFluidHandler}
*/
/* IFluidHandler */
@Override
public int fill(ForgeDirection from, FluidStack resource, boolean doFill) {
if (resource == null || this.tank.getFluid() != null && resource.getFluid() != this.tank.getFluid().getFluid())
@@ -224,7 +223,7 @@ public class TileCertusQuartzTank extends TileEntity implements IFluidHandler {
private TileCertusQuartzTank getTankBelow(TileEntity tile) {
TileEntity tank = new BlockPos(tile).getOffSet(0, -1, 0).getTileEntity();
if (tank instanceof TileCertusQuartzTank) {
if (tank != null && tank instanceof TileCertusQuartzTank) {
return (TileCertusQuartzTank) tank;
}
return null;
@@ -50,7 +50,9 @@ public class TileFluidBuffer extends AENetworkTile implements IAEFluidInventory,
.findPrecise(AEFluidStack.create(fs));
this.invFluids.setFluidInSlot(0, ias);
if (ias != null) return true;
} catch (final GridAccessException ignored) {}
} catch (final GridAccessException e) {
// :P
}
return false;
}
@@ -65,7 +67,9 @@ public class TileFluidBuffer extends AENetworkTile implements IAEFluidInventory,
this.source);
if (notInserted != null) return fluidStack.amount -= notInserted.getStackSize();
return fluidStack.amount;
} catch (final GridAccessException ignored) {}
} catch (final GridAccessException e) {
// :P
}
}
return 0;
}
@@ -88,7 +92,9 @@ public class TileFluidBuffer extends AENetworkTile implements IAEFluidInventory,
.extractItems(ias, actionable, this.source);
if (extracted == null) return null;
return extracted.getFluidStack();
} catch (final GridAccessException ignored) {}
} catch (final GridAccessException e) {
// :P
}
return null;
}
@@ -107,7 +113,9 @@ public class TileFluidBuffer extends AENetworkTile implements IAEFluidInventory,
try {
return this.getProxy().getStorage().getFluidInventory().getStorageList()
.findPrecise(this.getAEFluidStack());
} catch (final GridAccessException ignored) {}
} catch (final GridAccessException e) {
// :P
}
return null;
}
@@ -4,7 +4,6 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import com.glodblock.github.api.FluidCraftAPI;
import com.glodblock.github.common.item.ItemFluidDrop;
import appeng.api.AEApi;
@@ -44,6 +43,7 @@ public class TileFluidDiscretizer extends AENetworkTile implements IPriorityHost
@Override
public boolean canBeRotated() {
return false;
// based
}
@Override
@@ -190,8 +190,7 @@ public class TileFluidDiscretizer extends AENetworkTile implements IPriorityHost
if (fluidGrid != null) {
for (IAEFluidStack fluid : fluidGrid.getStorageList()) {
IAEItemStack stack = ItemFluidDrop.newAeStack(fluid);
if (stack != null
&& !FluidCraftAPI.instance().isBlacklistedInDisplay(fluid.getFluid().getClass())) {
if (stack != null) {
itemCache.add(stack);
}
}
@@ -211,7 +210,7 @@ public class TileFluidDiscretizer extends AENetworkTile implements IPriorityHost
@Override
public boolean isValid(Object verificationToken) {
IMEMonitor<IAEFluidStack> fluidGrid = getFluidGrid();
return fluidGrid != null && fluidGrid == verificationToken;
return fluidGrid != null && fluidGrid == verificationToken /* && !conflict */;
}
@Override
@@ -222,8 +221,7 @@ public class TileFluidDiscretizer extends AENetworkTile implements IPriorityHost
List<IAEItemStack> mappedChanges = new ArrayList<>();
for (IAEFluidStack fluidStack : change) {
IAEItemStack itemStack = ItemFluidDrop.newAeStack(fluidStack);
if (itemStack != null
&& !FluidCraftAPI.instance().isBlacklistedInDisplay(fluidStack.getFluid().getClass())) {
if (itemStack != null) {
mappedChanges.add(itemStack);
}
}
@@ -14,17 +14,34 @@ public class FCClassTransformer implements IClassTransformer {
public byte[] transform(String name, String transformedName, byte[] code) {
Transform tform;
switch (transformedName) {
case "appeng.crafting.CraftingTreeNode" -> tform = CraftingTreeNodeTransformer.INSTANCE;
case "appeng.me.cluster.implementations.CraftingCPUCluster" -> tform = CraftingCpuTransformer.INSTANCE;
case "appeng.helpers.DualityInterface" -> tform = DualityInterfaceTransformer.INSTANCE;
case "appeng.container.implementations.ContainerInterfaceTerminal" -> tform = ContainerInterfaceTerminalTransformer.INSTANCE;
case "appeng.client.gui.implementations.GuiCraftingCPU", "appeng.client.gui.implementations.GuiCraftConfirm", "net.p455w0rd.wirelesscraftingterminal.client.gui.GuiCraftConfirm" -> tform = GuiCraftingTransformer.INSTANCE;
case "appeng.integration.modules.NEI" -> tform = NEITransfermer.INSTANCE;
case "appeng.core.features.registries.ExternalStorageRegistry" -> tform = ExternalStorageRegistryTransformer.INSTANCE;
case "appeng.core.sync.packets.PacketCompressedNBT" -> tform = PacketCompressedNBTTransformer.INSTANCE;
default -> {
case "appeng.crafting.CraftingTreeNode":
tform = CraftingTreeNodeTransformer.INSTANCE;
break;
case "appeng.me.cluster.implementations.CraftingCPUCluster":
tform = CraftingCpuTransformer.INSTANCE;
break;
case "appeng.helpers.DualityInterface":
tform = DualityInterfaceTransformer.INSTANCE;
break;
case "appeng.container.implementations.ContainerInterfaceTerminal":
tform = ContainerInterfaceTerminalTransformer.INSTANCE;
break;
case "appeng.client.gui.implementations.GuiCraftingCPU":
case "appeng.client.gui.implementations.GuiCraftConfirm":
case "net.p455w0rd.wirelesscraftingterminal.client.gui.GuiCraftConfirm":
tform = GuiCraftingTransformer.INSTANCE;
break;
case "appeng.integration.modules.NEI":
tform = NEITransfermer.INSTANCE;
break;
case "appeng.core.features.registries.ExternalStorageRegistry":
tform = ExternalStorageRegistryTransformer.INSTANCE;
break;
case "appeng.core.sync.packets.PacketCompressedNBT":
tform = PacketCompressedNBTTransformer.INSTANCE;
break;
default:
return code;
}
}
System.out.println("[AE2FC] Transforming class: " + transformedName);
return tform.transformClass(code);
@@ -27,12 +27,16 @@ public class DualityInterfaceTransformer extends FCClassTransformer.ClassMapper
@Override
public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) {
return switch (name) {
case "pushItemsOut", "pushPattern", "isBusy" -> new TransformInvAdaptorCalls(
api,
super.visitMethod(access, name, desc, signature, exceptions));
default -> super.visitMethod(access, name, desc, signature, exceptions);
};
switch (name) {
case "pushItemsOut":
case "pushPattern":
case "isBusy":
return new TransformInvAdaptorCalls(
api,
super.visitMethod(access, name, desc, signature, exceptions));
default:
return super.visitMethod(access, name, desc, signature, exceptions);
}
}
}
@@ -27,15 +27,16 @@ public class NEITransfermer extends FCClassTransformer.ClassMapper {
@Override
public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) {
return switch (name) {
case "getStackUnderMouse" -> new TransformStackUnderMouse(
api,
super.visitMethod(access, name, desc, signature, exceptions));
case "shouldShowTooltip" -> new TransformShowTooltip(
api,
super.visitMethod(access, name, desc, signature, exceptions));
default -> super.visitMethod(access, name, desc, signature, exceptions);
};
switch (name) {
case "getStackUnderMouse":
return new TransformStackUnderMouse(
api,
super.visitMethod(access, name, desc, signature, exceptions));
case "shouldShowTooltip":
return new TransformShowTooltip(api, super.visitMethod(access, name, desc, signature, exceptions));
default:
return super.visitMethod(access, name, desc, signature, exceptions);
}
}
}
@@ -24,6 +24,8 @@ public class EC2Replacer {
if (m.type == GameRegistry.Type.ITEM && ItemReplacements.registry.containsKey(m.name)) {
Item toRemap = ItemReplacements.registry.get(m.name);
m.remap(toRemap);
} else {
m.warn();
}
}
}
@@ -22,7 +22,7 @@ import li.cil.oc.api.Items;
import li.cil.oc.api.detail.ItemInfo;
/**
* A shell class to organize proxy replacements and hide the ugliness
* Shell class to organize proxy replacements and hide the ugliness
*/
public class ItemReplacements {
@@ -78,11 +78,9 @@ public class ItemReplacements {
registry.put("extracells:storage.physical.void", voidCell);
deprecateItem("pattern.fluid", ItemAndBlockHolder.PATTERN);
deprecateWireless("terminal.fluid.wireless", ItemAndBlockHolder.WIRELESS_FLUID_TERM);
/* Storage casings */
deprecateItem("storage.casing", 0, AEApi.instance().definitions().materials().emptyAdvancedStorageCell());
deprecateItem("storage.casing", 1, ItemAndBlockHolder.CELL_HOUSING, 2);
/* Storage components (1k component, etc.) */
deprecateItem("storage.component", 0, AEApi.instance().definitions().materials().cell256kPart());
deprecateItem("storage.component", 1, AEApi.instance().definitions().materials().cell1024kPart());
@@ -69,7 +69,8 @@ public class ProxyItem extends FCBaseItem {
@Override
public void onUpdate(ItemStack stack, World worldIn, Entity entityIn, int p_77663_4_, boolean p_77663_5_) {
if (!worldIn.isRemote && entityIn instanceof EntityPlayer player) {
if (!worldIn.isRemote && entityIn instanceof EntityPlayer) {
EntityPlayer player = (EntityPlayer) entityIn;
for (int i = 0; i < player.inventory.getSizeInventory(); ++i) {
ItemStack s = player.inventory.getStackInSlot(i);
if (s == stack) {
@@ -4,8 +4,6 @@ import java.lang.ref.WeakReference;
import java.util.List;
import java.util.Random;
import javax.annotation.Nonnull;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
@@ -188,7 +186,6 @@ public class ProxyPart implements IPart, IPartDeprecated {
return def;
}
@Nonnull
@Override
public NBTTagCompound transformNBT(NBTTagCompound extra) {
return extra;
@@ -23,6 +23,12 @@ public class ProxyPartItem extends ProxyItem implements IPartItem {
super(ec2itemName);
}
/**
*
* @param srcMeta
* @param replacement
* @param part
*/
protected void addItemPart(int srcMeta, Item replacement, Function<ProxyPartItem, ProxyPart> part) {
this.replacements.put(srcMeta, new PartReplacement(replacement, part));
}
@@ -36,7 +42,8 @@ public class ProxyPartItem extends ProxyItem implements IPartItem {
@Override
public IPart createPartFromItemStack(ItemStack is) {
final int meta = is.getItemDamage();
if (this.replacements.get(meta) instanceof PartReplacement part) {
if (this.replacements.get(meta) instanceof PartReplacement) {
PartReplacement part = (PartReplacement) this.replacements.get(meta);
return part.proxyPart.apply(this);
}
return null;
@@ -2,8 +2,6 @@ package com.glodblock.github.crossmod.extracells.parts;
import static net.minecraftforge.common.util.Constants.NBT.TAG_COMPOUND;
import javax.annotation.Nonnull;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
@@ -27,7 +25,6 @@ public class ProxyFluidBusIO extends ProxyPart {
super(partItem);
}
@Nonnull
@Override
public NBTTagCompound transformNBT(NBTTagCompound extra) {
// Transform NBT in place
@@ -53,10 +50,18 @@ public class ProxyFluidBusIO extends ProxyPart {
// Redstone mode
RedstoneMode redstoneMode = RedstoneMode.values()[extra.getInteger("redstoneMode")];
switch (redstoneMode) {
case LOW_SIGNAL -> extra.setString("REDSTONE_CONTROLLED", "LOW_SIGNAL");
case HIGH_SIGNAL -> extra.setString("REDSTONE_CONTROLLED", "HIGH_SIGNAL");
case SIGNAL_PULSE -> extra.setString("REDSTONE_CONTROLLED", "SIGNAL_PULSE");
default -> extra.setString("REDSTONE_CONTROLLED", "IGNORE");
case LOW_SIGNAL:
extra.setString("REDSTONE_CONTROLLED", "LOW_SIGNAL");
break;
case HIGH_SIGNAL:
extra.setString("REDSTONE_CONTROLLED", "HIGH_SIGNAL");
break;
case SIGNAL_PULSE:
extra.setString("REDSTONE_CONTROLLED", "SIGNAL_PULSE");
break;
default:
extra.setString("REDSTONE_CONTROLLED", "IGNORE");
break;
}
extra.removeTag("redstoneMode");
// Part data
@@ -1,7 +1,5 @@
package com.glodblock.github.crossmod.extracells.parts;
import javax.annotation.Nonnull;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraftforge.common.util.Constants;
@@ -15,7 +13,6 @@ public class ProxyFluidInterface extends ProxyPart {
super(item);
}
@Nonnull
@Override
public NBTTagCompound transformNBT(NBTTagCompound extra) {
// Internal fluids - ConfigInv and FluidInv
@@ -2,8 +2,6 @@ package com.glodblock.github.crossmod.extracells.parts;
import static net.minecraftforge.common.util.Constants.NBT.TAG_COMPOUND;
import javax.annotation.Nonnull;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
@@ -33,7 +31,6 @@ public class ProxyFluidStorage extends ProxyPart {
super(item);
}
@Nonnull
@Override
public NBTTagCompound transformNBT(NBTTagCompound extra) {
// Transform in place, less messy IMO
@@ -1,7 +1,5 @@
package com.glodblock.github.crossmod.extracells.parts;
import javax.annotation.Nonnull;
import net.minecraft.nbt.NBTTagCompound;
import com.glodblock.github.crossmod.extracells.ProxyPart;
@@ -15,7 +13,6 @@ public class ProxyLevelEmitter extends ProxyPart {
super(item);
}
@Nonnull
@Override
public NBTTagCompound transformNBT(NBTTagCompound extra) {
// Fluid
@@ -1,7 +1,5 @@
package com.glodblock.github.crossmod.extracells.parts;
import javax.annotation.Nonnull;
import net.minecraft.nbt.NBTTagCompound;
import com.glodblock.github.crossmod.extracells.ProxyPart;
@@ -15,10 +13,9 @@ public class ProxyOreDictExportBus extends ProxyPart {
super(item);
}
@Nonnull
@Override
public NBTTagCompound transformNBT(NBTTagCompound extra) {
// TODO: Node tag... should use OOP here.
// Node tag... should've used OOP here but im too lazy to fix it now
extra.setTag("part", extra.getCompoundTag("node").getCompoundTag("node0"));
extra.removeTag("node");
// Ore dict card
@@ -1,7 +1,5 @@
package com.glodblock.github.crossmod.extracells.parts;
import javax.annotation.Nonnull;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidRegistry;
@@ -15,7 +13,6 @@ public class ProxyStorageMonitor extends ProxyPart {
super(item);
}
@Nonnull
@Override
public NBTTagCompound transformNBT(NBTTagCompound extra) {
// Fluid
@@ -3,9 +3,10 @@ package com.glodblock.github.crossmod.extracells.storage;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import com.glodblock.github.api.FluidCraftAPI;
import com.glodblock.github.common.Config;
import com.glodblock.github.common.storage.IStorageFluidCell;
import com.glodblock.github.crossmod.extracells.ProxyItem;
import com.glodblock.github.util.ModAndClassUtil;
import appeng.api.config.FuzzyMode;
import appeng.api.storage.data.IAEFluidStack;
@@ -45,8 +46,10 @@ public class ProxyFluidStorageCell extends ProxyItem implements IStorageFluidCel
@Override
public boolean isBlackListed(ItemStack cellItem, IAEFluidStack requestedAddition) {
return requestedAddition == null || requestedAddition.getFluid() == null
|| FluidCraftAPI.instance().isBlacklistedInStorage(requestedAddition.getFluid().getClass());
if (Config.blacklistEssentiaGas && ModAndClassUtil.ThE && requestedAddition != null) {
return ModAndClassUtil.essentiaGas.isInstance(requestedAddition.getFluid());
}
return false;
}
@Override
@@ -28,7 +28,8 @@ public class ProxyVoidStorageCell extends ItemVoidStorageCell {
@Override
public void onUpdate(ItemStack stack, World worldIn, Entity entityIn, int p_77663_4_, boolean p_77663_5_) {
if (!worldIn.isRemote && entityIn instanceof EntityPlayer player) {
if (!worldIn.isRemote && entityIn instanceof EntityPlayer) {
EntityPlayer player = (EntityPlayer) entityIn;
for (int i = 0; i < player.inventory.getSizeInventory(); ++i) {
ItemStack s = player.inventory.getStackInSlot(i);
if (s == stack) {
@@ -73,7 +73,8 @@ public class DriverDualFluidInterface implements SidedBlock {
}
Node node = node().network().node(address);
if (!(node instanceof Component)) throw new IllegalArgumentException("no such component");
if (!(node.host() instanceof Database database)) throw new IllegalArgumentException("not a database");
if (!(node.host() instanceof Database)) throw new IllegalArgumentException("not a database");
Database database = (Database) node.host();
if (index >= 0 && index < DualityFluidInterface.NUMBER_OF_TANKS) {
ItemStack data = database.getStackInSlot(entry - 1);
if (data == null) {
@@ -77,8 +77,9 @@ public class DriverOCPatternEditor extends DriverSidedTileEntity {
if (pattern == null) {
throw new IllegalArgumentException("No pattern here!");
}
if (pattern.getItem() instanceof ItemEncodedPattern iep
if (pattern.getItem() instanceof ItemEncodedPattern
&& !(pattern.getItem() instanceof ItemFluidEncodedPattern)) {
ItemEncodedPattern iep = (ItemEncodedPattern) pattern.getItem();
return iep.getOutput(pattern) == null;
}
return true;
@@ -4,7 +4,6 @@ import java.util.Objects;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidStack;
import org.apache.commons.lang3.tuple.ImmutablePair;
@@ -12,11 +11,9 @@ import org.apache.commons.lang3.tuple.MutablePair;
import appeng.api.storage.data.IAEFluidStack;
import appeng.util.item.AEFluidStack;
import cpw.mods.fml.common.Optional;
import thaumcraft.api.aspects.Aspect;
import thaumcraft.api.aspects.IEssentiaContainerItem;
import thaumcraft.common.Thaumcraft;
import thaumicenergistics.api.ThEApi;
import thaumicenergistics.api.storage.IAspectStack;
import thaumicenergistics.common.fluids.GaseousEssentia;
import thaumicenergistics.common.integration.tc.EssentiaItemContainerHelper;
@@ -25,12 +22,7 @@ import thaumicenergistics.common.storage.AspectStack;
public class AspectUtil {
public static final EssentiaItemContainerHelper HELPER = EssentiaItemContainerHelper.INSTANCE;
public static int R = 128;
@Optional.Method(modid = "thaumicenergistics")
public static void init() {
R = ThEApi.instance().config().conversionMultiplier();
}
public static final int R = 128;
public static boolean isPlayerDiscoveredAspect(final EntityPlayer player, final Aspect aspect) {
if (player != null && aspect != null) {
@@ -39,10 +31,6 @@ public class AspectUtil {
return false;
}
public static boolean isEssentiaGas(Fluid fluid) {
return fluid instanceof GaseousEssentia;
}
public static boolean isEssentiaGas(FluidStack fluid) {
return fluid != null && fluid.getFluid() instanceof GaseousEssentia;
}
@@ -35,7 +35,8 @@ public class FCTooltipHandlerWaila extends TooltipHandlerWaila {
+ EnumChatFormatting.RESET);
}
String modName = Util.getFluidModName(fs.getFluid());
if (modName != null && !modName.equals("")) currenttip.set(currenttip.size() - 1, "§9§o" + modName);
if (modName != null && !modName.equals(""))
currenttip.set(currenttip.size() - 1, "\u00a79\u00a7o" + modName);
}
return currenttip;
}
@@ -49,7 +49,7 @@ public class PartWailaDataProvider implements IWailaDataProvider {
ItemStack wailaStack = null;
for (final IPartWailaDataProvider provider : this.providers) {
wailaStack = provider.getWailaStack(part, config, null);
wailaStack = provider.getWailaStack(part, config, wailaStack);
if (wailaStack != null) break;
}
return wailaStack;
@@ -349,7 +349,7 @@ public class AEFluidInventory implements IAEFluidTank {
@Override
public int getCapacity() {
return AEFluidInventory.this.capacity;
return Math.min(AEFluidInventory.this.capacity, Integer.MAX_VALUE);
}
@Override
@@ -82,6 +82,7 @@ public class FluidConvertingInventoryAdaptor extends InventoryAdaptor {
}
public static InventoryAdaptor wrap(TileEntity capProvider, ForgeDirection face) {
// sometimes i wish 1.7.10 has cap system.
TileEntity inter = capProvider.getWorldObj().getTileEntity(
capProvider.xCoord + face.offsetX,
capProvider.yCoord + face.offsetY,
@@ -375,8 +376,9 @@ public class FluidConvertingInventoryAdaptor extends InventoryAdaptor {
}
if (tank != null && tank.getTankInfo(direction) != null) {
List<FluidTankInfo[]> tankInfos = new LinkedList<>();
if (Util.getPart(tank, direction) instanceof PartP2PLiquids invFluidsP2P) {
if (Util.getPart(tank, direction) instanceof PartP2PLiquids) {
// read other ends of p2p for blocking mode
PartP2PLiquids invFluidsP2P = (PartP2PLiquids) Util.getPart(tank, direction);
try {
Iterator<PartP2PLiquids> it = invFluidsP2P.getOutputs().iterator();
boolean checkedInput = false;
@@ -428,7 +430,7 @@ public class FluidConvertingInventoryAdaptor extends InventoryAdaptor {
if (te instanceof IGregTechTileEntity) {
IMetaTileEntity mte = ((IGregTechTileEntity) te).getMetaTileEntity();
if (mte instanceof MetaPipeEntity) {
return ((MetaPipeEntity) mte).isConnectedAtSide(direction);
return ((MetaPipeEntity) mte).isConnectedAtSide(direction.ordinal());
}
}
return true;
@@ -22,6 +22,7 @@ public class FluidConvertingInventoryCrafting extends InventoryCrafting {
if (fluid != null) {
super.setInventorySlotContents(index, ItemFluidPacket.newStack(new FluidStack(fluid, stack.stackSize)));
} else {
// wtf?
super.setInventorySlotContents(
index,
ItemFluidPacket.newStack(new FluidStack(FluidRegistry.WATER, 1000)));
@@ -181,8 +181,10 @@ public class MEMonitorIFluidHandler implements IMEMonitor<IAEFluidStack> {
}
public IItemList<IAEFluidStack> getAvailableItems(IItemList out) {
Iterator<?> var2 = this.cache.iterator();
for (IAEFluidStack fs : this.cache) {
while (var2.hasNext()) {
IAEFluidStack fs = (IAEFluidStack) var2.next();
out.addStorage(fs);
}
@@ -30,8 +30,9 @@ public class AEFluidInterfaceHandler implements IExternalStorageHandler {
if (te instanceof ITileStorageMonitorable
&& ((ITileStorageMonitorable) te).getMonitorable(d, src) != null) {
return ((ITileStorageMonitorable) te).getMonitorable(d, src).getFluidInventory();
} else if (Util.getPart(te, d.getOpposite()) instanceof ITileStorageMonitorable part
} else if (Util.getPart(te, d.getOpposite()) instanceof ITileStorageMonitorable
&& ((ITileStorageMonitorable) Util.getPart(te, d.getOpposite())).getMonitorable(d, src) != null) {
ITileStorageMonitorable part = (ITileStorageMonitorable) Util.getPart(te, d.getOpposite());
return part.getMonitorable(d, src).getFluidInventory();
}
}
@@ -27,7 +27,7 @@ import appeng.helpers.IPriorityHost;
public enum GuiType {
RENAMER(new PartOrItemGuiFactory<>(ITerminalHost.class) {
RENAMER(new PartOrItemGuiFactory<ITerminalHost>(ITerminalHost.class) {
@Override
protected Object createServerGui(EntityPlayer player, ITerminalHost inv) {
@@ -39,7 +39,7 @@ public enum GuiType {
return new GuiRenamer(player.inventory, inv);
}
}),
FLUID_AUTO_FILLER(new TileGuiFactory<>(TileFluidAutoFiller.class) {
FLUID_AUTO_FILLER(new TileGuiFactory<TileFluidAutoFiller>(TileFluidAutoFiller.class) {
@Override
protected Object createServerGui(EntityPlayer player, TileFluidAutoFiller inv) {
@@ -52,7 +52,7 @@ public enum GuiType {
}
}),
FLUID_LEVEL_EMITTER(new PartGuiFactory<>(PartFluidLevelEmitter.class) {
FLUID_LEVEL_EMITTER(new PartGuiFactory<PartFluidLevelEmitter>(PartFluidLevelEmitter.class) {
@Override
protected Object createServerGui(EntityPlayer player, PartFluidLevelEmitter inv) {
@@ -65,7 +65,7 @@ public enum GuiType {
}
}),
LEVEL_MAINTAINER(new TileGuiFactory<>(TileLevelMaintainer.class) {
LEVEL_MAINTAINER(new TileGuiFactory<TileLevelMaintainer>(TileLevelMaintainer.class) {
@Override
protected Object createServerGui(EntityPlayer player, TileLevelMaintainer inv) {
@@ -78,7 +78,7 @@ public enum GuiType {
}
}),
OC_PATTERN_EDITOR(new TileGuiFactory<>(TileOCPatternEditor.class) {
OC_PATTERN_EDITOR(new TileGuiFactory<TileOCPatternEditor>(TileOCPatternEditor.class) {
@Override
protected Object createServerGui(EntityPlayer player, TileOCPatternEditor inv) {
@@ -91,7 +91,7 @@ public enum GuiType {
}
}),
DUAL_INTERFACE(new TileOrPartGuiFactory<>(IInterfaceHost.class) {
DUAL_INTERFACE(new TileOrPartGuiFactory<IInterfaceHost>(IInterfaceHost.class) {
@Override
protected Object createServerGui(EntityPlayer player, IInterfaceHost inv) {
@@ -104,7 +104,7 @@ public enum GuiType {
}
}),
DUAL_INTERFACE_FLUID(new TileOrPartGuiFactory<>(IDualHost.class) {
DUAL_INTERFACE_FLUID(new TileOrPartGuiFactory<IDualHost>(IDualHost.class) {
@Override
protected Object createServerGui(EntityPlayer player, IDualHost inv) {
@@ -117,7 +117,7 @@ public enum GuiType {
}
}),
PRIORITY(new TileOrPartGuiFactory<>(IPriorityHost.class) {
PRIORITY(new TileOrPartGuiFactory<IPriorityHost>(IPriorityHost.class) {
@Override
protected Object createServerGui(EntityPlayer player, IPriorityHost inv) {
@@ -130,7 +130,7 @@ public enum GuiType {
}
}),
FLUID_BUS_IO(new PartGuiFactory<>(FCSharedFluidBus.class) {
FLUID_BUS_IO(new PartGuiFactory<FCSharedFluidBus>(FCSharedFluidBus.class) {
@Override
protected Object createServerGui(EntityPlayer player, FCSharedFluidBus inv) {
@@ -143,7 +143,7 @@ public enum GuiType {
}
}),
FLUID_STORAGE_BUS(new PartGuiFactory<>(PartFluidStorageBus.class) {
FLUID_STORAGE_BUS(new PartGuiFactory<PartFluidStorageBus>(PartFluidStorageBus.class) {
@Override
protected Object createServerGui(EntityPlayer player, PartFluidStorageBus inv) {
@@ -156,7 +156,7 @@ public enum GuiType {
}
}),
INGREDIENT_BUFFER(new TileGuiFactory<>(TileIngredientBuffer.class) {
INGREDIENT_BUFFER(new TileGuiFactory<TileIngredientBuffer>(TileIngredientBuffer.class) {
@Override
protected Object createServerGui(EntityPlayer player, TileIngredientBuffer inv) {
@@ -169,7 +169,7 @@ public enum GuiType {
}
}),
LARGE_INGREDIENT_BUFFER(new TileGuiFactory<>(TileLargeIngredientBuffer.class) {
LARGE_INGREDIENT_BUFFER(new TileGuiFactory<TileLargeIngredientBuffer>(TileLargeIngredientBuffer.class) {
@Override
protected Object createServerGui(EntityPlayer player, TileLargeIngredientBuffer inv) {
@@ -182,7 +182,7 @@ public enum GuiType {
}
}),
CRAFTING_STATUS(new PartOrItemGuiFactory<>(ITerminalHost.class) {
CRAFTING_STATUS(new PartOrItemGuiFactory<ITerminalHost>(ITerminalHost.class) {
@Override
protected Object createServerGui(EntityPlayer player, ITerminalHost inv) {
@@ -195,7 +195,7 @@ public enum GuiType {
}
}),
FLUID_TERMINAL(new TileOrPartGuiFactory<>(ITerminalHost.class) {
FLUID_TERMINAL(new TileOrPartGuiFactory<ITerminalHost>(ITerminalHost.class) {
@Override
protected Object createServerGui(EntityPlayer player, ITerminalHost inv) {
@@ -208,7 +208,7 @@ public enum GuiType {
}
}),
PORTABLE_FLUID_CELL(new ItemGuiFactory<>(IFluidPortableCell.class) {
PORTABLE_FLUID_CELL(new ItemGuiFactory<IFluidPortableCell>(IFluidPortableCell.class) {
@Override
protected Object createServerGui(EntityPlayer player, IFluidPortableCell inv) {
@@ -221,7 +221,7 @@ public enum GuiType {
}
}),
WIRELESS_FLUID_TERMINAL(new ItemGuiFactory<>(IWirelessTerminal.class) {
WIRELESS_FLUID_TERMINAL(new ItemGuiFactory<IWirelessTerminal>(IWirelessTerminal.class) {
@Override
protected Object createServerGui(EntityPlayer player, IWirelessTerminal inv) {
@@ -234,7 +234,7 @@ public enum GuiType {
}
}),
WIRELESS_ESSENTIA_TERMINAL(new ItemGuiFactory<>(IWirelessTerminal.class) {
WIRELESS_ESSENTIA_TERMINAL(new ItemGuiFactory<IWirelessTerminal>(IWirelessTerminal.class) {
@Override
protected Object createServerGui(EntityPlayer player, IWirelessTerminal inv) {
@@ -247,7 +247,7 @@ public enum GuiType {
}
}),
WIRELESS_FLUID_PATTERN_TERMINAL(new ItemGuiFactory<>(IWirelessTerminal.class) {
WIRELESS_FLUID_PATTERN_TERMINAL(new ItemGuiFactory<IWirelessTerminal>(IWirelessTerminal.class) {
@Override
protected Object createServerGui(EntityPlayer player, IWirelessTerminal inv) {
@@ -259,7 +259,7 @@ public enum GuiType {
return new GuiFluidPatternWireless(player.inventory, inv);
}
}),
WIRELESS_FLUID_PATTERN_TERMINAL_EX(new ItemGuiFactory<>(IWirelessTerminal.class) {
WIRELESS_FLUID_PATTERN_TERMINAL_EX(new ItemGuiFactory<IWirelessTerminal>(IWirelessTerminal.class) {
@Override
protected Object createServerGui(EntityPlayer player, IWirelessTerminal inv) {
@@ -271,7 +271,7 @@ public enum GuiType {
return new GuiFluidPatternExWireless(player.inventory, inv);
}
}),
WIRELESS_INTERFACE_TERMINAL(new ItemGuiFactory<>(IWirelessTerminal.class) {
WIRELESS_INTERFACE_TERMINAL(new ItemGuiFactory<IWirelessTerminal>(IWirelessTerminal.class) {
@Override
protected Object createServerGui(EntityPlayer player, IWirelessTerminal inv) {
@@ -284,7 +284,7 @@ public enum GuiType {
}
}),
WIRELESS_CRAFTING_TERMINAL(new ItemGuiFactory<>(IWirelessTerminal.class) {
WIRELESS_CRAFTING_TERMINAL(new ItemGuiFactory<IWirelessTerminal>(IWirelessTerminal.class) {
@Override
protected Object createServerGui(EntityPlayer player, IWirelessTerminal inv) {
@@ -297,7 +297,7 @@ public enum GuiType {
}
}),
FLUID_PATTERN_TERMINAL(new PartGuiFactory<>(ITerminalHost.class) {
FLUID_PATTERN_TERMINAL(new PartGuiFactory<ITerminalHost>(ITerminalHost.class) {
@Override
protected Object createServerGui(EntityPlayer player, ITerminalHost inv) {
@@ -310,7 +310,7 @@ public enum GuiType {
}
}),
FLUID_PATTERN_TERMINAL_EX(new PartGuiFactory<>(ITerminalHost.class) {
FLUID_PATTERN_TERMINAL_EX(new PartGuiFactory<ITerminalHost>(ITerminalHost.class) {
@Override
protected Object createServerGui(EntityPlayer player, ITerminalHost inv) {
@@ -323,7 +323,7 @@ public enum GuiType {
}
}),
FLUID_PATTERN_ENCODER(new TileGuiFactory<>(TileFluidPatternEncoder.class) {
FLUID_PATTERN_ENCODER(new TileGuiFactory<TileFluidPatternEncoder>(TileFluidPatternEncoder.class) {
@Override
protected Object createServerGui(EntityPlayer player, TileFluidPatternEncoder inv) {
@@ -336,7 +336,7 @@ public enum GuiType {
}
}),
FLUID_CRAFTING_CONFIRM(new PartGuiFactory<>(FCPart.class) {
FLUID_CRAFTING_CONFIRM(new PartGuiFactory<FCPart>(FCPart.class) {
@Override
protected Object createServerGui(EntityPlayer player, FCPart inv) {
@@ -349,7 +349,7 @@ public enum GuiType {
}
}),
FLUID_CRAFTING_CONFIRM_ITEM(new ItemGuiFactory<>(IWirelessTerminal.class) {
FLUID_CRAFTING_CONFIRM_ITEM(new ItemGuiFactory<IWirelessTerminal>(IWirelessTerminal.class) {
@Override
protected Object createServerGui(EntityPlayer player, IWirelessTerminal inv) {
@@ -362,7 +362,7 @@ public enum GuiType {
}
}),
FLUID_CRAFTING_AMOUNT(new PartOrItemGuiFactory<>(ITerminalHost.class) {
FLUID_CRAFTING_AMOUNT(new PartOrItemGuiFactory<ITerminalHost>(ITerminalHost.class) {
@Override
protected Object createServerGui(EntityPlayer player, ITerminalHost inv) {
@@ -375,7 +375,7 @@ public enum GuiType {
}
}),
FLUID_PACKET_DECODER(new TileGuiFactory<>(TileFluidPacketDecoder.class) {
FLUID_PACKET_DECODER(new TileGuiFactory<TileFluidPacketDecoder>(TileFluidPacketDecoder.class) {
@Override
protected Object createServerGui(EntityPlayer player, TileFluidPacketDecoder inv) {
@@ -388,7 +388,7 @@ public enum GuiType {
}
}),
PATTERN_VALUE_SET(new PartOrItemGuiFactory<>(ITerminalHost.class) {
PATTERN_VALUE_SET(new PartOrItemGuiFactory<ITerminalHost>(ITerminalHost.class) {
@Override
protected Object createServerGui(EntityPlayer player, ITerminalHost inv) {
@@ -177,8 +177,9 @@ public class WirelessPatternTerminalExInventory extends MEMonitorHandler<IAEItem
if (inv == this.pattern && slot == 1) {
final ItemStack is = inv.getStackInSlot(1);
if (is != null && is.getItem() instanceof final ICraftingPatternItem craftingPatternItem) {
final ICraftingPatternDetails details = craftingPatternItem
if (is != null && is.getItem() instanceof ICraftingPatternItem) {
final ICraftingPatternItem pattern = (ICraftingPatternItem) is.getItem();
final ICraftingPatternDetails details = pattern
.getPatternForItem(is, this.getActionableNode().getWorld());
if (details != null) {
@@ -372,8 +373,8 @@ public class WirelessPatternTerminalExInventory extends MEMonitorHandler<IAEItem
@Override
public void sortCraftingItems() {
List<ItemStack> items = new ArrayList<>();
List<ItemStack> fluids = new ArrayList<>();
List<ItemStack> items = new ArrayList<ItemStack>();
List<ItemStack> fluids = new ArrayList<ItemStack>();
for (ItemStack is : this.crafting) {
if (is == null) continue;
if (is.getItem() instanceof ItemFluidPacket) {
@@ -174,8 +174,9 @@ public class WirelessPatternTerminalInventory extends MEMonitorHandler<IAEItemSt
ItemStack newStack) {
if (inv == this.pattern && slot == 1) {
final ItemStack is = inv.getStackInSlot(1);
if (is != null && is.getItem() instanceof final ICraftingPatternItem craftingPatternItem) {
final ICraftingPatternDetails details = craftingPatternItem
if (is != null && is.getItem() instanceof ICraftingPatternItem) {
final ICraftingPatternItem pattern = (ICraftingPatternItem) is.getItem();
final ICraftingPatternDetails details = pattern
.getPatternForItem(is, this.getActionableNode().getWorld());
if (details != null) {
final IAEItemStack[] inItems = details.getInputs();
@@ -344,8 +345,8 @@ public class WirelessPatternTerminalInventory extends MEMonitorHandler<IAEItemSt
@Override
public void sortCraftingItems() {
List<ItemStack> items = new ArrayList<>();
List<ItemStack> fluids = new ArrayList<>();
List<ItemStack> items = new ArrayList<ItemStack>();
List<ItemStack> fluids = new ArrayList<ItemStack>();
for (ItemStack is : this.crafting) {
if (is == null) continue;
if (is.getItem() instanceof ItemFluidPacket) {
@@ -2,6 +2,7 @@ package com.glodblock.github.loader;
import static com.glodblock.github.common.storage.CellType.Cell16384kPart;
import static com.glodblock.github.loader.ItemAndBlockHolder.*;
import static com.glodblock.github.loader.ItemAndBlockHolder.CELL4KM;
import static net.minecraft.init.Blocks.redstone_torch;
import static net.minecraft.init.Items.fish;
@@ -9,21 +9,24 @@ import com.glodblock.github.common.item.ItemFluidDrop;
import appeng.api.config.TypeFilter;
import appeng.api.storage.data.IAEItemStack;
import appeng.api.storage.data.IAEStack;
import appeng.client.me.ItemRepo;
public class FluidFilter {
public static boolean filter(TypeFilter typeFilter, IAEStack<?> stack) {
public static void installFilter() {
ItemRepo.registerTypeHandler(FluidFilter::filter, FLUIDS);
}
private static boolean filter(IAEStack<?> stack, TypeFilter typeFilter) {
if (typeFilter == ALL) return true;
if (stack instanceof IAEItemStack) {
Item item = ((IAEItemStack) stack).getItem();
if (item != null) {
switch (typeFilter) {
case ITEMS -> {
case ITEMS:
return !(item instanceof ItemFluidDrop);
}
case FLUIDS -> {
case FLUIDS:
return item instanceof ItemFluidDrop;
}
}
}
}
@@ -1,36 +0,0 @@
package com.glodblock.github.nei;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.fluids.FluidStack;
import com.glodblock.github.common.item.ItemFluidDrop;
import com.glodblock.github.common.item.ItemFluidPacket;
import codechicken.nei.api.IStackStringifyHandler;
public class FCStackStringifyHandler implements IStackStringifyHandler {
@Override
public NBTTagCompound convertItemStackToNBT(ItemStack stack, boolean saveStackSize) {
return null;
}
@Override
public ItemStack convertNBTToItemStack(NBTTagCompound nbtTag) {
return null;
}
@Override
public FluidStack getFluid(ItemStack item) {
if (item.getItem() instanceof ItemFluidDrop) {
FluidStack fluid = ItemFluidDrop.getFluidStack(item);
if (fluid == null) return null;
fluid.amount /= Math.max(item.stackSize, 1);
return fluid;
} else if (item.getItem() instanceof ItemFluidPacket) {
return ItemFluidPacket.getFluidStack(item);
}
return null;
}
}
@@ -50,7 +50,7 @@ public class FluidCraftingTransferHandler implements IOverlayHandler {
Slot slot = (Slot) o;
if (slot.getSlotIndex() == col + row * 3) {
final NBTTagList tags = new NBTTagList();
final List<ItemStack> list = new LinkedList<>();
final List<ItemStack> list = new LinkedList<ItemStack>();
// prefer pure crystals.
for (int x = 0; x < positionedStack.items.length; x++) {
if (Platform.isRecipePrioritized(positionedStack.items[x])) {
@@ -41,7 +41,8 @@ public class NEIItemFilter implements SearchField.ISearchProvider {
if (itemStack.getItem() instanceof IStorageFluidCell) {
final IMEInventoryHandler<?> inventory = AEApi.instance().registries().cell()
.getCellInventory(itemStack, null, StorageChannel.FLUIDS);
if (inventory instanceof final IFluidCellInventoryHandler handler) {
if (inventory instanceof IFluidCellInventoryHandler) {
final IFluidCellInventoryHandler handler = (IFluidCellInventoryHandler) inventory;
final IFluidCellInventory cellInventory = handler.getCellInv();
if (cellInventory != null) {
for (IAEFluidStack fluid : cellInventory.getContents()) {
@@ -23,7 +23,8 @@ public class NEIUtils {
if (currentStack.stackSize == 0) continue;
boolean find = false;
for (OrderStack<?> storedStack : comp) {
if (storedStack == null || !(storedStack.getStack() instanceof ItemStack firstStack)) continue;
if (storedStack == null || !(storedStack.getStack() instanceof ItemStack)) continue;
ItemStack firstStack = (ItemStack) storedStack.getStack();
boolean areItemStackEqual = firstStack.isItemEqual(currentStack)
&& ItemStack.areItemStackTagsEqual(firstStack, currentStack);
if (areItemStackEqual
@@ -8,14 +8,12 @@ import com.glodblock.github.util.ModAndClassUtil;
import codechicken.nei.api.API;
import codechicken.nei.api.IConfigureNEI;
@SuppressWarnings("unused")
public class NEI_FC_Config implements IConfigureNEI {
@Override
public void loadConfig() {
API.registerNEIGuiHandler(new NEIGuiHandler());
API.addSearchProvider(new NEIItemFilter());
API.registerStackStringifyHandler(new FCStackStringifyHandler());
if (ModAndClassUtil.AVARITIA) {
API.registerGuiOverlay(GuiFluidPatternWireless.class, "extreme", null);
@@ -124,7 +124,7 @@ public class OrderStack<T> {
NBTTagCompound info = buf.getCompoundTag(index + ":");
byte id = info.getByte("t");
switch (id) {
case ITEM -> {
case ITEM:
List<ItemStack> list = new ArrayList<>();
if (info.hasKey(index + ":")) {
NBTTagList items = info.getTagList(index + ":", 10);
@@ -134,15 +134,13 @@ public class OrderStack<T> {
}
}
return new OrderStack<>(ItemStack.loadItemStackFromNBT(info), index, list.toArray(new ItemStack[0]));
}
case FLUID -> {
case FLUID:
return new OrderStack<>(FluidStack.loadFluidStackFromNBT(info), index);
}
case CUSTOM -> {
case CUSTOM:
if (dummy == null) throw new IllegalOrderStackID(id);
return new OrderStack<>(dummy.customNBTReader(buf), index);
}
default -> throw new IllegalOrderStackID(id);
default:
throw new IllegalOrderStackID(id);
}
}
}
@@ -35,7 +35,8 @@ public class EnderIORecipeExtractor implements IRecipeExtractor {
public List<OrderStack<?>> getInputIngredients(List<PositionedStack> rawInputs, IRecipeHandler recipe, int index) {
TemplateRecipeHandler tRecipe = (TemplateRecipeHandler) recipe;
List<OrderStack<?>> tmp;
if (tRecipe.arecipes.get(index) instanceof VatRecipeHandler.InnerVatRecipe vatRecipe) {
if (tRecipe.arecipes.get(index) instanceof VatRecipeHandler.InnerVatRecipe) {
VatRecipeHandler.InnerVatRecipe vatRecipe = (VatRecipeHandler.InnerVatRecipe) tRecipe.arecipes.get(index);
ArrayList<PositionedStack> inputs = ReflectEIO.getInputs(vatRecipe);
tmp = ExtractorUtil.packItemStack(inputs);
FluidStack in = ReflectEIO.getInputFluid(vatRecipe);
@@ -62,7 +63,8 @@ public class EnderIORecipeExtractor implements IRecipeExtractor {
int index) {
TemplateRecipeHandler tRecipe = (TemplateRecipeHandler) recipe;
List<OrderStack<?>> tmp = new LinkedList<>();
if (tRecipe.arecipes.get(index) instanceof VatRecipeHandler.InnerVatRecipe vatRecipe) {
if (tRecipe.arecipes.get(index) instanceof VatRecipeHandler.InnerVatRecipe) {
VatRecipeHandler.InnerVatRecipe vatRecipe = (VatRecipeHandler.InnerVatRecipe) tRecipe.arecipes.get(index);
FluidStack result = ReflectEIO.getResult(vatRecipe);
if (result != null) {
tmp.add(new OrderStack<>(result, 0));
@@ -57,10 +57,13 @@ public class CPacketCraftRequest implements IMessage {
@Nullable
@Override
public IMessage onMessage(CPacketCraftRequest message, MessageContext ctx) {
if (ctx.getServerHandler().playerEntity.openContainer instanceof final ContainerCraftAmount cca) {
if (ctx.getServerHandler().playerEntity.openContainer instanceof ContainerCraftAmount) {
EntityPlayerMP player = ctx.getServerHandler().playerEntity;
final ContainerCraftAmount cca = (ContainerCraftAmount) ctx
.getServerHandler().playerEntity.openContainer;
final Object target = cca.getTarget();
if (target instanceof final IGridHost gh) {
if (target instanceof IGridHost) {
final IGridHost gh = (IGridHost) target;
final IGridNode gn = gh.getGridNode(ForgeDirection.UNKNOWN);
if (gn == null) {
@@ -103,7 +106,8 @@ public class CPacketCraftRequest implements IMessage {
GuiType.FLUID_CRAFTING_CONFIRM_ITEM);
}
if (player.openContainer instanceof final ContainerCraftConfirm ccc) {
if (player.openContainer instanceof ContainerCraftConfirm) {
final ContainerCraftConfirm ccc = (ContainerCraftConfirm) player.openContainer;
ccc.setAutoStart(message.heldShift);
ccc.setJob(futureJob);
cca.detectAndSendChanges();
@@ -64,32 +64,60 @@ public class CPacketFluidPatternTermBtns implements IMessage {
String Name = message.Name;
String Value = message.Value;
final Container c = ctx.getServerHandler().playerEntity.openContainer;
if (Name.startsWith("PatternTerminal.") && (c instanceof final FCContainerEncodeTerminal cpt)) {
if (Name.startsWith("PatternTerminal.") && (c instanceof FCContainerEncodeTerminal)) {
final FCContainerEncodeTerminal cpt = (FCContainerEncodeTerminal) c;
switch (Name) {
case "PatternTerminal.CraftMode" -> cpt.getPatternTerminal().setCraftingRecipe(Value.equals("1"));
case "PatternTerminal.Encode" -> {
case "PatternTerminal.CraftMode":
cpt.getPatternTerminal().setCraftingRecipe(Value.equals("1"));
break;
case "PatternTerminal.Encode":
switch (Value) {
case "0" -> cpt.encode();
case "1" -> cpt.encodeAndMoveToInventory();
case "3" -> cpt.encodeAllItemAndMoveToInventory();
case "0":
cpt.encode();
break;
case "1":
cpt.encodeAndMoveToInventory();
break;
case "3":
cpt.encodeAllItemAndMoveToInventory();
break;
}
}
case "PatternTerminal.Clear" -> cpt.clear();
case "PatternTerminal.Substitute" -> cpt.getPatternTerminal().setSubstitution(Value.equals("1"));
case "PatternTerminal.Invert" -> cpt.getPatternTerminal().setInverted(Value.equals("1"));
case "PatternTerminal.Double" -> cpt.doubleStacks(Value.equals("1"));
case "PatternTerminal.Combine" -> cpt.getPatternTerminal().setCombineMode(Value.equals("1"));
case "PatternTerminal.beSubstitute" -> cpt.getPatternTerminal().setBeSubstitute(Value.equals("1"));
case "PatternTerminal.ActivePage" -> cpt.getPatternTerminal()
.setActivePage(Integer.parseInt(Value));
case "PatternTerminal.Prioritize" -> {
break;
case "PatternTerminal.Clear":
cpt.clear();
break;
case "PatternTerminal.Substitute":
cpt.getPatternTerminal().setSubstitution(Value.equals("1"));
break;
case "PatternTerminal.Invert":
cpt.getPatternTerminal().setInverted(Value.equals("1"));
break;
case "PatternTerminal.Double":
cpt.doubleStacks(Value.equals("1"));
break;
case "PatternTerminal.Combine":
cpt.getPatternTerminal().setCombineMode(Value.equals("1"));
break;
case "PatternTerminal.beSubstitute":
cpt.getPatternTerminal().setBeSubstitute(Value.equals("1"));
break;
case "PatternTerminal.ActivePage":
cpt.getPatternTerminal().setActivePage(Integer.parseInt(Value));
break;
case "PatternTerminal.Prioritize":
switch (Value) {
case "0", "1" -> cpt.getPatternTerminal().setPrioritization(Value.equals("1"));
case "2" -> cpt.getPatternTerminal().sortCraftingItems();
case "0":
case "1":
cpt.getPatternTerminal().setPrioritization(Value.equals("1"));
break;
case "2":
cpt.getPatternTerminal().sortCraftingItems();
break;
}
}
case "PatternTerminal.AutoFillerPattern" -> cpt.getPatternTerminal()
.setAutoFillPattern(Value.equals("1"));
break;
case "PatternTerminal.AutoFillerPattern":
cpt.getPatternTerminal().setAutoFillPattern(Value.equals("1"));
break;
}
cpt.getPatternTerminal().saveSettings();
} else if (Name.startsWith("StorageBus.") && c instanceof ContainerFluidStorageBus) {
@@ -92,7 +92,8 @@ public class CPacketInventoryAction implements IMessage {
@Override
public IMessage onMessage(CPacketInventoryAction message, MessageContext ctx) {
final EntityPlayerMP sender = ctx.getServerHandler().playerEntity;
if (sender.openContainer instanceof final AEBaseContainer baseContainer) {
if (sender.openContainer instanceof AEBaseContainer) {
final AEBaseContainer baseContainer = (AEBaseContainer) sender.openContainer;
Object target = baseContainer.getTarget();
if (message.action == InventoryAction.AUTO_CRAFT) {
final ContainerOpenContext context = baseContainer.getOpenContext();
@@ -116,7 +117,8 @@ public class CPacketInventoryAction implements IMessage {
ForgeDirection.UNKNOWN,
GuiType.FLUID_CRAFTING_AMOUNT);
}
if (sender.openContainer instanceof final ContainerCraftAmount cca) {
if (sender.openContainer instanceof ContainerCraftAmount) {
final ContainerCraftAmount cca = (ContainerCraftAmount) sender.openContainer;
if (baseContainer.getTargetStack() != null) {
cca.getCraftingItem().putStack(baseContainer.getTargetStack().getItemStack());
cca.setItemToCraft(baseContainer.getTargetStack());
@@ -152,7 +154,8 @@ public class CPacketInventoryAction implements IMessage {
amt = fluid == null ? 1 : fluid.amount;
}
FluidCraft.proxy.netHandler.sendTo(new SPacketSetItemAmount(amt), sender);
if (sender.openContainer instanceof final ContainerPatternValueAmount cpv) {
if (sender.openContainer instanceof ContainerPatternValueAmount) {
final ContainerPatternValueAmount cpv = (ContainerPatternValueAmount) sender.openContainer;
if (baseContainer.getTargetStack() != null) {
cpv.setValueIndex(message.slot);
cpv.getPatternValue().putStack(baseContainer.getTargetStack().getItemStack());
@@ -116,14 +116,23 @@ public class CPacketLevelMaintainer implements IMessage {
@Override
public IMessage onMessage(CPacketLevelMaintainer message, MessageContext ctx) {
if (message.action.startsWith("TileLevelMaintainer.")
&& ctx.getServerHandler().playerEntity.openContainer instanceof final ContainerLevelMaintainer cca) {
&& ctx.getServerHandler().playerEntity.openContainer instanceof ContainerLevelMaintainer) {
EntityPlayerMP player = ctx.getServerHandler().playerEntity;
final ContainerLevelMaintainer cca = (ContainerLevelMaintainer) ctx
.getServerHandler().playerEntity.openContainer;
switch (message.action) {
case "TileLevelMaintainer.Quantity" -> cca.getTile()
.updateQuantity(message.slotIndex, message.size);
case "TileLevelMaintainer.Batch" -> cca.getTile().updateBatchSize(message.slotIndex, message.size);
case "TileLevelMaintainer.Enable" -> cca.getTile().setRequestStatus(message.slotIndex, false);
case "TileLevelMaintainer.Disable" -> cca.getTile().setRequestStatus(message.slotIndex, true);
case "TileLevelMaintainer.Quantity":
cca.getTile().updateQuantity(message.slotIndex, message.size);
break;
case "TileLevelMaintainer.Batch":
cca.getTile().updateBatchSize(message.slotIndex, message.size);
break;
case "TileLevelMaintainer.Enable":
cca.getTile().setRequestStatus(message.slotIndex, false);
break;
case "TileLevelMaintainer.Disable":
cca.getTile().setRequestStatus(message.slotIndex, true);
break;
}
this.refresh(cca, player);
}
@@ -61,7 +61,8 @@ public class CPacketPatternValueSet implements IMessage {
@Override
public IMessage onMessage(CPacketPatternValueSet message, MessageContext ctx) {
EntityPlayer player = ctx.getServerHandler().playerEntity;
if (player.openContainer instanceof ContainerPatternValueAmount cpv) {
if (player.openContainer instanceof ContainerPatternValueAmount) {
ContainerPatternValueAmount cpv = (ContainerPatternValueAmount) player.openContainer;
final Object target = cpv.getTarget();
if (target instanceof IGridHost) {
final ContainerOpenContext context = cpv.getOpenContext();
@@ -48,7 +48,7 @@ public class CPacketTransferRecipe implements IMessage {
this.shift = shift;
}
// TODO: this should use GZIP to compress the message
// I should use GZIP to compress the message, but i'm too lazy.
// NBT to ByteBuf has a compress stream
@Override
public void toBytes(ByteBuf buf) {
@@ -100,8 +100,9 @@ public class CPacketTransferRecipe implements IMessage {
if (monitor != null) {
storageList = monitor.getStorageList();
}
if (c instanceof FCContainerEncodeTerminal cf) {
if (c instanceof FCContainerEncodeTerminal) {
// pattern terminal only
FCContainerEncodeTerminal cf = (FCContainerEncodeTerminal) c;
boolean combine = cf.combine;
cf.getPatternTerminal().setCraftingRecipe(message.isCraft);
@@ -91,6 +91,7 @@ public class SPacketMEItemInvUpdate implements IMessage {
public static class Handler implements IMessageHandler<SPacketMEItemInvUpdate, IMessage> {
@Override
@SuppressWarnings({ "unchecked", "rawtypes" })
public IMessage onMessage(SPacketMEItemInvUpdate message, MessageContext ctx) {
final GuiScreen gs = Minecraft.getMinecraft().currentScreen;
if (gs instanceof GuiItemMonitor) {
@@ -6,7 +6,6 @@ import com.glodblock.github.FluidCraft;
import com.glodblock.github.common.Config;
import com.glodblock.github.common.tile.TileWalrus;
import com.glodblock.github.crossmod.extracells.EC2Replacer;
import com.glodblock.github.crossmod.thaumcraft.AspectUtil;
import com.glodblock.github.inventory.external.AEFluidInterfaceHandler;
import com.glodblock.github.loader.ItemAndBlockHolder;
import com.glodblock.github.network.SPacketMEUpdateBuffer;
@@ -31,9 +30,6 @@ public class CommonProxy {
public void init(FMLInitializationEvent event) {
this.registerMovables();
FMLCommonHandler.instance().bus().register(SPacketMEUpdateBuffer.class);
if (ModAndClassUtil.ThE) {
AspectUtil.init();
}
}
public void postInit(FMLPostInitializationEvent event) {
Loaded 100 of 109 files, more files were not shown because too many files have changed in this diff. Show more