mirror of
https://github.com/Thorfusion/Mekanism-Community-Edition.git
synced 2026-11-26 23:03:01 +00:00
Add implementation for dynamic tank
This commit is contained in:
1 parent
84a5196136
commit
b37d0ad4ff
1 file changed
+25
-1
@@ -1,9 +1,11 @@
|
||||
package mekanism.common.tile;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import mekanism.api.Coord4D;
|
||||
import mekanism.api.TileNetworkList;
|
||||
import mekanism.common.Mekanism;
|
||||
@@ -13,6 +15,7 @@ import mekanism.common.content.tank.SynchronizedTankData;
|
||||
import mekanism.common.content.tank.SynchronizedTankData.ValveData;
|
||||
import mekanism.common.content.tank.TankCache;
|
||||
import mekanism.common.content.tank.TankUpdateProtocol;
|
||||
import mekanism.common.integration.computer.IComputerIntegration;
|
||||
import mekanism.common.multiblock.MultiblockManager;
|
||||
import mekanism.common.util.FluidContainerUtils;
|
||||
import mekanism.common.util.FluidContainerUtils.ContainerEditMode;
|
||||
@@ -27,10 +30,12 @@ import net.minecraftforge.common.capabilities.Capability;
|
||||
import net.minecraftforge.fml.common.FMLCommonHandler;
|
||||
import net.minecraftforge.items.CapabilityItemHandler;
|
||||
|
||||
public class TileEntityDynamicTank extends TileEntityMultiblock<SynchronizedTankData> implements IFluidContainerManager {
|
||||
public class TileEntityDynamicTank extends TileEntityMultiblock<SynchronizedTankData> implements IComputerIntegration, IFluidContainerManager {
|
||||
|
||||
protected static final int[] SLOTS = {0, 1};
|
||||
|
||||
public static final String[] methods = new String[]{"getAmount", "getCapacity", "getLiquidType"};
|
||||
|
||||
/**
|
||||
* A client-sided set of valves on this tank's structure that are currently active, used on the client for rendering fluids.
|
||||
*/
|
||||
@@ -229,4 +234,23 @@ public class TileEntityDynamicTank extends TileEntityMultiblock<SynchronizedTank
|
||||
}
|
||||
return super.isCapabilityDisabled(capability, side);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getMethods() {
|
||||
return methods;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object[] invoke(int method, Object[] args) throws NoSuchMethodException {
|
||||
switch (method) {
|
||||
case 0:
|
||||
return new Object[]{structure != null ? structure.fluidStored != null ? structure.fluidStored.amount : 0 : 0};
|
||||
case 1:
|
||||
return new Object[]{structure != null ? structure.volume : 0};
|
||||
case 2:
|
||||
return new Object[]{structure != null ? structure.fluidStored != null ? structure.fluidStored.getLocalizedName() : null : null};
|
||||
default:
|
||||
throw new NoSuchMethodException();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user