Pattern grid
This commit is contained in:
@@ -34,7 +34,7 @@ public class BlockGrid extends BlockMachine {
|
||||
|
||||
@Override
|
||||
public void getSubBlocks(Item item, CreativeTabs tab, List subItems) {
|
||||
for (int i = 0; i <= 1; i++) {
|
||||
for (int i = 0; i <= 2; i++) {
|
||||
subItems.add(new ItemStack(item, 1, i));
|
||||
}
|
||||
}
|
||||
@@ -50,12 +50,12 @@ public class BlockGrid extends BlockMachine {
|
||||
|
||||
@Override
|
||||
public IBlockState getStateFromMeta(int meta) {
|
||||
return getDefaultState().withProperty(TYPE, meta == 0 ? EnumGridType.NORMAL : EnumGridType.CRAFTING);
|
||||
return getDefaultState().withProperty(TYPE, meta == 0 ? EnumGridType.NORMAL : (meta == 1 ? EnumGridType.CRAFTING : EnumGridType.PATTERN));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetaFromState(IBlockState state) {
|
||||
return state.getValue(TYPE) == EnumGridType.NORMAL ? 0 : 1;
|
||||
return state.getValue(TYPE) == EnumGridType.NORMAL ? 0 : (state.getValue(TYPE) == EnumGridType.CRAFTING ? 1 : 2);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -4,7 +4,8 @@ import net.minecraft.util.IStringSerializable;
|
||||
|
||||
public enum EnumGridType implements IStringSerializable {
|
||||
NORMAL(0, "normal"),
|
||||
CRAFTING(1, "crafting");
|
||||
CRAFTING(1, "crafting"),
|
||||
PATTERN(2, "pattern");
|
||||
|
||||
private int id;
|
||||
private String name;
|
||||
|
||||
@@ -7,8 +7,9 @@ import net.minecraft.inventory.ICrafting;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import refinedstorage.RefinedStorage;
|
||||
import refinedstorage.RefinedStorageItems;
|
||||
import refinedstorage.block.EnumGridType;
|
||||
import refinedstorage.container.slot.SlotGridCraftingResult;
|
||||
import refinedstorage.container.slot.*;
|
||||
import refinedstorage.network.MessageGridCraftingShift;
|
||||
import refinedstorage.tile.grid.IGrid;
|
||||
import refinedstorage.tile.grid.TileGrid;
|
||||
@@ -27,7 +28,7 @@ public class ContainerGrid extends ContainerBase {
|
||||
|
||||
this.grid = grid;
|
||||
|
||||
addPlayerInventory(8, grid.getType() == EnumGridType.CRAFTING ? 174 : 126);
|
||||
addPlayerInventory(8, (grid.getType() == EnumGridType.CRAFTING || grid.getType() == EnumGridType.PATTERN) ? 174 : 126);
|
||||
|
||||
if (grid.getType() == EnumGridType.CRAFTING) {
|
||||
int x = 25;
|
||||
@@ -49,6 +50,25 @@ public class ContainerGrid extends ContainerBase {
|
||||
}
|
||||
|
||||
addSlotToContainer(new SlotGridCraftingResult(this, player, ((TileGrid) grid).getCraftingInventory(), ((TileGrid) grid).getCraftingResultInventory(), (TileGrid) grid, 0, 133 + 4, 120 + 4));
|
||||
} else if (grid.getType() == EnumGridType.PATTERN) {
|
||||
int x = 8;
|
||||
int y = 106;
|
||||
|
||||
for (int i = 0; i < 9; ++i) {
|
||||
addSlotToContainer(new SlotSpecimen(((TileGrid) grid).getCraftingInventory(), i, x, y, false));
|
||||
|
||||
x += 18;
|
||||
|
||||
if ((i + 1) % 3 == 0) {
|
||||
y += 18;
|
||||
x = 8;
|
||||
}
|
||||
}
|
||||
|
||||
addSlotToContainer(new SlotDisabled(((TileGrid) grid).getCraftingResultInventory(), 0, 116 + 4, 120 + 4));
|
||||
|
||||
addSlotToContainer(new SlotFiltered(((TileGrid) grid).getPatternsInventory(), 0, 152, 106, new BasicItemValidator(RefinedStorageItems.PATTERN)));
|
||||
addSlotToContainer(new SlotOutput(((TileGrid) grid).getPatternsInventory(), 1, 152, 142));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -93,7 +113,7 @@ public class ContainerGrid extends ContainerBase {
|
||||
public ItemStack func_184996_a(int id, int clickedButton, ClickType clickType, EntityPlayer player) {
|
||||
Slot slot = id >= 0 ? getSlot(id) : null;
|
||||
|
||||
if (player.worldObj.isRemote && slot instanceof SlotGridCraftingResult && slot.getHasStack()) {
|
||||
if (player.worldObj.isRemote && slot instanceof SlotGridCraftingResult && grid.getType() == EnumGridType.CRAFTING && slot.getHasStack()) {
|
||||
if (GuiScreen.isShiftKeyDown()) {
|
||||
RefinedStorage.NETWORK.sendToServer(new MessageGridCraftingShift((TileGrid) grid));
|
||||
|
||||
|
||||
@@ -40,11 +40,11 @@ public class GuiGrid extends GuiBase {
|
||||
private Scrollbar scrollbar;
|
||||
|
||||
public GuiGrid(ContainerGrid container, IGrid grid) {
|
||||
super(container, 193, grid.getType() == EnumGridType.CRAFTING ? 256 : 208);
|
||||
super(container, 193, (grid.getType() == EnumGridType.CRAFTING || grid.getType() == EnumGridType.PATTERN) ? 256 : 208);
|
||||
|
||||
this.container = container;
|
||||
this.grid = grid;
|
||||
this.scrollbar = new Scrollbar(174, 20, 12, grid.getType() == EnumGridType.CRAFTING ? 70 : 88);
|
||||
this.scrollbar = new Scrollbar(174, 20, 12, (grid.getType() == EnumGridType.CRAFTING || grid.getType() == EnumGridType.PATTERN) ? 70 : 88);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -141,6 +141,8 @@ public class GuiGrid extends GuiBase {
|
||||
public boolean isHoveringOverClear(int mouseX, int mouseY) {
|
||||
if (grid.getType() == EnumGridType.CRAFTING) {
|
||||
return inBounds(81, 105, 7, 7, mouseX, mouseY);
|
||||
} else if (grid.getType() == EnumGridType.PATTERN) {
|
||||
return inBounds(64, 105, 7, 7, mouseX, mouseY);
|
||||
}
|
||||
|
||||
return false;
|
||||
@@ -150,6 +152,8 @@ public class GuiGrid extends GuiBase {
|
||||
public void drawBackground(int x, int y, int mouseX, int mouseY) {
|
||||
if (grid.getType() == EnumGridType.CRAFTING) {
|
||||
bindTexture("gui/crafting_grid.png");
|
||||
} else if (grid.getType() == EnumGridType.PATTERN) {
|
||||
bindTexture("gui/pattern_grid.png");
|
||||
} else {
|
||||
bindTexture("gui/grid.png");
|
||||
}
|
||||
@@ -169,9 +173,11 @@ public class GuiGrid extends GuiBase {
|
||||
|
||||
if (grid.getType() == EnumGridType.CRAFTING) {
|
||||
drawString(7, 94, t("container.crafting"));
|
||||
} else if (grid.getType() == EnumGridType.PATTERN) {
|
||||
drawString(7, 94, t("gui.refinedstorage:grid.pattern"));
|
||||
}
|
||||
|
||||
drawString(7, grid.getType() == EnumGridType.CRAFTING ? 163 : 113, t("container.inventory"));
|
||||
drawString(7, (grid.getType() == EnumGridType.CRAFTING || grid.getType() == EnumGridType.PATTERN) ? 163 : 113, t("container.inventory"));
|
||||
|
||||
int x = 8;
|
||||
int y = 20;
|
||||
@@ -313,6 +319,6 @@ public class GuiGrid extends GuiBase {
|
||||
}
|
||||
|
||||
public int getVisibleRows() {
|
||||
return grid.getType() == EnumGridType.CRAFTING ? 4 : 5;
|
||||
return (grid.getType() == EnumGridType.CRAFTING || grid.getType() == EnumGridType.PATTERN) ? 4 : 5;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,7 +44,8 @@ public class MessageGridCraftingClear extends MessageHandlerPlayerToServer<Messa
|
||||
if (tile instanceof TileGrid) {
|
||||
TileGrid grid = (TileGrid) tile;
|
||||
|
||||
if (grid.isConnected() && grid.getType() == EnumGridType.CRAFTING) {
|
||||
if (grid.isConnected()) {
|
||||
if (grid.getType() == EnumGridType.CRAFTING) {
|
||||
for (int i = 0; i < grid.getCraftingInventory().getSizeInventory(); ++i) {
|
||||
ItemStack slot = grid.getCraftingInventory().getStackInSlot(i);
|
||||
|
||||
@@ -54,6 +55,11 @@ public class MessageGridCraftingClear extends MessageHandlerPlayerToServer<Messa
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (grid.getType() == EnumGridType.PATTERN) {
|
||||
for (int i = 0; i < grid.getCraftingInventory().getSizeInventory(); ++i) {
|
||||
grid.getCraftingInventory().setInventorySlotContents(i, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -88,6 +88,7 @@ public class ClientProxy extends CommonProxy {
|
||||
ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(RefinedStorageBlocks.CABLE), 0, new ModelResourceLocation("refinedstorage:cable", "inventory"));
|
||||
ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(RefinedStorageBlocks.GRID), EnumGridType.NORMAL.getId(), new ModelResourceLocation("refinedstorage:grid", "inventory"));
|
||||
ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(RefinedStorageBlocks.GRID), EnumGridType.CRAFTING.getId(), new ModelResourceLocation("refinedstorage:grid", "inventory"));
|
||||
ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(RefinedStorageBlocks.GRID), EnumGridType.PATTERN.getId(), new ModelResourceLocation("refinedstorage:grid", "inventory"));
|
||||
ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(RefinedStorageBlocks.MACHINE_CASING), 0, new ModelResourceLocation("refinedstorage:machine_casing", "inventory"));
|
||||
ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(RefinedStorageBlocks.EXPORTER), 0, new ModelResourceLocation("refinedstorage:exporter", "inventory"));
|
||||
ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(RefinedStorageBlocks.IMPORTER), 0, new ModelResourceLocation("refinedstorage:importer", "inventory"));
|
||||
|
||||
@@ -189,6 +189,9 @@ public class CommonProxy {
|
||||
// Crafting Grid
|
||||
SoldererRegistry.addRecipe(new SoldererRecipeCraftingGrid());
|
||||
|
||||
// Pattern Grid
|
||||
SoldererRegistry.addRecipe(new SoldererRecipePatternGrid());
|
||||
|
||||
// Wireless Grid
|
||||
GameRegistry.addRecipe(new ItemStack(RefinedStorageItems.WIRELESS_GRID, 1, ItemWirelessGrid.TYPE_NORMAL),
|
||||
" P ",
|
||||
|
||||
@@ -53,6 +53,8 @@ public class TileGrid extends TileMachine implements IGrid {
|
||||
private InventoryCrafting craftingInventory = new InventoryCrafting(craftingContainer, 3, 3);
|
||||
private InventorySimple craftingResultInventory = new InventorySimple("crafting_result", 1);
|
||||
|
||||
private InventorySimple patternsInventory = new InventorySimple("patterns", 2);
|
||||
|
||||
private int sortingDirection = SORTING_DIRECTION_DESCENDING;
|
||||
private int sortingType = SORTING_TYPE_NAME;
|
||||
private int searchBoxMode = SEARCH_BOX_MODE_NORMAL;
|
||||
@@ -99,6 +101,10 @@ public class TileGrid extends TileMachine implements IGrid {
|
||||
return craftingResultInventory;
|
||||
}
|
||||
|
||||
public InventorySimple getPatternsInventory() {
|
||||
return patternsInventory;
|
||||
}
|
||||
|
||||
public void onCraftingMatrixChanged() {
|
||||
markDirty();
|
||||
|
||||
@@ -240,6 +246,7 @@ public class TileGrid extends TileMachine implements IGrid {
|
||||
super.readFromNBT(nbt);
|
||||
|
||||
InventoryUtils.restoreInventory(craftingInventory, 0, nbt);
|
||||
InventoryUtils.restoreInventory(patternsInventory, 1, nbt);
|
||||
|
||||
if (nbt.hasKey(NBT_SORTING_DIRECTION)) {
|
||||
sortingDirection = nbt.getInteger(NBT_SORTING_DIRECTION);
|
||||
@@ -259,6 +266,7 @@ public class TileGrid extends TileMachine implements IGrid {
|
||||
super.writeToNBT(nbt);
|
||||
|
||||
InventoryUtils.saveInventory(craftingInventory, 0, nbt);
|
||||
InventoryUtils.saveInventory(patternsInventory, 1, nbt);
|
||||
|
||||
nbt.setInteger(NBT_SORTING_DIRECTION, sortingDirection);
|
||||
nbt.setInteger(NBT_SORTING_TYPE, sortingType);
|
||||
|
||||
@@ -13,7 +13,7 @@ public class SoldererRecipeCraftingGrid implements ISoldererRecipe {
|
||||
if (row == 0) {
|
||||
return new ItemStack(RefinedStorageItems.PROCESSOR, 1, ItemProcessor.TYPE_ADVANCED);
|
||||
} else if (row == 1) {
|
||||
return new ItemStack(RefinedStorageBlocks.GRID, 1, 0);
|
||||
return new ItemStack(RefinedStorageBlocks.GRID, 1, EnumGridType.NORMAL.getId());
|
||||
} else if (row == 2) {
|
||||
return new ItemStack(Blocks.crafting_table);
|
||||
}
|
||||
|
||||
32
src/main/java/refinedstorage/tile/solderer/SoldererRecipePatternGrid.java
Executable file
32
src/main/java/refinedstorage/tile/solderer/SoldererRecipePatternGrid.java
Executable file
@@ -0,0 +1,32 @@
|
||||
package refinedstorage.tile.solderer;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import refinedstorage.RefinedStorageBlocks;
|
||||
import refinedstorage.RefinedStorageItems;
|
||||
import refinedstorage.block.EnumGridType;
|
||||
import refinedstorage.item.ItemProcessor;
|
||||
|
||||
public class SoldererRecipePatternGrid 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.GRID, 1, EnumGridType.NORMAL.getId());
|
||||
} else if (row == 2) {
|
||||
return new ItemStack(RefinedStorageItems.PATTERN);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getResult() {
|
||||
return new ItemStack(RefinedStorageBlocks.GRID, 1, EnumGridType.PATTERN.getId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDuration() {
|
||||
return 500;
|
||||
}
|
||||
}
|
||||
@@ -21,6 +21,8 @@
|
||||
"normal": {
|
||||
},
|
||||
"crafting": {
|
||||
},
|
||||
"pattern": {
|
||||
}
|
||||
},
|
||||
"connected": {
|
||||
|
||||
@@ -6,6 +6,7 @@ gui.refinedstorage:controller.machine_position.x=X: %d
|
||||
gui.refinedstorage:controller.machine_position.y=Y: %d
|
||||
gui.refinedstorage:controller.machine_position.z=Z: %d
|
||||
gui.refinedstorage:grid=Grid
|
||||
gui.refinedstorage:grid.pattern=Pattern
|
||||
gui.refinedstorage:wireless_grid=Wireless Grid
|
||||
gui.refinedstorage:disk_drive=Drive
|
||||
gui.refinedstorage:external_storage=External Storage
|
||||
@@ -72,6 +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:grid.2.name=Pattern Grid
|
||||
block.refinedstorage:disk_drive.name=Disk Drive
|
||||
block.refinedstorage:external_storage.name=External Storage
|
||||
block.refinedstorage:importer.name=Importer
|
||||
|
||||
@@ -6,6 +6,7 @@ gui.refinedstorage:controller.machine_position.x=X: %d
|
||||
gui.refinedstorage:controller.machine_position.y=Y: %d
|
||||
gui.refinedstorage:controller.machine_position.z=Z: %d
|
||||
gui.refinedstorage:grid=Rooster
|
||||
gui.refinedstorage:grid.pattern=Patroon
|
||||
gui.refinedstorage:wireless_grid=Draadloos Rooster
|
||||
gui.refinedstorage:disk_drive=Schijf
|
||||
gui.refinedstorage:external_storage=Externe Opslag
|
||||
@@ -72,6 +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:grid.2.name=Patroon Rooster
|
||||
block.refinedstorage:disk_drive.name=Schijf
|
||||
block.refinedstorage:external_storage.name=Externe Opslag
|
||||
block.refinedstorage:importer.name=Importeur
|
||||
|
||||
Reference in New Issue
Block a user