mirror of
https://github.com/GTNewHorizons/AE2FluidCraft-Rework.git
synced 2026-11-24 22:04:29 +00:00
Compare commits
3
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
06e0821e67 | ||
|
|
a950c8f23b | ||
|
|
c0ba18417d |
No files matched your search
@@ -3,9 +3,9 @@ name: Build and test
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches: [ master, main ]
|
||||
branches: [ master, main, release/** ]
|
||||
push:
|
||||
branches: [ master, main ]
|
||||
branches: [ master, main, release/** ]
|
||||
|
||||
jobs:
|
||||
build-and-test:
|
||||
|
||||
@@ -91,16 +91,11 @@ public class ItemCertusQuartzTank extends BaseItemBlockContainer implements IFlu
|
||||
|
||||
if (!container.stackTagCompound.hasKey("tileEntity")
|
||||
|| container.stackTagCompound.getCompoundTag("tileEntity").hasKey("Empty")) {
|
||||
NBTTagCompound fluidTag = resource.writeToNBT(new NBTTagCompound());
|
||||
|
||||
if (this.capacity < resource.amount) {
|
||||
fluidTag.setInteger("Amount", this.capacity);
|
||||
container.stackTagCompound.setTag("tileEntity", fluidTag);
|
||||
return this.capacity;
|
||||
}
|
||||
|
||||
int finalAmount = Math.min(resource.amount, this.capacity);
|
||||
NBTTagCompound fluidTag = new FluidStack(resource.getFluid(), finalAmount, resource.tag)
|
||||
.writeToNBT(new NBTTagCompound());
|
||||
container.stackTagCompound.setTag("tileEntity", fluidTag);
|
||||
return resource.amount;
|
||||
return finalAmount;
|
||||
}
|
||||
|
||||
NBTTagCompound fluidTag = container.stackTagCompound.getCompoundTag("tileEntity");
|
||||
|
||||
+17
-9
@@ -5,8 +5,11 @@ import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import appeng.api.implementations.tiles.ITileStorageMonitorable;
|
||||
import appeng.api.networking.security.BaseActionSource;
|
||||
import appeng.api.parts.IPart;
|
||||
import appeng.api.parts.IPartHost;
|
||||
import appeng.api.storage.IExternalStorageHandler;
|
||||
import appeng.api.storage.IMEInventory;
|
||||
import appeng.api.storage.IStorageMonitorable;
|
||||
import appeng.api.storage.StorageChannel;
|
||||
import appeng.util.Platform;
|
||||
|
||||
@@ -16,8 +19,8 @@ public class AEFluidInterfaceHandler implements IExternalStorageHandler {
|
||||
public boolean canHandle(TileEntity te, ForgeDirection d, StorageChannel channel, BaseActionSource mySrc) {
|
||||
if (channel == StorageChannel.FLUIDS) {
|
||||
if (te instanceof ITileStorageMonitorable) {
|
||||
return true;
|
||||
} else return Platform.getPartFromTE(te, d.getOpposite()) instanceof ITileStorageMonitorable;
|
||||
return !(te instanceof IPartHost);
|
||||
} else return getMonitorablePart(te, d, mySrc) != null;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -26,14 +29,19 @@ public class AEFluidInterfaceHandler implements IExternalStorageHandler {
|
||||
@SuppressWarnings("rawtypes")
|
||||
public IMEInventory getInventory(TileEntity te, ForgeDirection d, StorageChannel channel, BaseActionSource src) {
|
||||
if (channel == StorageChannel.FLUIDS) {
|
||||
if (te instanceof ITileStorageMonitorable
|
||||
&& ((ITileStorageMonitorable) te).getMonitorable(d, src) != null) {
|
||||
return ((ITileStorageMonitorable) te).getMonitorable(d, src).getFluidInventory();
|
||||
} else if (Platform.getPartFromTE(te, d.getOpposite()) instanceof ITileStorageMonitorable part
|
||||
&& part.getMonitorable(d, src) != null) {
|
||||
return part.getMonitorable(d, src).getFluidInventory();
|
||||
}
|
||||
if (te instanceof ITileStorageMonitorable tsm) {
|
||||
final IStorageMonitorable monitorable = tsm.getMonitorable(d, src);
|
||||
return monitorable != null ? monitorable.getFluidInventory() : null;
|
||||
} else {
|
||||
final IStorageMonitorable monitorable = getMonitorablePart(te, d, src);
|
||||
return monitorable != null ? monitorable.getFluidInventory() : null;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private static IStorageMonitorable getMonitorablePart(TileEntity te, ForgeDirection d, BaseActionSource src) {
|
||||
final IPart part = Platform.getPartFromTE(te, d);
|
||||
return part instanceof ITileStorageMonitorable monitorablePart ? monitorablePart.getMonitorable(d, src) : null;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user