add detectors (redstone is broken though)
This commit is contained in:
@@ -22,6 +22,7 @@ public class StorageCraft {
|
||||
public static final int STORAGE_PROXY = 3;
|
||||
public static final int IMPORTER = 4;
|
||||
public static final int EXPORTER = 5;
|
||||
public static final int DETECTOR = 6;
|
||||
}
|
||||
|
||||
public static final String ID = "storagecraft";
|
||||
|
@@ -2,6 +2,7 @@ package storagecraft;
|
||||
|
||||
import storagecraft.block.BlockCable;
|
||||
import storagecraft.block.BlockController;
|
||||
import storagecraft.block.BlockDetector;
|
||||
import storagecraft.block.BlockDrive;
|
||||
import storagecraft.block.BlockExporter;
|
||||
import storagecraft.block.BlockGrid;
|
||||
@@ -16,4 +17,5 @@ public class StorageCraftBlocks {
|
||||
public static final BlockStorageProxy STORAGE_PROXY = new BlockStorageProxy();
|
||||
public static final BlockImporter IMPORTER = new BlockImporter();
|
||||
public static final BlockExporter EXPORTER = new BlockExporter();
|
||||
public static final BlockDetector DETECTOR = new BlockDetector();
|
||||
}
|
||||
|
75
src/main/java/storagecraft/block/BlockDetector.java
Normal file
75
src/main/java/storagecraft/block/BlockDetector.java
Normal file
@@ -0,0 +1,75 @@
|
||||
package storagecraft.block;
|
||||
|
||||
import net.minecraft.block.ITileEntityProvider;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import storagecraft.StorageCraft;
|
||||
import storagecraft.tile.TileDetector;
|
||||
|
||||
public class BlockDetector extends BlockBase implements ITileEntityProvider {
|
||||
private IIcon frontIcon;
|
||||
private IIcon sideIcon;
|
||||
|
||||
public BlockDetector() {
|
||||
super("detector");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
|
||||
if (!world.isRemote) {
|
||||
player.openGui(StorageCraft.INSTANCE, StorageCraft.GUI.DETECTOR, world, x, y, z);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta) {
|
||||
return new TileDetector();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int isProvidingWeakPower(IBlockAccess world, int x, int y, int z, int side) {
|
||||
return ((TileDetector) world.getTileEntity(x, y, z)).providesPower() ? 15 : 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int isProvidingStrongPower(IBlockAccess world, int x, int y, int z, int side) {
|
||||
return ((TileDetector) world.getTileEntity(x, y, z)).providesPower() ? 15 : 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canProvidePower() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerBlockIcons(IIconRegister register) {
|
||||
frontIcon = register.registerIcon("storagecraft:detector");
|
||||
sideIcon = register.registerIcon("storagecraft:generic");
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) {
|
||||
TileDetector tile = (TileDetector) world.getTileEntity(x, y, z);
|
||||
|
||||
if (side == tile.getDirection().ordinal()) {
|
||||
return frontIcon;
|
||||
}
|
||||
|
||||
return sideIcon;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(int side, int meta) {
|
||||
if (side == 3) {
|
||||
return frontIcon;
|
||||
}
|
||||
|
||||
return sideIcon;
|
||||
}
|
||||
}
|
15
src/main/java/storagecraft/container/ContainerDetector.java
Normal file
15
src/main/java/storagecraft/container/ContainerDetector.java
Normal file
@@ -0,0 +1,15 @@
|
||||
package storagecraft.container;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import storagecraft.container.slot.SlotSpecimen;
|
||||
import storagecraft.tile.TileDetector;
|
||||
|
||||
public class ContainerDetector extends ContainerBase {
|
||||
public ContainerDetector(EntityPlayer player, TileDetector detector) {
|
||||
super(player);
|
||||
|
||||
addSlotToContainer(new SlotSpecimen(detector, 0, 107, 20));
|
||||
|
||||
addPlayerInventory(8, 55);
|
||||
}
|
||||
}
|
74
src/main/java/storagecraft/gui/GuiDetector.java
Normal file
74
src/main/java/storagecraft/gui/GuiDetector.java
Normal file
@@ -0,0 +1,74 @@
|
||||
package storagecraft.gui;
|
||||
|
||||
import com.google.common.primitives.Ints;
|
||||
import net.minecraft.client.gui.GuiTextField;
|
||||
import storagecraft.StorageCraft;
|
||||
import storagecraft.container.ContainerDetector;
|
||||
import storagecraft.gui.sidebutton.SideButtonCompare;
|
||||
import storagecraft.gui.sidebutton.SideButtonDetectorMode;
|
||||
import storagecraft.gui.sidebutton.SideButtonRedstoneMode;
|
||||
import storagecraft.network.MessageDetectorModeUpdate;
|
||||
import storagecraft.tile.TileDetector;
|
||||
import storagecraft.util.InventoryUtils;
|
||||
|
||||
public class GuiDetector extends GuiBase {
|
||||
private TileDetector detector;
|
||||
|
||||
private GuiTextField amountField;
|
||||
|
||||
public GuiDetector(ContainerDetector container, TileDetector detector) {
|
||||
super(container, 176, 137);
|
||||
|
||||
this.detector = detector;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(int x, int y) {
|
||||
addSideButton(new SideButtonRedstoneMode(detector));
|
||||
|
||||
addSideButton(new SideButtonCompare(detector, InventoryUtils.COMPARE_DAMAGE));
|
||||
addSideButton(new SideButtonCompare(detector, InventoryUtils.COMPARE_NBT));
|
||||
|
||||
addSideButton(new SideButtonDetectorMode(detector));
|
||||
|
||||
amountField = new GuiTextField(fontRendererObj, x + 62 + 1, y + 23 + 1, 25, fontRendererObj.FONT_HEIGHT);
|
||||
amountField.setText(String.valueOf(detector.getAmount()));
|
||||
amountField.setEnableBackgroundDrawing(false);
|
||||
amountField.setVisible(true);
|
||||
amountField.setTextColor(16777215);
|
||||
amountField.setCanLoseFocus(false);
|
||||
amountField.setFocused(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(int x, int y) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawBackground(int x, int y, int mouseX, int mouseY) {
|
||||
bindTexture("gui/detector.png");
|
||||
|
||||
drawTexturedModalRect(x, y, 0, 0, xSize, ySize);
|
||||
|
||||
amountField.drawTextBox();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawForeground(int mouseX, int mouseY) {
|
||||
drawString(7, 7, t("gui.storagecraft:detector"));
|
||||
drawString(7, 43, t("container.inventory"));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void keyTyped(char character, int keyCode) {
|
||||
if (!checkHotbarKeys(keyCode) && amountField.textboxKeyTyped(character, keyCode)) {
|
||||
Integer result = Ints.tryParse(amountField.getText());
|
||||
|
||||
if (result != null) {
|
||||
StorageCraft.NETWORK.sendToServer(new MessageDetectorModeUpdate(detector, result));
|
||||
}
|
||||
} else {
|
||||
super.keyTyped(character, keyCode);
|
||||
}
|
||||
}
|
||||
}
|
@@ -7,12 +7,14 @@ import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import storagecraft.StorageCraft;
|
||||
import storagecraft.container.ContainerController;
|
||||
import storagecraft.container.ContainerDetector;
|
||||
import storagecraft.container.ContainerDrive;
|
||||
import storagecraft.container.ContainerExporter;
|
||||
import storagecraft.container.ContainerGrid;
|
||||
import storagecraft.container.ContainerImporter;
|
||||
import storagecraft.container.ContainerStorageProxy;
|
||||
import storagecraft.tile.TileController;
|
||||
import storagecraft.tile.TileDetector;
|
||||
import storagecraft.tile.TileDrive;
|
||||
import storagecraft.tile.TileExporter;
|
||||
import storagecraft.tile.TileGrid;
|
||||
@@ -34,6 +36,8 @@ public class GuiHandler implements IGuiHandler {
|
||||
return new ContainerImporter(player, (TileImporter) tile);
|
||||
case StorageCraft.GUI.EXPORTER:
|
||||
return new ContainerExporter(player, (TileExporter) tile);
|
||||
case StorageCraft.GUI.DETECTOR:
|
||||
return new ContainerDetector(player, (TileDetector) tile);
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
@@ -61,6 +65,8 @@ public class GuiHandler implements IGuiHandler {
|
||||
return new GuiImporter((ContainerImporter) getContainer(ID, player, tile), (TileImporter) tile);
|
||||
case StorageCraft.GUI.EXPORTER:
|
||||
return new GuiExporter((ContainerExporter) getContainer(ID, player, tile), (TileExporter) tile);
|
||||
case StorageCraft.GUI.DETECTOR:
|
||||
return new GuiDetector((ContainerDetector) getContainer(ID, player, tile), (TileDetector) tile);
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
|
@@ -0,0 +1,35 @@
|
||||
package storagecraft.gui.sidebutton;
|
||||
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import storagecraft.StorageCraft;
|
||||
import storagecraft.gui.GuiBase;
|
||||
import storagecraft.network.MessageDetectorModeUpdate;
|
||||
import storagecraft.tile.TileDetector;
|
||||
|
||||
public class SideButtonDetectorMode extends SideButton {
|
||||
private TileDetector detector;
|
||||
|
||||
public SideButtonDetectorMode(TileDetector detector) {
|
||||
this.detector = detector;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTooltip(GuiBase gui) {
|
||||
StringBuilder builder = new StringBuilder();
|
||||
|
||||
builder.append(EnumChatFormatting.GREEN).append(gui.t("sidebutton.storagecraft:detector.mode")).append(EnumChatFormatting.RESET).append("\n");
|
||||
|
||||
builder.append(gui.t("sidebutton.storagecraft:detector.mode." + detector.getMode()));
|
||||
|
||||
return builder.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(GuiBase gui, int x, int y) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void actionPerformed() {
|
||||
StorageCraft.NETWORK.sendToServer(new MessageDetectorModeUpdate(detector, detector.getAmount()));
|
||||
}
|
||||
}
|
@@ -0,0 +1,71 @@
|
||||
package storagecraft.network;
|
||||
|
||||
import cpw.mods.fml.common.network.simpleimpl.IMessage;
|
||||
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
|
||||
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import storagecraft.tile.TileDetector;
|
||||
|
||||
public class MessageDetectorModeUpdate implements IMessage, IMessageHandler<MessageDetectorModeUpdate, IMessage> {
|
||||
private int x;
|
||||
private int y;
|
||||
private int z;
|
||||
private int amount;
|
||||
|
||||
public MessageDetectorModeUpdate() {
|
||||
}
|
||||
|
||||
public MessageDetectorModeUpdate(TileDetector detector, int amount) {
|
||||
this.x = detector.xCoord;
|
||||
this.y = detector.yCoord;
|
||||
this.z = detector.zCoord;
|
||||
this.amount = amount;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fromBytes(ByteBuf buf) {
|
||||
x = buf.readInt();
|
||||
y = buf.readInt();
|
||||
z = buf.readInt();
|
||||
amount = buf.readInt();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void toBytes(ByteBuf buf) {
|
||||
buf.writeInt(x);
|
||||
buf.writeInt(y);
|
||||
buf.writeInt(z);
|
||||
buf.writeInt(amount);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMessage onMessage(MessageDetectorModeUpdate message, MessageContext context) {
|
||||
EntityPlayerMP player = context.getServerHandler().playerEntity;
|
||||
|
||||
TileEntity tile = player.worldObj.getTileEntity(message.x, message.y, message.z);
|
||||
|
||||
if (tile instanceof TileDetector) {
|
||||
TileDetector detector = (TileDetector) tile;
|
||||
|
||||
switch (detector.getMode()) {
|
||||
case TileDetector.MODE_UNDER:
|
||||
detector.setMode(TileDetector.MODE_EQUAL);
|
||||
break;
|
||||
case TileDetector.MODE_EQUAL:
|
||||
detector.setMode(TileDetector.MODE_ABOVE);
|
||||
break;
|
||||
case TileDetector.MODE_ABOVE:
|
||||
detector.setMode(TileDetector.MODE_UNDER);
|
||||
break;
|
||||
}
|
||||
|
||||
if (message.amount >= 0) {
|
||||
detector.setAmount(message.amount);
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
@@ -12,6 +12,7 @@ import storagecraft.StorageCraftItems;
|
||||
import storagecraft.gui.GuiHandler;
|
||||
import storagecraft.item.ItemBlockCable;
|
||||
import storagecraft.network.MessageCompareUpdate;
|
||||
import storagecraft.network.MessageDetectorModeUpdate;
|
||||
import storagecraft.network.MessageImporterModeUpdate;
|
||||
import storagecraft.network.MessageRedstoneModeUpdate;
|
||||
import storagecraft.network.MessageStoragePull;
|
||||
@@ -19,6 +20,7 @@ import storagecraft.network.MessageStoragePush;
|
||||
import storagecraft.network.MessageTileUpdate;
|
||||
import storagecraft.tile.TileCable;
|
||||
import storagecraft.tile.TileController;
|
||||
import storagecraft.tile.TileDetector;
|
||||
import storagecraft.tile.TileDrive;
|
||||
import storagecraft.tile.TileExporter;
|
||||
import storagecraft.tile.TileGrid;
|
||||
@@ -33,6 +35,7 @@ public class CommonProxy {
|
||||
StorageCraft.NETWORK.registerMessage(MessageStoragePull.class, MessageStoragePull.class, 3, Side.SERVER);
|
||||
StorageCraft.NETWORK.registerMessage(MessageCompareUpdate.class, MessageCompareUpdate.class, 4, Side.SERVER);
|
||||
StorageCraft.NETWORK.registerMessage(MessageImporterModeUpdate.class, MessageImporterModeUpdate.class, 5, Side.SERVER);
|
||||
StorageCraft.NETWORK.registerMessage(MessageDetectorModeUpdate.class, MessageDetectorModeUpdate.class, 6, Side.SERVER);
|
||||
|
||||
NetworkRegistry.INSTANCE.registerGuiHandler(StorageCraft.INSTANCE, new GuiHandler());
|
||||
|
||||
@@ -43,6 +46,7 @@ public class CommonProxy {
|
||||
GameRegistry.registerTileEntity(TileStorageProxy.class, "storageProxy");
|
||||
GameRegistry.registerTileEntity(TileImporter.class, "importer");
|
||||
GameRegistry.registerTileEntity(TileExporter.class, "exporter");
|
||||
GameRegistry.registerTileEntity(TileDetector.class, "detector");
|
||||
|
||||
GameRegistry.registerBlock(StorageCraftBlocks.CONTROLLER, "controller");
|
||||
GameRegistry.registerBlock(StorageCraftBlocks.CABLE, ItemBlockCable.class, "cable");
|
||||
@@ -51,6 +55,7 @@ public class CommonProxy {
|
||||
GameRegistry.registerBlock(StorageCraftBlocks.STORAGE_PROXY, "storageProxy");
|
||||
GameRegistry.registerBlock(StorageCraftBlocks.IMPORTER, "importer");
|
||||
GameRegistry.registerBlock(StorageCraftBlocks.EXPORTER, "exporter");
|
||||
GameRegistry.registerBlock(StorageCraftBlocks.DETECTOR, "detector");
|
||||
|
||||
GameRegistry.registerItem(StorageCraftItems.STORAGE_CELL, "storageCell");
|
||||
}
|
||||
|
@@ -3,7 +3,7 @@ package storagecraft.tile;
|
||||
public interface ICompareSetting {
|
||||
public int getCompare();
|
||||
|
||||
public void setCompare(int flags);
|
||||
public void setCompare(int compare);
|
||||
|
||||
public int getX();
|
||||
|
||||
|
234
src/main/java/storagecraft/tile/TileDetector.java
Normal file
234
src/main/java/storagecraft/tile/TileDetector.java
Normal file
@@ -0,0 +1,234 @@
|
||||
package storagecraft.tile;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.ISidedInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import storagecraft.inventory.InventorySimple;
|
||||
import storagecraft.storage.StorageItem;
|
||||
import storagecraft.util.InventoryUtils;
|
||||
|
||||
public class TileDetector extends TileMachine implements IInventory, ISidedInventory, ICompareSetting {
|
||||
public static final int MODE_UNDER = 0;
|
||||
public static final int MODE_EQUAL = 1;
|
||||
public static final int MODE_ABOVE = 2;
|
||||
|
||||
public static final String NBT_COMPARE = "Compare";
|
||||
public static final String NBT_MODE = "Mode";
|
||||
public static final String NBT_AMOUNT = "Amount";
|
||||
|
||||
private InventorySimple inventory = new InventorySimple("detector", 1);
|
||||
|
||||
private int compare = 0;
|
||||
private int mode = MODE_EQUAL;
|
||||
private int amount = 0;
|
||||
|
||||
private boolean providesPower = false;
|
||||
|
||||
@Override
|
||||
public int getEnergyUsage() {
|
||||
return 4;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateMachine() {
|
||||
if (ticks % 5 == 0) {
|
||||
ItemStack slot = inventory.getStackInSlot(0);
|
||||
|
||||
if (slot != null) {
|
||||
boolean foundAny = false;
|
||||
|
||||
for (StorageItem item : getController().getItems()) {
|
||||
if (item.compare(slot, compare)) {
|
||||
foundAny = true;
|
||||
|
||||
switch (mode) {
|
||||
case MODE_UNDER:
|
||||
providesPower = item.getQuantity() < amount;
|
||||
break;
|
||||
case MODE_EQUAL:
|
||||
providesPower = item.getQuantity() == amount;
|
||||
break;
|
||||
case MODE_ABOVE:
|
||||
providesPower = item.getQuantity() > amount;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!foundAny) {
|
||||
switch (mode) {
|
||||
case MODE_UNDER:
|
||||
providesPower = amount != 0;
|
||||
break;
|
||||
case MODE_EQUAL:
|
||||
providesPower = amount == 0;
|
||||
break;
|
||||
default:
|
||||
providesPower = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
providesPower = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean providesPower() {
|
||||
return providesPower;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCompare() {
|
||||
return compare;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCompare(int compare) {
|
||||
this.compare = compare;
|
||||
}
|
||||
|
||||
public int getMode() {
|
||||
return mode;
|
||||
}
|
||||
|
||||
public void setMode(int mode) {
|
||||
this.mode = mode;
|
||||
}
|
||||
|
||||
public int getAmount() {
|
||||
return amount;
|
||||
}
|
||||
|
||||
public void setAmount(int amount) {
|
||||
this.amount = amount;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSizeInventory() {
|
||||
return inventory.getSizeInventory();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlot(int slot) {
|
||||
return inventory.getStackInSlot(slot);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack decrStackSize(int slot, int amount) {
|
||||
return inventory.decrStackSize(slot, amount);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlotOnClosing(int slot) {
|
||||
return inventory.getStackInSlotOnClosing(slot);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setInventorySlotContents(int slot, ItemStack stack) {
|
||||
inventory.setInventorySlotContents(slot, stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getInventoryName() {
|
||||
return inventory.getInventoryName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasCustomInventoryName() {
|
||||
return inventory.hasCustomInventoryName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getInventoryStackLimit() {
|
||||
return inventory.getInventoryStackLimit();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isUseableByPlayer(EntityPlayer player) {
|
||||
return inventory.isUseableByPlayer(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void openInventory() {
|
||||
inventory.openInventory();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void closeInventory() {
|
||||
inventory.closeInventory();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int slot, ItemStack stack) {
|
||||
return inventory.isItemValidForSlot(slot, stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getAccessibleSlotsFromSide(int side) {
|
||||
return new int[] {};
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInsertItem(int slot, ItemStack stack, int side) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canExtractItem(int slot, ItemStack stack, int side) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound nbt) {
|
||||
super.readFromNBT(nbt);
|
||||
|
||||
if (nbt.hasKey(NBT_COMPARE)) {
|
||||
compare = nbt.getInteger(NBT_COMPARE);
|
||||
}
|
||||
|
||||
if (nbt.hasKey(NBT_MODE)) {
|
||||
mode = nbt.getInteger(NBT_MODE);
|
||||
}
|
||||
|
||||
if (nbt.hasKey(NBT_AMOUNT)) {
|
||||
amount = nbt.getInteger(NBT_AMOUNT);
|
||||
}
|
||||
|
||||
InventoryUtils.restoreInventory(this, nbt);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound nbt) {
|
||||
super.writeToNBT(nbt);
|
||||
|
||||
nbt.setInteger(NBT_COMPARE, compare);
|
||||
nbt.setInteger(NBT_MODE, mode);
|
||||
nbt.setInteger(NBT_AMOUNT, amount);
|
||||
|
||||
InventoryUtils.saveInventory(this, nbt);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fromBytes(ByteBuf buf) {
|
||||
super.fromBytes(buf);
|
||||
|
||||
compare = buf.readInt();
|
||||
mode = buf.readInt();
|
||||
amount = buf.readInt();
|
||||
providesPower = buf.readBoolean();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void toBytes(ByteBuf buf) {
|
||||
super.toBytes(buf);
|
||||
|
||||
buf.writeInt(compare);
|
||||
buf.writeInt(mode);
|
||||
buf.writeInt(amount);
|
||||
buf.writeBoolean(providesPower);
|
||||
}
|
||||
}
|
@@ -47,7 +47,7 @@ public class TileExporter extends TileMachine implements IInventory, ISidedInven
|
||||
boolean pushedAny = false;
|
||||
|
||||
for (int si = 0; si < connectedInventory.getSizeInventory(); ++si) {
|
||||
if (sided.canInsertItem(si, took, getDirection().getOpposite().ordinal())) {
|
||||
if (sided.canInsertItem(si, took, getDirection().getOpposite().ordinal())) { // @TODO: make more compact
|
||||
if (InventoryUtils.canPushToInventorySlot(connectedInventory, si, took)) {
|
||||
InventoryUtils.pushToInventorySlot(connectedInventory, si, took);
|
||||
|
||||
@@ -79,8 +79,8 @@ public class TileExporter extends TileMachine implements IInventory, ISidedInven
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCompare(int flags) {
|
||||
this.compare = flags;
|
||||
public void setCompare(int compare) {
|
||||
this.compare = compare;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -104,8 +104,8 @@ public class TileImporter extends TileMachine implements IInventory, ISidedInven
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCompare(int flags) {
|
||||
this.compare = flags;
|
||||
public void setCompare(int compare) {
|
||||
this.compare = compare;
|
||||
}
|
||||
|
||||
public int getMode() {
|
||||
|
@@ -6,6 +6,7 @@ gui.storagecraft:drive=Drive
|
||||
gui.storagecraft:storageProxy=Storage Proxy
|
||||
gui.storagecraft:importer=Importer
|
||||
gui.storagecraft:exporter=Exporter
|
||||
gui.storagecraft:detector=Detector
|
||||
|
||||
misc.storagecraft:energyStored=%d / %d RF
|
||||
misc.storagecraft:energyUsage=Usage: %d RF/t
|
||||
@@ -33,6 +34,11 @@ sidebutton.storagecraft:importer.mode=Mode
|
||||
sidebutton.storagecraft:importer.mode.0=Whitelist
|
||||
sidebutton.storagecraft:importer.mode.1=Blacklist
|
||||
|
||||
sidebutton.storagecraft:detector.mode=Mode
|
||||
sidebutton.storagecraft:detector.mode.0=Under the amount
|
||||
sidebutton.storagecraft:detector.mode.1=On the amount
|
||||
sidebutton.storagecraft:detector.mode.2=Above the amount
|
||||
|
||||
misc.storagecraft:yes=Yes
|
||||
misc.storagecraft:no=No
|
||||
|
||||
@@ -44,6 +50,7 @@ block.storagecraft:drive.name=Drive
|
||||
block.storagecraft:storageProxy.name=Storage Proxy
|
||||
block.storagecraft:importer.name=Importer
|
||||
block.storagecraft:exporter.name=Exporter
|
||||
block.storagecraft:detector.name=Detector
|
||||
|
||||
item.storagecraft:storageCell.0.name=1k Storage Cell
|
||||
item.storagecraft:storageCell.1.name=4k Storage Cell
|
||||
|
Binary file not shown.
After Width: | Height: | Size: 352 B |
BIN
src/main/resources/assets/storagecraft/textures/gui/detector.png
Normal file
BIN
src/main/resources/assets/storagecraft/textures/gui/detector.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.8 KiB |
Binary file not shown.
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 1.8 KiB |
BIN
src/main/resources/assets/storagecraft/textures/sidebuttons.png
Normal file
BIN
src/main/resources/assets/storagecraft/textures/sidebuttons.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 289 B |
Reference in New Issue
Block a user