Rename drive to disk drive
This commit is contained in:
@@ -6,7 +6,7 @@ public final class RefinedStorageBlocks {
|
||||
public static final BlockController CONTROLLER = new BlockController();
|
||||
public static final BlockCable CABLE = new BlockCable();
|
||||
public static final BlockGrid GRID = new BlockGrid();
|
||||
public static final BlockDrive DRIVE = new BlockDrive();
|
||||
public static final BlockDiskDrive DISK_DRIVE = new BlockDiskDrive();
|
||||
public static final BlockExternalStorage EXTERNAL_STORAGE = new BlockExternalStorage();
|
||||
public static final BlockImporter IMPORTER = new BlockImporter();
|
||||
public static final BlockExporter EXPORTER = new BlockExporter();
|
||||
|
@@ -3,7 +3,7 @@ package refinedstorage;
|
||||
public final class RefinedStorageGui {
|
||||
public static final int CONTROLLER = 0;
|
||||
public static final int GRID = 1;
|
||||
public static final int DRIVE = 2;
|
||||
public static final int DISK_DRIVE = 2;
|
||||
public static final int IMPORTER = 4;
|
||||
public static final int EXPORTER = 5;
|
||||
public static final int DETECTOR = 6;
|
||||
|
@@ -9,22 +9,22 @@ import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.world.World;
|
||||
import refinedstorage.RefinedStorage;
|
||||
import refinedstorage.RefinedStorageGui;
|
||||
import refinedstorage.tile.TileDrive;
|
||||
import refinedstorage.tile.TileDiskDrive;
|
||||
|
||||
public class BlockDrive extends BlockMachine {
|
||||
public BlockDrive() {
|
||||
super("drive");
|
||||
public class BlockDiskDrive extends BlockMachine {
|
||||
public BlockDiskDrive() {
|
||||
super("disk_drive");
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createTileEntity(World world, IBlockState state) {
|
||||
return new TileDrive();
|
||||
return new TileDiskDrive();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, net.minecraft.util.math.BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) {
|
||||
if (!world.isRemote) {
|
||||
player.openGui(RefinedStorage.INSTANCE, RefinedStorageGui.DRIVE, world, pos.getX(), pos.getY(), pos.getZ());
|
||||
player.openGui(RefinedStorage.INSTANCE, RefinedStorageGui.DISK_DRIVE, world, pos.getX(), pos.getY(), pos.getZ());
|
||||
}
|
||||
|
||||
return true;
|
@@ -1,21 +1,21 @@
|
||||
package refinedstorage.container;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import refinedstorage.RefinedStorageItems;
|
||||
import refinedstorage.container.slot.BasicItemValidator;
|
||||
import refinedstorage.container.slot.SlotFiltered;
|
||||
import refinedstorage.tile.TileDrive;
|
||||
|
||||
public class ContainerDrive extends ContainerStorage {
|
||||
public ContainerDrive(EntityPlayer player, TileDrive drive) {
|
||||
super(player, drive.getInventory());
|
||||
|
||||
for (int i = 0; i < 4; ++i) {
|
||||
addSlotToContainer(new SlotFiltered(drive, i, 98 + (i * 18), 78, new BasicItemValidator(RefinedStorageItems.STORAGE_DISK)));
|
||||
}
|
||||
|
||||
for (int i = 0; i < 4; ++i) {
|
||||
addSlotToContainer(new SlotFiltered(drive, 4 + i, 98 + (i * 18), 96, new BasicItemValidator(RefinedStorageItems.STORAGE_DISK)));
|
||||
}
|
||||
}
|
||||
}
|
||||
package refinedstorage.container;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import refinedstorage.RefinedStorageItems;
|
||||
import refinedstorage.container.slot.BasicItemValidator;
|
||||
import refinedstorage.container.slot.SlotFiltered;
|
||||
import refinedstorage.tile.TileDiskDrive;
|
||||
|
||||
public class ContainerDiskDrive extends ContainerStorage {
|
||||
public ContainerDiskDrive(EntityPlayer player, TileDiskDrive drive) {
|
||||
super(player, drive.getInventory());
|
||||
|
||||
for (int i = 0; i < 4; ++i) {
|
||||
addSlotToContainer(new SlotFiltered(drive, i, 98 + (i * 18), 78, new BasicItemValidator(RefinedStorageItems.STORAGE_DISK)));
|
||||
}
|
||||
|
||||
for (int i = 0; i < 4; ++i) {
|
||||
addSlotToContainer(new SlotFiltered(drive, 4 + i, 98 + (i * 18), 96, new BasicItemValidator(RefinedStorageItems.STORAGE_DISK)));
|
||||
}
|
||||
}
|
||||
}
|
@@ -18,8 +18,8 @@ public class GuiHandler implements IGuiHandler {
|
||||
return new ContainerController(player);
|
||||
case RefinedStorageGui.GRID:
|
||||
return new ContainerGrid(player, (TileGrid) tile);
|
||||
case RefinedStorageGui.DRIVE:
|
||||
return new ContainerDrive(player, (TileDrive) tile);
|
||||
case RefinedStorageGui.DISK_DRIVE:
|
||||
return new ContainerDiskDrive(player, (TileDiskDrive) tile);
|
||||
case RefinedStorageGui.IMPORTER:
|
||||
return new ContainerImporter(player, (TileImporter) tile);
|
||||
case RefinedStorageGui.EXPORTER:
|
||||
@@ -59,8 +59,8 @@ public class GuiHandler implements IGuiHandler {
|
||||
return new GuiController((ContainerController) getContainer(ID, player, tile), (TileController) tile);
|
||||
case RefinedStorageGui.GRID:
|
||||
return new GuiGrid((ContainerGrid) getContainer(ID, player, tile), (TileGrid) tile);
|
||||
case RefinedStorageGui.DRIVE:
|
||||
return new GuiStorage((ContainerStorage) getContainer(ID, player, tile), (IStorageGui) tile, "gui/drive.png");
|
||||
case RefinedStorageGui.DISK_DRIVE:
|
||||
return new GuiStorage((ContainerStorage) getContainer(ID, player, tile), (IStorageGui) tile, "gui/disk_drive.png");
|
||||
case RefinedStorageGui.IMPORTER:
|
||||
return new GuiImporter((ContainerImporter) getContainer(ID, player, tile), (TileImporter) tile);
|
||||
case RefinedStorageGui.EXPORTER:
|
||||
|
@@ -1,13 +1,14 @@
|
||||
package refinedstorage.gui;
|
||||
|
||||
import net.minecraft.inventory.Container;
|
||||
import refinedstorage.container.ContainerSolderer;
|
||||
import refinedstorage.gui.sidebutton.SideButtonRedstoneMode;
|
||||
import refinedstorage.tile.TileSolderer;
|
||||
|
||||
public class GuiSolderer extends GuiBase {
|
||||
private TileSolderer solderer;
|
||||
|
||||
public GuiSolderer(Container container, TileSolderer solderer) {
|
||||
public GuiSolderer(ContainerSolderer container, TileSolderer solderer) {
|
||||
super(container, 176, 177);
|
||||
|
||||
this.solderer = solderer;
|
||||
|
@@ -1,13 +1,14 @@
|
||||
package refinedstorage.gui;
|
||||
|
||||
import net.minecraft.inventory.Container;
|
||||
import refinedstorage.container.ContainerWirelessTransmitter;
|
||||
import refinedstorage.gui.sidebutton.SideButtonRedstoneMode;
|
||||
import refinedstorage.tile.TileWirelessTransmitter;
|
||||
|
||||
public class GuiWirelessTransmitter extends GuiBase {
|
||||
private TileWirelessTransmitter wirelessTransmitter;
|
||||
|
||||
public GuiWirelessTransmitter(Container container, TileWirelessTransmitter wirelessTransmitter) {
|
||||
public GuiWirelessTransmitter(ContainerWirelessTransmitter container, TileWirelessTransmitter wirelessTransmitter) {
|
||||
super(container, 176, 137);
|
||||
|
||||
this.wirelessTransmitter = wirelessTransmitter;
|
||||
|
@@ -5,7 +5,7 @@ import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraftforge.fml.common.network.simpleimpl.IMessage;
|
||||
import refinedstorage.tile.TileDrive;
|
||||
import refinedstorage.tile.TileDiskDrive;
|
||||
import refinedstorage.tile.TileExternalStorage;
|
||||
import refinedstorage.tile.TileStorage;
|
||||
|
||||
@@ -49,8 +49,8 @@ public class MessagePriorityUpdate extends MessageHandlerPlayerToServer<MessageP
|
||||
((TileStorage) tile).setPriority(message.priority);
|
||||
} else if (tile instanceof TileExternalStorage) {
|
||||
((TileExternalStorage) tile).setPriority(message.priority);
|
||||
} else if (tile instanceof TileDrive) {
|
||||
((TileDrive) tile).setPriority(message.priority);
|
||||
} else if (tile instanceof TileDiskDrive) {
|
||||
((TileDiskDrive) tile).setPriority(message.priority);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -105,7 +105,7 @@ public class ClientProxy extends CommonProxy {
|
||||
ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(RefinedStorageBlocks.EXPORTER), 0, new ModelResourceLocation("refinedstorage:exporter", "inventory"));
|
||||
ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(RefinedStorageBlocks.IMPORTER), 0, new ModelResourceLocation("refinedstorage:importer", "inventory"));
|
||||
ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(RefinedStorageBlocks.EXTERNAL_STORAGE), 0, new ModelResourceLocation("refinedstorage:external_storage", "inventory"));
|
||||
ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(RefinedStorageBlocks.DRIVE), 0, new ModelResourceLocation("refinedstorage:drive", "inventory"));
|
||||
ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(RefinedStorageBlocks.DISK_DRIVE), 0, new ModelResourceLocation("refinedstorage:disk_drive", "inventory"));
|
||||
ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(RefinedStorageBlocks.CONTROLLER), EnumControllerType.NORMAL.getId(), new ModelResourceLocation("refinedstorage:controller", "inventory"));
|
||||
ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(RefinedStorageBlocks.CONTROLLER), EnumControllerType.CREATIVE.getId(), new ModelResourceLocation("refinedstorage:controller", "inventory"));
|
||||
ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(RefinedStorageBlocks.CONSTRUCTOR), 0, new ModelResourceLocation("refinedstorage:constructor", "inventory"));
|
||||
|
@@ -42,7 +42,7 @@ public class CommonProxy {
|
||||
GameRegistry.registerTileEntity(TileController.class, "controller");
|
||||
GameRegistry.registerTileEntity(TileCable.class, "cable");
|
||||
GameRegistry.registerTileEntity(TileGrid.class, "grid");
|
||||
GameRegistry.registerTileEntity(TileDrive.class, "drive");
|
||||
GameRegistry.registerTileEntity(TileDiskDrive.class, "disk_drive");
|
||||
GameRegistry.registerTileEntity(TileExternalStorage.class, "external_storage");
|
||||
GameRegistry.registerTileEntity(TileImporter.class, "importer");
|
||||
GameRegistry.registerTileEntity(TileExporter.class, "exporter");
|
||||
@@ -58,7 +58,7 @@ public class CommonProxy {
|
||||
GameRegistry.registerBlock(RefinedStorageBlocks.CONTROLLER, ItemBlockController.class, "controller");
|
||||
GameRegistry.registerBlock(RefinedStorageBlocks.CABLE, "cable");
|
||||
GameRegistry.registerBlock(RefinedStorageBlocks.GRID, ItemBlockGrid.class, "grid");
|
||||
GameRegistry.registerBlock(RefinedStorageBlocks.DRIVE, "drive");
|
||||
GameRegistry.registerBlock(RefinedStorageBlocks.DISK_DRIVE, "disk_drive");
|
||||
GameRegistry.registerBlock(RefinedStorageBlocks.EXTERNAL_STORAGE, "external_storage");
|
||||
GameRegistry.registerBlock(RefinedStorageBlocks.IMPORTER, "importer");
|
||||
GameRegistry.registerBlock(RefinedStorageBlocks.EXPORTER, "exporter");
|
||||
@@ -151,8 +151,8 @@ public class CommonProxy {
|
||||
'S', new ItemStack(Blocks.sticky_piston)
|
||||
);
|
||||
|
||||
// Drive
|
||||
SoldererRegistry.addRecipe(new SoldererRecipeDrive());
|
||||
// Disk Drive
|
||||
SoldererRegistry.addRecipe(new SoldererRecipeDiskDrive());
|
||||
|
||||
// Cable
|
||||
GameRegistry.addRecipe(new ItemStack(RefinedStorageBlocks.CABLE, 6),
|
||||
|
@@ -2,21 +2,21 @@ package refinedstorage.storage;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import refinedstorage.item.ItemStorageDisk;
|
||||
import refinedstorage.tile.TileDrive;
|
||||
import refinedstorage.tile.TileDiskDrive;
|
||||
import refinedstorage.tile.settings.ModeSettingUtils;
|
||||
|
||||
public class DiskStorage extends NBTStorage {
|
||||
private TileDrive drive;
|
||||
private TileDiskDrive diskDrive;
|
||||
|
||||
public DiskStorage(ItemStack disk, TileDrive drive) {
|
||||
super(disk.getTagCompound(), getCapacity(disk), drive.getPriority());
|
||||
public DiskStorage(ItemStack disk, TileDiskDrive diskDrive) {
|
||||
super(disk.getTagCompound(), getCapacity(disk), diskDrive.getPriority());
|
||||
|
||||
this.drive = drive;
|
||||
this.diskDrive = diskDrive;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canPush(ItemStack stack) {
|
||||
if (ModeSettingUtils.doesNotViolateMode(drive.getInventory(), drive.getModeSetting(), drive.getCompare(), stack)) {
|
||||
if (ModeSettingUtils.doesNotViolateMode(diskDrive.getInventory(), diskDrive.getModeSetting(), diskDrive.getCompare(), stack)) {
|
||||
return super.canPush(stack);
|
||||
}
|
||||
|
||||
|
@@ -1,305 +1,305 @@
|
||||
package refinedstorage.tile;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import refinedstorage.RefinedStorage;
|
||||
import refinedstorage.inventory.InventorySimple;
|
||||
import refinedstorage.network.MessagePriorityUpdate;
|
||||
import refinedstorage.storage.*;
|
||||
import refinedstorage.tile.settings.ICompareSetting;
|
||||
import refinedstorage.tile.settings.IModeSetting;
|
||||
import refinedstorage.tile.settings.IRedstoneModeSetting;
|
||||
import refinedstorage.util.InventoryUtils;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class TileDrive extends TileMachine implements IStorageProvider, IStorageGui, ICompareSetting, IModeSetting, IInventory {
|
||||
public static final String NBT_PRIORITY = "Priority";
|
||||
public static final String NBT_COMPARE = "Compare";
|
||||
public static final String NBT_MODE = "Mode";
|
||||
|
||||
private InventorySimple inventory = new InventorySimple("drive", 8, this);
|
||||
private InventorySimple filterInventory = new InventorySimple("filters", 9, this);
|
||||
|
||||
private int priority = 0;
|
||||
private int compare = 0;
|
||||
private int mode = 0;
|
||||
|
||||
@Override
|
||||
public int getEnergyUsage() {
|
||||
int base = 5;
|
||||
|
||||
for (int i = 0; i < getSizeInventory(); ++i) {
|
||||
if (getStackInSlot(i) != null) {
|
||||
base += 2;
|
||||
}
|
||||
}
|
||||
|
||||
return base;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateMachine() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addStorages(List<IStorage> storages) {
|
||||
for (int i = 0; i < getSizeInventory(); ++i) {
|
||||
if (getStackInSlot(i) != null) {
|
||||
storages.add(new DiskStorage(getStackInSlot(i), this));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound nbt) {
|
||||
super.readFromNBT(nbt);
|
||||
|
||||
InventoryUtils.restoreInventory(inventory, 0, nbt);
|
||||
InventoryUtils.restoreInventory(filterInventory, 1, nbt);
|
||||
|
||||
if (nbt.hasKey(NBT_PRIORITY)) {
|
||||
priority = nbt.getInteger(NBT_PRIORITY);
|
||||
}
|
||||
|
||||
if (nbt.hasKey(NBT_COMPARE)) {
|
||||
compare = nbt.getInteger(NBT_COMPARE);
|
||||
}
|
||||
|
||||
if (nbt.hasKey(NBT_MODE)) {
|
||||
mode = nbt.getInteger(NBT_MODE);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound nbt) {
|
||||
super.writeToNBT(nbt);
|
||||
|
||||
InventoryUtils.saveInventory(inventory, 0, nbt);
|
||||
InventoryUtils.saveInventory(filterInventory, 1, nbt);
|
||||
|
||||
nbt.setInteger(NBT_PRIORITY, priority);
|
||||
nbt.setInteger(NBT_COMPARE, compare);
|
||||
nbt.setInteger(NBT_MODE, mode);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void toBytes(ByteBuf buf) {
|
||||
super.toBytes(buf);
|
||||
|
||||
buf.writeInt(priority);
|
||||
buf.writeInt(compare);
|
||||
buf.writeInt(mode);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fromBytes(ByteBuf buf) {
|
||||
super.fromBytes(buf);
|
||||
|
||||
priority = buf.readInt();
|
||||
compare = buf.readInt();
|
||||
mode = buf.readInt();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCompare() {
|
||||
return compare;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCompare(int compare) {
|
||||
markDirty();
|
||||
|
||||
this.compare = compare;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isWhitelist() {
|
||||
return mode == 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isBlacklist() {
|
||||
return mode == 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setToWhitelist() {
|
||||
markDirty();
|
||||
|
||||
this.mode = 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setToBlacklist() {
|
||||
markDirty();
|
||||
|
||||
this.mode = 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "block.refinedstorage:drive.name";
|
||||
}
|
||||
|
||||
@Override
|
||||
public IInventory getInventory() {
|
||||
return filterInventory;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IRedstoneModeSetting getRedstoneModeSetting() {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ICompareSetting getCompareSetting() {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IModeSetting getModeSetting() {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPriorityChanged(int priority) {
|
||||
RefinedStorage.NETWORK.sendToServer(new MessagePriorityUpdate(pos, priority));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getPriority() {
|
||||
return priority;
|
||||
}
|
||||
|
||||
public void setPriority(int priority) {
|
||||
markDirty();
|
||||
|
||||
this.priority = priority;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getStored() {
|
||||
int stored = 0;
|
||||
|
||||
for (int i = 0; i < getSizeInventory(); ++i) {
|
||||
ItemStack stack = getStackInSlot(i);
|
||||
|
||||
if (stack != null) {
|
||||
stored += NBTStorage.getStored(stack.getTagCompound());
|
||||
}
|
||||
}
|
||||
|
||||
return stored;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCapacity() {
|
||||
int capacity = 0;
|
||||
|
||||
for (int i = 0; i < getSizeInventory(); ++i) {
|
||||
ItemStack stack = getStackInSlot(i);
|
||||
|
||||
if (stack != null) {
|
||||
int diskCapacity = DiskStorage.getCapacity(stack);
|
||||
|
||||
if (diskCapacity == -1) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
capacity += diskCapacity;
|
||||
}
|
||||
}
|
||||
|
||||
return capacity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSizeInventory() {
|
||||
return inventory.getSizeInventory();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlot(int slot) {
|
||||
return inventory.getStackInSlot(slot);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack decrStackSize(int slot, int count) {
|
||||
return inventory.decrStackSize(slot, count);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack removeStackFromSlot(int slot) {
|
||||
return inventory.removeStackFromSlot(slot);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setInventorySlotContents(int slot, ItemStack stack) {
|
||||
inventory.setInventorySlotContents(slot, stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getInventoryStackLimit() {
|
||||
return inventory.getInventoryStackLimit();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isUseableByPlayer(EntityPlayer player) {
|
||||
return inventory.isUseableByPlayer(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void openInventory(EntityPlayer player) {
|
||||
inventory.openInventory(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void closeInventory(EntityPlayer player) {
|
||||
inventory.closeInventory(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int slot, ItemStack stack) {
|
||||
return inventory.isItemValidForSlot(slot, stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getField(int id) {
|
||||
return inventory.getField(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setField(int id, int value) {
|
||||
inventory.setField(id, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getFieldCount() {
|
||||
return inventory.getFieldCount();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clear() {
|
||||
inventory.clear();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasCustomName() {
|
||||
return inventory.hasCustomName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ITextComponent getDisplayName() {
|
||||
return inventory.getDisplayName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IInventory getDroppedInventory() {
|
||||
return inventory;
|
||||
}
|
||||
}
|
||||
package refinedstorage.tile;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import refinedstorage.RefinedStorage;
|
||||
import refinedstorage.inventory.InventorySimple;
|
||||
import refinedstorage.network.MessagePriorityUpdate;
|
||||
import refinedstorage.storage.*;
|
||||
import refinedstorage.tile.settings.ICompareSetting;
|
||||
import refinedstorage.tile.settings.IModeSetting;
|
||||
import refinedstorage.tile.settings.IRedstoneModeSetting;
|
||||
import refinedstorage.util.InventoryUtils;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class TileDiskDrive extends TileMachine implements IStorageProvider, IStorageGui, ICompareSetting, IModeSetting, IInventory {
|
||||
public static final String NBT_PRIORITY = "Priority";
|
||||
public static final String NBT_COMPARE = "Compare";
|
||||
public static final String NBT_MODE = "Mode";
|
||||
|
||||
private InventorySimple inventory = new InventorySimple("disk_drive", 8, this);
|
||||
private InventorySimple filterInventory = new InventorySimple("filters", 9, this);
|
||||
|
||||
private int priority = 0;
|
||||
private int compare = 0;
|
||||
private int mode = 0;
|
||||
|
||||
@Override
|
||||
public int getEnergyUsage() {
|
||||
int base = 5;
|
||||
|
||||
for (int i = 0; i < getSizeInventory(); ++i) {
|
||||
if (getStackInSlot(i) != null) {
|
||||
base += 2;
|
||||
}
|
||||
}
|
||||
|
||||
return base;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateMachine() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addStorages(List<IStorage> storages) {
|
||||
for (int i = 0; i < getSizeInventory(); ++i) {
|
||||
if (getStackInSlot(i) != null) {
|
||||
storages.add(new DiskStorage(getStackInSlot(i), this));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound nbt) {
|
||||
super.readFromNBT(nbt);
|
||||
|
||||
InventoryUtils.restoreInventory(inventory, 0, nbt);
|
||||
InventoryUtils.restoreInventory(filterInventory, 1, nbt);
|
||||
|
||||
if (nbt.hasKey(NBT_PRIORITY)) {
|
||||
priority = nbt.getInteger(NBT_PRIORITY);
|
||||
}
|
||||
|
||||
if (nbt.hasKey(NBT_COMPARE)) {
|
||||
compare = nbt.getInteger(NBT_COMPARE);
|
||||
}
|
||||
|
||||
if (nbt.hasKey(NBT_MODE)) {
|
||||
mode = nbt.getInteger(NBT_MODE);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound nbt) {
|
||||
super.writeToNBT(nbt);
|
||||
|
||||
InventoryUtils.saveInventory(inventory, 0, nbt);
|
||||
InventoryUtils.saveInventory(filterInventory, 1, nbt);
|
||||
|
||||
nbt.setInteger(NBT_PRIORITY, priority);
|
||||
nbt.setInteger(NBT_COMPARE, compare);
|
||||
nbt.setInteger(NBT_MODE, mode);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void toBytes(ByteBuf buf) {
|
||||
super.toBytes(buf);
|
||||
|
||||
buf.writeInt(priority);
|
||||
buf.writeInt(compare);
|
||||
buf.writeInt(mode);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fromBytes(ByteBuf buf) {
|
||||
super.fromBytes(buf);
|
||||
|
||||
priority = buf.readInt();
|
||||
compare = buf.readInt();
|
||||
mode = buf.readInt();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCompare() {
|
||||
return compare;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCompare(int compare) {
|
||||
markDirty();
|
||||
|
||||
this.compare = compare;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isWhitelist() {
|
||||
return mode == 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isBlacklist() {
|
||||
return mode == 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setToWhitelist() {
|
||||
markDirty();
|
||||
|
||||
this.mode = 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setToBlacklist() {
|
||||
markDirty();
|
||||
|
||||
this.mode = 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "block.refinedstorage:disk_drive.name";
|
||||
}
|
||||
|
||||
@Override
|
||||
public IInventory getInventory() {
|
||||
return filterInventory;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IRedstoneModeSetting getRedstoneModeSetting() {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ICompareSetting getCompareSetting() {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IModeSetting getModeSetting() {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPriorityChanged(int priority) {
|
||||
RefinedStorage.NETWORK.sendToServer(new MessagePriorityUpdate(pos, priority));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getPriority() {
|
||||
return priority;
|
||||
}
|
||||
|
||||
public void setPriority(int priority) {
|
||||
markDirty();
|
||||
|
||||
this.priority = priority;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getStored() {
|
||||
int stored = 0;
|
||||
|
||||
for (int i = 0; i < getSizeInventory(); ++i) {
|
||||
ItemStack stack = getStackInSlot(i);
|
||||
|
||||
if (stack != null) {
|
||||
stored += NBTStorage.getStored(stack.getTagCompound());
|
||||
}
|
||||
}
|
||||
|
||||
return stored;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCapacity() {
|
||||
int capacity = 0;
|
||||
|
||||
for (int i = 0; i < getSizeInventory(); ++i) {
|
||||
ItemStack stack = getStackInSlot(i);
|
||||
|
||||
if (stack != null) {
|
||||
int diskCapacity = DiskStorage.getCapacity(stack);
|
||||
|
||||
if (diskCapacity == -1) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
capacity += diskCapacity;
|
||||
}
|
||||
}
|
||||
|
||||
return capacity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSizeInventory() {
|
||||
return inventory.getSizeInventory();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlot(int slot) {
|
||||
return inventory.getStackInSlot(slot);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack decrStackSize(int slot, int count) {
|
||||
return inventory.decrStackSize(slot, count);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack removeStackFromSlot(int slot) {
|
||||
return inventory.removeStackFromSlot(slot);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setInventorySlotContents(int slot, ItemStack stack) {
|
||||
inventory.setInventorySlotContents(slot, stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getInventoryStackLimit() {
|
||||
return inventory.getInventoryStackLimit();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isUseableByPlayer(EntityPlayer player) {
|
||||
return inventory.isUseableByPlayer(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void openInventory(EntityPlayer player) {
|
||||
inventory.openInventory(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void closeInventory(EntityPlayer player) {
|
||||
inventory.closeInventory(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int slot, ItemStack stack) {
|
||||
return inventory.isItemValidForSlot(slot, stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getField(int id) {
|
||||
return inventory.getField(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setField(int id, int value) {
|
||||
inventory.setField(id, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getFieldCount() {
|
||||
return inventory.getFieldCount();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clear() {
|
||||
inventory.clear();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasCustomName() {
|
||||
return inventory.hasCustomName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ITextComponent getDisplayName() {
|
||||
return inventory.getDisplayName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IInventory getDroppedInventory() {
|
||||
return inventory;
|
||||
}
|
||||
}
|
@@ -1,32 +1,32 @@
|
||||
package refinedstorage.tile.solderer;
|
||||
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import refinedstorage.RefinedStorageBlocks;
|
||||
import refinedstorage.RefinedStorageItems;
|
||||
import refinedstorage.item.ItemProcessor;
|
||||
|
||||
public class SoldererRecipeDrive implements ISoldererRecipe {
|
||||
@Override
|
||||
public ItemStack getRow(int row) {
|
||||
if (row == 0) {
|
||||
return new ItemStack(RefinedStorageItems.PROCESSOR, 1, ItemProcessor.TYPE_ADVANCED);
|
||||
} else if (row == 1) {
|
||||
return new ItemStack(RefinedStorageBlocks.MACHINE_CASING);
|
||||
} else if (row == 2) {
|
||||
return new ItemStack(Blocks.chest);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getResult() {
|
||||
return new ItemStack(RefinedStorageBlocks.DRIVE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDuration() {
|
||||
return 500;
|
||||
}
|
||||
}
|
||||
package refinedstorage.tile.solderer;
|
||||
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import refinedstorage.RefinedStorageBlocks;
|
||||
import refinedstorage.RefinedStorageItems;
|
||||
import refinedstorage.item.ItemProcessor;
|
||||
|
||||
public class SoldererRecipeDiskDrive implements ISoldererRecipe {
|
||||
@Override
|
||||
public ItemStack getRow(int row) {
|
||||
if (row == 0) {
|
||||
return new ItemStack(RefinedStorageItems.PROCESSOR, 1, ItemProcessor.TYPE_ADVANCED);
|
||||
} else if (row == 1) {
|
||||
return new ItemStack(RefinedStorageBlocks.MACHINE_CASING);
|
||||
} else if (row == 2) {
|
||||
return new ItemStack(Blocks.chest);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getResult() {
|
||||
return new ItemStack(RefinedStorageBlocks.DISK_DRIVE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDuration() {
|
||||
return 500;
|
||||
}
|
||||
}
|
@@ -5,7 +5,7 @@
|
||||
"textures": {
|
||||
"side": "refinedstorage:blocks/side",
|
||||
"top": "refinedstorage:blocks/side",
|
||||
"front": "refinedstorage:blocks/drive"
|
||||
"front": "refinedstorage:blocks/disk_drive"
|
||||
}
|
||||
},
|
||||
"variants": {
|
@@ -3,7 +3,7 @@ itemGroup.refinedstorage=Refined Storage
|
||||
gui.refinedstorage:controller.0=Controller
|
||||
gui.refinedstorage:controller.1=Creative Controller
|
||||
gui.refinedstorage:grid=Grid
|
||||
gui.refinedstorage:drive=Drive
|
||||
gui.refinedstorage:disk_drive=Drive
|
||||
gui.refinedstorage:external_storage=External Storage
|
||||
gui.refinedstorage:importer=Importer
|
||||
gui.refinedstorage:exporter=Exporter
|
||||
@@ -73,7 +73,7 @@ block.refinedstorage:controller.1.name=Creative Controller
|
||||
block.refinedstorage:cable.name=Cable
|
||||
block.refinedstorage:grid.0.name=Grid
|
||||
block.refinedstorage:grid.1.name=Crafting Grid
|
||||
block.refinedstorage:drive.name=Drive
|
||||
block.refinedstorage:disk_drive.name=Disk Drive
|
||||
block.refinedstorage:external_storage.name=External Storage
|
||||
block.refinedstorage:importer.name=Importer
|
||||
block.refinedstorage:exporter.name=Exporter
|
||||
|
@@ -3,7 +3,7 @@ itemGroup.refinedstorage=Refined Storage
|
||||
gui.refinedstorage:controller.0=Controller
|
||||
gui.refinedstorage:controller.1=Creative Controller
|
||||
gui.refinedstorage:grid=Rooster
|
||||
gui.refinedstorage:drive=Schijf
|
||||
gui.refinedstorage:disk_drive=Schijf
|
||||
gui.refinedstorage:external_storage=Externe Opslag
|
||||
gui.refinedstorage:importer=Importeur
|
||||
gui.refinedstorage:exporter=Exporteur
|
||||
@@ -73,7 +73,7 @@ block.refinedstorage:controller.1.name=Creative Controller
|
||||
block.refinedstorage:cable.name=Kabel
|
||||
block.refinedstorage:grid.0.name=Rooster
|
||||
block.refinedstorage:grid.1.name=Crafting Rooster
|
||||
block.refinedstorage:drive.name=Schijf
|
||||
block.refinedstorage:disk_drive.name=Schijf
|
||||
block.refinedstorage:external_storage.name=Externe Opslag
|
||||
block.refinedstorage:importer.name=Importeur
|
||||
block.refinedstorage:exporter.name=Exporteur
|
||||
|
Before Width: | Height: | Size: 206 B After Width: | Height: | Size: 206 B |
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 2.2 KiB |
Reference in New Issue
Block a user