Updated changelog, removed manipulator toggle constant, fixed sidebutton offset, added recipe for manipulator, small formatting fixes

This commit is contained in:
Raoul Van den Berge
2016-09-18 19:24:55 +02:00
parent d686b83f60
commit be808d4ff8
8 changed files with 103 additions and 43 deletions

View File

@@ -4,6 +4,7 @@
- Fixed crafting a complex item causes the process to flow off the Crafting Monitor's GUI (raoulvdberge) - Fixed crafting a complex item causes the process to flow off the Crafting Monitor's GUI (raoulvdberge)
- Fixed shift clicking from Grid when player inventory is full throwing items in the world (raoulvdberge) - Fixed shift clicking from Grid when player inventory is full throwing items in the world (raoulvdberge)
- Added support for ore dictionary substitutions in Crafting Patterns (raoulvdberge) - Added support for ore dictionary substitutions in Crafting Patterns (raoulvdberge)
- Added Disk Manipulator (way2muchnoise)
### 1.0.4 ### 1.0.4
- Fixed lag caused by Crafter (raoulvdberge) - Fixed lag caused by Crafter (raoulvdberge)

View File

@@ -2,6 +2,7 @@
## Programming ## Programming
- raoulvdberge - raoulvdberge
- way2muchnoise
- tomevoll (providing small patches) - tomevoll (providing small patches)
- blay09 (Crafting Tweaks integration) - blay09 (Crafting Tweaks integration)

View File

@@ -29,6 +29,7 @@ public class BlockDiskManipulator extends BlockNode {
if (!world.isRemote) { if (!world.isRemote) {
player.openGui(RefinedStorage.INSTANCE, RefinedStorageGui.DISK_MANIPULATOR, world, pos.getX(), pos.getY(), pos.getZ()); player.openGui(RefinedStorage.INSTANCE, RefinedStorageGui.DISK_MANIPULATOR, world, pos.getX(), pos.getY(), pos.getZ());
} }
return true; return true;
} }

View File

@@ -15,18 +15,17 @@ public class SideButtonIOMode extends SideButton {
@Override @Override
public String getTooltip(GuiBase gui) { public String getTooltip(GuiBase gui) {
return TextFormatting.GREEN + gui.t("sidebutton.refinedstorage:iomode") + TextFormatting.RESET + "\n" + gui.t("sidebutton.refinedstorage:iomode." + (parameter.getValue() == TileDiskManipulator.INSERT ? "insert" : "extract")); return TextFormatting.GREEN + gui.t("sidebutton.refinedstorage:iomode") + TextFormatting.RESET + "\n" + gui.t("sidebutton.refinedstorage:iomode." + (parameter.getValue() == TileDiskManipulator.IO_MODE_INSERT ? "insert" : "extract"));
} }
@Override @Override
public void draw(GuiBase gui, int x, int y) { public void draw(GuiBase gui, int x, int y) {
gui.bindTexture("icons.png"); gui.bindTexture("icons.png");
gui.drawTexture(x, y + 1, parameter.getValue() == TileDiskManipulator.IO_MODE_EXTRACT ? 0 : 16, 160, 16, 16);
gui.drawTexture(x, y + 1, parameter.getValue() == TileDiskManipulator.EXTRACT ? 0 : 16, 160, 16, 16);
} }
@Override @Override
public void actionPerformed() { public void actionPerformed() {
TileDataManager.setParameter(parameter, parameter.getValue() == TileDiskManipulator.INSERT ? TileDiskManipulator.EXTRACT : TileDiskManipulator.INSERT); TileDataManager.setParameter(parameter, parameter.getValue() == TileDiskManipulator.IO_MODE_INSERT ? TileDiskManipulator.IO_MODE_EXTRACT : TileDiskManipulator.IO_MODE_INSERT);
} }
} }

View File

@@ -280,9 +280,7 @@ public class ClientProxy extends CommonProxy {
ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(RefinedStorageBlocks.FLUID_STORAGE), EnumFluidStorageType.TYPE_256K.getId(), new ModelResourceLocation("refinedstorage:fluid_storage", "type=256k")); ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(RefinedStorageBlocks.FLUID_STORAGE), EnumFluidStorageType.TYPE_256K.getId(), new ModelResourceLocation("refinedstorage:fluid_storage", "type=256k"));
ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(RefinedStorageBlocks.FLUID_STORAGE), EnumFluidStorageType.TYPE_512K.getId(), new ModelResourceLocation("refinedstorage:fluid_storage", "type=512k")); ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(RefinedStorageBlocks.FLUID_STORAGE), EnumFluidStorageType.TYPE_512K.getId(), new ModelResourceLocation("refinedstorage:fluid_storage", "type=512k"));
ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(RefinedStorageBlocks.FLUID_STORAGE), EnumFluidStorageType.TYPE_CREATIVE.getId(), new ModelResourceLocation("refinedstorage:fluid_storage", "type=creative")); ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(RefinedStorageBlocks.FLUID_STORAGE), EnumFluidStorageType.TYPE_CREATIVE.getId(), new ModelResourceLocation("refinedstorage:fluid_storage", "type=creative"));
if (ENABLE_DISK_MANIPULATOR) { ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(RefinedStorageBlocks.DISK_MANIPULATOR), 0, new ModelResourceLocation("refinedstorage:disk_manipulator", "inventory"));
ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(RefinedStorageBlocks.DISK_MANIPULATOR), 0, new ModelResourceLocation("refinedstorage:disk_manipulator", "inventory"));
}
ModelLoader.setCustomStateMapper(RefinedStorageBlocks.CONTROLLER, new StateMap.Builder().ignore(BlockController.TYPE).build()); ModelLoader.setCustomStateMapper(RefinedStorageBlocks.CONTROLLER, new StateMap.Builder().ignore(BlockController.TYPE).build());

View File

@@ -39,8 +39,6 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
public class CommonProxy { public class CommonProxy {
public static final boolean ENABLE_DISK_MANIPULATOR = true;
protected List<BlockCable> cableTypes = new ArrayList<>(); protected List<BlockCable> cableTypes = new ArrayList<>();
public void preInit(FMLPreInitializationEvent e) { public void preInit(FMLPreInitializationEvent e) {
@@ -98,9 +96,7 @@ public class CommonProxy {
registerTile(TileNetworkTransmitter.class, "network_transmitter"); registerTile(TileNetworkTransmitter.class, "network_transmitter");
registerTile(TileFluidInterface.class, "fluid_interface"); registerTile(TileFluidInterface.class, "fluid_interface");
registerTile(TileFluidStorage.class, "fluid_storage"); registerTile(TileFluidStorage.class, "fluid_storage");
if (ENABLE_DISK_MANIPULATOR) { registerTile(TileDiskManipulator.class, "disk_manipulator");
registerTile(TileDiskManipulator.class, "disk_manipulator");
}
registerBlock(RefinedStorageBlocks.CONTROLLER); registerBlock(RefinedStorageBlocks.CONTROLLER);
registerBlock(RefinedStorageBlocks.GRID); registerBlock(RefinedStorageBlocks.GRID);
@@ -125,9 +121,7 @@ public class CommonProxy {
registerBlock(RefinedStorageBlocks.MACHINE_CASING); registerBlock(RefinedStorageBlocks.MACHINE_CASING);
registerBlock(RefinedStorageBlocks.NETWORK_TRANSMITTER); registerBlock(RefinedStorageBlocks.NETWORK_TRANSMITTER);
registerBlock(RefinedStorageBlocks.NETWORK_RECEIVER); registerBlock(RefinedStorageBlocks.NETWORK_RECEIVER);
if (ENABLE_DISK_MANIPULATOR) { registerBlock(RefinedStorageBlocks.DISK_MANIPULATOR);
registerBlock(RefinedStorageBlocks.DISK_MANIPULATOR);
}
registerItem(RefinedStorageItems.QUARTZ_ENRICHED_IRON); registerItem(RefinedStorageItems.QUARTZ_ENRICHED_IRON);
registerItem(RefinedStorageItems.STORAGE_DISK); registerItem(RefinedStorageItems.STORAGE_DISK);
@@ -629,6 +623,18 @@ public class CommonProxy {
'D', new ItemStack(RefinedStorageItems.CORE, 1, ItemCore.TYPE_DESTRUCTION), 'D', new ItemStack(RefinedStorageItems.CORE, 1, ItemCore.TYPE_DESTRUCTION),
'A', new ItemStack(RefinedStorageItems.PROCESSOR, 1, ItemProcessor.TYPE_ADVANCED) 'A', new ItemStack(RefinedStorageItems.PROCESSOR, 1, ItemProcessor.TYPE_ADVANCED)
); );
// Disk Manipulator
GameRegistry.addShapedRecipe(new ItemStack(RefinedStorageBlocks.DISK_MANIPULATOR),
"ESE",
"CMD",
"ESE",
'E', new ItemStack(RefinedStorageItems.QUARTZ_ENRICHED_IRON),
'S', new ItemStack(RefinedStorageItems.STORAGE_HOUSING),
'C', new ItemStack(RefinedStorageItems.CORE, 1, ItemCore.TYPE_CONSTRUCTION),
'M', new ItemStack(RefinedStorageBlocks.MACHINE_CASING),
'D', new ItemStack(RefinedStorageItems.CORE, 1, ItemCore.TYPE_DESTRUCTION)
);
} }
public void init(FMLInitializationEvent e) { public void init(FMLInitializationEvent e) {

View File

@@ -34,8 +34,10 @@ public class TileDiskManipulator extends TileNode implements IComparable, IFilte
public static final TileDataParameter<Integer> MODE = IFilterable.createParameter(); public static final TileDataParameter<Integer> MODE = IFilterable.createParameter();
public static final TileDataParameter<Integer> TYPE = IType.createParameter(); public static final TileDataParameter<Integer> TYPE = IType.createParameter();
public static final int INSERT = 0, EXTRACT = 1; public static final int IO_MODE_INSERT = 0;
public static final TileDataParameter<Integer> IO_MODE = new TileDataParameter<>(DataSerializers.VARINT, INSERT, new ITileDataProducer<Integer, TileDiskManipulator>() { public static final int IO_MODE_EXTRACT = 1;
public static final TileDataParameter<Integer> IO_MODE = new TileDataParameter<>(DataSerializers.VARINT, IO_MODE_INSERT, new ITileDataProducer<Integer, TileDiskManipulator>() {
@Override @Override
public Integer getValue(TileDiskManipulator tile) { public Integer getValue(TileDiskManipulator tile) {
return tile.ioMode; return tile.ioMode;
@@ -56,19 +58,16 @@ public class TileDiskManipulator extends TileNode implements IComparable, IFilte
private int compare = 0; private int compare = 0;
private int mode = IFilterable.WHITELIST; private int mode = IFilterable.WHITELIST;
private int type = IType.ITEMS; private int type = IType.ITEMS;
private int ioMode = INSERT; private int ioMode = IO_MODE_INSERT;
private ItemStorage[] itemStorages; private ItemStorage[] itemStorages = new ItemStorage[6];
private FluidStorage[] fluidStorages; private FluidStorage[] fluidStorages = new FluidStorage[6];
public TileDiskManipulator() { public TileDiskManipulator() {
dataManager.addWatchedParameter(COMPARE); dataManager.addWatchedParameter(COMPARE);
dataManager.addWatchedParameter(MODE); dataManager.addWatchedParameter(MODE);
dataManager.addWatchedParameter(TYPE); dataManager.addWatchedParameter(TYPE);
dataManager.addWatchedParameter(IO_MODE); dataManager.addWatchedParameter(IO_MODE);
itemStorages = new ItemStorage[6];
fluidStorages = new FluidStorage[6];
} }
private ItemHandlerBasic disks = new ItemHandlerBasic(12, this, IItemValidator.STORAGE_DISK) { private ItemHandlerBasic disks = new ItemHandlerBasic(12, this, IItemValidator.STORAGE_DISK) {
@@ -166,22 +165,35 @@ public class TileDiskManipulator extends TileNode implements IComparable, IFilte
public void updateNode() { public void updateNode() {
int slot = 0; int slot = 0;
if (type == IType.ITEMS) { if (type == IType.ITEMS) {
while (slot < itemStorages.length && itemStorages[slot] == null) slot++; while (slot < itemStorages.length && itemStorages[slot] == null) {
if (slot == itemStorages.length) return; slot++;
ItemStorage storage = itemStorages[slot];
if (ioMode == INSERT) {
insertIntoNetwork(storage, slot);
} else if (ioMode == EXTRACT) {
extractFromNetwork(storage, slot);
} }
} else if (type == IType.FLUIDS) { if (slot == itemStorages.length) {
while (slot < fluidStorages.length && fluidStorages[slot] == null) slot++; return;
if (slot == fluidStorages.length) return; }
FluidStorage storage = fluidStorages[slot];
if (ioMode == INSERT) { ItemStorage storage = itemStorages[slot];
if (ioMode == IO_MODE_INSERT) {
insertIntoNetwork(storage, slot); insertIntoNetwork(storage, slot);
} else if (ioMode == EXTRACT) { } else if (ioMode == IO_MODE_EXTRACT) {
extractFromNetwork(storage, slot);
}
} else if (type == IType.FLUIDS) {
while (slot < fluidStorages.length && fluidStorages[slot] == null) {
slot++;
}
if (slot == fluidStorages.length) {
return;
}
FluidStorage storage = fluidStorages[slot];
if (ioMode == IO_MODE_INSERT) {
insertIntoNetwork(storage, slot);
} else if (ioMode == IO_MODE_EXTRACT) {
extractFromNetwork(storage, slot); extractFromNetwork(storage, slot);
} }
} }
@@ -192,22 +204,29 @@ public class TileDiskManipulator extends TileNode implements IComparable, IFilte
moveDriveToOutput(slot); moveDriveToOutput(slot);
return; return;
} }
ItemStack extracted = null; ItemStack extracted = null;
int i = 0; int i = 0;
do { do {
ItemStack stack = null; ItemStack stack = null;
while (storage.getItems().size() > i && stack == null) { while (storage.getItems().size() > i && stack == null) {
stack = storage.getItems().get(i++); stack = storage.getItems().get(i++);
} }
if (stack != null) { if (stack != null) {
extracted = storage.extractItem(stack, 1, compare); extracted = storage.extractItem(stack, 1, compare);
} }
} while (storage.getItems().size() > i && extracted == null); } while (storage.getItems().size() > i && extracted == null);
if (extracted == null) { if (extracted == null) {
moveDriveToOutput(slot); moveDriveToOutput(slot);
return; return;
} }
ItemStack remainder = network.insertItem(extracted, extracted.stackSize, false); ItemStack remainder = network.insertItem(extracted, extracted.stackSize, false);
if (remainder != null) { if (remainder != null) {
storage.insertItem(remainder, remainder.stackSize, false); storage.insertItem(remainder, remainder.stackSize, false);
} }
@@ -218,24 +237,31 @@ public class TileDiskManipulator extends TileNode implements IComparable, IFilte
moveDriveToOutput(slot); moveDriveToOutput(slot);
return; return;
} }
ItemStack extracted = null; ItemStack extracted = null;
int i = 0; int i = 0;
if (IFilterable.isEmpty(itemFilters)) { if (IFilterable.isEmpty(itemFilters)) {
ItemStack toExtract = null; ItemStack toExtract = null;
ArrayList<ItemStack> networkItems = new ArrayList<>(network.getItemStorage().getStacks()); ArrayList<ItemStack> networkItems = new ArrayList<>(network.getItemStorage().getStacks());
int iii = 0;
while ((toExtract == null || toExtract.stackSize == 0) && iii < networkItems.size()) { int j = 0;
toExtract = networkItems.get(iii++);
while ((toExtract == null || toExtract.stackSize == 0) && j < networkItems.size()) {
toExtract = networkItems.get(j++);
} }
if (toExtract != null) { if (toExtract != null) {
extracted = network.extractItem(toExtract, 1, compare); extracted = network.extractItem(toExtract, 1, compare);
} }
} else { } else {
while (itemFilters.getSlots() > i && extracted == null) { while (itemFilters.getSlots() > i && extracted == null) {
ItemStack stack = null; ItemStack stack = null;
while (itemFilters.getSlots() > i && stack == null) { while (itemFilters.getSlots() > i && stack == null) {
stack = itemFilters.getStackInSlot(i++); stack = itemFilters.getStackInSlot(i++);
} }
if (stack != null) { if (stack != null) {
extracted = network.extractItem(stack, 1, compare); extracted = network.extractItem(stack, 1, compare);
} }
@@ -246,7 +272,9 @@ public class TileDiskManipulator extends TileNode implements IComparable, IFilte
moveDriveToOutput(slot); moveDriveToOutput(slot);
return; return;
} }
ItemStack remainder = storage.insertItem(extracted, extracted.stackSize, false); ItemStack remainder = storage.insertItem(extracted, extracted.stackSize, false);
if (remainder != null) { if (remainder != null) {
network.insertItem(remainder, remainder.stackSize, false); network.insertItem(remainder, remainder.stackSize, false);
} }
@@ -257,22 +285,29 @@ public class TileDiskManipulator extends TileNode implements IComparable, IFilte
moveDriveToOutput(slot); moveDriveToOutput(slot);
return; return;
} }
FluidStack extracted = null; FluidStack extracted = null;
int i = 0; int i = 0;
do { do {
FluidStack stack = storage.getStacks().get(i); FluidStack stack = storage.getStacks().get(i);
while (stack == null && storage.getStacks().size() > i) { while (stack == null && storage.getStacks().size() > i) {
i++; i++;
} }
if (stack != null) { if (stack != null) {
extracted = storage.extractFluid(stack, 1, compare); extracted = storage.extractFluid(stack, 1, compare);
} }
} while (extracted == null && storage.getStacks().size() > i); } while (extracted == null && storage.getStacks().size() > i);
if (extracted == null) { if (extracted == null) {
moveDriveToOutput(slot); moveDriveToOutput(slot);
return; return;
} }
FluidStack remainder = network.insertFluid(extracted, extracted.amount, false); FluidStack remainder = network.insertFluid(extracted, extracted.amount, false);
if (remainder != null) { if (remainder != null) {
storage.insertFluid(remainder, remainder.amount, false); storage.insertFluid(remainder, remainder.amount, false);
} }
@@ -283,24 +318,31 @@ public class TileDiskManipulator extends TileNode implements IComparable, IFilte
moveDriveToOutput(slot); moveDriveToOutput(slot);
return; return;
} }
FluidStack extracted = null; FluidStack extracted = null;
int i = 0; int i = 0;
if (IFilterable.isEmpty(itemFilters)) { if (IFilterable.isEmpty(itemFilters)) {
FluidStack toExtract = null; FluidStack toExtract = null;
ArrayList<FluidStack> networkFluids = new ArrayList<>(network.getFluidStorage().getStacks()); ArrayList<FluidStack> networkFluids = new ArrayList<>(network.getFluidStorage().getStacks());
int j = 0; int j = 0;
while ((toExtract == null || toExtract.amount == 0) && j < networkFluids.size()) { while ((toExtract == null || toExtract.amount == 0) && j < networkFluids.size()) {
toExtract = networkFluids.get(j++); toExtract = networkFluids.get(j++);
} }
if (toExtract != null) { if (toExtract != null) {
extracted = network.extractFluid(toExtract, 1, compare); extracted = network.extractFluid(toExtract, 1, compare);
} }
} else { } else {
while (fluidFilters.getSlots() > i && extracted == null) { while (fluidFilters.getSlots() > i && extracted == null) {
FluidStack stack = null; FluidStack stack = null;
while (fluidFilters.getSlots() > i && stack == null) { while (fluidFilters.getSlots() > i && stack == null) {
stack = fluidFilters.getFluidStackInSlot(i++); stack = fluidFilters.getFluidStackInSlot(i++);
} }
if (stack != null) { if (stack != null) {
extracted = network.extractFluid(stack, 1, compare); extracted = network.extractFluid(stack, 1, compare);
} }
@@ -311,7 +353,9 @@ public class TileDiskManipulator extends TileNode implements IComparable, IFilte
moveDriveToOutput(slot); moveDriveToOutput(slot);
return; return;
} }
FluidStack remainder = storage.insertFluid(extracted, extracted.amount, false); FluidStack remainder = storage.insertFluid(extracted, extracted.amount, false);
if (remainder != null) { if (remainder != null) {
network.insertFluid(remainder, remainder.amount, false); network.insertFluid(remainder, remainder.amount, false);
} }
@@ -321,22 +365,27 @@ public class TileDiskManipulator extends TileNode implements IComparable, IFilte
ItemStack disk = disks.getStackInSlot(slot); ItemStack disk = disks.getStackInSlot(slot);
if (disk != null) { if (disk != null) {
int i = 6; int i = 6;
while (disks.getStackInSlot(i) != null && i < 12) { while (disks.getStackInSlot(i) != null && i < 12) {
i++; i++;
} }
if (i == 12) { if (i == 12) {
return; return;
} }
if (slot < 6) { if (slot < 6) {
if (itemStorages[slot] != null) { if (itemStorages[slot] != null) {
itemStorages[slot].writeToNBT(); itemStorages[slot].writeToNBT();
itemStorages[slot] = null; itemStorages[slot] = null;
} }
if (fluidStorages[slot] != null) { if (fluidStorages[slot] != null) {
fluidStorages[slot].writeToNBT(); fluidStorages[slot].writeToNBT();
fluidStorages[slot] = null; fluidStorages[slot] = null;
} }
} }
disks.extractItem(slot, 1, false); disks.extractItem(slot, 1, false);
disks.insertItem(i, disk, false); disks.insertItem(i, disk, false);
} }
@@ -442,11 +491,16 @@ public class TileDiskManipulator extends TileNode implements IComparable, IFilte
} }
public void onBreak() { public void onBreak() {
for (ItemStorage storage : itemStorages) for (ItemStorage storage : itemStorages) {
if (storage != null) if (storage != null) {
storage.writeToNBT(); storage.writeToNBT();
for (FluidStorage storage : fluidStorages) }
if (storage != null) }
for (FluidStorage storage : fluidStorages) {
if (storage != null) {
storage.writeToNBT(); storage.writeToNBT();
}
}
} }
} }

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.0 KiB

After

Width:  |  Height:  |  Size: 3.0 KiB