Add basic grid opening code.
This commit is contained in:
@@ -6,6 +6,7 @@ import com.raoulvdberge.refinedstorage.render.model.baked.FullbrightBakedModel;
|
|||||||
import com.raoulvdberge.refinedstorage.screen.ControllerScreen;
|
import com.raoulvdberge.refinedstorage.screen.ControllerScreen;
|
||||||
import com.raoulvdberge.refinedstorage.screen.DiskDriveScreen;
|
import com.raoulvdberge.refinedstorage.screen.DiskDriveScreen;
|
||||||
import com.raoulvdberge.refinedstorage.screen.FilterScreen;
|
import com.raoulvdberge.refinedstorage.screen.FilterScreen;
|
||||||
|
import com.raoulvdberge.refinedstorage.screen.factory.GridScreenFactory;
|
||||||
import net.minecraft.client.gui.ScreenManager;
|
import net.minecraft.client.gui.ScreenManager;
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
import net.minecraftforge.client.event.ModelBakeEvent;
|
import net.minecraftforge.client.event.ModelBakeEvent;
|
||||||
@@ -57,6 +58,7 @@ public class ClientSetup {
|
|||||||
ScreenManager.registerFactory(RSContainers.FILTER, FilterScreen::new);
|
ScreenManager.registerFactory(RSContainers.FILTER, FilterScreen::new);
|
||||||
ScreenManager.registerFactory(RSContainers.CONTROLLER, ControllerScreen::new);
|
ScreenManager.registerFactory(RSContainers.CONTROLLER, ControllerScreen::new);
|
||||||
ScreenManager.registerFactory(RSContainers.DISK_DRIVE, DiskDriveScreen::new);
|
ScreenManager.registerFactory(RSContainers.DISK_DRIVE, DiskDriveScreen::new);
|
||||||
|
ScreenManager.registerFactory(RSContainers.GRID, new GridScreenFactory());
|
||||||
}
|
}
|
||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
|
@@ -3,6 +3,7 @@ package com.raoulvdberge.refinedstorage;
|
|||||||
import com.raoulvdberge.refinedstorage.api.network.grid.GridType;
|
import com.raoulvdberge.refinedstorage.api.network.grid.GridType;
|
||||||
import com.raoulvdberge.refinedstorage.apiimpl.API;
|
import com.raoulvdberge.refinedstorage.apiimpl.API;
|
||||||
import com.raoulvdberge.refinedstorage.apiimpl.network.NetworkNodeListener;
|
import com.raoulvdberge.refinedstorage.apiimpl.network.NetworkNodeListener;
|
||||||
|
import com.raoulvdberge.refinedstorage.apiimpl.network.grid.GridFactoryGridBlock;
|
||||||
import com.raoulvdberge.refinedstorage.apiimpl.network.node.CableNetworkNode;
|
import com.raoulvdberge.refinedstorage.apiimpl.network.node.CableNetworkNode;
|
||||||
import com.raoulvdberge.refinedstorage.apiimpl.network.node.GridNetworkNode;
|
import com.raoulvdberge.refinedstorage.apiimpl.network.node.GridNetworkNode;
|
||||||
import com.raoulvdberge.refinedstorage.apiimpl.network.node.diskdrive.DiskDriveNetworkNode;
|
import com.raoulvdberge.refinedstorage.apiimpl.network.node.diskdrive.DiskDriveNetworkNode;
|
||||||
@@ -16,6 +17,7 @@ import com.raoulvdberge.refinedstorage.config.ServerConfig;
|
|||||||
import com.raoulvdberge.refinedstorage.container.ControllerContainer;
|
import com.raoulvdberge.refinedstorage.container.ControllerContainer;
|
||||||
import com.raoulvdberge.refinedstorage.container.DiskDriveContainer;
|
import com.raoulvdberge.refinedstorage.container.DiskDriveContainer;
|
||||||
import com.raoulvdberge.refinedstorage.container.FilterContainer;
|
import com.raoulvdberge.refinedstorage.container.FilterContainer;
|
||||||
|
import com.raoulvdberge.refinedstorage.container.factory.GridContainerFactory;
|
||||||
import com.raoulvdberge.refinedstorage.container.factory.PositionalTileContainerFactory;
|
import com.raoulvdberge.refinedstorage.container.factory.PositionalTileContainerFactory;
|
||||||
import com.raoulvdberge.refinedstorage.item.*;
|
import com.raoulvdberge.refinedstorage.item.*;
|
||||||
import com.raoulvdberge.refinedstorage.item.blockitem.ControllerBlockItem;
|
import com.raoulvdberge.refinedstorage.item.blockitem.ControllerBlockItem;
|
||||||
@@ -90,8 +92,9 @@ public final class RS {
|
|||||||
});
|
});
|
||||||
|
|
||||||
API.instance().getNetworkNodeRegistry().add(CableNetworkNode.ID, (tag, world, pos) -> new CableNetworkNode(world, pos));
|
API.instance().getNetworkNodeRegistry().add(CableNetworkNode.ID, (tag, world, pos) -> new CableNetworkNode(world, pos));
|
||||||
|
|
||||||
API.instance().getNetworkNodeRegistry().add(GridNetworkNode.ID, (tag, world, pos) -> new GridNetworkNode(world, pos, GridType.NORMAL));
|
API.instance().getNetworkNodeRegistry().add(GridNetworkNode.ID, (tag, world, pos) -> new GridNetworkNode(world, pos, GridType.NORMAL));
|
||||||
|
|
||||||
|
API.instance().getGridManager().add(GridFactoryGridBlock.ID, new GridFactoryGridBlock());
|
||||||
}
|
}
|
||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
@@ -143,6 +146,7 @@ public final class RS {
|
|||||||
e.getRegistry().register(IForgeContainerType.create((windowId, inv, data) -> new FilterContainer(inv.player, inv.getCurrentItem(), windowId)).setRegistryName(RS.ID, "filter"));
|
e.getRegistry().register(IForgeContainerType.create((windowId, inv, data) -> new FilterContainer(inv.player, inv.getCurrentItem(), windowId)).setRegistryName(RS.ID, "filter"));
|
||||||
e.getRegistry().register(IForgeContainerType.create(((windowId, inv, data) -> new ControllerContainer(null, inv.player, windowId))).setRegistryName(RS.ID, "controller"));
|
e.getRegistry().register(IForgeContainerType.create(((windowId, inv, data) -> new ControllerContainer(null, inv.player, windowId))).setRegistryName(RS.ID, "controller"));
|
||||||
e.getRegistry().register(IForgeContainerType.create(new PositionalTileContainerFactory<DiskDriveContainer, DiskDriveTile>((windowId, inv, tile) -> new DiskDriveContainer(tile, inv.player, windowId))).setRegistryName(RS.ID, "disk_drive"));
|
e.getRegistry().register(IForgeContainerType.create(new PositionalTileContainerFactory<DiskDriveContainer, DiskDriveTile>((windowId, inv, tile) -> new DiskDriveContainer(tile, inv.player, windowId))).setRegistryName(RS.ID, "disk_drive"));
|
||||||
|
e.getRegistry().register(IForgeContainerType.create(new GridContainerFactory()).setRegistryName(RS.ID, "grid"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
|
@@ -11,6 +11,10 @@ public final class RSContainers {
|
|||||||
@ObjectHolder(RS.ID + ":controller")
|
@ObjectHolder(RS.ID + ":controller")
|
||||||
public static final ContainerType<ControllerContainer> CONTROLLER = null;
|
public static final ContainerType<ControllerContainer> CONTROLLER = null;
|
||||||
|
|
||||||
|
|
||||||
|
@ObjectHolder(RS.ID + ":grid")
|
||||||
|
public static final ContainerType<GridContainer> GRID = null;
|
||||||
|
|
||||||
//@ObjectHolder(RS.ID + ":crafter")
|
//@ObjectHolder(RS.ID + ":crafter")
|
||||||
public static final ContainerType<CrafterContainer> CRAFTER = null;
|
public static final ContainerType<CrafterContainer> CRAFTER = null;
|
||||||
//@ObjectHolder(RS.ID + ":crafter_manager")
|
//@ObjectHolder(RS.ID + ":crafter_manager")
|
||||||
@@ -36,8 +40,6 @@ public final class RSContainers {
|
|||||||
public static final ContainerType<FluidInterfaceContainer> FLUID_INTERFACE = null;
|
public static final ContainerType<FluidInterfaceContainer> FLUID_INTERFACE = null;
|
||||||
//@ObjectHolder(RS.ID + ":fluid_storage")
|
//@ObjectHolder(RS.ID + ":fluid_storage")
|
||||||
public static final ContainerType<FluidInterfaceContainer> FLUID_STORAGE = null;
|
public static final ContainerType<FluidInterfaceContainer> FLUID_STORAGE = null;
|
||||||
//@ObjectHolder(RS.ID + ":grid")
|
|
||||||
public static final ContainerType<GridContainer> GRID = null;
|
|
||||||
//@ObjectHolder(RS.ID + ":importer")
|
//@ObjectHolder(RS.ID + ":importer")
|
||||||
public static final ContainerType<ImporterContainer> IMPORTER = null;
|
public static final ContainerType<ImporterContainer> IMPORTER = null;
|
||||||
//@ObjectHolder(RS.ID + ":interface")
|
//@ObjectHolder(RS.ID + ":interface")
|
||||||
|
@@ -10,6 +10,7 @@ import net.minecraft.entity.player.ServerPlayerEntity;
|
|||||||
import net.minecraft.inventory.CraftResultInventory;
|
import net.minecraft.inventory.CraftResultInventory;
|
||||||
import net.minecraft.inventory.CraftingInventory;
|
import net.minecraft.inventory.CraftingInventory;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.util.text.ITextComponent;
|
||||||
import net.minecraftforge.items.IItemHandlerModifiable;
|
import net.minecraftforge.items.IItemHandlerModifiable;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
@@ -86,9 +87,9 @@ public interface IGrid {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return an unlocalized gui title
|
* @return the title
|
||||||
*/
|
*/
|
||||||
String getGuiTitle();
|
ITextComponent getTitle();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the view type
|
* @return the view type
|
||||||
|
@@ -4,6 +4,7 @@ import net.minecraft.entity.player.PlayerEntity;
|
|||||||
import net.minecraft.entity.player.ServerPlayerEntity;
|
import net.minecraft.entity.player.ServerPlayerEntity;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
|
import net.minecraft.util.ResourceLocation;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import org.apache.commons.lang3.tuple.Pair;
|
import org.apache.commons.lang3.tuple.Pair;
|
||||||
|
|
||||||
@@ -14,45 +15,45 @@ import javax.annotation.Nullable;
|
|||||||
*/
|
*/
|
||||||
public interface IGridManager {
|
public interface IGridManager {
|
||||||
/**
|
/**
|
||||||
|
* @param id the id of this factory
|
||||||
* @param factory the factory
|
* @param factory the factory
|
||||||
* @return the id of this factory
|
|
||||||
*/
|
*/
|
||||||
int add(IGridFactory factory);
|
void add(ResourceLocation id, IGridFactory factory);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param id the id of the factory
|
* @param id the id of the factory
|
||||||
* @return the factory, or null if no factory was found
|
* @return the factory, or null if no factory was found
|
||||||
*/
|
*/
|
||||||
@Nullable
|
@Nullable
|
||||||
IGridFactory get(int id);
|
IGridFactory get(ResourceLocation id);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Opens a grid. Can only be called on the server.
|
* Opens a grid. Can only be called on the server.
|
||||||
*
|
*
|
||||||
* @param id the grid factory id as returned from {@link #add(IGridFactory)}
|
* @param id the grid factory id
|
||||||
* @param player the player
|
* @param player the player
|
||||||
* @param pos the block position
|
* @param pos the block position
|
||||||
*/
|
*/
|
||||||
void openGrid(int id, ServerPlayerEntity player, BlockPos pos);
|
void openGrid(ResourceLocation id, ServerPlayerEntity player, BlockPos pos);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Opens a grid. Can only be called on the server.
|
* Opens a grid. Can only be called on the server.
|
||||||
*
|
*
|
||||||
* @param id the grid factory id as returned from {@link #add(IGridFactory)}
|
* @param id the grid factory id
|
||||||
* @param player the player
|
* @param player the player
|
||||||
* @param stack the stack
|
* @param stack the stack
|
||||||
*/
|
*/
|
||||||
void openGrid(int id, ServerPlayerEntity player, ItemStack stack);
|
void openGrid(ResourceLocation id, ServerPlayerEntity player, ItemStack stack);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a grid.
|
* Creates a grid.
|
||||||
*
|
*
|
||||||
* @param id the grid factory id as returned from {@link #add(IGridFactory)}
|
* @param id the grid factory id
|
||||||
* @param player the player
|
* @param player the player
|
||||||
* @param stack the stack, if there is one
|
* @param stack the stack, if there is one
|
||||||
* @param pos the block position, if there is one
|
* @param pos the block position, if there is one
|
||||||
* @return a grid, or null if an error has occurred
|
* @return a grid, or null if an error has occurred
|
||||||
*/
|
*/
|
||||||
@Nullable
|
@Nullable
|
||||||
Pair<IGrid, TileEntity> createGrid(int id, PlayerEntity player, @Nullable ItemStack stack, @Nullable BlockPos pos);
|
Pair<IGrid, TileEntity> createGrid(ResourceLocation id, PlayerEntity player, @Nullable ItemStack stack, @Nullable BlockPos pos);
|
||||||
}
|
}
|
||||||
|
@@ -1,5 +1,6 @@
|
|||||||
package com.raoulvdberge.refinedstorage.apiimpl.network.grid;
|
package com.raoulvdberge.refinedstorage.apiimpl.network.grid;
|
||||||
|
|
||||||
|
import com.raoulvdberge.refinedstorage.RS;
|
||||||
import com.raoulvdberge.refinedstorage.api.network.grid.GridFactoryType;
|
import com.raoulvdberge.refinedstorage.api.network.grid.GridFactoryType;
|
||||||
import com.raoulvdberge.refinedstorage.api.network.grid.IGrid;
|
import com.raoulvdberge.refinedstorage.api.network.grid.IGrid;
|
||||||
import com.raoulvdberge.refinedstorage.api.network.grid.IGridFactory;
|
import com.raoulvdberge.refinedstorage.api.network.grid.IGridFactory;
|
||||||
@@ -7,12 +8,15 @@ import com.raoulvdberge.refinedstorage.tile.grid.GridTile;
|
|||||||
import net.minecraft.entity.player.PlayerEntity;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
|
import net.minecraft.util.ResourceLocation;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
public class GridFactoryGridBlock implements IGridFactory {
|
public class GridFactoryGridBlock implements IGridFactory {
|
||||||
|
public static final ResourceLocation ID = new ResourceLocation(RS.ID, "grid");
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Nullable
|
@Nullable
|
||||||
public IGrid createFromStack(PlayerEntity player, ItemStack stack) {
|
public IGrid createFromStack(PlayerEntity player, ItemStack stack) {
|
||||||
|
@@ -3,81 +3,68 @@ package com.raoulvdberge.refinedstorage.apiimpl.network.grid;
|
|||||||
import com.raoulvdberge.refinedstorage.api.network.grid.IGrid;
|
import com.raoulvdberge.refinedstorage.api.network.grid.IGrid;
|
||||||
import com.raoulvdberge.refinedstorage.api.network.grid.IGridFactory;
|
import com.raoulvdberge.refinedstorage.api.network.grid.IGridFactory;
|
||||||
import com.raoulvdberge.refinedstorage.api.network.grid.IGridManager;
|
import com.raoulvdberge.refinedstorage.api.network.grid.IGridManager;
|
||||||
|
import com.raoulvdberge.refinedstorage.container.factory.GridContainerProvider;
|
||||||
import net.minecraft.entity.player.PlayerEntity;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
import net.minecraft.entity.player.ServerPlayerEntity;
|
import net.minecraft.entity.player.ServerPlayerEntity;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
|
import net.minecraft.util.ResourceLocation;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraftforge.fml.network.NetworkHooks;
|
||||||
import org.apache.commons.lang3.tuple.Pair;
|
import org.apache.commons.lang3.tuple.Pair;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
import java.util.ArrayList;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.Map;
|
||||||
|
|
||||||
public class GridManager implements IGridManager {
|
public class GridManager implements IGridManager {
|
||||||
private List<IGridFactory> factories = new ArrayList<>();
|
private final Map<ResourceLocation, IGridFactory> factories = new HashMap<>();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int add(IGridFactory factory) {
|
public void add(ResourceLocation id, IGridFactory factory) {
|
||||||
factories.add(factory);
|
factories.put(id, factory);
|
||||||
|
|
||||||
return factories.size() - 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Nullable
|
@Nullable
|
||||||
public IGridFactory get(int id) {
|
public IGridFactory get(ResourceLocation id) {
|
||||||
if (id < 0 || id >= factories.size()) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
return factories.get(id);
|
return factories.get(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void openGrid(int id, ServerPlayerEntity player, BlockPos pos) {
|
public void openGrid(ResourceLocation id, ServerPlayerEntity player, BlockPos pos) {
|
||||||
openGrid(id, player, null, pos);
|
openGrid(id, player, null, pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void openGrid(int id, ServerPlayerEntity player, ItemStack stack) {
|
public void openGrid(ResourceLocation id, ServerPlayerEntity player, ItemStack stack) {
|
||||||
openGrid(id, player, stack, null);
|
openGrid(id, player, stack, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void openGrid(int id, ServerPlayerEntity player, @Nullable ItemStack stack, @Nullable BlockPos pos) {
|
private void openGrid(ResourceLocation id, ServerPlayerEntity player, @Nullable ItemStack stack, @Nullable BlockPos pos) {
|
||||||
Pair<IGrid, TileEntity> grid = createGrid(id, player, stack, pos);
|
Pair<IGrid, TileEntity> grid = createGrid(id, player, stack, pos);
|
||||||
if (grid == null) {
|
if (grid == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// @Volatile: FMLNetworkHandler#openGui
|
NetworkHooks.openGui(player, new GridContainerProvider(grid.getLeft(), grid.getRight()), buf -> {
|
||||||
player.getNextWindowId();
|
buf.writeResourceLocation(id);
|
||||||
player.closeContainer();
|
|
||||||
|
|
||||||
// The order of sending this packet and setting openContainer matters!
|
buf.writeBoolean(pos != null);
|
||||||
|
if (pos != null) {
|
||||||
|
buf.writeBlockPos(pos);
|
||||||
|
}
|
||||||
|
|
||||||
// We first need to send the grid open packet with the window id.
|
buf.writeBoolean(stack != null);
|
||||||
|
if (stack != null) {
|
||||||
// Then we set the openContainer so the slots are getting sent (ServerPlayerEntity::update -> Container::detectAndSendChanges).
|
buf.writeItemStack(stack);
|
||||||
|
}
|
||||||
// If the client window id mismatches with the server window id this causes problems with slots not being set.
|
});
|
||||||
// If we would set the openContainer first, the slot packets would be sent first but wouldn't be able to be set
|
|
||||||
// on the client since the window id would mismatch.
|
|
||||||
// So we first send the window id in MessageGridOpen.
|
|
||||||
|
|
||||||
// The order is preserved by TCP.
|
|
||||||
/* TODO ! RS.INSTANCE.network.sendTo(new MessageGridOpen(player.currentWindowId, pos, id, stack), player);
|
|
||||||
|
|
||||||
player.openContainer = new ContainerGrid(grid.getLeft(), new ResizableDisplayDummy(), grid.getRight() instanceof TileBase ? (TileBase) grid.getRight() : null, player);
|
|
||||||
player.openContainer.windowId = player.currentWindowId;
|
|
||||||
player.openContainer.addListener(player);
|
|
||||||
|
|
||||||
MinecraftForge.EVENT_BUS.post(new PlayerContainerEvent.Open(player, player.openContainer));*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Nullable
|
@Nullable
|
||||||
public Pair<IGrid, TileEntity> createGrid(int id, PlayerEntity player, @Nullable ItemStack stack, @Nullable BlockPos pos) {
|
public Pair<IGrid, TileEntity> createGrid(ResourceLocation id, PlayerEntity player, @Nullable ItemStack stack, @Nullable BlockPos pos) {
|
||||||
IGridFactory factory = get(id);
|
IGridFactory factory = get(id);
|
||||||
|
|
||||||
if (factory == null) {
|
if (factory == null) {
|
||||||
|
@@ -5,11 +5,8 @@ import com.raoulvdberge.refinedstorage.api.network.INetwork;
|
|||||||
import com.raoulvdberge.refinedstorage.api.network.item.INetworkItem;
|
import com.raoulvdberge.refinedstorage.api.network.item.INetworkItem;
|
||||||
import com.raoulvdberge.refinedstorage.api.network.item.INetworkItemHandler;
|
import com.raoulvdberge.refinedstorage.api.network.item.INetworkItemHandler;
|
||||||
import com.raoulvdberge.refinedstorage.api.network.security.Permission;
|
import com.raoulvdberge.refinedstorage.api.network.security.Permission;
|
||||||
import com.raoulvdberge.refinedstorage.apiimpl.API;
|
|
||||||
import com.raoulvdberge.refinedstorage.tile.grid.WirelessFluidGrid;
|
|
||||||
import com.raoulvdberge.refinedstorage.util.WorldUtils;
|
import com.raoulvdberge.refinedstorage.util.WorldUtils;
|
||||||
import net.minecraft.entity.player.PlayerEntity;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
import net.minecraft.entity.player.ServerPlayerEntity;
|
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraftforge.energy.CapabilityEnergy;
|
import net.minecraftforge.energy.CapabilityEnergy;
|
||||||
import net.minecraftforge.energy.IEnergyStorage;
|
import net.minecraftforge.energy.IEnergyStorage;
|
||||||
@@ -44,7 +41,7 @@ public class NetworkItemWirelessFluidGrid implements INetworkItem {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
API.instance().getGridManager().openGrid(WirelessFluidGrid.ID, (ServerPlayerEntity) player, stack);
|
// TODO API.instance().getGridManager().openGrid(WirelessFluidGrid.ID, (ServerPlayerEntity) player, stack);
|
||||||
|
|
||||||
drainEnergy(RS.INSTANCE.config.wirelessFluidGridOpenUsage);
|
drainEnergy(RS.INSTANCE.config.wirelessFluidGridOpenUsage);
|
||||||
|
|
||||||
|
@@ -5,11 +5,8 @@ import com.raoulvdberge.refinedstorage.api.network.INetwork;
|
|||||||
import com.raoulvdberge.refinedstorage.api.network.item.INetworkItem;
|
import com.raoulvdberge.refinedstorage.api.network.item.INetworkItem;
|
||||||
import com.raoulvdberge.refinedstorage.api.network.item.INetworkItemHandler;
|
import com.raoulvdberge.refinedstorage.api.network.item.INetworkItemHandler;
|
||||||
import com.raoulvdberge.refinedstorage.api.network.security.Permission;
|
import com.raoulvdberge.refinedstorage.api.network.security.Permission;
|
||||||
import com.raoulvdberge.refinedstorage.apiimpl.API;
|
|
||||||
import com.raoulvdberge.refinedstorage.tile.grid.WirelessGrid;
|
|
||||||
import com.raoulvdberge.refinedstorage.util.WorldUtils;
|
import com.raoulvdberge.refinedstorage.util.WorldUtils;
|
||||||
import net.minecraft.entity.player.PlayerEntity;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
import net.minecraft.entity.player.ServerPlayerEntity;
|
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraftforge.energy.CapabilityEnergy;
|
import net.minecraftforge.energy.CapabilityEnergy;
|
||||||
import net.minecraftforge.energy.IEnergyStorage;
|
import net.minecraftforge.energy.IEnergyStorage;
|
||||||
@@ -44,7 +41,7 @@ public class NetworkItemWirelessGrid implements INetworkItem {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
API.instance().getGridManager().openGrid(WirelessGrid.ID, (ServerPlayerEntity) player, stack);
|
// TODO API.instance().getGridManager().openGrid(WirelessGrid.ID, (ServerPlayerEntity) player, stack);
|
||||||
|
|
||||||
drainEnergy(RS.INSTANCE.config.wirelessGridOpenUsage);
|
drainEnergy(RS.INSTANCE.config.wirelessGridOpenUsage);
|
||||||
|
|
||||||
|
@@ -39,6 +39,8 @@ import net.minecraft.item.crafting.IRecipeType;
|
|||||||
import net.minecraft.nbt.CompoundNBT;
|
import net.minecraft.nbt.CompoundNBT;
|
||||||
import net.minecraft.util.NonNullList;
|
import net.minecraft.util.NonNullList;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.util.text.ITextComponent;
|
||||||
|
import net.minecraft.util.text.TranslationTextComponent;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.fluids.FluidAttributes;
|
import net.minecraftforge.fluids.FluidAttributes;
|
||||||
import net.minecraftforge.fluids.FluidStack;
|
import net.minecraftforge.fluids.FluidStack;
|
||||||
@@ -57,7 +59,6 @@ import java.util.Set;
|
|||||||
|
|
||||||
public class GridNetworkNode extends NetworkNode implements IGridNetworkAware, IType {
|
public class GridNetworkNode extends NetworkNode implements IGridNetworkAware, IType {
|
||||||
public static final String ID = "grid";
|
public static final String ID = "grid";
|
||||||
public static int FACTORY_ID = 0;
|
|
||||||
|
|
||||||
public static final String NBT_VIEW_TYPE = "ViewType";
|
public static final String NBT_VIEW_TYPE = "ViewType";
|
||||||
public static final String NBT_SORTING_DIRECTION = "SortingDirection";
|
public static final String NBT_SORTING_DIRECTION = "SortingDirection";
|
||||||
@@ -266,18 +267,18 @@ public class GridNetworkNode extends NetworkNode implements IGridNetworkAware, I
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getGuiTitle() {
|
public ITextComponent getTitle() {
|
||||||
GridType type = getGridType();
|
GridType type = getGridType();
|
||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case CRAFTING:
|
case CRAFTING:
|
||||||
return "gui.refinedstorage:crafting_grid";
|
return new TranslationTextComponent("gui.refinedstorage.crafting_grid");
|
||||||
case PATTERN:
|
case PATTERN:
|
||||||
return "gui.refinedstorage:pattern_grid";
|
return new TranslationTextComponent("gui.refinedstorage.pattern_grid");
|
||||||
case FLUID:
|
case FLUID:
|
||||||
return "gui.refinedstorage:fluid_grid";
|
return new TranslationTextComponent("gui.refinedstorage.fluid_grid");
|
||||||
default:
|
default:
|
||||||
return "gui.refinedstorage:grid";
|
return new TranslationTextComponent("gui.refinedstorage.grid");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -2,13 +2,22 @@ package com.raoulvdberge.refinedstorage.block;
|
|||||||
|
|
||||||
import com.raoulvdberge.refinedstorage.RS;
|
import com.raoulvdberge.refinedstorage.RS;
|
||||||
import com.raoulvdberge.refinedstorage.api.network.grid.GridType;
|
import com.raoulvdberge.refinedstorage.api.network.grid.GridType;
|
||||||
|
import com.raoulvdberge.refinedstorage.apiimpl.API;
|
||||||
|
import com.raoulvdberge.refinedstorage.apiimpl.network.grid.GridFactoryGridBlock;
|
||||||
import com.raoulvdberge.refinedstorage.block.info.BlockDirection;
|
import com.raoulvdberge.refinedstorage.block.info.BlockDirection;
|
||||||
import com.raoulvdberge.refinedstorage.tile.grid.GridTile;
|
import com.raoulvdberge.refinedstorage.tile.grid.GridTile;
|
||||||
import com.raoulvdberge.refinedstorage.util.BlockUtils;
|
import com.raoulvdberge.refinedstorage.util.BlockUtils;
|
||||||
|
import com.raoulvdberge.refinedstorage.util.NetworkUtils;
|
||||||
import net.minecraft.block.BlockState;
|
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.tileentity.TileEntity;
|
||||||
import net.minecraft.util.BlockRenderLayer;
|
import net.minecraft.util.BlockRenderLayer;
|
||||||
|
import net.minecraft.util.Hand;
|
||||||
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.util.math.BlockRayTraceResult;
|
||||||
import net.minecraft.world.IBlockReader;
|
import net.minecraft.world.IBlockReader;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
@@ -49,6 +58,16 @@ public class GridBlock extends NodeBlock {
|
|||||||
return new GridTile(type);
|
return new GridTile(type);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
|
public boolean onBlockActivated(BlockState state, World worldIn, BlockPos pos, PlayerEntity player, Hand handIn, BlockRayTraceResult hit) {
|
||||||
|
if (!worldIn.isRemote) {
|
||||||
|
return NetworkUtils.attemptModify(worldIn, pos, hit.getFace(), player, () -> API.instance().getGridManager().openGrid(GridFactoryGridBlock.ID, (ServerPlayerEntity) player, pos));
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@Override
|
@Override
|
||||||
@OnlyIn(Dist.CLIENT)
|
@OnlyIn(Dist.CLIENT)
|
||||||
@@ -64,10 +83,5 @@ public class GridBlock extends NodeBlock {
|
|||||||
RS.ID + ":blocks/grid/cutouts/pattern_front_connected",
|
RS.ID + ":blocks/grid/cutouts/pattern_front_connected",
|
||||||
RS.ID + ":blocks/grid/cutouts/fluid_front_connected"
|
RS.ID + ":blocks/grid/cutouts/fluid_front_connected"
|
||||||
));
|
));
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean onBlockActivated(World world, BlockPos pos, BlockState state, PlayerEntity player, EnumHand hand, Direction side, float hitX, float hitY, float hitZ) {
|
|
||||||
return openNetworkGui(player, world, pos, side, () -> API.instance().getGridManager().openGrid(NetworkNodeGrid.FACTORY_ID, (ServerPlayerEntity) player, pos));
|
|
||||||
}*/
|
}*/
|
||||||
}
|
}
|
||||||
|
@@ -6,7 +6,7 @@ import com.raoulvdberge.refinedstorage.apiimpl.network.node.NetworkNodeCrafter;
|
|||||||
import com.raoulvdberge.refinedstorage.apiimpl.network.node.NetworkNodeCrafterManager;
|
import com.raoulvdberge.refinedstorage.apiimpl.network.node.NetworkNodeCrafterManager;
|
||||||
import com.raoulvdberge.refinedstorage.container.slot.CrafterManagerSlot;
|
import com.raoulvdberge.refinedstorage.container.slot.CrafterManagerSlot;
|
||||||
import com.raoulvdberge.refinedstorage.inventory.item.ItemHandlerBase;
|
import com.raoulvdberge.refinedstorage.inventory.item.ItemHandlerBase;
|
||||||
import com.raoulvdberge.refinedstorage.screen.IResizableDisplay;
|
import com.raoulvdberge.refinedstorage.screen.IScreenInfoProvider;
|
||||||
import com.raoulvdberge.refinedstorage.screen.grid.filtering.GridFilterParser;
|
import com.raoulvdberge.refinedstorage.screen.grid.filtering.GridFilterParser;
|
||||||
import com.raoulvdberge.refinedstorage.screen.grid.stack.GridStackItem;
|
import com.raoulvdberge.refinedstorage.screen.grid.stack.GridStackItem;
|
||||||
import com.raoulvdberge.refinedstorage.screen.grid.stack.IGridStack;
|
import com.raoulvdberge.refinedstorage.screen.grid.stack.IGridStack;
|
||||||
@@ -62,7 +62,7 @@ public class CrafterManagerContainer extends BaseContainer {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private IResizableDisplay display;
|
private IScreenInfoProvider display;
|
||||||
private NetworkNodeCrafterManager crafterManager;
|
private NetworkNodeCrafterManager crafterManager;
|
||||||
private Map<String, Integer> containerData;
|
private Map<String, Integer> containerData;
|
||||||
private Map<String, IItemHandlerModifiable> dummyInventories = new HashMap<>();
|
private Map<String, IItemHandlerModifiable> dummyInventories = new HashMap<>();
|
||||||
@@ -83,7 +83,7 @@ public class CrafterManagerContainer extends BaseContainer {
|
|||||||
return new ArrayList<>();
|
return new ArrayList<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public CrafterManagerContainer(TileCrafterManager crafterManager, PlayerEntity player, IResizableDisplay display, int windowId) {
|
public CrafterManagerContainer(TileCrafterManager crafterManager, PlayerEntity player, IScreenInfoProvider display, int windowId) {
|
||||||
super(RSContainers.CRAFTER_MANAGER, crafterManager, player, windowId);
|
super(RSContainers.CRAFTER_MANAGER, crafterManager, player, windowId);
|
||||||
|
|
||||||
this.display = display;
|
this.display = display;
|
||||||
|
@@ -16,7 +16,7 @@ import com.raoulvdberge.refinedstorage.container.slot.grid.ResultCraftingGridSlo
|
|||||||
import com.raoulvdberge.refinedstorage.container.slot.legacy.BaseLegacySlot;
|
import com.raoulvdberge.refinedstorage.container.slot.legacy.BaseLegacySlot;
|
||||||
import com.raoulvdberge.refinedstorage.container.slot.legacy.DisabledLegacySlot;
|
import com.raoulvdberge.refinedstorage.container.slot.legacy.DisabledLegacySlot;
|
||||||
import com.raoulvdberge.refinedstorage.container.slot.legacy.FilterLegacySlot;
|
import com.raoulvdberge.refinedstorage.container.slot.legacy.FilterLegacySlot;
|
||||||
import com.raoulvdberge.refinedstorage.screen.IResizableDisplay;
|
import com.raoulvdberge.refinedstorage.screen.IScreenInfoProvider;
|
||||||
import com.raoulvdberge.refinedstorage.tile.BaseTile;
|
import com.raoulvdberge.refinedstorage.tile.BaseTile;
|
||||||
import com.raoulvdberge.refinedstorage.tile.config.IType;
|
import com.raoulvdberge.refinedstorage.tile.config.IType;
|
||||||
import com.raoulvdberge.refinedstorage.tile.grid.WirelessGrid;
|
import com.raoulvdberge.refinedstorage.tile.grid.WirelessGrid;
|
||||||
@@ -37,22 +37,23 @@ public class GridContainer extends BaseContainer implements IGridCraftingListene
|
|||||||
private IGrid grid;
|
private IGrid grid;
|
||||||
private IStorageCache cache;
|
private IStorageCache cache;
|
||||||
private IStorageCacheListener listener;
|
private IStorageCacheListener listener;
|
||||||
private IResizableDisplay display;
|
private IScreenInfoProvider screenInfoProvider;
|
||||||
|
|
||||||
private ResultCraftingGridSlot craftingResultSlot;
|
private ResultCraftingGridSlot craftingResultSlot;
|
||||||
private BaseLegacySlot patternResultSlot;
|
private BaseLegacySlot patternResultSlot;
|
||||||
|
|
||||||
public GridContainer(IGrid grid, IResizableDisplay display, @Nullable BaseTile gridTile, PlayerEntity player, int windowId) {
|
public GridContainer(IGrid grid, @Nullable BaseTile gridTile, PlayerEntity player, int windowId) {
|
||||||
super(RSContainers.GRID, gridTile, player, windowId);
|
super(RSContainers.GRID, gridTile, player, windowId);
|
||||||
|
|
||||||
this.grid = grid;
|
this.grid = grid;
|
||||||
this.display = display;
|
|
||||||
|
|
||||||
initSlots();
|
|
||||||
|
|
||||||
grid.addCraftingListener(this);
|
grid.addCraftingListener(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setScreenInfoProvider(IScreenInfoProvider screenInfoProvider) {
|
||||||
|
this.screenInfoProvider = screenInfoProvider;
|
||||||
|
}
|
||||||
|
|
||||||
public void initSlots() {
|
public void initSlots() {
|
||||||
this.inventorySlots.clear();
|
this.inventorySlots.clear();
|
||||||
// this.inventoryItemStacks.clear(); // TODO at
|
// this.inventoryItemStacks.clear(); // TODO at
|
||||||
@@ -112,7 +113,7 @@ public class GridContainer extends BaseContainer implements IGridCraftingListene
|
|||||||
return ItemStack.EMPTY;
|
return ItemStack.EMPTY;
|
||||||
});
|
});
|
||||||
|
|
||||||
addPlayerInventory(8, display.getYPlayerInventory());
|
addPlayerInventory(8, screenInfoProvider.getYPlayerInventory());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addPortableGridSlots() {
|
private void addPortableGridSlots() {
|
||||||
@@ -136,7 +137,7 @@ public class GridContainer extends BaseContainer implements IGridCraftingListene
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void addCraftingSlots() {
|
private void addCraftingSlots() {
|
||||||
int headerAndSlots = display.getTopHeight() + (display.getVisibleRows() * 18);
|
int headerAndSlots = screenInfoProvider.getTopHeight() + (screenInfoProvider.getVisibleRows() * 18);
|
||||||
|
|
||||||
int x = 26;
|
int x = 26;
|
||||||
int y = headerAndSlots + 4;
|
int y = headerAndSlots + 4;
|
||||||
@@ -156,7 +157,7 @@ public class GridContainer extends BaseContainer implements IGridCraftingListene
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void addPatternSlots() {
|
private void addPatternSlots() {
|
||||||
int headerAndSlots = display.getTopHeight() + (display.getVisibleRows() * 18);
|
int headerAndSlots = screenInfoProvider.getTopHeight() + (screenInfoProvider.getVisibleRows() * 18);
|
||||||
|
|
||||||
addSlot(new SlotItemHandler(((GridNetworkNode) grid).getPatterns(), 0, 172, headerAndSlots + 4));
|
addSlot(new SlotItemHandler(((GridNetworkNode) grid).getPatterns(), 0, 172, headerAndSlots + 4));
|
||||||
addSlot(new SlotItemHandler(((GridNetworkNode) grid).getPatterns(), 1, 172, headerAndSlots + 40));
|
addSlot(new SlotItemHandler(((GridNetworkNode) grid).getPatterns(), 1, 172, headerAndSlots + 40));
|
||||||
|
@@ -0,0 +1,36 @@
|
|||||||
|
package com.raoulvdberge.refinedstorage.container.factory;
|
||||||
|
|
||||||
|
import com.raoulvdberge.refinedstorage.api.network.grid.IGrid;
|
||||||
|
import com.raoulvdberge.refinedstorage.apiimpl.API;
|
||||||
|
import com.raoulvdberge.refinedstorage.container.GridContainer;
|
||||||
|
import com.raoulvdberge.refinedstorage.tile.BaseTile;
|
||||||
|
import net.minecraft.entity.player.PlayerInventory;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.network.PacketBuffer;
|
||||||
|
import net.minecraft.tileentity.TileEntity;
|
||||||
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraftforge.fml.network.IContainerFactory;
|
||||||
|
import org.apache.commons.lang3.tuple.Pair;
|
||||||
|
|
||||||
|
public class GridContainerFactory implements IContainerFactory<GridContainer> {
|
||||||
|
@Override
|
||||||
|
public GridContainer create(int windowId, PlayerInventory inv, PacketBuffer data) {
|
||||||
|
ResourceLocation id = data.readResourceLocation();
|
||||||
|
|
||||||
|
BlockPos pos = null;
|
||||||
|
ItemStack stack = null;
|
||||||
|
|
||||||
|
if (data.readBoolean()) {
|
||||||
|
pos = data.readBlockPos();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (data.readBoolean()) {
|
||||||
|
stack = data.readItemStack();
|
||||||
|
}
|
||||||
|
|
||||||
|
Pair<IGrid, TileEntity> grid = API.instance().getGridManager().createGrid(id, inv.player, stack, pos);
|
||||||
|
|
||||||
|
return new GridContainer(grid.getLeft(), grid.getRight() instanceof BaseTile ? (BaseTile) grid.getRight() : null, inv.player, windowId);
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,40 @@
|
|||||||
|
package com.raoulvdberge.refinedstorage.container.factory;
|
||||||
|
|
||||||
|
import com.raoulvdberge.refinedstorage.api.network.grid.IGrid;
|
||||||
|
import com.raoulvdberge.refinedstorage.container.GridContainer;
|
||||||
|
import com.raoulvdberge.refinedstorage.screen.EmptyScreenInfoProvider;
|
||||||
|
import com.raoulvdberge.refinedstorage.tile.BaseTile;
|
||||||
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
|
import net.minecraft.entity.player.PlayerInventory;
|
||||||
|
import net.minecraft.inventory.container.Container;
|
||||||
|
import net.minecraft.inventory.container.INamedContainerProvider;
|
||||||
|
import net.minecraft.tileentity.TileEntity;
|
||||||
|
import net.minecraft.util.text.ITextComponent;
|
||||||
|
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
|
public class GridContainerProvider implements INamedContainerProvider {
|
||||||
|
private final IGrid grid;
|
||||||
|
private final TileEntity tile;
|
||||||
|
|
||||||
|
public GridContainerProvider(IGrid grid, TileEntity tile) {
|
||||||
|
this.grid = grid;
|
||||||
|
this.tile = tile;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ITextComponent getDisplayName() {
|
||||||
|
return grid.getTitle();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
@Override
|
||||||
|
public Container createMenu(int windowId, PlayerInventory inv, PlayerEntity player) {
|
||||||
|
GridContainer c = new GridContainer(grid, tile instanceof BaseTile ? (BaseTile) tile : null, player, windowId);
|
||||||
|
|
||||||
|
c.setScreenInfoProvider(new EmptyScreenInfoProvider());
|
||||||
|
c.initSlots();
|
||||||
|
|
||||||
|
return c;
|
||||||
|
}
|
||||||
|
}
|
@@ -1,15 +1,15 @@
|
|||||||
package com.raoulvdberge.refinedstorage.container.slot;
|
package com.raoulvdberge.refinedstorage.container.slot;
|
||||||
|
|
||||||
import com.raoulvdberge.refinedstorage.apiimpl.network.node.NetworkNodeCrafterManager;
|
import com.raoulvdberge.refinedstorage.apiimpl.network.node.NetworkNodeCrafterManager;
|
||||||
import com.raoulvdberge.refinedstorage.screen.IResizableDisplay;
|
import com.raoulvdberge.refinedstorage.screen.IScreenInfoProvider;
|
||||||
import net.minecraftforge.items.IItemHandler;
|
import net.minecraftforge.items.IItemHandler;
|
||||||
|
|
||||||
public class CrafterManagerSlot extends BaseSlot {
|
public class CrafterManagerSlot extends BaseSlot {
|
||||||
private boolean visible;
|
private boolean visible;
|
||||||
private NetworkNodeCrafterManager crafterManager;
|
private NetworkNodeCrafterManager crafterManager;
|
||||||
private IResizableDisplay display;
|
private IScreenInfoProvider display;
|
||||||
|
|
||||||
public CrafterManagerSlot(IItemHandler itemHandler, int inventoryIndex, int x, int y, boolean visible, IResizableDisplay display, NetworkNodeCrafterManager crafterManager) {
|
public CrafterManagerSlot(IItemHandler itemHandler, int inventoryIndex, int x, int y, boolean visible, IScreenInfoProvider display, NetworkNodeCrafterManager crafterManager) {
|
||||||
super(itemHandler, inventoryIndex, x, y);
|
super(itemHandler, inventoryIndex, x, y);
|
||||||
|
|
||||||
this.visible = visible;
|
this.visible = visible;
|
||||||
|
@@ -9,7 +9,7 @@ import com.raoulvdberge.refinedstorage.inventory.fluid.FluidInventoryFilter;
|
|||||||
import com.raoulvdberge.refinedstorage.inventory.item.validator.ItemValidatorBasic;
|
import com.raoulvdberge.refinedstorage.inventory.item.validator.ItemValidatorBasic;
|
||||||
import com.raoulvdberge.refinedstorage.item.FilterItem;
|
import com.raoulvdberge.refinedstorage.item.FilterItem;
|
||||||
import com.raoulvdberge.refinedstorage.screen.BaseScreen;
|
import com.raoulvdberge.refinedstorage.screen.BaseScreen;
|
||||||
import com.raoulvdberge.refinedstorage.screen.grid.GuiGrid;
|
import com.raoulvdberge.refinedstorage.screen.grid.GridScreen;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraftforge.fluids.FluidStack;
|
import net.minecraftforge.fluids.FluidStack;
|
||||||
import net.minecraftforge.fml.LogicalSide;
|
import net.minecraftforge.fml.LogicalSide;
|
||||||
@@ -47,7 +47,7 @@ public class ItemHandlerFilter extends ItemHandlerBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (EffectiveSide.get() == LogicalSide.CLIENT) { // TODO check
|
if (EffectiveSide.get() == LogicalSide.CLIENT) { // TODO check
|
||||||
BaseScreen.executeLater(GuiGrid.class, grid -> grid.getView().sort());
|
BaseScreen.executeLater(GridScreen.class, grid -> grid.getView().sort());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -43,7 +43,7 @@ public abstract class AmountSpecifyingScreen<T extends Container> extends BaseSc
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init(int x, int y) {
|
public void onPostInit(int x, int y) {
|
||||||
Pair<Integer, Integer> pos = getOkCancelPos();
|
Pair<Integer, Integer> pos = getOkCancelPos();
|
||||||
|
|
||||||
okButton = addButton(x + pos.getLeft(), y + pos.getRight(), 50, 20, getOkButtonText(), true, true, btn -> onOkButtonPressed(hasShiftDown()));
|
okButton = addButton(x + pos.getLeft(), y + pos.getRight(), 50, 20, getOkButtonText(), true, true, btn -> onOkButtonPressed(hasShiftDown()));
|
||||||
|
@@ -60,6 +60,8 @@ public abstract class BaseScreen<T extends Container> extends ContainerScreen<T>
|
|||||||
public void init() {
|
public void init() {
|
||||||
minecraft.keyboardListener.enableRepeatEvents(true);
|
minecraft.keyboardListener.enableRepeatEvents(true);
|
||||||
|
|
||||||
|
onPreInit();
|
||||||
|
|
||||||
super.init();
|
super.init();
|
||||||
|
|
||||||
buttons.clear();
|
buttons.clear();
|
||||||
@@ -67,7 +69,7 @@ public abstract class BaseScreen<T extends Container> extends ContainerScreen<T>
|
|||||||
|
|
||||||
sideButtonY = 6;
|
sideButtonY = 6;
|
||||||
|
|
||||||
init(guiLeft, guiTop);
|
onPostInit(guiLeft, guiTop);
|
||||||
|
|
||||||
runActions();
|
runActions();
|
||||||
}
|
}
|
||||||
@@ -318,7 +320,11 @@ public abstract class BaseScreen<T extends Container> extends ContainerScreen<T>
|
|||||||
GlStateManager.enableLighting();
|
GlStateManager.enableLighting();
|
||||||
}
|
}
|
||||||
|
|
||||||
public abstract void init(int x, int y);
|
protected void onPreInit() {
|
||||||
|
// NO OP
|
||||||
|
}
|
||||||
|
|
||||||
|
public abstract void onPostInit(int x, int y);
|
||||||
|
|
||||||
public abstract void tick(int x, int y);
|
public abstract void tick(int x, int y);
|
||||||
|
|
||||||
|
@@ -32,7 +32,7 @@ public class ControllerScreen extends BaseScreen<ControllerContainer> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init(int x, int y) {
|
public void onPostInit(int x, int y) {
|
||||||
addSideButton(new SideButtonRedstoneMode(this, ControllerTile.REDSTONE_MODE));
|
addSideButton(new SideButtonRedstoneMode(this, ControllerTile.REDSTONE_MODE));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
package com.raoulvdberge.refinedstorage.screen;
|
package com.raoulvdberge.refinedstorage.screen;
|
||||||
|
|
||||||
public class ResizableDisplayDummy implements IResizableDisplay {
|
public class EmptyScreenInfoProvider implements IScreenInfoProvider {
|
||||||
@Override
|
@Override
|
||||||
public int getVisibleRows() {
|
public int getVisibleRows() {
|
||||||
return 3;
|
return 3;
|
@@ -42,7 +42,7 @@ public class FilterScreen extends BaseScreen<FilterContainer> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init(int x, int y) {
|
public void onPostInit(int x, int y) {
|
||||||
addCheckBox(x + 7, y + 77, I18n.format("gui.refinedstorage.filter.compare_nbt"), (compare & IComparer.COMPARE_NBT) == IComparer.COMPARE_NBT, btn -> {
|
addCheckBox(x + 7, y + 77, I18n.format("gui.refinedstorage.filter.compare_nbt"), (compare & IComparer.COMPARE_NBT) == IComparer.COMPARE_NBT, btn -> {
|
||||||
compare ^= IComparer.COMPARE_NBT;
|
compare ^= IComparer.COMPARE_NBT;
|
||||||
|
|
||||||
|
@@ -17,7 +17,7 @@ public class GuiConstructor extends BaseScreen<ConstructorContainer> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init(int x, int y) {
|
public void onPostInit(int x, int y) {
|
||||||
addSideButton(new SideButtonRedstoneMode(this, TileConstructor.REDSTONE_MODE));
|
addSideButton(new SideButtonRedstoneMode(this, TileConstructor.REDSTONE_MODE));
|
||||||
|
|
||||||
addSideButton(new SideButtonType(this, TileConstructor.TYPE));
|
addSideButton(new SideButtonType(this, TileConstructor.TYPE));
|
||||||
|
@@ -13,7 +13,7 @@ public class GuiCrafter extends BaseScreen<CrafterContainer> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init(int x, int y) {
|
public void onPostInit(int x, int y) {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@@ -21,7 +21,7 @@ import net.minecraft.inventory.container.Slot;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
// TODO @MouseTweaksDisableWheelTweak
|
// TODO @MouseTweaksDisableWheelTweak
|
||||||
public class GuiCrafterManager extends BaseScreen<CrafterManagerContainer> implements IResizableDisplay {
|
public class GuiCrafterManager extends BaseScreen<CrafterManagerContainer> implements IScreenInfoProvider {
|
||||||
private CrafterManagerContainer container;
|
private CrafterManagerContainer container;
|
||||||
private NetworkNodeCrafterManager crafterManager;
|
private NetworkNodeCrafterManager crafterManager;
|
||||||
|
|
||||||
@@ -96,7 +96,7 @@ public class GuiCrafterManager extends BaseScreen<CrafterManagerContainer> imple
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init(int x, int y) {
|
public void onPostInit(int x, int y) {
|
||||||
addSideButton(new SideButtonRedstoneMode(this, TileCrafterManager.REDSTONE_MODE));
|
addSideButton(new SideButtonRedstoneMode(this, TileCrafterManager.REDSTONE_MODE));
|
||||||
addSideButton(new SideButtonCrafterManagerSearchBoxMode(this));
|
addSideButton(new SideButtonCrafterManagerSearchBoxMode(this));
|
||||||
addSideButton(new SideButtonGridSize(this, () -> crafterManager.getSize(), size -> TileDataManager.setParameter(TileCrafterManager.SIZE, size)));
|
addSideButton(new SideButtonGridSize(this, () -> crafterManager.getSize(), size -> TileDataManager.setParameter(TileCrafterManager.SIZE, size)));
|
||||||
|
@@ -151,7 +151,7 @@ public class GuiCraftingMonitor extends BaseScreen<CraftingMonitorContainer> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init(int x, int y) {
|
public void onPostInit(int x, int y) {
|
||||||
this.tabs.init(xSize);
|
this.tabs.init(xSize);
|
||||||
|
|
||||||
this.scrollbar = new ScrollbarWidget(this, 235, 20, 12, 149);
|
this.scrollbar = new ScrollbarWidget(this, 235, 20, 12, 149);
|
||||||
|
@@ -67,7 +67,7 @@ public class GuiCraftingPreview extends BaseScreen {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init(int x, int y) {
|
public void onPostInit(int x, int y) {
|
||||||
cancelButton = addButton(x + 55, y + 201 - 20 - 7, 50, 20, I18n.format("gui.cancel"), true, true, btn -> {
|
cancelButton = addButton(x + 55, y + 201 - 20 - 7, 50, 20, I18n.format("gui.cancel"), true, true, btn -> {
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@@ -14,7 +14,7 @@ public class GuiDestructor extends BaseScreen<DestructorContainer> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init(int x, int y) {
|
public void onPostInit(int x, int y) {
|
||||||
addSideButton(new SideButtonRedstoneMode(this, TileDestructor.REDSTONE_MODE));
|
addSideButton(new SideButtonRedstoneMode(this, TileDestructor.REDSTONE_MODE));
|
||||||
|
|
||||||
addSideButton(new SideButtonType(this, TileDestructor.TYPE));
|
addSideButton(new SideButtonType(this, TileDestructor.TYPE));
|
||||||
|
@@ -19,7 +19,7 @@ public class GuiDetector extends BaseScreen<DetectorContainer> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init(int x, int y) {
|
public void onPostInit(int x, int y) {
|
||||||
addSideButton(new SideButtonType(this, TileDetector.TYPE));
|
addSideButton(new SideButtonType(this, TileDetector.TYPE));
|
||||||
|
|
||||||
addSideButton(new SideButtonDetectorMode(this));
|
addSideButton(new SideButtonDetectorMode(this));
|
||||||
|
@@ -14,7 +14,7 @@ public class GuiDiskManipulator extends BaseScreen<DiskManipulatorContainer> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init(int x, int y) {
|
public void onPostInit(int x, int y) {
|
||||||
addSideButton(new SideButtonRedstoneMode(this, TileDiskManipulator.REDSTONE_MODE));
|
addSideButton(new SideButtonRedstoneMode(this, TileDiskManipulator.REDSTONE_MODE));
|
||||||
addSideButton(new SideButtonIOMode(this));
|
addSideButton(new SideButtonIOMode(this));
|
||||||
addSideButton(new SideButtonType(this, TileDiskManipulator.TYPE));
|
addSideButton(new SideButtonType(this, TileDiskManipulator.TYPE));
|
||||||
|
@@ -16,7 +16,7 @@ public class GuiExporter extends BaseScreen<ExporterContainer> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init(int x, int y) {
|
public void onPostInit(int x, int y) {
|
||||||
addSideButton(new SideButtonRedstoneMode(this, TileExporter.REDSTONE_MODE));
|
addSideButton(new SideButtonRedstoneMode(this, TileExporter.REDSTONE_MODE));
|
||||||
|
|
||||||
addSideButton(new SideButtonType(this, TileExporter.TYPE));
|
addSideButton(new SideButtonType(this, TileExporter.TYPE));
|
||||||
|
@@ -20,7 +20,7 @@ public class GuiFluidInterface extends BaseScreen<FluidInterfaceContainer> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init(int x, int y) {
|
public void onPostInit(int x, int y) {
|
||||||
addSideButton(new SideButtonRedstoneMode(this, TileFluidInterface.REDSTONE_MODE));
|
addSideButton(new SideButtonRedstoneMode(this, TileFluidInterface.REDSTONE_MODE));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -17,7 +17,7 @@ public class GuiImporter extends BaseScreen<ImporterContainer> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init(int x, int y) {
|
public void onPostInit(int x, int y) {
|
||||||
addSideButton(new SideButtonRedstoneMode(this, TileImporter.REDSTONE_MODE));
|
addSideButton(new SideButtonRedstoneMode(this, TileImporter.REDSTONE_MODE));
|
||||||
|
|
||||||
addSideButton(new SideButtonType(this, TileImporter.TYPE));
|
addSideButton(new SideButtonType(this, TileImporter.TYPE));
|
||||||
|
@@ -15,7 +15,7 @@ public class GuiInterface extends BaseScreen<InterfaceContainer> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init(int x, int y) {
|
public void onPostInit(int x, int y) {
|
||||||
addSideButton(new SideButtonRedstoneMode(this, TileInterface.REDSTONE_MODE));
|
addSideButton(new SideButtonRedstoneMode(this, TileInterface.REDSTONE_MODE));
|
||||||
|
|
||||||
addSideButton(new SideButtonCompare(this, TileInterface.COMPARE, IComparer.COMPARE_NBT));
|
addSideButton(new SideButtonCompare(this, TileInterface.COMPARE, IComparer.COMPARE_NBT));
|
||||||
|
@@ -17,7 +17,7 @@ public class GuiNetworkTransmitter extends BaseScreen<NetworkTransmitterContaine
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init(int x, int y) {
|
public void onPostInit(int x, int y) {
|
||||||
addSideButton(new SideButtonRedstoneMode(this, TileNetworkTransmitter.REDSTONE_MODE));
|
addSideButton(new SideButtonRedstoneMode(this, TileNetworkTransmitter.REDSTONE_MODE));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -44,7 +44,7 @@ public class GuiReaderWriter extends BaseScreen<ReaderWriterContainer> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init(int x, int y) {
|
public void onPostInit(int x, int y) {
|
||||||
addSideButton(new SideButtonRedstoneMode(this, readerWriter.getRedstoneModeParameter()));
|
addSideButton(new SideButtonRedstoneMode(this, readerWriter.getRedstoneModeParameter()));
|
||||||
|
|
||||||
add = addButton(x + 128, y + 15, 20, 20, "+", true, true, btn -> {
|
add = addButton(x + 128, y + 15, 20, 20, "+", true, true, btn -> {
|
||||||
|
@@ -13,7 +13,7 @@ public class GuiRelay extends BaseScreen<RelayContainer> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init(int x, int y) {
|
public void onPostInit(int x, int y) {
|
||||||
addSideButton(new SideButtonRedstoneMode(this, TileRelay.REDSTONE_MODE));
|
addSideButton(new SideButtonRedstoneMode(this, TileRelay.REDSTONE_MODE));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -22,7 +22,7 @@ public class GuiSecurityManager extends BaseScreen<SecurityManagerContainer> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init(int x, int y) {
|
public void onPostInit(int x, int y) {
|
||||||
addSideButton(new SideButtonRedstoneMode(this, TileSecurityManager.REDSTONE_MODE));
|
addSideButton(new SideButtonRedstoneMode(this, TileSecurityManager.REDSTONE_MODE));
|
||||||
|
|
||||||
int padding = 15;
|
int padding = 15;
|
||||||
|
@@ -14,7 +14,7 @@ public class GuiStorageMonitor extends BaseScreen<StorageMonitorContainer> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init(int x, int y) {
|
public void onPostInit(int x, int y) {
|
||||||
addSideButton(new SideButtonCompare(this, TileStorageMonitor.COMPARE, IComparer.COMPARE_NBT));
|
addSideButton(new SideButtonCompare(this, TileStorageMonitor.COMPARE, IComparer.COMPARE_NBT));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -13,7 +13,7 @@ public class GuiWirelessTransmitter extends BaseScreen<WirelessTransmitterContai
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init(int x, int y) {
|
public void onPostInit(int x, int y) {
|
||||||
addSideButton(new SideButtonRedstoneMode(this, TileWirelessTransmitter.REDSTONE_MODE));
|
addSideButton(new SideButtonRedstoneMode(this, TileWirelessTransmitter.REDSTONE_MODE));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
package com.raoulvdberge.refinedstorage.screen;
|
package com.raoulvdberge.refinedstorage.screen;
|
||||||
|
|
||||||
public interface IResizableDisplay {
|
public interface IScreenInfoProvider {
|
||||||
int getVisibleRows();
|
int getVisibleRows();
|
||||||
|
|
||||||
int getRows();
|
int getRows();
|
@@ -60,7 +60,7 @@ public class StorageScreen<T extends Container> extends BaseScreen<T> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init(int x, int y) {
|
public void onPostInit(int x, int y) {
|
||||||
if (redstoneModeParameter != null) {
|
if (redstoneModeParameter != null) {
|
||||||
addSideButton(new SideButtonRedstoneMode(this, redstoneModeParameter));
|
addSideButton(new SideButtonRedstoneMode(this, redstoneModeParameter));
|
||||||
}
|
}
|
||||||
|
@@ -0,0 +1,18 @@
|
|||||||
|
package com.raoulvdberge.refinedstorage.screen.factory;
|
||||||
|
|
||||||
|
import com.raoulvdberge.refinedstorage.container.GridContainer;
|
||||||
|
import com.raoulvdberge.refinedstorage.screen.grid.GridScreen;
|
||||||
|
import net.minecraft.client.gui.ScreenManager;
|
||||||
|
import net.minecraft.entity.player.PlayerInventory;
|
||||||
|
import net.minecraft.util.text.ITextComponent;
|
||||||
|
|
||||||
|
public class GridScreenFactory implements ScreenManager.IScreenFactory<GridContainer, GridScreen> {
|
||||||
|
@Override
|
||||||
|
public GridScreen create(GridContainer container, PlayerInventory inv, ITextComponent title) {
|
||||||
|
GridScreen grid = new GridScreen(container, container.getGrid(), inv, title);
|
||||||
|
|
||||||
|
container.setScreenInfoProvider(grid);
|
||||||
|
|
||||||
|
return grid;
|
||||||
|
}
|
||||||
|
}
|
@@ -9,7 +9,7 @@ import com.raoulvdberge.refinedstorage.apiimpl.network.node.GridNetworkNode;
|
|||||||
import com.raoulvdberge.refinedstorage.apiimpl.render.ElementDrawers;
|
import com.raoulvdberge.refinedstorage.apiimpl.render.ElementDrawers;
|
||||||
import com.raoulvdberge.refinedstorage.container.GridContainer;
|
import com.raoulvdberge.refinedstorage.container.GridContainer;
|
||||||
import com.raoulvdberge.refinedstorage.screen.BaseScreen;
|
import com.raoulvdberge.refinedstorage.screen.BaseScreen;
|
||||||
import com.raoulvdberge.refinedstorage.screen.IResizableDisplay;
|
import com.raoulvdberge.refinedstorage.screen.IScreenInfoProvider;
|
||||||
import com.raoulvdberge.refinedstorage.screen.grid.sorting.*;
|
import com.raoulvdberge.refinedstorage.screen.grid.sorting.*;
|
||||||
import com.raoulvdberge.refinedstorage.screen.grid.stack.GridStackItem;
|
import com.raoulvdberge.refinedstorage.screen.grid.stack.GridStackItem;
|
||||||
import com.raoulvdberge.refinedstorage.screen.grid.stack.IGridStack;
|
import com.raoulvdberge.refinedstorage.screen.grid.stack.IGridStack;
|
||||||
@@ -30,12 +30,13 @@ import net.minecraft.client.renderer.RenderHelper;
|
|||||||
import net.minecraft.client.resources.I18n;
|
import net.minecraft.client.resources.I18n;
|
||||||
import net.minecraft.entity.player.PlayerInventory;
|
import net.minecraft.entity.player.PlayerInventory;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.util.text.ITextComponent;
|
||||||
import net.minecraftforge.fml.client.config.GuiCheckBox;
|
import net.minecraftforge.fml.client.config.GuiCheckBox;
|
||||||
|
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class GuiGrid extends BaseScreen<GridContainer> implements IResizableDisplay {
|
public class GridScreen extends BaseScreen<GridContainer> implements IScreenInfoProvider {
|
||||||
private IGridView view;
|
private IGridView view;
|
||||||
|
|
||||||
private SearchWidget searchField;
|
private SearchWidget searchField;
|
||||||
@@ -51,8 +52,8 @@ public class GuiGrid extends BaseScreen<GridContainer> implements IResizableDisp
|
|||||||
|
|
||||||
private int slotNumber;
|
private int slotNumber;
|
||||||
|
|
||||||
public GuiGrid(GridContainer container, IGrid grid, PlayerInventory inventory) {
|
public GridScreen(GridContainer container, IGrid grid, PlayerInventory inventory, ITextComponent title) {
|
||||||
super(container, 227, 0, inventory, null);
|
super(container, 227, 0, inventory, title);
|
||||||
|
|
||||||
this.grid = grid;
|
this.grid = grid;
|
||||||
this.view = grid.getGridType() == GridType.FLUID ? new GridViewFluid(this, getDefaultSorter(), getSorters()) : new GridViewItem(this, getDefaultSorter(), getSorters());
|
this.view = grid.getGridType() == GridType.FLUID ? new GridViewFluid(this, getDefaultSorter(), getSorters()) : new GridViewItem(this, getDefaultSorter(), getSorters());
|
||||||
@@ -71,15 +72,15 @@ public class GuiGrid extends BaseScreen<GridContainer> implements IResizableDisp
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/* TODO - calcHeight
|
|
||||||
@Override
|
@Override
|
||||||
protected void calcHeight() {
|
protected void onPreInit() {
|
||||||
|
super.onPreInit();
|
||||||
|
|
||||||
this.ySize = getTopHeight() + getBottomHeight() + (getVisibleRows() * 18);
|
this.ySize = getTopHeight() + getBottomHeight() + (getVisibleRows() * 18);
|
||||||
this.ySize = ySize;
|
}
|
||||||
}*/
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init(int x, int y) {
|
public void onPostInit(int x, int y) {
|
||||||
container.initSlots();
|
container.initSlots();
|
||||||
|
|
||||||
this.tabs.init(xSize - 32);
|
this.tabs.init(xSize - 32);
|
||||||
@@ -208,7 +209,7 @@ public class GuiGrid extends BaseScreen<GridContainer> implements IResizableDisp
|
|||||||
case IGrid.SIZE_STRETCH:
|
case IGrid.SIZE_STRETCH:
|
||||||
int screenSpaceAvailable = height - getTopHeight() - getBottomHeight();
|
int screenSpaceAvailable = height - getTopHeight() - getBottomHeight();
|
||||||
|
|
||||||
return Math.max(3, Math.min((screenSpaceAvailable / 18) - 3, RS.INSTANCE.config.maxRowsStretch));
|
return Math.max(3, Math.min((screenSpaceAvailable / 18) - 3, Integer.MAX_VALUE));//@TODO: MaxRowsStretch
|
||||||
case IGrid.SIZE_SMALL:
|
case IGrid.SIZE_SMALL:
|
||||||
return 3;
|
return 3;
|
||||||
case IGrid.SIZE_MEDIUM:
|
case IGrid.SIZE_MEDIUM:
|
||||||
@@ -324,7 +325,7 @@ public class GuiGrid extends BaseScreen<GridContainer> implements IResizableDisp
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void renderForeground(int mouseX, int mouseY) {
|
public void renderForeground(int mouseX, int mouseY) {
|
||||||
renderString(7, 7, I18n.format(grid.getGuiTitle()));
|
renderString(7, 7, title.getFormattedText());
|
||||||
renderString(7, getYPlayerInventory() - 12, I18n.format("container.inventory"));
|
renderString(7, getYPlayerInventory() - 12, I18n.format("container.inventory"));
|
||||||
|
|
||||||
int x = 8;
|
int x = 8;
|
||||||
@@ -372,7 +373,7 @@ public class GuiGrid extends BaseScreen<GridContainer> implements IResizableDisp
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (isOverCreatePattern(mouseX, mouseY)) {
|
if (isOverCreatePattern(mouseX, mouseY)) {
|
||||||
renderTooltip(mouseX, mouseY, I18n.format("gui.refinedstorage:grid.pattern_create"));
|
renderTooltip(mouseX, mouseY, I18n.format("gui.refinedstorage.grid.pattern_create"));
|
||||||
}
|
}
|
||||||
|
|
||||||
tabs.drawTooltip(font, mouseX, mouseY);
|
tabs.drawTooltip(font, mouseX, mouseY);
|
@@ -111,7 +111,7 @@ public class GridStackFluid implements IGridStack {
|
|||||||
String text;
|
String text;
|
||||||
|
|
||||||
if (displayCraftText) {
|
if (displayCraftText) {
|
||||||
text = I18n.format("gui.refinedstorage:grid.craft");
|
text = I18n.format("gui.refinedstorage.grid.craft");
|
||||||
} else {
|
} else {
|
||||||
text = API.instance().getQuantityFormatter().formatInBucketFormWithOnlyTrailingDigitsIfZero(getQuantity());
|
text = API.instance().getQuantityFormatter().formatInBucketFormWithOnlyTrailingDigitsIfZero(getQuantity());
|
||||||
}
|
}
|
||||||
|
@@ -154,7 +154,7 @@ public class GridStackItem implements IGridStack {
|
|||||||
String text = null;
|
String text = null;
|
||||||
|
|
||||||
if (displayCraftText) {
|
if (displayCraftText) {
|
||||||
text = I18n.format("gui.refinedstorage:grid.craft");
|
text = I18n.format("gui.refinedstorage.grid.craft");
|
||||||
} else if (stack.getCount() > 1) {
|
} else if (stack.getCount() > 1) {
|
||||||
text = API.instance().getQuantityFormatter().formatWithUnits(getQuantity());
|
text = API.instance().getQuantityFormatter().formatWithUnits(getQuantity());
|
||||||
}
|
}
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
package com.raoulvdberge.refinedstorage.screen.grid.view;
|
package com.raoulvdberge.refinedstorage.screen.grid.view;
|
||||||
|
|
||||||
import com.raoulvdberge.refinedstorage.api.network.grid.IGrid;
|
import com.raoulvdberge.refinedstorage.api.network.grid.IGrid;
|
||||||
import com.raoulvdberge.refinedstorage.screen.grid.GuiGrid;
|
import com.raoulvdberge.refinedstorage.screen.grid.GridScreen;
|
||||||
import com.raoulvdberge.refinedstorage.screen.grid.filtering.GridFilterParser;
|
import com.raoulvdberge.refinedstorage.screen.grid.filtering.GridFilterParser;
|
||||||
import com.raoulvdberge.refinedstorage.screen.grid.sorting.GridSorterDirection;
|
import com.raoulvdberge.refinedstorage.screen.grid.sorting.GridSorterDirection;
|
||||||
import com.raoulvdberge.refinedstorage.screen.grid.sorting.IGridSorter;
|
import com.raoulvdberge.refinedstorage.screen.grid.sorting.IGridSorter;
|
||||||
@@ -11,7 +11,7 @@ import java.util.*;
|
|||||||
import java.util.function.Predicate;
|
import java.util.function.Predicate;
|
||||||
|
|
||||||
public abstract class GridViewBase implements IGridView {
|
public abstract class GridViewBase implements IGridView {
|
||||||
private GuiGrid gui;
|
private GridScreen gui;
|
||||||
private boolean canCraft;
|
private boolean canCraft;
|
||||||
|
|
||||||
private IGridSorter defaultSorter;
|
private IGridSorter defaultSorter;
|
||||||
@@ -20,7 +20,7 @@ public abstract class GridViewBase implements IGridView {
|
|||||||
private List<IGridStack> stacks = new ArrayList<>();
|
private List<IGridStack> stacks = new ArrayList<>();
|
||||||
protected Map<Integer, IGridStack> map = new HashMap<>();
|
protected Map<Integer, IGridStack> map = new HashMap<>();
|
||||||
|
|
||||||
public GridViewBase(GuiGrid gui, IGridSorter defaultSorter, List<IGridSorter> sorters) {
|
public GridViewBase(GridScreen gui, IGridSorter defaultSorter, List<IGridSorter> sorters) {
|
||||||
this.gui = gui;
|
this.gui = gui;
|
||||||
this.defaultSorter = defaultSorter;
|
this.defaultSorter = defaultSorter;
|
||||||
this.sorters = sorters;
|
this.sorters = sorters;
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
package com.raoulvdberge.refinedstorage.screen.grid.view;
|
package com.raoulvdberge.refinedstorage.screen.grid.view;
|
||||||
|
|
||||||
import com.raoulvdberge.refinedstorage.screen.grid.GuiGrid;
|
import com.raoulvdberge.refinedstorage.screen.grid.GridScreen;
|
||||||
import com.raoulvdberge.refinedstorage.screen.grid.sorting.IGridSorter;
|
import com.raoulvdberge.refinedstorage.screen.grid.sorting.IGridSorter;
|
||||||
import com.raoulvdberge.refinedstorage.screen.grid.stack.GridStackFluid;
|
import com.raoulvdberge.refinedstorage.screen.grid.stack.GridStackFluid;
|
||||||
import com.raoulvdberge.refinedstorage.screen.grid.stack.IGridStack;
|
import com.raoulvdberge.refinedstorage.screen.grid.stack.IGridStack;
|
||||||
@@ -8,7 +8,7 @@ import com.raoulvdberge.refinedstorage.screen.grid.stack.IGridStack;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class GridViewFluid extends GridViewBase {
|
public class GridViewFluid extends GridViewBase {
|
||||||
public GridViewFluid(GuiGrid gui, IGridSorter defaultSorter, List<IGridSorter> sorters) {
|
public GridViewFluid(GridScreen gui, IGridSorter defaultSorter, List<IGridSorter> sorters) {
|
||||||
super(gui, defaultSorter, sorters);
|
super(gui, defaultSorter, sorters);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
package com.raoulvdberge.refinedstorage.screen.grid.view;
|
package com.raoulvdberge.refinedstorage.screen.grid.view;
|
||||||
|
|
||||||
import com.raoulvdberge.refinedstorage.screen.grid.GuiGrid;
|
import com.raoulvdberge.refinedstorage.screen.grid.GridScreen;
|
||||||
import com.raoulvdberge.refinedstorage.screen.grid.sorting.IGridSorter;
|
import com.raoulvdberge.refinedstorage.screen.grid.sorting.IGridSorter;
|
||||||
import com.raoulvdberge.refinedstorage.screen.grid.stack.GridStackItem;
|
import com.raoulvdberge.refinedstorage.screen.grid.stack.GridStackItem;
|
||||||
import com.raoulvdberge.refinedstorage.screen.grid.stack.IGridStack;
|
import com.raoulvdberge.refinedstorage.screen.grid.stack.IGridStack;
|
||||||
@@ -8,7 +8,7 @@ import com.raoulvdberge.refinedstorage.screen.grid.stack.IGridStack;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class GridViewItem extends GridViewBase {
|
public class GridViewItem extends GridViewBase {
|
||||||
public GridViewItem(GuiGrid gui, IGridSorter defaultSorter, List<IGridSorter> sorters) {
|
public GridViewItem(GridScreen gui, IGridSorter defaultSorter, List<IGridSorter> sorters) {
|
||||||
super(gui, defaultSorter, sorters);
|
super(gui, defaultSorter, sorters);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1,30 +1,30 @@
|
|||||||
package com.raoulvdberge.refinedstorage.screen.widget.sidebutton;
|
package com.raoulvdberge.refinedstorage.screen.widget.sidebutton;
|
||||||
|
|
||||||
import com.raoulvdberge.refinedstorage.api.network.grid.IGrid;
|
import com.raoulvdberge.refinedstorage.api.network.grid.IGrid;
|
||||||
import com.raoulvdberge.refinedstorage.screen.grid.GuiGrid;
|
import com.raoulvdberge.refinedstorage.screen.grid.GridScreen;
|
||||||
import net.minecraft.client.resources.I18n;
|
import net.minecraft.client.resources.I18n;
|
||||||
import net.minecraft.util.text.TextFormatting;
|
import net.minecraft.util.text.TextFormatting;
|
||||||
|
|
||||||
public class SideButtonGridSearchBoxMode extends SideButton {
|
public class SideButtonGridSearchBoxMode extends SideButton {
|
||||||
public SideButtonGridSearchBoxMode(GuiGrid gui) {
|
public SideButtonGridSearchBoxMode(GridScreen gui) {
|
||||||
super(gui);
|
super(gui);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getTooltip() {
|
public String getTooltip() {
|
||||||
return I18n.format("sidebutton.refinedstorage:grid.search_box_mode") + "\n" + TextFormatting.GRAY + I18n.format("sidebutton.refinedstorage:grid.search_box_mode." + ((GuiGrid) screen).getGrid().getSearchBoxMode());
|
return I18n.format("sidebutton.refinedstorage:grid.search_box_mode") + "\n" + TextFormatting.GRAY + I18n.format("sidebutton.refinedstorage:grid.search_box_mode." + ((GridScreen) screen).getGrid().getSearchBoxMode());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void renderButtonIcon(int x, int y) {
|
protected void renderButtonIcon(int x, int y) {
|
||||||
int mode = ((GuiGrid) screen).getGrid().getSearchBoxMode();
|
int mode = ((GridScreen) screen).getGrid().getSearchBoxMode();
|
||||||
|
|
||||||
screen.blit(x, y, mode == IGrid.SEARCH_BOX_MODE_NORMAL_AUTOSELECTED || mode == IGrid.SEARCH_BOX_MODE_JEI_SYNCHRONIZED_AUTOSELECTED ? 16 : 0, 96, 16, 16);
|
screen.blit(x, y, mode == IGrid.SEARCH_BOX_MODE_NORMAL_AUTOSELECTED || mode == IGrid.SEARCH_BOX_MODE_JEI_SYNCHRONIZED_AUTOSELECTED ? 16 : 0, 96, 16, 16);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onPress() {
|
public void onPress() {
|
||||||
int mode = ((GuiGrid) screen).getGrid().getSearchBoxMode();
|
int mode = ((GridScreen) screen).getGrid().getSearchBoxMode();
|
||||||
|
|
||||||
if (mode == IGrid.SEARCH_BOX_MODE_NORMAL) {
|
if (mode == IGrid.SEARCH_BOX_MODE_NORMAL) {
|
||||||
mode = IGrid.SEARCH_BOX_MODE_NORMAL_AUTOSELECTED;
|
mode = IGrid.SEARCH_BOX_MODE_NORMAL_AUTOSELECTED;
|
||||||
@@ -40,8 +40,8 @@ public class SideButtonGridSearchBoxMode extends SideButton {
|
|||||||
mode = IGrid.SEARCH_BOX_MODE_NORMAL;
|
mode = IGrid.SEARCH_BOX_MODE_NORMAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
((GuiGrid) screen).getGrid().onSearchBoxModeChanged(mode);
|
((GridScreen) screen).getGrid().onSearchBoxModeChanged(mode);
|
||||||
|
|
||||||
((GuiGrid) screen).getSearchField().setMode(mode);
|
((GridScreen) screen).getSearchField().setMode(mode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -5,7 +5,7 @@ import com.raoulvdberge.refinedstorage.api.network.grid.GridType;
|
|||||||
import com.raoulvdberge.refinedstorage.api.network.grid.IGrid;
|
import com.raoulvdberge.refinedstorage.api.network.grid.IGrid;
|
||||||
import com.raoulvdberge.refinedstorage.apiimpl.network.node.GridNetworkNode;
|
import com.raoulvdberge.refinedstorage.apiimpl.network.node.GridNetworkNode;
|
||||||
import com.raoulvdberge.refinedstorage.screen.BaseScreen;
|
import com.raoulvdberge.refinedstorage.screen.BaseScreen;
|
||||||
import com.raoulvdberge.refinedstorage.screen.grid.GuiGrid;
|
import com.raoulvdberge.refinedstorage.screen.grid.GridScreen;
|
||||||
import com.raoulvdberge.refinedstorage.tile.NetworkNodeTile;
|
import com.raoulvdberge.refinedstorage.tile.NetworkNodeTile;
|
||||||
import com.raoulvdberge.refinedstorage.tile.config.IType;
|
import com.raoulvdberge.refinedstorage.tile.config.IType;
|
||||||
import com.raoulvdberge.refinedstorage.tile.data.TileDataParameter;
|
import com.raoulvdberge.refinedstorage.tile.data.TileDataParameter;
|
||||||
@@ -39,17 +39,17 @@ public class GridTile extends NetworkNodeTile<GridNetworkNode> {
|
|||||||
t.getNode().setSearchBoxMode(v);
|
t.getNode().setSearchBoxMode(v);
|
||||||
t.getNode().markDirty();
|
t.getNode().markDirty();
|
||||||
}
|
}
|
||||||
}, (initial, p) -> BaseScreen.executeLater(GuiGrid.class, grid -> grid.getSearchField().setMode(p)));
|
}, (initial, p) -> BaseScreen.executeLater(GridScreen.class, grid -> grid.getSearchField().setMode(p)));
|
||||||
public static final TileDataParameter<Integer, GridTile> SIZE = new TileDataParameter<>(DataSerializers.VARINT, 0, t -> t.getNode().getSize(), (t, v) -> {
|
public static final TileDataParameter<Integer, GridTile> SIZE = new TileDataParameter<>(DataSerializers.VARINT, 0, t -> t.getNode().getSize(), (t, v) -> {
|
||||||
if (IGrid.isValidSize(v)) {
|
if (IGrid.isValidSize(v)) {
|
||||||
t.getNode().setSize(v);
|
t.getNode().setSize(v);
|
||||||
t.getNode().markDirty();
|
t.getNode().markDirty();
|
||||||
}
|
}
|
||||||
}, (initial, p) -> BaseScreen.executeLater(GuiGrid.class, BaseScreen::init));
|
}, (initial, p) -> BaseScreen.executeLater(GridScreen.class, BaseScreen::init));
|
||||||
public static final TileDataParameter<Integer, GridTile> TAB_SELECTED = new TileDataParameter<>(DataSerializers.VARINT, 0, t -> t.getNode().getTabSelected(), (t, v) -> {
|
public static final TileDataParameter<Integer, GridTile> TAB_SELECTED = new TileDataParameter<>(DataSerializers.VARINT, 0, t -> t.getNode().getTabSelected(), (t, v) -> {
|
||||||
t.getNode().setTabSelected(v == t.getNode().getTabSelected() ? -1 : v);
|
t.getNode().setTabSelected(v == t.getNode().getTabSelected() ? -1 : v);
|
||||||
t.getNode().markDirty();
|
t.getNode().markDirty();
|
||||||
}, (initial, p) -> BaseScreen.executeLater(GuiGrid.class, grid -> grid.getView().sort()));
|
}, (initial, p) -> BaseScreen.executeLater(GridScreen.class, grid -> grid.getView().sort()));
|
||||||
public static final TileDataParameter<Integer, GridTile> TAB_PAGE = new TileDataParameter<>(DataSerializers.VARINT, 0, t -> t.getNode().getTabPage(), (t, v) -> {
|
public static final TileDataParameter<Integer, GridTile> TAB_PAGE = new TileDataParameter<>(DataSerializers.VARINT, 0, t -> t.getNode().getTabPage(), (t, v) -> {
|
||||||
if (v >= 0 && v <= t.getNode().getTotalTabPages()) {
|
if (v >= 0 && v <= t.getNode().getTotalTabPages()) {
|
||||||
t.getNode().setTabPage(v);
|
t.getNode().setTabPage(v);
|
||||||
@@ -59,17 +59,17 @@ public class GridTile extends NetworkNodeTile<GridNetworkNode> {
|
|||||||
public static final TileDataParameter<Boolean, GridTile> OREDICT_PATTERN = new TileDataParameter<>(DataSerializers.BOOLEAN, false, t -> t.getNode().isOredictPattern(), (t, v) -> {
|
public static final TileDataParameter<Boolean, GridTile> OREDICT_PATTERN = new TileDataParameter<>(DataSerializers.BOOLEAN, false, t -> t.getNode().isOredictPattern(), (t, v) -> {
|
||||||
t.getNode().setOredictPattern(v);
|
t.getNode().setOredictPattern(v);
|
||||||
t.getNode().markDirty();
|
t.getNode().markDirty();
|
||||||
}, (initial, p) -> BaseScreen.executeLater(GuiGrid.class, grid -> grid.updateOredictPattern(p)));
|
}, (initial, p) -> BaseScreen.executeLater(GridScreen.class, grid -> grid.updateOredictPattern(p)));
|
||||||
public static final TileDataParameter<Boolean, GridTile> PROCESSING_PATTERN = new TileDataParameter<>(DataSerializers.BOOLEAN, false, t -> t.getNode().isProcessingPattern(), (t, v) -> {
|
public static final TileDataParameter<Boolean, GridTile> PROCESSING_PATTERN = new TileDataParameter<>(DataSerializers.BOOLEAN, false, t -> t.getNode().isProcessingPattern(), (t, v) -> {
|
||||||
t.getNode().setProcessingPattern(v);
|
t.getNode().setProcessingPattern(v);
|
||||||
t.getNode().clearMatrix();
|
t.getNode().clearMatrix();
|
||||||
t.getNode().markDirty();
|
t.getNode().markDirty();
|
||||||
}, (initial, p) -> BaseScreen.executeLater(GuiGrid.class, BaseScreen::init));
|
}, (initial, p) -> BaseScreen.executeLater(GridScreen.class, BaseScreen::init));
|
||||||
public static final TileDataParameter<Integer, GridTile> PROCESSING_TYPE = IType.createParameter((initial, p) -> BaseScreen.executeLater(GuiGrid.class, BaseScreen::init));
|
public static final TileDataParameter<Integer, GridTile> PROCESSING_TYPE = IType.createParameter((initial, p) -> BaseScreen.executeLater(GridScreen.class, BaseScreen::init));
|
||||||
|
|
||||||
public static void trySortGrid(boolean initial) {
|
public static void trySortGrid(boolean initial) {
|
||||||
if (!initial) {
|
if (!initial) {
|
||||||
BaseScreen.executeLater(GuiGrid.class, grid -> grid.getView().sort());
|
BaseScreen.executeLater(GridScreen.class, grid -> grid.getView().sort());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -10,7 +10,7 @@ import com.raoulvdberge.refinedstorage.api.util.IFilter;
|
|||||||
import com.raoulvdberge.refinedstorage.apiimpl.storage.StorageCacheListenerGridFluid;
|
import com.raoulvdberge.refinedstorage.apiimpl.storage.StorageCacheListenerGridFluid;
|
||||||
import com.raoulvdberge.refinedstorage.inventory.item.ItemHandlerFilter;
|
import com.raoulvdberge.refinedstorage.inventory.item.ItemHandlerFilter;
|
||||||
import com.raoulvdberge.refinedstorage.screen.BaseScreen;
|
import com.raoulvdberge.refinedstorage.screen.BaseScreen;
|
||||||
import com.raoulvdberge.refinedstorage.screen.grid.GuiGrid;
|
import com.raoulvdberge.refinedstorage.screen.grid.GridScreen;
|
||||||
import com.raoulvdberge.refinedstorage.util.StackUtils;
|
import com.raoulvdberge.refinedstorage.util.StackUtils;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.entity.player.PlayerEntity;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
@@ -21,6 +21,8 @@ import net.minecraft.item.ItemStack;
|
|||||||
import net.minecraft.nbt.CompoundNBT;
|
import net.minecraft.nbt.CompoundNBT;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.util.text.ITextComponent;
|
||||||
|
import net.minecraft.util.text.TranslationTextComponent;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.items.IItemHandlerModifiable;
|
import net.minecraftforge.items.IItemHandlerModifiable;
|
||||||
|
|
||||||
@@ -138,8 +140,8 @@ public class WirelessFluidGrid implements IGridNetworkAware {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getGuiTitle() {
|
public ITextComponent getTitle() {
|
||||||
return "gui.refinedstorage:fluid_grid";
|
return new TranslationTextComponent("gui.refinedstorage.fluid_grid");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -193,7 +195,7 @@ public class WirelessFluidGrid implements IGridNetworkAware {
|
|||||||
|
|
||||||
this.sortingType = type;
|
this.sortingType = type;
|
||||||
|
|
||||||
BaseScreen.executeLater(GuiGrid.class, grid -> grid.getView().sort());
|
BaseScreen.executeLater(GridScreen.class, grid -> grid.getView().sort());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -202,7 +204,7 @@ public class WirelessFluidGrid implements IGridNetworkAware {
|
|||||||
|
|
||||||
this.sortingDirection = direction;
|
this.sortingDirection = direction;
|
||||||
|
|
||||||
BaseScreen.executeLater(GuiGrid.class, grid -> grid.getView().sort());
|
BaseScreen.executeLater(GridScreen.class, grid -> grid.getView().sort());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -229,7 +231,7 @@ public class WirelessFluidGrid implements IGridNetworkAware {
|
|||||||
|
|
||||||
// TODO RS.INSTANCE.network.sendToServer(new MessageWirelessFluidGridSettingsUpdate(getSortingDirection(), getSortingType(), getSearchBoxMode(), getSize(), tabSelected, getTabPage()));
|
// TODO RS.INSTANCE.network.sendToServer(new MessageWirelessFluidGridSettingsUpdate(getSortingDirection(), getSortingType(), getSearchBoxMode(), getSize(), tabSelected, getTabPage()));
|
||||||
|
|
||||||
BaseScreen.executeLater(GuiGrid.class, grid -> grid.getView().sort());
|
BaseScreen.executeLater(GridScreen.class, grid -> grid.getView().sort());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@@ -10,7 +10,7 @@ import com.raoulvdberge.refinedstorage.api.util.IFilter;
|
|||||||
import com.raoulvdberge.refinedstorage.apiimpl.storage.StorageCacheListenerGridItem;
|
import com.raoulvdberge.refinedstorage.apiimpl.storage.StorageCacheListenerGridItem;
|
||||||
import com.raoulvdberge.refinedstorage.inventory.item.ItemHandlerFilter;
|
import com.raoulvdberge.refinedstorage.inventory.item.ItemHandlerFilter;
|
||||||
import com.raoulvdberge.refinedstorage.screen.BaseScreen;
|
import com.raoulvdberge.refinedstorage.screen.BaseScreen;
|
||||||
import com.raoulvdberge.refinedstorage.screen.grid.GuiGrid;
|
import com.raoulvdberge.refinedstorage.screen.grid.GridScreen;
|
||||||
import com.raoulvdberge.refinedstorage.util.StackUtils;
|
import com.raoulvdberge.refinedstorage.util.StackUtils;
|
||||||
import net.minecraft.entity.player.PlayerEntity;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
import net.minecraft.entity.player.ServerPlayerEntity;
|
import net.minecraft.entity.player.ServerPlayerEntity;
|
||||||
@@ -20,6 +20,8 @@ import net.minecraft.item.ItemStack;
|
|||||||
import net.minecraft.nbt.CompoundNBT;
|
import net.minecraft.nbt.CompoundNBT;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.util.text.ITextComponent;
|
||||||
|
import net.minecraft.util.text.TranslationTextComponent;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.items.IItemHandlerModifiable;
|
import net.minecraftforge.items.IItemHandlerModifiable;
|
||||||
|
|
||||||
@@ -139,8 +141,8 @@ public class WirelessGrid implements IGridNetworkAware {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getGuiTitle() {
|
public ITextComponent getTitle() {
|
||||||
return "gui.refinedstorage:grid";
|
return new TranslationTextComponent("gui.refinedstorage.grid");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -189,7 +191,7 @@ public class WirelessGrid implements IGridNetworkAware {
|
|||||||
|
|
||||||
this.viewType = type;
|
this.viewType = type;
|
||||||
|
|
||||||
BaseScreen.executeLater(GuiGrid.class, grid -> grid.getView().sort());
|
BaseScreen.executeLater(GridScreen.class, grid -> grid.getView().sort());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -198,7 +200,7 @@ public class WirelessGrid implements IGridNetworkAware {
|
|||||||
|
|
||||||
this.sortingType = type;
|
this.sortingType = type;
|
||||||
|
|
||||||
BaseScreen.executeLater(GuiGrid.class, grid -> grid.getView().sort());
|
BaseScreen.executeLater(GridScreen.class, grid -> grid.getView().sort());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -207,7 +209,7 @@ public class WirelessGrid implements IGridNetworkAware {
|
|||||||
|
|
||||||
this.sortingDirection = direction;
|
this.sortingDirection = direction;
|
||||||
|
|
||||||
BaseScreen.executeLater(GuiGrid.class, grid -> grid.getView().sort());
|
BaseScreen.executeLater(GridScreen.class, grid -> grid.getView().sort());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -234,7 +236,7 @@ public class WirelessGrid implements IGridNetworkAware {
|
|||||||
|
|
||||||
// TODO RS.INSTANCE.network.sendToServer(new MessageGridSettingsUpdate(getViewType(), getSortingDirection(), getSortingType(), getSearchBoxMode(), getSize(), tabSelected, getTabPage()));
|
// TODO RS.INSTANCE.network.sendToServer(new MessageGridSettingsUpdate(getViewType(), getSortingDirection(), getSortingType(), getSearchBoxMode(), getSize(), tabSelected, getTabPage()));
|
||||||
|
|
||||||
BaseScreen.executeLater(GuiGrid.class, grid -> grid.getView().sort());
|
BaseScreen.executeLater(GridScreen.class, grid -> grid.getView().sort());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@@ -25,7 +25,7 @@ import com.raoulvdberge.refinedstorage.apiimpl.storage.disk.StorageDiskItemPorta
|
|||||||
import com.raoulvdberge.refinedstorage.inventory.item.ItemHandlerBase;
|
import com.raoulvdberge.refinedstorage.inventory.item.ItemHandlerBase;
|
||||||
import com.raoulvdberge.refinedstorage.inventory.item.ItemHandlerFilter;
|
import com.raoulvdberge.refinedstorage.inventory.item.ItemHandlerFilter;
|
||||||
import com.raoulvdberge.refinedstorage.screen.BaseScreen;
|
import com.raoulvdberge.refinedstorage.screen.BaseScreen;
|
||||||
import com.raoulvdberge.refinedstorage.screen.grid.GuiGrid;
|
import com.raoulvdberge.refinedstorage.screen.grid.GridScreen;
|
||||||
import com.raoulvdberge.refinedstorage.util.StackUtils;
|
import com.raoulvdberge.refinedstorage.util.StackUtils;
|
||||||
import net.minecraft.entity.player.PlayerEntity;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
import net.minecraft.entity.player.ServerPlayerEntity;
|
import net.minecraft.entity.player.ServerPlayerEntity;
|
||||||
@@ -33,6 +33,8 @@ import net.minecraft.inventory.CraftResultInventory;
|
|||||||
import net.minecraft.inventory.CraftingInventory;
|
import net.minecraft.inventory.CraftingInventory;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.CompoundNBT;
|
import net.minecraft.nbt.CompoundNBT;
|
||||||
|
import net.minecraft.util.text.ITextComponent;
|
||||||
|
import net.minecraft.util.text.TranslationTextComponent;
|
||||||
import net.minecraft.world.server.ServerWorld;
|
import net.minecraft.world.server.ServerWorld;
|
||||||
import net.minecraftforge.common.util.Constants;
|
import net.minecraftforge.common.util.Constants;
|
||||||
import net.minecraftforge.energy.CapabilityEnergy;
|
import net.minecraftforge.energy.CapabilityEnergy;
|
||||||
@@ -243,8 +245,8 @@ public class PortableGrid implements IGrid, IPortableGrid, IStorageDiskContainer
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getGuiTitle() {
|
public ITextComponent getTitle() {
|
||||||
return "gui.refinedstorage:portable_grid";
|
return new TranslationTextComponent("gui.refinedstorage.portable_grid");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -298,7 +300,7 @@ public class PortableGrid implements IGrid, IPortableGrid, IStorageDiskContainer
|
|||||||
|
|
||||||
this.sortingType = type;
|
this.sortingType = type;
|
||||||
|
|
||||||
BaseScreen.executeLater(GuiGrid.class, grid -> grid.getView().sort());
|
BaseScreen.executeLater(GridScreen.class, grid -> grid.getView().sort());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -307,7 +309,7 @@ public class PortableGrid implements IGrid, IPortableGrid, IStorageDiskContainer
|
|||||||
|
|
||||||
this.sortingDirection = direction;
|
this.sortingDirection = direction;
|
||||||
|
|
||||||
BaseScreen.executeLater(GuiGrid.class, grid -> grid.getView().sort());
|
BaseScreen.executeLater(GridScreen.class, grid -> grid.getView().sort());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -334,7 +336,7 @@ public class PortableGrid implements IGrid, IPortableGrid, IStorageDiskContainer
|
|||||||
|
|
||||||
// TODO RS.INSTANCE.network.sendToServer(new MessageGridSettingsUpdate(getViewType(), getSortingDirection(), getSortingType(), getSearchBoxMode(), getSize(), tabSelected, getTabPage()));
|
// TODO RS.INSTANCE.network.sendToServer(new MessageGridSettingsUpdate(getViewType(), getSortingDirection(), getSortingType(), getSearchBoxMode(), getSize(), tabSelected, getTabPage()));
|
||||||
|
|
||||||
BaseScreen.executeLater(GuiGrid.class, grid -> grid.getView().sort());
|
BaseScreen.executeLater(GridScreen.class, grid -> grid.getView().sort());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@@ -29,7 +29,7 @@ import com.raoulvdberge.refinedstorage.inventory.item.ItemHandlerBase;
|
|||||||
import com.raoulvdberge.refinedstorage.inventory.item.ItemHandlerFilter;
|
import com.raoulvdberge.refinedstorage.inventory.item.ItemHandlerFilter;
|
||||||
import com.raoulvdberge.refinedstorage.inventory.listener.ListenerTile;
|
import com.raoulvdberge.refinedstorage.inventory.listener.ListenerTile;
|
||||||
import com.raoulvdberge.refinedstorage.screen.BaseScreen;
|
import com.raoulvdberge.refinedstorage.screen.BaseScreen;
|
||||||
import com.raoulvdberge.refinedstorage.screen.grid.GuiGrid;
|
import com.raoulvdberge.refinedstorage.screen.grid.GridScreen;
|
||||||
import com.raoulvdberge.refinedstorage.tile.BaseTile;
|
import com.raoulvdberge.refinedstorage.tile.BaseTile;
|
||||||
import com.raoulvdberge.refinedstorage.tile.config.IRedstoneConfigurable;
|
import com.raoulvdberge.refinedstorage.tile.config.IRedstoneConfigurable;
|
||||||
import com.raoulvdberge.refinedstorage.tile.config.RedstoneMode;
|
import com.raoulvdberge.refinedstorage.tile.config.RedstoneMode;
|
||||||
@@ -48,6 +48,8 @@ import net.minecraft.nbt.CompoundNBT;
|
|||||||
import net.minecraft.nbt.ListNBT;
|
import net.minecraft.nbt.ListNBT;
|
||||||
import net.minecraft.network.datasync.DataSerializers;
|
import net.minecraft.network.datasync.DataSerializers;
|
||||||
import net.minecraft.util.Direction;
|
import net.minecraft.util.Direction;
|
||||||
|
import net.minecraft.util.text.ITextComponent;
|
||||||
|
import net.minecraft.util.text.TranslationTextComponent;
|
||||||
import net.minecraft.world.server.ServerWorld;
|
import net.minecraft.world.server.ServerWorld;
|
||||||
import net.minecraftforge.common.capabilities.Capability;
|
import net.minecraftforge.common.capabilities.Capability;
|
||||||
import net.minecraftforge.common.util.Constants;
|
import net.minecraftforge.common.util.Constants;
|
||||||
@@ -85,17 +87,17 @@ public class TilePortableGrid extends BaseTile implements IGrid, IPortableGrid,
|
|||||||
t.setSearchBoxMode(v);
|
t.setSearchBoxMode(v);
|
||||||
t.markDirty();
|
t.markDirty();
|
||||||
}
|
}
|
||||||
}, (initial, p) -> BaseScreen.executeLater(GuiGrid.class, grid -> grid.getSearchField().setMode(p)));
|
}, (initial, p) -> BaseScreen.executeLater(GridScreen.class, grid -> grid.getSearchField().setMode(p)));
|
||||||
private static final TileDataParameter<Integer, TilePortableGrid> SIZE = new TileDataParameter<>(DataSerializers.VARINT, 0, TilePortableGrid::getSize, (t, v) -> {
|
private static final TileDataParameter<Integer, TilePortableGrid> SIZE = new TileDataParameter<>(DataSerializers.VARINT, 0, TilePortableGrid::getSize, (t, v) -> {
|
||||||
if (IGrid.isValidSize(v)) {
|
if (IGrid.isValidSize(v)) {
|
||||||
t.setSize(v);
|
t.setSize(v);
|
||||||
t.markDirty();
|
t.markDirty();
|
||||||
}
|
}
|
||||||
}, (initial, p) -> BaseScreen.executeLater(GuiGrid.class, BaseScreen::init));
|
}, (initial, p) -> BaseScreen.executeLater(GridScreen.class, BaseScreen::init));
|
||||||
private static final TileDataParameter<Integer, TilePortableGrid> TAB_SELECTED = new TileDataParameter<>(DataSerializers.VARINT, 0, TilePortableGrid::getTabSelected, (t, v) -> {
|
private static final TileDataParameter<Integer, TilePortableGrid> TAB_SELECTED = new TileDataParameter<>(DataSerializers.VARINT, 0, TilePortableGrid::getTabSelected, (t, v) -> {
|
||||||
t.setTabSelected(v == t.getTabSelected() ? -1 : v);
|
t.setTabSelected(v == t.getTabSelected() ? -1 : v);
|
||||||
t.markDirty();
|
t.markDirty();
|
||||||
}, (initial, p) -> BaseScreen.executeLater(GuiGrid.class, grid -> grid.getView().sort()));
|
}, (initial, p) -> BaseScreen.executeLater(GridScreen.class, grid -> grid.getView().sort()));
|
||||||
private static final TileDataParameter<Integer, TilePortableGrid> TAB_PAGE = new TileDataParameter<>(DataSerializers.VARINT, 0, TilePortableGrid::getTabPage, (t, v) -> {
|
private static final TileDataParameter<Integer, TilePortableGrid> TAB_PAGE = new TileDataParameter<>(DataSerializers.VARINT, 0, TilePortableGrid::getTabPage, (t, v) -> {
|
||||||
if (v >= 0 && v <= t.getTotalTabPages()) {
|
if (v >= 0 && v <= t.getTotalTabPages()) {
|
||||||
t.setTabPage(v);
|
t.setTabPage(v);
|
||||||
@@ -343,8 +345,8 @@ public class TilePortableGrid extends BaseTile implements IGrid, IPortableGrid,
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getGuiTitle() {
|
public ITextComponent getTitle() {
|
||||||
return "gui.refinedstorage:portable_grid";
|
return new TranslationTextComponent("gui.refinedstorage.portable_grid");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@@ -9,12 +9,13 @@
|
|||||||
"key.refinedstorage.openWirelessCraftingMonitor": "Open Wireless Crafting Monitor",
|
"key.refinedstorage.openWirelessCraftingMonitor": "Open Wireless Crafting Monitor",
|
||||||
"gui.refinedstorage.controller": "Controller",
|
"gui.refinedstorage.controller": "Controller",
|
||||||
"gui.refinedstorage.creative_controller": "Creative Controller",
|
"gui.refinedstorage.creative_controller": "Creative Controller",
|
||||||
"gui.refinedstorage:grid": "Grid",
|
"gui.refinedstorage.grid": "Grid",
|
||||||
"gui.refinedstorage:grid.craft": "Craft",
|
"gui.refinedstorage.grid.craft": "Craft",
|
||||||
"gui.refinedstorage:crafting_grid": "Crafting Grid",
|
"gui.refinedstorage.crafting_grid": "Crafting Grid",
|
||||||
"gui.refinedstorage:pattern_grid": "Pattern Grid",
|
"gui.refinedstorage.pattern_grid": "Pattern Grid",
|
||||||
"gui.refinedstorage:grid.pattern_create": "Create",
|
"gui.refinedstorage.grid.pattern_create": "Create",
|
||||||
"gui.refinedstorage:fluid_grid": "Fluid Grid",
|
"gui.refinedstorage.fluid_grid": "Fluid Grid",
|
||||||
|
"gui.refinedstorage.portable_grid": "Portable Grid",
|
||||||
"gui.refinedstorage:item_amount": "Item amount",
|
"gui.refinedstorage:item_amount": "Item amount",
|
||||||
"gui.refinedstorage:fluid_amount": "Fluid amount in mB",
|
"gui.refinedstorage:fluid_amount": "Fluid amount in mB",
|
||||||
"gui.refinedstorage.disk_drive": "Disk Drive",
|
"gui.refinedstorage.disk_drive": "Disk Drive",
|
||||||
@@ -82,7 +83,6 @@
|
|||||||
"gui.refinedstorage.security_manager.permission.5": "Security",
|
"gui.refinedstorage.security_manager.permission.5": "Security",
|
||||||
"gui.refinedstorage.security_manager.permission.5.tooltip": "Ability to change security options",
|
"gui.refinedstorage.security_manager.permission.5.tooltip": "Ability to change security options",
|
||||||
"gui.refinedstorage:storage_monitor": "Storage Monitor",
|
"gui.refinedstorage:storage_monitor": "Storage Monitor",
|
||||||
"gui.refinedstorage:portable_grid": "Portable Grid",
|
|
||||||
"gui.refinedstorage:crafter_manager": "Crafter Manager",
|
"gui.refinedstorage:crafter_manager": "Crafter Manager",
|
||||||
"misc.refinedstorage.energy_stored": "%d / %d FE",
|
"misc.refinedstorage.energy_stored": "%d / %d FE",
|
||||||
"misc.refinedstorage.energy_usage": "Usage: %d FE/t",
|
"misc.refinedstorage.energy_usage": "Usage: %d FE/t",
|
||||||
|
Reference in New Issue
Block a user