add upgrades to the manipulator
This commit is contained in:
@@ -11,6 +11,10 @@ public class ContainerDiskManipulator extends ContainerBase {
|
|||||||
public ContainerDiskManipulator(TileDiskManipulator manipulator, EntityPlayer player) {
|
public ContainerDiskManipulator(TileDiskManipulator manipulator, EntityPlayer player) {
|
||||||
super(manipulator, player);
|
super(manipulator, player);
|
||||||
|
|
||||||
|
for (int i = 0; i < 4; ++i) {
|
||||||
|
addSlotToContainer(new SlotItemHandler(manipulator.getUpgrades(), i, 187, 6 + (i * 18)));
|
||||||
|
}
|
||||||
|
|
||||||
for (int i = 0; i < 6; ++i) {
|
for (int i = 0; i < 6; ++i) {
|
||||||
addSlotToContainer(new SlotItemHandler(manipulator.getDisks(), i, 26 + (i % 2 * 18), ((i / 2) * 18) + 57));
|
addSlotToContainer(new SlotItemHandler(manipulator.getDisks(), i, 26 + (i % 2 * 18), ((i / 2) * 18) + 57));
|
||||||
}
|
}
|
||||||
@@ -35,12 +39,12 @@ public class ContainerDiskManipulator extends ContainerBase {
|
|||||||
if (slot != null && slot.getHasStack()) {
|
if (slot != null && slot.getHasStack()) {
|
||||||
stack = slot.getStack();
|
stack = slot.getStack();
|
||||||
|
|
||||||
if (index < 12) {
|
if (index < 4 + 12) {
|
||||||
if (!mergeItemStack(stack, 12 + 9, inventorySlots.size(), false)) {
|
if (!mergeItemStack(stack, 4 + 12 + 9, inventorySlots.size(), false)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
} else if (!mergeItemStack(stack, 0, 12, false)) {
|
} else if (!mergeItemStack(stack, 0, 16, false)) {
|
||||||
return mergeItemStackToSpecimen(stack, 12, 12 + 9);
|
return mergeItemStackToSpecimen(stack, 4 + 12, 4 + 12 + 9);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stack.stackSize == 0) {
|
if (stack.stackSize == 0) {
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import refinedstorage.tile.TileDiskManipulator;
|
|||||||
|
|
||||||
public class GuiDiskManipulator extends GuiBase {
|
public class GuiDiskManipulator extends GuiBase {
|
||||||
public GuiDiskManipulator(ContainerDiskManipulator container) {
|
public GuiDiskManipulator(ContainerDiskManipulator container) {
|
||||||
super(container, 176, 211);
|
super(container, 211, 211);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -20,6 +20,8 @@ import refinedstorage.block.EnumItemStorageType;
|
|||||||
import refinedstorage.inventory.IItemValidator;
|
import refinedstorage.inventory.IItemValidator;
|
||||||
import refinedstorage.inventory.ItemHandlerBasic;
|
import refinedstorage.inventory.ItemHandlerBasic;
|
||||||
import refinedstorage.inventory.ItemHandlerFluid;
|
import refinedstorage.inventory.ItemHandlerFluid;
|
||||||
|
import refinedstorage.inventory.ItemHandlerUpgrade;
|
||||||
|
import refinedstorage.item.ItemUpgrade;
|
||||||
import refinedstorage.tile.config.IComparable;
|
import refinedstorage.tile.config.IComparable;
|
||||||
import refinedstorage.tile.config.IFilterable;
|
import refinedstorage.tile.config.IFilterable;
|
||||||
import refinedstorage.tile.config.IType;
|
import refinedstorage.tile.config.IType;
|
||||||
@@ -70,6 +72,8 @@ public class TileDiskManipulator extends TileNode implements IComparable, IFilte
|
|||||||
dataManager.addWatchedParameter(IO_MODE);
|
dataManager.addWatchedParameter(IO_MODE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private ItemHandlerUpgrade upgrades = new ItemHandlerUpgrade(4, this, ItemUpgrade.TYPE_SPEED, ItemUpgrade.TYPE_STACK);
|
||||||
|
|
||||||
private ItemHandlerBasic disks = new ItemHandlerBasic(12, this, IItemValidator.STORAGE_DISK) {
|
private ItemHandlerBasic disks = new ItemHandlerBasic(12, this, IItemValidator.STORAGE_DISK) {
|
||||||
@Override
|
@Override
|
||||||
protected void onContentsChanged(int slot) {
|
protected void onContentsChanged(int slot) {
|
||||||
@@ -163,6 +167,7 @@ public class TileDiskManipulator extends TileNode implements IComparable, IFilte
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateNode() {
|
public void updateNode() {
|
||||||
|
if (ticks % upgrades.getSpeed() != 0) return;
|
||||||
int slot = 0;
|
int slot = 0;
|
||||||
if (type == IType.ITEMS) {
|
if (type == IType.ITEMS) {
|
||||||
while (slot < itemStorages.length && itemStorages[slot] == null) {
|
while (slot < itemStorages.length && itemStorages[slot] == null) {
|
||||||
@@ -199,6 +204,10 @@ public class TileDiskManipulator extends TileNode implements IComparable, IFilte
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private int getInteractStackSize() {
|
||||||
|
return upgrades.hasUpgrade(ItemUpgrade.TYPE_STACK) ? 64 : 1;
|
||||||
|
}
|
||||||
|
|
||||||
private void insertIntoNetwork(ItemStorage storage, int slot) {
|
private void insertIntoNetwork(ItemStorage storage, int slot) {
|
||||||
if (storage.getStored() == 0) {
|
if (storage.getStored() == 0) {
|
||||||
moveDriveToOutput(slot);
|
moveDriveToOutput(slot);
|
||||||
@@ -216,7 +225,7 @@ public class TileDiskManipulator extends TileNode implements IComparable, IFilte
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (stack != null) {
|
if (stack != null) {
|
||||||
extracted = storage.extractItem(stack, 1, compare);
|
extracted = storage.extractItem(stack, getInteractStackSize(), compare);
|
||||||
}
|
}
|
||||||
} while (storage.getItems().size() > i && extracted == null);
|
} while (storage.getItems().size() > i && extracted == null);
|
||||||
|
|
||||||
@@ -252,7 +261,7 @@ public class TileDiskManipulator extends TileNode implements IComparable, IFilte
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (toExtract != null) {
|
if (toExtract != null) {
|
||||||
extracted = network.extractItem(toExtract, 1, compare);
|
extracted = network.extractItem(toExtract, getInteractStackSize(), compare);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
while (itemFilters.getSlots() > i && extracted == null) {
|
while (itemFilters.getSlots() > i && extracted == null) {
|
||||||
@@ -263,7 +272,7 @@ public class TileDiskManipulator extends TileNode implements IComparable, IFilte
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (stack != null) {
|
if (stack != null) {
|
||||||
extracted = network.extractItem(stack, 1, compare);
|
extracted = network.extractItem(stack, getInteractStackSize(), compare);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -297,7 +306,7 @@ public class TileDiskManipulator extends TileNode implements IComparable, IFilte
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (stack != null) {
|
if (stack != null) {
|
||||||
extracted = storage.extractFluid(stack, 1, compare);
|
extracted = storage.extractFluid(stack, getInteractStackSize(), compare);
|
||||||
}
|
}
|
||||||
} while (extracted == null && storage.getStacks().size() > i);
|
} while (extracted == null && storage.getStacks().size() > i);
|
||||||
|
|
||||||
@@ -333,7 +342,7 @@ public class TileDiskManipulator extends TileNode implements IComparable, IFilte
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (toExtract != null) {
|
if (toExtract != null) {
|
||||||
extracted = network.extractFluid(toExtract, 1, compare);
|
extracted = network.extractFluid(toExtract, getInteractStackSize(), compare);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
while (fluidFilters.getSlots() > i && extracted == null) {
|
while (fluidFilters.getSlots() > i && extracted == null) {
|
||||||
@@ -344,7 +353,7 @@ public class TileDiskManipulator extends TileNode implements IComparable, IFilte
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (stack != null) {
|
if (stack != null) {
|
||||||
extracted = network.extractFluid(stack, 1, compare);
|
extracted = network.extractFluid(stack, getInteractStackSize(), compare);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -430,6 +439,10 @@ public class TileDiskManipulator extends TileNode implements IComparable, IFilte
|
|||||||
return disks;
|
return disks;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public IItemHandler getUpgrades() {
|
||||||
|
return upgrades;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void read(NBTTagCompound tag) {
|
public void read(NBTTagCompound tag) {
|
||||||
super.read(tag);
|
super.read(tag);
|
||||||
@@ -437,6 +450,7 @@ public class TileDiskManipulator extends TileNode implements IComparable, IFilte
|
|||||||
readItems(disks, 0, tag);
|
readItems(disks, 0, tag);
|
||||||
readItems(itemFilters, 1, tag);
|
readItems(itemFilters, 1, tag);
|
||||||
readItems(fluidFilters, 2, tag);
|
readItems(fluidFilters, 2, tag);
|
||||||
|
readItems(upgrades, 3, tag);
|
||||||
|
|
||||||
if (tag.hasKey(NBT_COMPARE)) {
|
if (tag.hasKey(NBT_COMPARE)) {
|
||||||
compare = tag.getInteger(NBT_COMPARE);
|
compare = tag.getInteger(NBT_COMPARE);
|
||||||
@@ -462,6 +476,7 @@ public class TileDiskManipulator extends TileNode implements IComparable, IFilte
|
|||||||
writeItems(disks, 0, tag);
|
writeItems(disks, 0, tag);
|
||||||
writeItems(itemFilters, 1, tag);
|
writeItems(itemFilters, 1, tag);
|
||||||
writeItems(fluidFilters, 2, tag);
|
writeItems(fluidFilters, 2, tag);
|
||||||
|
writeItems(upgrades, 3, tag);
|
||||||
|
|
||||||
tag.setInteger(NBT_COMPARE, compare);
|
tag.setInteger(NBT_COMPARE, compare);
|
||||||
tag.setInteger(NBT_MODE, mode);
|
tag.setInteger(NBT_MODE, mode);
|
||||||
|
|||||||
Binary file not shown.
|
Before Width: | Height: | Size: 3.3 KiB After Width: | Height: | Size: 3.5 KiB |
Reference in New Issue
Block a user