Change model of crafter manager and handle redstone mode
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
package com.raoulvdberge.refinedstorage.container;
|
||||
|
||||
import com.raoulvdberge.refinedstorage.apiimpl.network.node.NetworkNodeCrafterManager;
|
||||
import com.raoulvdberge.refinedstorage.container.slot.SlotCrafterManager;
|
||||
import com.raoulvdberge.refinedstorage.gui.IResizableDisplay;
|
||||
import com.raoulvdberge.refinedstorage.inventory.ItemHandlerBase;
|
||||
@@ -64,6 +65,7 @@ public class ContainerCrafterManager extends ContainerBase {
|
||||
}
|
||||
|
||||
private IResizableDisplay display;
|
||||
private NetworkNodeCrafterManager crafterManager;
|
||||
private Map<String, Integer> containerData;
|
||||
private Map<String, IItemHandlerModifiable> dummyInventories = new HashMap<>();
|
||||
|
||||
@@ -80,6 +82,7 @@ public class ContainerCrafterManager extends ContainerBase {
|
||||
super(crafterManager, player);
|
||||
|
||||
this.display = display;
|
||||
this.crafterManager = crafterManager.getNode();
|
||||
|
||||
if (!player.world.isRemote) {
|
||||
addPlayerInventory(8, display.getYPlayerInventory());
|
||||
@@ -132,7 +135,7 @@ public class ContainerCrafterManager extends ContainerBase {
|
||||
}
|
||||
|
||||
for (int slot = 0; slot < entry.getValue(); ++slot) {
|
||||
addSlotToContainer(new SlotCrafterManager(dummy, slot, x, y, visible, display));
|
||||
addSlotToContainer(new SlotCrafterManager(dummy, slot, x, y, visible, display, crafterManager));
|
||||
|
||||
if (visible) {
|
||||
x += 18;
|
||||
|
||||
@@ -1,22 +1,25 @@
|
||||
package com.raoulvdberge.refinedstorage.container.slot;
|
||||
|
||||
import com.raoulvdberge.refinedstorage.apiimpl.network.node.NetworkNodeCrafterManager;
|
||||
import com.raoulvdberge.refinedstorage.gui.IResizableDisplay;
|
||||
import net.minecraftforge.items.IItemHandler;
|
||||
import net.minecraftforge.items.SlotItemHandler;
|
||||
|
||||
public class SlotCrafterManager extends SlotItemHandler {
|
||||
private boolean visible;
|
||||
private NetworkNodeCrafterManager crafterManager;
|
||||
private IResizableDisplay display;
|
||||
|
||||
public SlotCrafterManager(IItemHandler itemHandler, int index, int xPosition, int yPosition, boolean visible, IResizableDisplay display) {
|
||||
public SlotCrafterManager(IItemHandler itemHandler, int index, int xPosition, int yPosition, boolean visible, IResizableDisplay display, NetworkNodeCrafterManager crafterManager) {
|
||||
super(itemHandler, index, xPosition, yPosition);
|
||||
|
||||
this.visible = visible;
|
||||
this.display = display;
|
||||
this.crafterManager = crafterManager;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEnabled() {
|
||||
return yPos >= display.getTopHeight() && yPos < display.getTopHeight() + 18 * display.getVisibleRows() && visible;
|
||||
return yPos >= display.getTopHeight() && yPos < display.getTopHeight() + 18 * display.getVisibleRows() && visible && crafterManager.isActive();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -155,7 +155,7 @@ public class GuiCrafterManager extends GuiBase implements IResizableDisplay {
|
||||
|
||||
drawTexture(x, yy, 0, getTopHeight() + (18 * 3), screenWidth, getBottomHeight());
|
||||
|
||||
if (container != null) {
|
||||
if (container != null && crafterManager.isActive()) {
|
||||
for (Slot slot : container.inventorySlots) {
|
||||
if (slot instanceof SlotCrafterManager && slot.isEnabled()) {
|
||||
drawTexture(x + slot.xPos - 1, y + slot.yPos - 1, 0, 193, 18, 18);
|
||||
@@ -197,7 +197,7 @@ public class GuiCrafterManager extends GuiBase implements IResizableDisplay {
|
||||
drawString(7, 7, t("gui.refinedstorage:crafter_manager"));
|
||||
drawString(7, getYPlayerInventory() - 12, t("container.inventory"));
|
||||
|
||||
if (container != null && container.getContainerData() != null) {
|
||||
if (container != null && container.getContainerData() != null && crafterManager.isActive()) {
|
||||
int x = 7;
|
||||
int y = 18 - getCurrentOffset() * 18;
|
||||
|
||||
|
||||
@@ -99,7 +99,9 @@ public abstract class GridViewBase implements IGridView {
|
||||
|
||||
GridSorterDirection sortingDirection = grid.getSortingDirection() == IGrid.SORTING_DIRECTION_DESCENDING ? GridSorterDirection.DESCENDING : GridSorterDirection.ASCENDING;
|
||||
|
||||
stacks.sort((left, right) -> new GridSorterName().compare(left, right, sortingDirection));
|
||||
GridSorterName defaultSorting = new GridSorterName();
|
||||
|
||||
stacks.sort((left, right) -> defaultSorting.compare(left, right, sortingDirection));
|
||||
|
||||
sorters.stream().filter(s -> s.isApplicable(grid)).forEach(s -> {
|
||||
stacks.sort((left, right) -> s.compare(left, right, sortingDirection));
|
||||
|
||||
Reference in New Issue
Block a user