speed upgrades on exporter
This commit is contained in:
@@ -1,7 +1,12 @@
|
||||
package refinedstorage.container;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import refinedstorage.RefinedStorageItems;
|
||||
import refinedstorage.container.slot.IItemValidator;
|
||||
import refinedstorage.container.slot.SlotFiltered;
|
||||
import refinedstorage.container.slot.SlotSpecimen;
|
||||
import refinedstorage.item.ItemUpgrade;
|
||||
import refinedstorage.tile.TileExporter;
|
||||
|
||||
public class ContainerExporter extends ContainerBase {
|
||||
@@ -12,6 +17,15 @@ public class ContainerExporter extends ContainerBase {
|
||||
addSlotToContainer(new SlotSpecimen(exporter.getInventory(), i, 8 + (18 * i), 20, false));
|
||||
}
|
||||
|
||||
for (int i = 0; i < 4; ++i) {
|
||||
addSlotToContainer(new SlotFiltered(exporter.getUpgradesInventory(), i, 187, 6 + (i * 18), new IItemValidator() {
|
||||
@Override
|
||||
public boolean isValid(ItemStack stack) {
|
||||
return stack.getItem() == RefinedStorageItems.UPGRADE && stack.getMetadata() == ItemUpgrade.TYPE_SPEED;
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
||||
addPlayerInventory(8, 55);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ public class GuiExporter extends GuiBase {
|
||||
private TileExporter exporter;
|
||||
|
||||
public GuiExporter(ContainerExporter container, TileExporter exporter) {
|
||||
super(container, 176, 137);
|
||||
super(container, 211, 137);
|
||||
|
||||
this.exporter = exporter;
|
||||
}
|
||||
|
||||
@@ -15,9 +15,8 @@ import refinedstorage.util.InventoryUtils;
|
||||
public class TileExporter extends TileMachine implements ICompareConfig {
|
||||
public static final String NBT_COMPARE = "Compare";
|
||||
|
||||
public static final int SPEED = 3;
|
||||
|
||||
private InventorySimple inventory = new InventorySimple("exporter", 9, this);
|
||||
private InventorySimple upgradesInventory = new InventorySimple("upgrades", 4, this);
|
||||
|
||||
private int compare = 0;
|
||||
|
||||
@@ -33,7 +32,7 @@ public class TileExporter extends TileMachine implements ICompareConfig {
|
||||
if (connectedTile instanceof IInventory) {
|
||||
IInventory connectedInventory = (IInventory) connectedTile;
|
||||
|
||||
if (ticks % SPEED == 0) {
|
||||
if (ticks % TileInterface.getSpeed(upgradesInventory) == 0) {
|
||||
for (int i = 0; i < inventory.getSizeInventory(); ++i) {
|
||||
ItemStack slot = inventory.getStackInSlot(i);
|
||||
|
||||
@@ -77,6 +76,7 @@ public class TileExporter extends TileMachine implements ICompareConfig {
|
||||
}
|
||||
|
||||
InventoryUtils.restoreInventory(inventory, 0, nbt);
|
||||
InventoryUtils.restoreInventory(upgradesInventory, 1, nbt);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -86,6 +86,7 @@ public class TileExporter extends TileMachine implements ICompareConfig {
|
||||
nbt.setInteger(NBT_COMPARE, compare);
|
||||
|
||||
InventoryUtils.saveInventory(inventory, 0, nbt);
|
||||
InventoryUtils.saveInventory(upgradesInventory, 1, nbt);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -107,6 +108,15 @@ public class TileExporter extends TileMachine implements ICompareConfig {
|
||||
return ContainerExporter.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IInventory getDroppedInventory() {
|
||||
return upgradesInventory;
|
||||
}
|
||||
|
||||
public InventorySimple getUpgradesInventory() {
|
||||
return upgradesInventory;
|
||||
}
|
||||
|
||||
public IInventory getInventory() {
|
||||
return inventory;
|
||||
}
|
||||
|
||||
@@ -25,18 +25,6 @@ public class TileImporter extends TileMachine implements ICompareConfig, IModeCo
|
||||
|
||||
private int currentSlot;
|
||||
|
||||
public int getSpeed() {
|
||||
int upgrades = 0;
|
||||
|
||||
for (int i = 0; i < upgradesInventory.getSizeInventory(); ++i) {
|
||||
if (upgradesInventory.getStackInSlot(i) != null) {
|
||||
upgrades++;
|
||||
}
|
||||
}
|
||||
|
||||
return 9 - (upgrades * 2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getEnergyUsage() {
|
||||
return 2;
|
||||
@@ -63,7 +51,7 @@ public class TileImporter extends TileMachine implements ICompareConfig, IModeCo
|
||||
if (stack == null) {
|
||||
currentSlot++;
|
||||
} else {
|
||||
if (ticks % getSpeed() == 0) {
|
||||
if (ticks % TileInterface.getSpeed(upgradesInventory) == 0) {
|
||||
ItemStack toTake = stack.copy();
|
||||
toTake.stackSize = 1;
|
||||
|
||||
@@ -89,7 +77,7 @@ public class TileImporter extends TileMachine implements ICompareConfig, IModeCo
|
||||
ItemStack stack = inventory.getStackInSlot(currentSlot);
|
||||
|
||||
if (stack != null) {
|
||||
if (ticks % getSpeed() == 0) {
|
||||
if (ticks % TileInterface.getSpeed(upgradesInventory) == 0) {
|
||||
ItemStack toTake = stack.copy();
|
||||
toTake.stackSize = 1;
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ public class TileInterface extends TileMachine implements ICompareConfig, ISided
|
||||
return 4;
|
||||
}
|
||||
|
||||
public int getSpeed() {
|
||||
public static int getSpeed(InventorySimple upgradesInventory) {
|
||||
int upgrades = 0;
|
||||
|
||||
for (int i = 0; i < upgradesInventory.getSizeInventory(); ++i) {
|
||||
@@ -59,7 +59,7 @@ public class TileInterface extends TileMachine implements ICompareConfig, ISided
|
||||
if (slot == null) {
|
||||
currentSlot++;
|
||||
} else {
|
||||
if (ticks % getSpeed() == 0) {
|
||||
if (ticks % getSpeed(upgradesInventory) == 0) {
|
||||
ItemStack toPush = slot.copy();
|
||||
toPush.stackSize = 1;
|
||||
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 1.9 KiB |
Reference in New Issue
Block a user