mirror of
https://github.com/GTNewHorizons/AE2FluidCraft-Rework.git
synced 2026-10-26 14:24:23 +00:00
Fix FMP compatibility (#444)
Co-authored-by: UltraProdigy <187078471+UltraProdigy@users.noreply.github.com>
This commit is contained in:
1 parent
208e4d66d9
commit
3b67b77572
8 files changed
+33
-38
No files matched your search
+1
-1
@@ -35,7 +35,7 @@
|
|||||||
*/
|
*/
|
||||||
dependencies {
|
dependencies {
|
||||||
api('com.github.GTNewHorizons:NotEnoughItems:2.8.100-GTNH:dev')
|
api('com.github.GTNewHorizons:NotEnoughItems:2.8.100-GTNH:dev')
|
||||||
api('com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-971-GTNH:dev')
|
api('com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-982-GTNH:dev')
|
||||||
api('com.github.GTNewHorizons:waila:1.19.29:dev')
|
api('com.github.GTNewHorizons:waila:1.19.29:dev')
|
||||||
api("com.github.GTNewHorizons:GTNHLib:0.11.4:dev")
|
api("com.github.GTNewHorizons:GTNHLib:0.11.4:dev")
|
||||||
|
|
||||||
|
|||||||
+7
-8
@@ -13,7 +13,7 @@ import com.glodblock.github.util.DualityFluidInterface;
|
|||||||
import com.glodblock.github.util.NameConst;
|
import com.glodblock.github.util.NameConst;
|
||||||
import com.glodblock.github.util.Util;
|
import com.glodblock.github.util.Util;
|
||||||
|
|
||||||
import appeng.api.parts.IPartHost;
|
import appeng.util.Platform;
|
||||||
import li.cil.oc.api.driver.EnvironmentProvider;
|
import li.cil.oc.api.driver.EnvironmentProvider;
|
||||||
import li.cil.oc.api.driver.NamedBlock;
|
import li.cil.oc.api.driver.NamedBlock;
|
||||||
import li.cil.oc.api.driver.SidedBlock;
|
import li.cil.oc.api.driver.SidedBlock;
|
||||||
@@ -104,20 +104,19 @@ public class DriverDualFluidInterface implements SidedBlock {
|
|||||||
if (te instanceof TileFluidInterface) {
|
if (te instanceof TileFluidInterface) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (te instanceof IPartHost) {
|
|
||||||
return ((IPartHost) te).getPart(face) instanceof PartFluidInterface;
|
return Platform.getPartFromTE(te, face) instanceof PartFluidInterface;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static DualityFluidInterface getInterface(TileEntity te, ForgeDirection face) {
|
private static DualityFluidInterface getInterface(TileEntity te, ForgeDirection face) {
|
||||||
if (te != null) {
|
if (te != null) {
|
||||||
if (te instanceof TileFluidInterface) {
|
if (te instanceof TileFluidInterface tile) {
|
||||||
return ((TileFluidInterface) te).getDualityFluid();
|
return tile.getDualityFluid();
|
||||||
}
|
}
|
||||||
if (te instanceof IPartHost && ((IPartHost) te).getPart(face) instanceof PartFluidInterface) {
|
if (Platform.getPartFromTE(te, face) instanceof PartFluidInterface part) {
|
||||||
return ((PartFluidInterface) ((IPartHost) te).getPart(face)).getDualityFluid();
|
return part.getDualityFluid();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
@@ -4,6 +4,8 @@ import com.glodblock.github.common.tile.TileCertusQuartzTank;
|
|||||||
import com.glodblock.github.util.ModAndClassUtil;
|
import com.glodblock.github.util.ModAndClassUtil;
|
||||||
|
|
||||||
import appeng.api.parts.IPartHost;
|
import appeng.api.parts.IPartHost;
|
||||||
|
import appeng.integration.IntegrationRegistry;
|
||||||
|
import appeng.integration.IntegrationType;
|
||||||
import appeng.tile.AEBaseTile;
|
import appeng.tile.AEBaseTile;
|
||||||
import appeng.util.Platform;
|
import appeng.util.Platform;
|
||||||
import codechicken.nei.guihook.GuiContainerManager;
|
import codechicken.nei.guihook.GuiContainerManager;
|
||||||
@@ -19,8 +21,12 @@ public class WailaInit {
|
|||||||
|
|
||||||
public static void register(final IWailaRegistrar registrar) {
|
public static void register(final IWailaRegistrar registrar) {
|
||||||
final IWailaDataProvider part = new PartWailaDataProvider();
|
final IWailaDataProvider part = new PartWailaDataProvider();
|
||||||
registrar.registerBodyProvider(part, IPartHost.class);
|
registerPartProvider(registrar, part, IPartHost.class);
|
||||||
registrar.registerNBTProvider(part, IPartHost.class);
|
if (IntegrationRegistry.INSTANCE.isEnabled(IntegrationType.FMP)) {
|
||||||
|
try {
|
||||||
|
registerPartProvider(registrar, part, Class.forName("codechicken.multipart.TileMultipart"));
|
||||||
|
} catch (final ClassNotFoundException ignored) {}
|
||||||
|
}
|
||||||
if (Platform.isClient()) GuiContainerManager.addTooltipHandler(new FCTooltipHandlerWaila());
|
if (Platform.isClient()) GuiContainerManager.addTooltipHandler(new FCTooltipHandlerWaila());
|
||||||
|
|
||||||
final IWailaDataProvider tile = new TileWailaDataProvider();
|
final IWailaDataProvider tile = new TileWailaDataProvider();
|
||||||
@@ -32,4 +38,10 @@ public class WailaInit {
|
|||||||
registrar.registerBodyProvider(certusQuartzTank, TileCertusQuartzTank.class);
|
registrar.registerBodyProvider(certusQuartzTank, TileCertusQuartzTank.class);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static void registerPartProvider(final IWailaRegistrar registrar, final IWailaDataProvider provider,
|
||||||
|
final Class<?> tileClass) {
|
||||||
|
registrar.registerBodyProvider(provider, tileClass);
|
||||||
|
registrar.registerNBTProvider(provider, tileClass);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
+4
-5
@@ -3,13 +3,12 @@ package com.glodblock.github.inventory.external;
|
|||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraftforge.common.util.ForgeDirection;
|
import net.minecraftforge.common.util.ForgeDirection;
|
||||||
|
|
||||||
import com.glodblock.github.util.Util;
|
|
||||||
|
|
||||||
import appeng.api.implementations.tiles.ITileStorageMonitorable;
|
import appeng.api.implementations.tiles.ITileStorageMonitorable;
|
||||||
import appeng.api.networking.security.BaseActionSource;
|
import appeng.api.networking.security.BaseActionSource;
|
||||||
import appeng.api.storage.IExternalStorageHandler;
|
import appeng.api.storage.IExternalStorageHandler;
|
||||||
import appeng.api.storage.IMEInventory;
|
import appeng.api.storage.IMEInventory;
|
||||||
import appeng.api.storage.StorageChannel;
|
import appeng.api.storage.StorageChannel;
|
||||||
|
import appeng.util.Platform;
|
||||||
|
|
||||||
public class AEFluidInterfaceHandler implements IExternalStorageHandler {
|
public class AEFluidInterfaceHandler implements IExternalStorageHandler {
|
||||||
|
|
||||||
@@ -18,7 +17,7 @@ public class AEFluidInterfaceHandler implements IExternalStorageHandler {
|
|||||||
if (channel == StorageChannel.FLUIDS) {
|
if (channel == StorageChannel.FLUIDS) {
|
||||||
if (te instanceof ITileStorageMonitorable) {
|
if (te instanceof ITileStorageMonitorable) {
|
||||||
return true;
|
return true;
|
||||||
} else return Util.getPart(te, d.getOpposite()) instanceof ITileStorageMonitorable;
|
} else return Platform.getPartFromTE(te, d.getOpposite()) instanceof ITileStorageMonitorable;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -30,8 +29,8 @@ public class AEFluidInterfaceHandler implements IExternalStorageHandler {
|
|||||||
if (te instanceof ITileStorageMonitorable
|
if (te instanceof ITileStorageMonitorable
|
||||||
&& ((ITileStorageMonitorable) te).getMonitorable(d, src) != null) {
|
&& ((ITileStorageMonitorable) te).getMonitorable(d, src) != null) {
|
||||||
return ((ITileStorageMonitorable) te).getMonitorable(d, src).getFluidInventory();
|
return ((ITileStorageMonitorable) te).getMonitorable(d, src).getFluidInventory();
|
||||||
} else if (Util.getPart(te, d.getOpposite()) instanceof ITileStorageMonitorable part
|
} else if (Platform.getPartFromTE(te, d.getOpposite()) instanceof ITileStorageMonitorable part
|
||||||
&& ((ITileStorageMonitorable) Util.getPart(te, d.getOpposite())).getMonitorable(d, src) != null) {
|
&& part.getMonitorable(d, src) != null) {
|
||||||
return part.getMonitorable(d, src).getFluidInventory();
|
return part.getMonitorable(d, src).getFluidInventory();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import net.minecraft.tileentity.TileEntity;
|
|||||||
import net.minecraftforge.common.util.ForgeDirection;
|
import net.minecraftforge.common.util.ForgeDirection;
|
||||||
|
|
||||||
import appeng.api.parts.IPart;
|
import appeng.api.parts.IPart;
|
||||||
import appeng.api.parts.IPartHost;
|
import appeng.util.Platform;
|
||||||
|
|
||||||
public abstract class PartGuiFactory<T> extends TileGuiFactory<T> {
|
public abstract class PartGuiFactory<T> extends TileGuiFactory<T> {
|
||||||
|
|
||||||
@@ -17,12 +17,11 @@ public abstract class PartGuiFactory<T> extends TileGuiFactory<T> {
|
|||||||
@Nullable
|
@Nullable
|
||||||
@Override
|
@Override
|
||||||
protected T getInventory(TileEntity tile, ForgeDirection face) {
|
protected T getInventory(TileEntity tile, ForgeDirection face) {
|
||||||
if (tile instanceof IPartHost) {
|
IPart part = Platform.getPartFromTE(tile, face);
|
||||||
IPart part = ((IPartHost) tile).getPart(face);
|
|
||||||
if (invClass.isInstance(part)) {
|
if (invClass.isInstance(part)) {
|
||||||
return invClass.cast(part);
|
return invClass.cast(part);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -6,7 +6,7 @@ import net.minecraft.tileentity.TileEntity;
|
|||||||
import net.minecraftforge.common.util.ForgeDirection;
|
import net.minecraftforge.common.util.ForgeDirection;
|
||||||
|
|
||||||
import appeng.api.parts.IPart;
|
import appeng.api.parts.IPart;
|
||||||
import appeng.api.parts.IPartHost;
|
import appeng.util.Platform;
|
||||||
|
|
||||||
public abstract class TileOrPartGuiFactory<T> extends TileGuiFactory<T> {
|
public abstract class TileOrPartGuiFactory<T> extends TileGuiFactory<T> {
|
||||||
|
|
||||||
@@ -17,12 +17,11 @@ public abstract class TileOrPartGuiFactory<T> extends TileGuiFactory<T> {
|
|||||||
@Nullable
|
@Nullable
|
||||||
@Override
|
@Override
|
||||||
protected T getInventory(TileEntity tile, ForgeDirection face) {
|
protected T getInventory(TileEntity tile, ForgeDirection face) {
|
||||||
if (tile instanceof IPartHost) {
|
IPart part = Platform.getPartFromTE(tile, face);
|
||||||
IPart part = ((IPartHost) tile).getPart(face);
|
|
||||||
if (invClass.isInstance(part)) {
|
if (invClass.isInstance(part)) {
|
||||||
return invClass.cast(part);
|
return invClass.cast(part);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return super.getInventory(tile, face);
|
return super.getInventory(tile, face);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -12,8 +12,6 @@ import com.glodblock.github.inventory.gui.GuiType;
|
|||||||
import com.glodblock.github.util.BlockPos;
|
import com.glodblock.github.util.BlockPos;
|
||||||
|
|
||||||
import appeng.api.parts.ILevelEmitter;
|
import appeng.api.parts.ILevelEmitter;
|
||||||
import appeng.api.parts.IPart;
|
|
||||||
import appeng.api.parts.IPartHost;
|
|
||||||
import appeng.container.AEBaseContainer;
|
import appeng.container.AEBaseContainer;
|
||||||
import appeng.container.PrimaryGui;
|
import appeng.container.PrimaryGui;
|
||||||
import appeng.container.interfaces.IContainerSubGui;
|
import appeng.container.interfaces.IContainerSubGui;
|
||||||
@@ -125,16 +123,13 @@ public class CPacketLevelTerminalCommands implements IMessage {
|
|||||||
TileEntity tile = DimensionManager.getWorld(message.dim)
|
TileEntity tile = DimensionManager.getWorld(message.dim)
|
||||||
.getTileEntity(message.x, message.y, message.z);
|
.getTileEntity(message.x, message.y, message.z);
|
||||||
|
|
||||||
if (tile instanceof IPartHost host) {
|
if (Platform.getPartFromTE(tile, message.side) instanceof ILevelEmitter) {
|
||||||
IPart part = host.getPart(message.side);
|
|
||||||
if (part instanceof ILevelEmitter) {
|
|
||||||
InventoryHandler.openGui(
|
InventoryHandler.openGui(
|
||||||
player,
|
player,
|
||||||
tile.getWorldObj(),
|
tile.getWorldObj(),
|
||||||
new BlockPos(tile),
|
new BlockPos(tile),
|
||||||
message.side,
|
message.side,
|
||||||
GuiType.LEVEL_EMITTER_PROXY);
|
GuiType.LEVEL_EMITTER_PROXY);
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
InventoryHandler.openGui(
|
InventoryHandler.openGui(
|
||||||
player,
|
player,
|
||||||
|
|||||||
@@ -52,7 +52,6 @@ import appeng.api.util.DimensionalCoord;
|
|||||||
import appeng.container.AEBaseContainer;
|
import appeng.container.AEBaseContainer;
|
||||||
import appeng.items.tools.powered.ToolWirelessTerminal;
|
import appeng.items.tools.powered.ToolWirelessTerminal;
|
||||||
import appeng.me.storage.NullInventory;
|
import appeng.me.storage.NullInventory;
|
||||||
import appeng.tile.networking.TileCableBus;
|
|
||||||
import appeng.util.Platform;
|
import appeng.util.Platform;
|
||||||
import appeng.util.item.AEFluidStack;
|
import appeng.util.item.AEFluidStack;
|
||||||
import appeng.util.item.AEItemStack;
|
import appeng.util.item.AEItemStack;
|
||||||
@@ -345,13 +344,6 @@ public final class Util {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static IPart getPart(Object te, ForgeDirection face) {
|
|
||||||
if (te instanceof TileCableBus) {
|
|
||||||
return ((TileCableBus) te).getPart(face);
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void writeFluidMapToBuf(Map<Integer, IAEFluidStack> list, ByteBuf buf) throws IOException {
|
public static void writeFluidMapToBuf(Map<Integer, IAEFluidStack> list, ByteBuf buf) throws IOException {
|
||||||
buf.writeInt(list.size());
|
buf.writeInt(list.size());
|
||||||
for (Map.Entry<Integer, IAEFluidStack> fs : list.entrySet()) {
|
for (Map.Entry<Integer, IAEFluidStack> fs : list.entrySet()) {
|
||||||
|
|||||||
Reference in new issue
Block a user