| package li.cil.oc.driver.vanilla; |
| |
| import li.cil.oc.api.network.Arguments; |
| import li.cil.oc.api.network.Callback; |
| import li.cil.oc.api.network.Context; |
| import li.cil.oc.api.network.ManagedEnvironment; |
| import li.cil.oc.driver.ManagedTileEntityEnvironment; |
| import li.cil.oc.driver.TileEntityDriver; |
| import li.cil.oc.util.TypeConversion; |
| import net.minecraft.world.World; |
| import net.minecraftforge.fluids.FluidTankInfo; |
| import net.minecraftforge.fluids.IFluidTank; |
| |
| public final class DriverFluidTank extends TileEntityDriver { |
| @Override |
| public Class<?> getFilterClass() { |
| return IFluidTank.class; |
| } |
| |
| @Override |
| public ManagedEnvironment createEnvironment(final World world, final int x, final int y, final int z) { |
| return new Environment((IFluidTank) world.getBlockTileEntity(x, y, z)); |
| } |
| |
| public static final class Environment extends ManagedTileEntityEnvironment<IFluidTank> { |
| public Environment(final IFluidTank tileEntity) { |
| super(tileEntity, "fluid_tank"); |
| } |
| |
| @Callback |
| public Object[] getInfo(final Context context, final Arguments args) { |
| final FluidTankInfo info = tileEntity.getInfo(); |
| return new Object[]{TypeConversion.toMap(info)}; |
| } |
| } |
| } |