Re-add the Fluid Interface
This commit is contained in:
@@ -123,6 +123,7 @@ public class ClientSetup {
|
||||
ScreenManager.registerFactory(RSContainers.DETECTOR, DetectorScreen::new);
|
||||
ScreenManager.registerFactory(RSContainers.SECURITY_MANAGER, SecurityManagerScreen::new);
|
||||
ScreenManager.registerFactory(RSContainers.INTERFACE, InterfaceScreen::new);
|
||||
ScreenManager.registerFactory(RSContainers.FLUID_INTERFACE, FluidInterfaceScreen::new);
|
||||
|
||||
ClientRegistry.registerKeyBinding(RSKeyBindings.FOCUS_SEARCH_BAR);
|
||||
ClientRegistry.registerKeyBinding(RSKeyBindings.CLEAR_GRID_CRAFTING_MATRIX);
|
||||
|
||||
@@ -124,6 +124,7 @@ public final class RS {
|
||||
API.instance().getNetworkNodeRegistry().add(DetectorNetworkNode.ID, (tag, world, pos) -> readAndReturn(tag, new DetectorNetworkNode(world, pos)));
|
||||
API.instance().getNetworkNodeRegistry().add(SecurityManagerNetworkNode.ID, (tag, world, pos) -> readAndReturn(tag, new SecurityManagerNetworkNode(world, pos)));
|
||||
API.instance().getNetworkNodeRegistry().add(InterfaceNetworkNode.ID, (tag, world, pos) -> readAndReturn(tag, new InterfaceNetworkNode(world, pos)));
|
||||
API.instance().getNetworkNodeRegistry().add(FluidInterfaceNetworkNode.ID, (tag, world, pos) -> readAndReturn(tag, new FluidInterfaceNetworkNode(world, pos)));
|
||||
|
||||
API.instance().getGridManager().add(GridBlockGridFactory.ID, new GridBlockGridFactory());
|
||||
|
||||
@@ -174,6 +175,7 @@ public final class RS {
|
||||
e.getRegistry().register(new DetectorBlock());
|
||||
e.getRegistry().register(new SecurityManagerBlock());
|
||||
e.getRegistry().register(new InterfaceBlock());
|
||||
e.getRegistry().register(new FluidInterfaceBlock());
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
@@ -208,6 +210,7 @@ public final class RS {
|
||||
e.getRegistry().register(registerTileDataParameters(TileEntityType.Builder.create(DetectorTile::new, RSBlocks.DETECTOR).build(null).setRegistryName(RS.ID, "detector")));
|
||||
e.getRegistry().register(registerTileDataParameters(TileEntityType.Builder.create(SecurityManagerTile::new, RSBlocks.SECURITY_MANAGER).build(null).setRegistryName(RS.ID, "security_manager")));
|
||||
e.getRegistry().register(registerTileDataParameters(TileEntityType.Builder.create(InterfaceTile::new, RSBlocks.INTERFACE).build(null).setRegistryName(RS.ID, "interface")));
|
||||
e.getRegistry().register(registerTileDataParameters(TileEntityType.Builder.create(FluidInterfaceTile::new, RSBlocks.FLUID_INTERFACE).build(null).setRegistryName(RS.ID, "fluid_interface")));
|
||||
}
|
||||
|
||||
private <T extends TileEntity> TileEntityType<T> registerTileDataParameters(TileEntityType<T> t) {
|
||||
@@ -234,6 +237,7 @@ public final class RS {
|
||||
e.getRegistry().register(IForgeContainerType.create(new PositionalTileContainerFactory<DetectorContainer, DetectorTile>((windowId, inv, tile) -> new DetectorContainer(tile, inv.player, windowId))).setRegistryName(RS.ID, "detector"));
|
||||
e.getRegistry().register(IForgeContainerType.create(new PositionalTileContainerFactory<SecurityManagerContainer, SecurityManagerTile>((windowId, inv, tile) -> new SecurityManagerContainer(tile, inv.player, windowId))).setRegistryName(RS.ID, "security_manager"));
|
||||
e.getRegistry().register(IForgeContainerType.create(new PositionalTileContainerFactory<InterfaceContainer, InterfaceTile>((windowId, inv, tile) -> new InterfaceContainer(tile, inv.player, windowId))).setRegistryName(RS.ID, "interface"));
|
||||
e.getRegistry().register(IForgeContainerType.create(new PositionalTileContainerFactory<FluidInterfaceContainer, FluidInterfaceTile>((windowId, inv, tile) -> new FluidInterfaceContainer(tile, inv.player, windowId))).setRegistryName(RS.ID, "fluid_interface"));
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
@@ -310,6 +314,7 @@ public final class RS {
|
||||
e.getRegistry().register(BlockUtils.createBlockItemFor(RSBlocks.DETECTOR));
|
||||
e.getRegistry().register(BlockUtils.createBlockItemFor(RSBlocks.SECURITY_MANAGER));
|
||||
e.getRegistry().register(BlockUtils.createBlockItemFor(RSBlocks.INTERFACE));
|
||||
e.getRegistry().register(BlockUtils.createBlockItemFor(RSBlocks.FLUID_INTERFACE));
|
||||
}
|
||||
|
||||
/* TODO
|
||||
|
||||
@@ -62,13 +62,14 @@ public final class RSBlocks {
|
||||
public static final SecurityManagerBlock SECURITY_MANAGER = null;
|
||||
@ObjectHolder(RS.ID + ":interface")
|
||||
public static final InterfaceBlock INTERFACE = null;
|
||||
@ObjectHolder(RS.ID + ":fluid_interface")
|
||||
public static final FluidInterfaceBlock FLUID_INTERFACE = null;
|
||||
|
||||
public static final BlockDestructor DESTRUCTOR = new BlockDestructor();
|
||||
public static final BlockConstructor CONSTRUCTOR = new BlockConstructor();
|
||||
public static final BlockCraftingMonitor CRAFTING_MONITOR = new BlockCraftingMonitor();
|
||||
public static final BlockWirelessTransmitter WIRELESS_TRANSMITTER = new BlockWirelessTransmitter();
|
||||
public static final BlockCrafter CRAFTER = new BlockCrafter();
|
||||
public static final BlockFluidInterface FLUID_INTERFACE = new BlockFluidInterface();
|
||||
public static final BlockDiskManipulator DISK_MANIPULATOR = new BlockDiskManipulator();
|
||||
public static final BlockStorageMonitor STORAGE_MONITOR = new BlockStorageMonitor();
|
||||
public static final BlockPortableGrid PORTABLE_GRID = new BlockPortableGrid();
|
||||
|
||||
@@ -33,6 +33,8 @@ public final class RSContainers {
|
||||
public static final ContainerType<SecurityManagerContainer> SECURITY_MANAGER = null;
|
||||
@ObjectHolder(RS.ID + ":interface")
|
||||
public static final ContainerType<InterfaceContainer> INTERFACE = null;
|
||||
@ObjectHolder(RS.ID + ":fluid_interface")
|
||||
public static final ContainerType<FluidInterfaceContainer> FLUID_INTERFACE = null;
|
||||
|
||||
//@ObjectHolder(RS.ID + ":crafter")
|
||||
public static final ContainerType<CrafterContainer> CRAFTER = null;
|
||||
@@ -46,8 +48,6 @@ public final class RSContainers {
|
||||
public static final ContainerType<ConstructorContainer> CONSTRUCTOR = null;
|
||||
//@ObjectHolder(RS.ID + ":disk_manipulator")
|
||||
public static final ContainerType<DiskManipulatorContainer> DISK_MANIPULATOR = null;
|
||||
//@ObjectHolder(RS.ID + ":fluid_interface")
|
||||
public static final ContainerType<FluidInterfaceContainer> FLUID_INTERFACE = null;
|
||||
//@ObjectHolder(RS.ID + ":storage_monitor")
|
||||
public static final ContainerType<StorageMonitorContainer> STORAGE_MONITOR = null;
|
||||
//@ObjectHolder(RS.ID + ":wireless_transmitter")
|
||||
|
||||
@@ -8,7 +8,6 @@ public class RSOldConfig {
|
||||
public int craftingMonitorUsage;
|
||||
public int crafterManagerUsage;
|
||||
public int destructorUsage;
|
||||
public int fluidInterfaceUsage;
|
||||
public int wirelessTransmitterUsage;
|
||||
public int diskManipulatorUsage;
|
||||
//endregion
|
||||
@@ -72,7 +71,6 @@ public class RSOldConfig {
|
||||
craftingMonitorUsage = config.getInt("craftingMonitor", ENERGY, 2, 0, Integer.MAX_VALUE, "The energy used by Crafting Monitors");
|
||||
crafterManagerUsage = config.getInt("crafterManager", ENERGY, 4, 0, Integer.MAX_VALUE, "The energy used by Crafter Managers");
|
||||
destructorUsage = config.getInt("destructor", ENERGY, 1, 0, Integer.MAX_VALUE, "The energy used by Destructors");
|
||||
fluidInterfaceUsage = config.getInt("fluidInterface", ENERGY, 3, 0, Integer.MAX_VALUE, "The energy used by Fluid Interfaces");
|
||||
wirelessTransmitterUsage = config.getInt("wirelessTransmitter", ENERGY, 8, 0, Integer.MAX_VALUE, "The energy used by Wireless Transmitters");
|
||||
diskManipulatorUsage = config.getInt("diskManipulator", ENERGY, 3, 0, Integer.MAX_VALUE, "The energy used by Disk Manipulators");
|
||||
//endregion
|
||||
|
||||
@@ -62,6 +62,8 @@ public class RSTiles {
|
||||
public static final TileEntityType<SecurityManagerTile> SECURITY_MANAGER = null;
|
||||
@ObjectHolder(RS.ID + ":interface")
|
||||
public static final TileEntityType<InterfaceTile> INTERFACE = null;
|
||||
@ObjectHolder(RS.ID + ":fluid_interface")
|
||||
public static final TileEntityType<FluidInterfaceTile> FLUID_INTERFACE = null;
|
||||
|
||||
//@ObjectHolder(RS.ID + ":portable_grid")
|
||||
public static final TileEntityType<TilePortableGrid> PORTABLE_GRID = null;
|
||||
@@ -69,8 +71,6 @@ public class RSTiles {
|
||||
public static final TileEntityType<TileStorageMonitor> STORAGE_MONITOR = null;
|
||||
//@ObjectHolder(RS.ID + ":wireless_transmitter")
|
||||
public static final TileEntityType<SecurityManagerTile> WIRELESS_TRANSMITTER = null;
|
||||
//@ObjectHolder(RS.ID + ":fluid_interface")
|
||||
public static final TileEntityType<TileFluidInterface> FLUID_INTERFACE = null;
|
||||
//@ObjectHolder(RS.ID + ":disk_manipulator")
|
||||
public static final TileEntityType<TileDiskManipulator> DISK_MANIPULATOR = null;
|
||||
//@ObjectHolder(RS.ID + ":crafter")
|
||||
|
||||
@@ -81,6 +81,8 @@ public class Network implements INetwork, IRedstoneConfigurable {
|
||||
this.world = world;
|
||||
this.type = type;
|
||||
this.root = new RootNetworkNode(this, world, pos);
|
||||
|
||||
// TODO: Update ControllerTile.NODES when graph changes?
|
||||
}
|
||||
|
||||
public RootNetworkNode getRoot() {
|
||||
|
||||
@@ -13,7 +13,7 @@ import com.raoulvdberge.refinedstorage.inventory.item.UpgradeItemHandler;
|
||||
import com.raoulvdberge.refinedstorage.inventory.listener.NetworkNodeFluidInventoryListener;
|
||||
import com.raoulvdberge.refinedstorage.inventory.listener.NetworkNodeInventoryListener;
|
||||
import com.raoulvdberge.refinedstorage.item.UpgradeItem;
|
||||
import com.raoulvdberge.refinedstorage.tile.TileFluidInterface;
|
||||
import com.raoulvdberge.refinedstorage.tile.FluidInterfaceTile;
|
||||
import com.raoulvdberge.refinedstorage.tile.config.IType;
|
||||
import com.raoulvdberge.refinedstorage.util.StackUtils;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -31,7 +31,7 @@ import net.minecraftforge.items.IItemHandler;
|
||||
import net.minecraftforge.items.wrapper.CombinedInvWrapper;
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
|
||||
public class NetworkNodeFluidInterface extends NetworkNode {
|
||||
public class FluidInterfaceNetworkNode extends NetworkNode {
|
||||
public static final ResourceLocation ID = new ResourceLocation(RS.ID, "fluid_interface");
|
||||
|
||||
public static final int TANK_CAPACITY = 16_000;
|
||||
@@ -46,7 +46,7 @@ public class NetworkNodeFluidInterface extends NetworkNode {
|
||||
super.onContentsChanged();
|
||||
|
||||
if (!world.isRemote) {
|
||||
((TileFluidInterface) world.getTileEntity(pos)).getDataManager().sendParameterToWatchers(TileFluidInterface.TANK_IN);
|
||||
((FluidInterfaceTile) world.getTileEntity(pos)).getDataManager().sendParameterToWatchers(FluidInterfaceTile.TANK_IN);
|
||||
}
|
||||
|
||||
markDirty();
|
||||
@@ -59,9 +59,9 @@ public class NetworkNodeFluidInterface extends NetworkNode {
|
||||
private BaseItemHandler in = new BaseItemHandler(1).addListener(new NetworkNodeInventoryListener(this)).addValidator(stack -> !StackUtils.getFluid(stack, true).getValue().isEmpty());
|
||||
private FluidInventory out = new FluidInventory(1, TANK_CAPACITY).addListener(new NetworkNodeFluidInventoryListener(this));
|
||||
|
||||
private UpgradeItemHandler upgrades = (UpgradeItemHandler) new UpgradeItemHandler(4 /* TODO, ItemUpgrade.TYPE_SPEED, ItemUpgrade.TYPE_STACK, ItemUpgrade.TYPE_CRAFTING*/).addListener(new NetworkNodeInventoryListener(this));
|
||||
private UpgradeItemHandler upgrades = (UpgradeItemHandler) new UpgradeItemHandler(4, UpgradeItem.Type.SPEED, UpgradeItem.Type.STACK, UpgradeItem.Type.CRAFTING).addListener(new NetworkNodeInventoryListener(this));
|
||||
|
||||
public NetworkNodeFluidInterface(World world, BlockPos pos) {
|
||||
public FluidInterfaceNetworkNode(World world, BlockPos pos) {
|
||||
super(world, pos);
|
||||
}
|
||||
|
||||
@@ -98,7 +98,7 @@ public class NetworkNodeFluidInterface extends NetworkNode {
|
||||
FluidStack wanted = out.getFluid(0);
|
||||
FluidStack got = tankOut.getFluid();
|
||||
|
||||
if (!wanted.isEmpty()) {
|
||||
if (wanted.isEmpty()) {
|
||||
if (!got.isEmpty()) {
|
||||
tankOut.setFluid(network.insertFluidTracked(got, got.getAmount()));
|
||||
|
||||
@@ -170,7 +170,7 @@ public class NetworkNodeFluidInterface extends NetworkNode {
|
||||
|
||||
@Override
|
||||
public int getEnergyUsage() {
|
||||
return RS.INSTANCE.config.fluidInterfaceUsage;
|
||||
return RS.SERVER_CONFIG.getFluidInterface().getUsage();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -251,7 +251,7 @@ public class NetworkNodeFluidInterface extends NetworkNode {
|
||||
|
||||
private void onTankOutChanged() {
|
||||
if (!world.isRemote) {
|
||||
((TileFluidInterface) world.getTileEntity(pos)).getDataManager().sendParameterToWatchers(TileFluidInterface.TANK_OUT);
|
||||
((FluidInterfaceTile) world.getTileEntity(pos)).getDataManager().sendParameterToWatchers(FluidInterfaceTile.TANK_OUT);
|
||||
}
|
||||
|
||||
markDirty();
|
||||
@@ -3,7 +3,7 @@ package com.raoulvdberge.refinedstorage.apiimpl.storage.externalstorage;
|
||||
import com.raoulvdberge.refinedstorage.api.storage.externalstorage.IExternalStorage;
|
||||
import com.raoulvdberge.refinedstorage.api.storage.externalstorage.IExternalStorageContext;
|
||||
import com.raoulvdberge.refinedstorage.api.storage.externalstorage.IExternalStorageProvider;
|
||||
import com.raoulvdberge.refinedstorage.tile.TileFluidInterface;
|
||||
import com.raoulvdberge.refinedstorage.tile.FluidInterfaceTile;
|
||||
import com.raoulvdberge.refinedstorage.util.WorldUtils;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.Direction;
|
||||
@@ -21,7 +21,7 @@ public class FluidExternalStorageProvider implements IExternalStorageProvider<Fl
|
||||
@Nonnull
|
||||
@Override
|
||||
public IExternalStorage<FluidStack> provide(IExternalStorageContext context, Supplier<TileEntity> tile, Direction direction) {
|
||||
return new FluidExternalStorage(context, () -> WorldUtils.getFluidHandler(tile.get(), direction.getOpposite()), tile.get() instanceof TileFluidInterface);
|
||||
return new FluidExternalStorage(context, () -> WorldUtils.getFluidHandler(tile.get(), direction.getOpposite()), tile.get() instanceof FluidInterfaceTile);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,26 +0,0 @@
|
||||
package com.raoulvdberge.refinedstorage.block;
|
||||
|
||||
import com.raoulvdberge.refinedstorage.block.info.BlockInfoBuilder;
|
||||
import com.raoulvdberge.refinedstorage.tile.TileFluidInterface;
|
||||
|
||||
public class BlockFluidInterface extends BlockNode {
|
||||
public BlockFluidInterface() {
|
||||
super(BlockInfoBuilder.forId("fluid_interface").tileEntity(TileFluidInterface::new).create());
|
||||
}
|
||||
/* TODO
|
||||
@Override
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public void registerModels(IModelRegistration modelRegistration) {
|
||||
modelRegistration.setModel(this, 0, new ModelResourceLocation(info.getId(), "inventory"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, BlockPos pos, BlockState state, PlayerEntity player, EnumHand hand, Direction side, float hitX, float hitY, float hitZ) {
|
||||
return openNetworkGui(RSGui.FLUID_INTERFACE, player, world, pos, side, Permission.MODIFY, Permission.INSERT, Permission.EXTRACT);
|
||||
} */
|
||||
|
||||
@Override
|
||||
public boolean hasConnectedState() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
package com.raoulvdberge.refinedstorage.block;
|
||||
|
||||
import com.raoulvdberge.refinedstorage.RS;
|
||||
import com.raoulvdberge.refinedstorage.api.network.security.Permission;
|
||||
import com.raoulvdberge.refinedstorage.container.FluidInterfaceContainer;
|
||||
import com.raoulvdberge.refinedstorage.container.factory.PositionalTileContainerProvider;
|
||||
import com.raoulvdberge.refinedstorage.tile.FluidInterfaceTile;
|
||||
import com.raoulvdberge.refinedstorage.util.BlockUtils;
|
||||
import com.raoulvdberge.refinedstorage.util.NetworkUtils;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.entity.player.ServerPlayerEntity;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.BlockRayTraceResult;
|
||||
import net.minecraft.util.text.TranslationTextComponent;
|
||||
import net.minecraft.world.IBlockReader;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.network.NetworkHooks;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class FluidInterfaceBlock extends NodeBlock {
|
||||
public FluidInterfaceBlock() {
|
||||
super(BlockUtils.DEFAULT_ROCK_PROPERTIES);
|
||||
|
||||
this.setRegistryName(RS.ID, "fluid_interface");
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public TileEntity createTileEntity(BlockState state, IBlockReader world) {
|
||||
return new FluidInterfaceTile();
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public boolean onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand handIn, BlockRayTraceResult hit) {
|
||||
if (!world.isRemote) {
|
||||
return NetworkUtils.attempt(world, pos, hit.getFace(), player, () -> NetworkHooks.openGui(
|
||||
(ServerPlayerEntity) player,
|
||||
new PositionalTileContainerProvider<FluidInterfaceTile>(
|
||||
new TranslationTextComponent("gui.refinedstorage.fluid_interface"),
|
||||
(tile, windowId, inventory, p) -> new FluidInterfaceContainer(tile, player, windowId),
|
||||
pos
|
||||
),
|
||||
pos
|
||||
), Permission.MODIFY, Permission.INSERT, Permission.EXTRACT);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasConnectedState() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -21,6 +21,7 @@ public class ServerConfig {
|
||||
private Detector detector;
|
||||
private SecurityManager securityManager;
|
||||
private Interface _interface;
|
||||
private FluidInterface fluidInterface;
|
||||
private Upgrades upgrades;
|
||||
|
||||
public ServerConfig() {
|
||||
@@ -38,8 +39,9 @@ public class ServerConfig {
|
||||
relay = new Relay();
|
||||
detector = new Detector();
|
||||
securityManager = new SecurityManager();
|
||||
upgrades = new Upgrades();
|
||||
_interface = new Interface();
|
||||
fluidInterface = new FluidInterface();
|
||||
upgrades = new Upgrades();
|
||||
|
||||
spec = builder.build();
|
||||
}
|
||||
@@ -108,6 +110,10 @@ public class ServerConfig {
|
||||
return _interface;
|
||||
}
|
||||
|
||||
public FluidInterface getFluidInterface() {
|
||||
return fluidInterface;
|
||||
}
|
||||
|
||||
public ForgeConfigSpec getSpec() {
|
||||
return spec;
|
||||
}
|
||||
@@ -505,4 +511,20 @@ public class ServerConfig {
|
||||
return usage.get();
|
||||
}
|
||||
}
|
||||
|
||||
public class FluidInterface {
|
||||
private final ForgeConfigSpec.IntValue usage;
|
||||
|
||||
public FluidInterface() {
|
||||
builder.push("fluidInterface");
|
||||
|
||||
usage = builder.comment("The energy used by the Fluid Interface").defineInRange("usage", 2, 0, Integer.MAX_VALUE);
|
||||
|
||||
builder.pop();
|
||||
}
|
||||
|
||||
public int getUsage() {
|
||||
return usage.get();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,12 +3,12 @@ package com.raoulvdberge.refinedstorage.container;
|
||||
import com.raoulvdberge.refinedstorage.RSContainers;
|
||||
import com.raoulvdberge.refinedstorage.container.slot.filter.FilterSlot;
|
||||
import com.raoulvdberge.refinedstorage.container.slot.filter.FluidFilterSlot;
|
||||
import com.raoulvdberge.refinedstorage.tile.TileFluidInterface;
|
||||
import com.raoulvdberge.refinedstorage.tile.FluidInterfaceTile;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraftforge.items.SlotItemHandler;
|
||||
|
||||
public class FluidInterfaceContainer extends BaseContainer {
|
||||
public FluidInterfaceContainer(TileFluidInterface fluidInterface, PlayerEntity player, int windowId) {
|
||||
public FluidInterfaceContainer(FluidInterfaceTile fluidInterface, PlayerEntity player, int windowId) {
|
||||
super(RSContainers.FLUID_INTERFACE, fluidInterface, player, windowId);
|
||||
|
||||
for (int i = 0; i < 4; ++i) {
|
||||
|
||||
@@ -2,26 +2,27 @@ package com.raoulvdberge.refinedstorage.screen;
|
||||
|
||||
import com.raoulvdberge.refinedstorage.RS;
|
||||
import com.raoulvdberge.refinedstorage.apiimpl.API;
|
||||
import com.raoulvdberge.refinedstorage.apiimpl.network.node.NetworkNodeFluidInterface;
|
||||
import com.raoulvdberge.refinedstorage.apiimpl.network.node.FluidInterfaceNetworkNode;
|
||||
import com.raoulvdberge.refinedstorage.container.FluidInterfaceContainer;
|
||||
import com.raoulvdberge.refinedstorage.render.FluidRenderer;
|
||||
import com.raoulvdberge.refinedstorage.screen.widget.sidebutton.RedstoneModeSideButton;
|
||||
import com.raoulvdberge.refinedstorage.tile.TileFluidInterface;
|
||||
import com.raoulvdberge.refinedstorage.tile.FluidInterfaceTile;
|
||||
import com.raoulvdberge.refinedstorage.util.RenderUtils;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.entity.player.PlayerInventory;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
|
||||
public class GuiFluidInterface extends BaseScreen<FluidInterfaceContainer> {
|
||||
private static final FluidRenderer TANK_RENDERER = new FluidRenderer(NetworkNodeFluidInterface.TANK_CAPACITY, 12, 47);
|
||||
public class FluidInterfaceScreen extends BaseScreen<FluidInterfaceContainer> {
|
||||
private static final FluidRenderer TANK_RENDERER = new FluidRenderer(FluidInterfaceNetworkNode.TANK_CAPACITY, 12, 47);
|
||||
|
||||
public GuiFluidInterface(FluidInterfaceContainer container, PlayerInventory inventory) {
|
||||
super(container, 211, 204, inventory, null);
|
||||
public FluidInterfaceScreen(FluidInterfaceContainer container, PlayerInventory inventory, ITextComponent title) {
|
||||
super(container, 211, 204, inventory, title);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPostInit(int x, int y) {
|
||||
addSideButton(new RedstoneModeSideButton(this, TileFluidInterface.REDSTONE_MODE));
|
||||
addSideButton(new RedstoneModeSideButton(this, FluidInterfaceTile.REDSTONE_MODE));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -34,30 +35,28 @@ public class GuiFluidInterface extends BaseScreen<FluidInterfaceContainer> {
|
||||
|
||||
blit(x, y, 0, 0, xSize, ySize);
|
||||
|
||||
if (TileFluidInterface.TANK_IN.getValue() != null) {
|
||||
TANK_RENDERER.render(x + 46, y + 56, TileFluidInterface.TANK_IN.getValue());
|
||||
if (!FluidInterfaceTile.TANK_IN.getValue().isEmpty()) {
|
||||
TANK_RENDERER.render(x + 46, y + 56, FluidInterfaceTile.TANK_IN.getValue());
|
||||
}
|
||||
|
||||
if (TileFluidInterface.TANK_OUT.getValue() != null) {
|
||||
TANK_RENDERER.render(x + 118, y + 56, TileFluidInterface.TANK_OUT.getValue());
|
||||
if (!FluidInterfaceTile.TANK_OUT.getValue().isEmpty()) {
|
||||
TANK_RENDERER.render(x + 118, y + 56, FluidInterfaceTile.TANK_OUT.getValue());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderForeground(int mouseX, int mouseY) {
|
||||
renderString(7, 7, I18n.format("gui.refinedstorage:fluid_interface"));
|
||||
renderString(43 + 4, 20, I18n.format("gui.refinedstorage:fluid_interface.in"));
|
||||
renderString(115 + 1, 20, I18n.format("gui.refinedstorage:fluid_interface.out"));
|
||||
renderString(7, 7, title.getFormattedText());
|
||||
renderString(43 + 4, 20, I18n.format("gui.refinedstorage.fluid_interface.in"));
|
||||
renderString(115 + 1, 20, I18n.format("gui.refinedstorage.fluid_interface.out"));
|
||||
renderString(7, 111, I18n.format("container.inventory"));
|
||||
|
||||
// TODO getFormattedText
|
||||
if (RenderUtils.inBounds(46, 56, 12, 47, mouseX, mouseY) && TileFluidInterface.TANK_IN.getValue() != null) {
|
||||
renderTooltip(mouseX, mouseY, TileFluidInterface.TANK_IN.getValue().getDisplayName().getFormattedText() + "\n" + TextFormatting.GRAY + API.instance().getQuantityFormatter().formatInBucketForm(TileFluidInterface.TANK_IN.getValue().getAmount()) + TextFormatting.RESET);
|
||||
if (RenderUtils.inBounds(46, 56, 12, 47, mouseX, mouseY) && !FluidInterfaceTile.TANK_IN.getValue().isEmpty()) {
|
||||
renderTooltip(mouseX, mouseY, FluidInterfaceTile.TANK_IN.getValue().getDisplayName().getFormattedText() + "\n" + TextFormatting.GRAY + API.instance().getQuantityFormatter().formatInBucketForm(FluidInterfaceTile.TANK_IN.getValue().getAmount()) + TextFormatting.RESET);
|
||||
}
|
||||
|
||||
// TODO getFormattedText
|
||||
if (RenderUtils.inBounds(118, 56, 12, 47, mouseX, mouseY) && TileFluidInterface.TANK_OUT.getValue() != null) {
|
||||
renderTooltip(mouseX, mouseY, TileFluidInterface.TANK_OUT.getValue().getDisplayName().getFormattedText() + "\n" + TextFormatting.GRAY + API.instance().getQuantityFormatter().formatInBucketForm(TileFluidInterface.TANK_OUT.getValue().getAmount()) + TextFormatting.RESET);
|
||||
if (RenderUtils.inBounds(118, 56, 12, 47, mouseX, mouseY) && !FluidInterfaceTile.TANK_OUT.getValue().isEmpty()) {
|
||||
renderTooltip(mouseX, mouseY, FluidInterfaceTile.TANK_OUT.getValue().getDisplayName().getFormattedText() + "\n" + TextFormatting.GRAY + API.instance().getQuantityFormatter().formatInBucketForm(FluidInterfaceTile.TANK_OUT.getValue().getAmount()) + TextFormatting.RESET);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
package com.raoulvdberge.refinedstorage.tile;
|
||||
|
||||
import com.raoulvdberge.refinedstorage.RSTiles;
|
||||
import com.raoulvdberge.refinedstorage.apiimpl.network.node.FluidInterfaceNetworkNode;
|
||||
import com.raoulvdberge.refinedstorage.tile.data.RSSerializers;
|
||||
import com.raoulvdberge.refinedstorage.tile.data.TileDataParameter;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.capabilities.Capability;
|
||||
import net.minecraftforge.common.util.LazyOptional;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.capability.CapabilityFluidHandler;
|
||||
import net.minecraftforge.fluids.capability.IFluidHandler;
|
||||
import net.minecraftforge.items.CapabilityItemHandler;
|
||||
import net.minecraftforge.items.IItemHandler;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class FluidInterfaceTile extends NetworkNodeTile<FluidInterfaceNetworkNode> {
|
||||
public static final TileDataParameter<FluidStack, FluidInterfaceTile> TANK_IN = new TileDataParameter<>(RSSerializers.FLUID_STACK_SERIALIZER, FluidStack.EMPTY, t -> t.getNode().getTankIn().getFluid());
|
||||
public static final TileDataParameter<FluidStack, FluidInterfaceTile> TANK_OUT = new TileDataParameter<>(RSSerializers.FLUID_STACK_SERIALIZER, FluidStack.EMPTY, t -> t.getNode().getTankOut().getFluid());
|
||||
|
||||
private LazyOptional<IFluidHandler> tankCapability = LazyOptional.of(() -> getNode().getTank());
|
||||
private LazyOptional<IItemHandler> inCapability = LazyOptional.of(() -> getNode().getIn());
|
||||
|
||||
public FluidInterfaceTile() {
|
||||
super(RSTiles.FLUID_INTERFACE);
|
||||
|
||||
dataManager.addParameter(TANK_IN);
|
||||
dataManager.addParameter(TANK_OUT);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public <T> LazyOptional<T> getCapability(@Nonnull Capability<T> cap, @Nullable Direction direction) {
|
||||
if (cap == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) {
|
||||
return inCapability.cast();
|
||||
} else if (cap == CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY) {
|
||||
return tankCapability.cast();
|
||||
}
|
||||
|
||||
return super.getCapability(cap, direction);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nonnull
|
||||
public FluidInterfaceNetworkNode createNode(World world, BlockPos pos) {
|
||||
return new FluidInterfaceNetworkNode(world, pos);
|
||||
}
|
||||
}
|
||||
@@ -1,46 +0,0 @@
|
||||
package com.raoulvdberge.refinedstorage.tile;
|
||||
|
||||
import com.raoulvdberge.refinedstorage.RSTiles;
|
||||
import com.raoulvdberge.refinedstorage.apiimpl.network.node.NetworkNodeFluidInterface;
|
||||
import com.raoulvdberge.refinedstorage.tile.data.RSSerializers;
|
||||
import com.raoulvdberge.refinedstorage.tile.data.TileDataParameter;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
public class TileFluidInterface extends NetworkNodeTile<NetworkNodeFluidInterface> {
|
||||
public static final TileDataParameter<FluidStack, TileFluidInterface> TANK_IN = new TileDataParameter<>(RSSerializers.FLUID_STACK_SERIALIZER, null, t -> t.getNode().getTankIn().getFluid());
|
||||
public static final TileDataParameter<FluidStack, TileFluidInterface> TANK_OUT = new TileDataParameter<>(RSSerializers.FLUID_STACK_SERIALIZER, null, t -> t.getNode().getTankOut().getFluid());
|
||||
|
||||
public TileFluidInterface() {
|
||||
super(RSTiles.FLUID_INTERFACE);
|
||||
|
||||
dataManager.addParameter(TANK_IN);
|
||||
dataManager.addParameter(TANK_OUT);
|
||||
}
|
||||
|
||||
/* TODO
|
||||
@Override
|
||||
public boolean hasCapability(@Nonnull Capability<?> capability, @Nullable Direction facing) {
|
||||
return capability == CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY || capability == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY || super.hasCapability(capability, facing);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> T getCapability(@Nonnull Capability<T> capability, @Nullable Direction facing) {
|
||||
if (capability == CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY) {
|
||||
return CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY.cast(getNode().getTank());
|
||||
} else if (capability == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) {
|
||||
return CapabilityItemHandler.ITEM_HANDLER_CAPABILITY.cast(getNode().getIn());
|
||||
}
|
||||
|
||||
return super.getCapability(capability, facing);
|
||||
}*/
|
||||
|
||||
@Override
|
||||
@Nonnull
|
||||
public NetworkNodeFluidInterface createNode(World world, BlockPos pos) {
|
||||
return new NetworkNodeFluidInterface(world, pos);
|
||||
}
|
||||
}
|
||||
@@ -1,25 +1,10 @@
|
||||
{
|
||||
"forge_marker": 1,
|
||||
"defaults": {
|
||||
"model": "cube_all",
|
||||
"textures": {
|
||||
"all": "refinedstorage:blocks/fluid_interface_disconnected"
|
||||
}
|
||||
},
|
||||
"variants": {
|
||||
"inventory": [
|
||||
{
|
||||
"transform": "forge:default-block"
|
||||
}
|
||||
],
|
||||
"connected": {
|
||||
"true": {
|
||||
"textures": {
|
||||
"all": "refinedstorage:blocks/fluid_interface_connected"
|
||||
}
|
||||
},
|
||||
"false": {
|
||||
}
|
||||
"connected=true": {
|
||||
"model": "refinedstorage:block/fluid_interface_connected"
|
||||
},
|
||||
"connected=false": {
|
||||
"model": "refinedstorage:block/fluid_interface_disconnected"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -50,9 +50,9 @@
|
||||
"gui.refinedstorage.network_transmitter": "Network Transmitter",
|
||||
"gui.refinedstorage.network_transmitter.distance": "%d block(s)",
|
||||
"gui.refinedstorage.network_transmitter.missing_card": "Missing Network Card",
|
||||
"gui.refinedstorage:fluid_interface": "Fluid Interface",
|
||||
"gui.refinedstorage:fluid_interface.in": "In",
|
||||
"gui.refinedstorage:fluid_interface.out": "Out",
|
||||
"gui.refinedstorage.fluid_interface": "Fluid Interface",
|
||||
"gui.refinedstorage.fluid_interface.in": "In",
|
||||
"gui.refinedstorage.fluid_interface.out": "Out",
|
||||
"gui.refinedstorage:crafting_preview": "Crafting Preview",
|
||||
"gui.refinedstorage:crafting_preview.to_craft": "To craft: %d",
|
||||
"gui.refinedstorage:crafting_preview.available": "Available: %d",
|
||||
@@ -202,7 +202,7 @@
|
||||
"block.refinedstorage:crafter": "Crafter",
|
||||
"block.refinedstorage.network_receiver": "Network Receiver",
|
||||
"block.refinedstorage.network_transmitter": "Network Transmitter",
|
||||
"block.refinedstorage:fluid_interface": "Fluid Interface",
|
||||
"block.refinedstorage.fluid_interface": "Fluid Interface",
|
||||
"block.refinedstorage.64k_fluid_storage_block": "64k Fluid Storage Block",
|
||||
"block.refinedstorage.256k_fluid_storage_block": "256k Fluid Storage Block",
|
||||
"block.refinedstorage.1024k_fluid_storage_block": "1024k Fluid Storage Block",
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"parent": "block/cube_all",
|
||||
"textures": {
|
||||
"all": "refinedstorage:block/fluid_interface_connected"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"parent": "block/cube_all",
|
||||
"textures": {
|
||||
"all": "refinedstorage:block/fluid_interface_disconnected"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"parent": "refinedstorage:block/fluid_interface_disconnected"
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"type": "minecraft:block",
|
||||
"pools": [
|
||||
{
|
||||
"rolls": 1,
|
||||
"entries": [
|
||||
{
|
||||
"type": "minecraft:item",
|
||||
"name": "refinedstorage:fluid_interface"
|
||||
}
|
||||
],
|
||||
"conditions": [
|
||||
{
|
||||
"condition": "minecraft:survives_explosion"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -5,7 +5,7 @@
|
||||
"item": "refinedstorage:interface"
|
||||
},
|
||||
{
|
||||
"item": "#advanced_processor"
|
||||
"item": "refinedstorage:advanced_processor"
|
||||
},
|
||||
{
|
||||
"item": "minecraft:bucket"
|
||||
Reference in New Issue
Block a user