make larger crafting grids possible
This commit is contained in:
parent
aa0ff6cf96
commit
8bd9370bab
11 changed files with 97 additions and 102 deletions
|
@ -1,42 +1,22 @@
|
||||||
package client.gui.container;
|
package client.gui.container;
|
||||||
|
|
||||||
|
import common.block.BlockWorkbench;
|
||||||
import common.inventory.ContainerWorkbench;
|
import common.inventory.ContainerWorkbench;
|
||||||
import common.inventory.InventoryPlayer;
|
import common.inventory.InventoryPlayer;
|
||||||
import common.util.BlockPos;
|
import common.util.BlockPos;
|
||||||
import common.world.World;
|
import common.world.World;
|
||||||
|
|
||||||
public class GuiCrafting extends GuiContainer
|
public class GuiCrafting extends GuiContainer {
|
||||||
{
|
private final BlockWorkbench type;
|
||||||
// private static final String craftingTableGuiTextures = "textures/gui/crafting_table.png";
|
|
||||||
|
public GuiCrafting(InventoryPlayer playerInv, World worldIn, BlockWorkbench type) {
|
||||||
|
super(new ContainerWorkbench(playerInv, worldIn, BlockPos.ORIGIN, type));
|
||||||
|
this.type = type;
|
||||||
|
this.ySize = 112 + 18 * this.type.getSize();
|
||||||
|
}
|
||||||
|
|
||||||
public GuiCrafting(InventoryPlayer playerInv, World worldIn)
|
public void drawGuiContainerForegroundLayer() {
|
||||||
{
|
this.drawString("Handwerk (" + this.type.getDisplay() + ")", 26, 6);
|
||||||
this(playerInv, worldIn, BlockPos.ORIGIN);
|
this.drawString("Inventar", 8, this.ySize - 96 + 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
public GuiCrafting(InventoryPlayer playerInv, World worldIn, BlockPos blockPosition)
|
|
||||||
{
|
|
||||||
super(new ContainerWorkbench(playerInv, worldIn, blockPosition));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Draw the foreground layer for the GuiContainer (everything in front of the items). Args : mouseX, mouseY
|
|
||||||
*/
|
|
||||||
public void drawGuiContainerForegroundLayer()
|
|
||||||
{
|
|
||||||
this.drawString("Handwerk", 28, 6);
|
|
||||||
this.drawString("Inventar", 8, this.ySize - 96 + 2);
|
|
||||||
}
|
|
||||||
|
|
||||||
// /**
|
|
||||||
// * Args : renderPartialTicks, mouseX, mouseY
|
|
||||||
// */
|
|
||||||
// protected void drawGuiContainerBackgroundLayer(int mouseX, int mouseY)
|
|
||||||
// {
|
|
||||||
// GlState.color(1.0F, 1.0F, 1.0F, 1.0F);
|
|
||||||
// this.gm.getTextureManager().bindTexture(craftingTableGuiTextures);
|
|
||||||
// int i = (this.width - this.xSize) / 2;
|
|
||||||
// int j = (this.height - this.ySize) / 2;
|
|
||||||
//// this.rect(i, j, 0, 0, this.xSize, this.ySize);
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,6 +34,8 @@ import common.attributes.Attribute;
|
||||||
import common.attributes.AttributeInstance;
|
import common.attributes.AttributeInstance;
|
||||||
import common.attributes.AttributeMap;
|
import common.attributes.AttributeMap;
|
||||||
import common.attributes.AttributeModifier;
|
import common.attributes.AttributeModifier;
|
||||||
|
import common.block.Block;
|
||||||
|
import common.block.BlockWorkbench;
|
||||||
import common.collect.Lists;
|
import common.collect.Lists;
|
||||||
import common.collect.Maps;
|
import common.collect.Maps;
|
||||||
import common.dimension.Dimension;
|
import common.dimension.Dimension;
|
||||||
|
@ -47,6 +49,7 @@ import common.entity.npc.EntityNPC;
|
||||||
import common.entity.npc.PlayerCharacter;
|
import common.entity.npc.PlayerCharacter;
|
||||||
import common.entity.projectile.EntityProjectile;
|
import common.entity.projectile.EntityProjectile;
|
||||||
import common.entity.types.EntityLiving;
|
import common.entity.types.EntityLiving;
|
||||||
|
import common.init.BlockRegistry;
|
||||||
import common.init.EntityRegistry;
|
import common.init.EntityRegistry;
|
||||||
import common.init.ItemRegistry;
|
import common.init.ItemRegistry;
|
||||||
import common.init.SoundEvent;
|
import common.init.SoundEvent;
|
||||||
|
@ -2047,11 +2050,11 @@ public class ClientPlayer extends NetHandler implements IClientPlayer
|
||||||
public void displayGui(IInteractionObject guiOwner, InventoryPlayer inventory, World worldObj) {
|
public void displayGui(IInteractionObject guiOwner, InventoryPlayer inventory, World worldObj) {
|
||||||
String s = guiOwner.getGuiID();
|
String s = guiOwner.getGuiID();
|
||||||
|
|
||||||
if ("crafting_table".equals(s))
|
Block block = BlockRegistry.getRegisteredBlock(s);
|
||||||
{
|
if(block instanceof BlockWorkbench) {
|
||||||
this.gameController.displayGuiScreen(new GuiCrafting(inventory, worldObj));
|
this.gameController.displayGuiScreen(new GuiCrafting(inventory, worldObj, (BlockWorkbench)block));
|
||||||
}
|
}
|
||||||
else if ("enchanting_table".equals(s))
|
else if ("enchanting_table".equals(s))
|
||||||
{
|
{
|
||||||
this.gameController.displayGuiScreen(new GuiEnchant(inventory, worldObj, guiOwner));
|
this.gameController.displayGuiScreen(new GuiEnchant(inventory, worldObj, guiOwner));
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package common.block;
|
package common.block;
|
||||||
|
|
||||||
import common.entity.npc.EntityNPC;
|
import common.entity.npc.EntityNPC;
|
||||||
|
import common.init.BlockRegistry;
|
||||||
import common.inventory.Container;
|
import common.inventory.Container;
|
||||||
import common.inventory.ContainerWorkbench;
|
import common.inventory.ContainerWorkbench;
|
||||||
import common.inventory.InventoryPlayer;
|
import common.inventory.InventoryPlayer;
|
||||||
|
@ -16,11 +17,18 @@ import common.world.World;
|
||||||
|
|
||||||
public class BlockWorkbench extends Block
|
public class BlockWorkbench extends Block
|
||||||
{
|
{
|
||||||
public BlockWorkbench()
|
private final int size;
|
||||||
|
|
||||||
|
public BlockWorkbench(int size)
|
||||||
{
|
{
|
||||||
super(Material.wood);
|
super(Material.wood);
|
||||||
this.setTab(CheatTab.tabTech);
|
this.setTab(CheatTab.tabTech);
|
||||||
|
this.size = size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getSize() {
|
||||||
|
return this.size;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean onBlockActivated(World worldIn, BlockPos pos, State state, EntityNPC playerIn, Facing side, float hitX, float hitY, float hitZ)
|
public boolean onBlockActivated(World worldIn, BlockPos pos, State state, EntityNPC playerIn, Facing side, float hitX, float hitY, float hitZ)
|
||||||
{
|
{
|
||||||
|
@ -30,7 +38,7 @@ public class BlockWorkbench extends Block
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
playerIn.displayGui(new BlockWorkbench.InterfaceCraftingTable(worldIn, pos));
|
playerIn.displayGui(new BlockWorkbench.InterfaceCraftingTable(worldIn, pos, this));
|
||||||
// playerIn.triggerAchievement(StatRegistry.craftingTableStat);
|
// playerIn.triggerAchievement(StatRegistry.craftingTableStat);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -45,36 +53,28 @@ public class BlockWorkbench extends Block
|
||||||
{
|
{
|
||||||
private final World world;
|
private final World world;
|
||||||
private final BlockPos position;
|
private final BlockPos position;
|
||||||
|
private final BlockWorkbench block;
|
||||||
|
|
||||||
public InterfaceCraftingTable(World worldIn, BlockPos pos)
|
public InterfaceCraftingTable(World worldIn, BlockPos pos, BlockWorkbench block)
|
||||||
{
|
{
|
||||||
this.world = worldIn;
|
this.world = worldIn;
|
||||||
this.position = pos;
|
this.position = pos;
|
||||||
|
this.block = block;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getName()
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean hasCustomName()
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getCommandName()
|
public String getCommandName()
|
||||||
{
|
{
|
||||||
return "Werkbank";
|
return this.block.getDisplay();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Container createContainer(InventoryPlayer playerInventory, EntityNPC playerIn)
|
public Container createContainer(InventoryPlayer playerInventory, EntityNPC playerIn)
|
||||||
{
|
{
|
||||||
return new ContainerWorkbench(playerInventory, this.world, this.position);
|
return new ContainerWorkbench(playerInventory, this.world, this.position, this.block);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getGuiID()
|
public String getGuiID()
|
||||||
{
|
{
|
||||||
return "crafting_table";
|
return BlockRegistry.REGISTRY.getNameForObject(this.block);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -527,7 +527,7 @@ public abstract class BlockRegistry {
|
||||||
.setDisplay("Chunk-Lade-Kern"));
|
.setDisplay("Chunk-Lade-Kern"));
|
||||||
registerBlock(2001, "mob_spawner",
|
registerBlock(2001, "mob_spawner",
|
||||||
(new BlockMobSpawner()).setHardness(5.0F).setStepSound(SoundType.STONE).setDisplay("Monsterspawner"));
|
(new BlockMobSpawner()).setHardness(5.0F).setStepSound(SoundType.STONE).setDisplay("Monsterspawner"));
|
||||||
registerBlock(2002, "crafting_table", (new BlockWorkbench()).setHardness(2.5F).setStepSound(SoundType.WOOD).setDisplay("Werkbank"));
|
registerBlock(2002, "workbench", (new BlockWorkbench(3)).setHardness(2.5F).setStepSound(SoundType.WOOD).setDisplay("Werkbank"));
|
||||||
registerBlock(2003, "furnace", (new BlockFurnace(false)).setHardness(3.5F).setStepSound(SoundType.STONE).setDisplay("Ofen")
|
registerBlock(2003, "furnace", (new BlockFurnace(false)).setHardness(3.5F).setStepSound(SoundType.STONE).setDisplay("Ofen")
|
||||||
.setTab(CheatTab.tabTech));
|
.setTab(CheatTab.tabTech));
|
||||||
registerBlock(2004, "lit_furnace", (new BlockFurnace(true)).setHardness(3.5F).setStepSound(SoundType.STONE).setLightLevel(0.875F)
|
registerBlock(2004, "lit_furnace", (new BlockFurnace(true)).setHardness(3.5F).setStepSound(SoundType.STONE).setLightLevel(0.875F)
|
||||||
|
@ -542,6 +542,8 @@ public abstract class BlockRegistry {
|
||||||
registerBlock(2010, "noteblock", (new BlockNote()).setHardness(0.8F).setDisplay("Notenblock"));
|
registerBlock(2010, "noteblock", (new BlockNote()).setHardness(0.8F).setDisplay("Notenblock"));
|
||||||
registerBlock(2011, "jukebox",
|
registerBlock(2011, "jukebox",
|
||||||
(new BlockJukebox()).setHardness(2.0F).setResistance(10.0F).setStepSound(SoundType.STONE).setDisplay("Plattenspieler"));
|
(new BlockJukebox()).setHardness(2.0F).setResistance(10.0F).setStepSound(SoundType.STONE).setDisplay("Plattenspieler"));
|
||||||
|
registerBlock(2012, "construction_table", (new BlockWorkbench(4)).setHardness(2.5F).setStepSound(SoundType.WOOD).setDisplay("Konstruktionstisch"));
|
||||||
|
registerBlock(2013, "assembly_unit", (new BlockWorkbench(5)).setHardness(2.5F).setStepSound(SoundType.WOOD).setDisplay("Fertigungseinheit"));
|
||||||
|
|
||||||
registerBlock(2100, "chest", (new BlockChest(0)).setHardness(2.5F).setStepSound(SoundType.WOOD).setDisplay("Truhe"));
|
registerBlock(2100, "chest", (new BlockChest(0)).setHardness(2.5F).setStepSound(SoundType.WOOD).setDisplay("Truhe"));
|
||||||
registerBlock(2101, "trapped_chest", (new BlockChest(1)).setHardness(2.5F).setStepSound(SoundType.WOOD).setDisplay("Redstonetruhe"));
|
registerBlock(2101, "trapped_chest", (new BlockChest(1)).setHardness(2.5F).setStepSound(SoundType.WOOD).setDisplay("Redstonetruhe"));
|
||||||
|
|
|
@ -142,7 +142,9 @@ public abstract class Blocks {
|
||||||
public static final BlockRedstoneWire redstone = (BlockRedstoneWire)get("redstone");
|
public static final BlockRedstoneWire redstone = (BlockRedstoneWire)get("redstone");
|
||||||
public static final BlockOre diamond_ore = (BlockOre)get("diamond_ore");
|
public static final BlockOre diamond_ore = (BlockOre)get("diamond_ore");
|
||||||
public static final Block diamond_block = get("diamond_block");
|
public static final Block diamond_block = get("diamond_block");
|
||||||
public static final Block crafting_table = get("crafting_table");
|
public static final Block workbench = get("workbench");
|
||||||
|
public static final Block construction_table = get("construction_table");
|
||||||
|
public static final Block assembly_unit = get("assembly_unit");
|
||||||
public static final Block wheat = get("wheat");
|
public static final Block wheat = get("wheat");
|
||||||
public static final Block farmland = get("farmland");
|
public static final Block farmland = get("farmland");
|
||||||
public static final Block furnace = get("furnace");
|
public static final Block furnace = get("furnace");
|
||||||
|
|
|
@ -315,7 +315,8 @@ public abstract class CraftingRegistry
|
||||||
add(new ItemStack(Blocks.daylight_detector), "GGG", "QQQ", "WWW", 'G', Blocks.glass, 'Q', Items.quartz, 'W', slab);
|
add(new ItemStack(Blocks.daylight_detector), "GGG", "QQQ", "WWW", 'G', Blocks.glass, 'Q', Items.quartz, 'W', slab);
|
||||||
|
|
||||||
add(new ItemStack(Blocks.chest), "###", "# #", "###", '#', planks);
|
add(new ItemStack(Blocks.chest), "###", "# #", "###", '#', planks);
|
||||||
addBasic(new ItemStack(Blocks.crafting_table), "##", "##", '#', planks);
|
addBasic(new ItemStack(Blocks.workbench), "##", "##", '#', planks);
|
||||||
|
add(new ItemStack(Blocks.assembly_unit), "----", "XXXX", "X##X", '#', Blocks.construction_table, '-', Items.titanium_ingot, 'X', planks);
|
||||||
|
|
||||||
|
|
||||||
add(new ItemStack(Blocks.jukebox, 1), "###", "#X#", "###", '#', planks, 'X', Items.diamond);
|
add(new ItemStack(Blocks.jukebox, 1), "###", "#X#", "###", '#', planks, 'X', Items.diamond);
|
||||||
|
@ -466,6 +467,9 @@ public abstract class CraftingRegistry
|
||||||
add(new ItemStack(Items.magnet, 1), "I I", "N N", " R ", 'I', Items.iron_ingot, 'N', Items.neodymium_ingot, 'R', Items.redstone);
|
add(new ItemStack(Items.magnet, 1), "I I", "N N", " R ", 'I', Items.iron_ingot, 'N', Items.neodymium_ingot, 'R', Items.redstone);
|
||||||
|
|
||||||
addShapeless(new ItemStack(Items.potion, 1, 16384), new ItemStack(Items.potion, 1, 0), Items.gunpowder);
|
addShapeless(new ItemStack(Items.potion, 1, 16384), new ItemStack(Items.potion, 1, 0), Items.gunpowder);
|
||||||
|
|
||||||
|
add(new ItemStack(Blocks.construction_table), "---", "-#-", "---", '#', Blocks.workbench, '-', Items.iron_ingot);
|
||||||
|
add(new ItemStack(Blocks.bedrock), "#####", "#####", "#####", "#####", "#####", '#', Blocks.obsidian);
|
||||||
|
|
||||||
Collections.sort(recipes, new Comparator<IRecipe>()
|
Collections.sort(recipes, new Comparator<IRecipe>()
|
||||||
{
|
{
|
||||||
|
@ -1570,9 +1574,9 @@ public abstract class CraftingRegistry
|
||||||
*/
|
*/
|
||||||
public boolean matches(InventoryCrafting inv, World worldIn)
|
public boolean matches(InventoryCrafting inv, World worldIn)
|
||||||
{
|
{
|
||||||
for (int i = 0; i <= 3 - this.recipeWidth; ++i)
|
for (int i = 0; i <= inv.getWidth() - this.recipeWidth; ++i)
|
||||||
{
|
{
|
||||||
for (int j = 0; j <= 3 - this.recipeHeight; ++j)
|
for (int j = 0; j <= inv.getHeight() - this.recipeHeight; ++j)
|
||||||
{
|
{
|
||||||
if (this.checkMatch(inv, i, j, true))
|
if (this.checkMatch(inv, i, j, true))
|
||||||
{
|
{
|
||||||
|
@ -1592,43 +1596,43 @@ public abstract class CraftingRegistry
|
||||||
/**
|
/**
|
||||||
* Checks if the region of a crafting inventory is match for the recipe.
|
* Checks if the region of a crafting inventory is match for the recipe.
|
||||||
*/
|
*/
|
||||||
private boolean checkMatch(InventoryCrafting p_77573_1_, int p_77573_2_, int p_77573_3_, boolean p_77573_4_)
|
private boolean checkMatch(InventoryCrafting inv, int xPos, int yPos, boolean mirror)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < 3; ++i)
|
for (int x = 0; x < inv.getWidth(); ++x)
|
||||||
{
|
{
|
||||||
for (int j = 0; j < 3; ++j)
|
for (int y = 0; y < inv.getHeight(); ++y)
|
||||||
{
|
{
|
||||||
int k = i - p_77573_2_;
|
int rx = x - xPos;
|
||||||
int l = j - p_77573_3_;
|
int ry = y - yPos;
|
||||||
ItemStack itemstack = null;
|
ItemStack stack = null;
|
||||||
|
|
||||||
if (k >= 0 && l >= 0 && k < this.recipeWidth && l < this.recipeHeight)
|
if (rx >= 0 && ry >= 0 && rx < this.recipeWidth && ry < this.recipeHeight)
|
||||||
{
|
{
|
||||||
if (p_77573_4_)
|
if (mirror)
|
||||||
{
|
{
|
||||||
itemstack = this.recipeItems[this.recipeWidth - k - 1 + l * this.recipeWidth];
|
stack = this.recipeItems[this.recipeWidth - rx - 1 + ry * this.recipeWidth];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
itemstack = this.recipeItems[k + l * this.recipeWidth];
|
stack = this.recipeItems[rx + ry * this.recipeWidth];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ItemStack itemstack1 = p_77573_1_.getStackInRowAndColumn(i, j);
|
ItemStack ingredient = inv.getStackInRowAndColumn(x, y);
|
||||||
|
|
||||||
if (itemstack1 != null || itemstack != null)
|
if (ingredient != null || stack != null)
|
||||||
{
|
{
|
||||||
if (itemstack1 == null && itemstack != null || itemstack1 != null && itemstack == null)
|
if (ingredient == null && stack != null || ingredient != null && stack == null)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (itemstack.getItem() != itemstack1.getItem())
|
if (stack.getItem() != ingredient.getItem())
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (itemstack.getMetadata() != 32767 && itemstack.getMetadata() != itemstack1.getMetadata())
|
if (stack.getMetadata() != 32767 && stack.getMetadata() != ingredient.getMetadata())
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -120,6 +120,7 @@ public abstract class Items {
|
||||||
public static final Item iron_hoe = get("iron_hoe");
|
public static final Item iron_hoe = get("iron_hoe");
|
||||||
public static final Item iron_horse_armor = get("iron_horse_armor");
|
public static final Item iron_horse_armor = get("iron_horse_armor");
|
||||||
public static final Item iron_ingot = get("iron_ingot");
|
public static final Item iron_ingot = get("iron_ingot");
|
||||||
|
public static final Item titanium_ingot = get("titanium_ingot");
|
||||||
public static final ItemArmor iron_leggings = (ItemArmor)get("iron_leggings");
|
public static final ItemArmor iron_leggings = (ItemArmor)get("iron_leggings");
|
||||||
public static final Item iron_pickaxe = get("iron_pickaxe");
|
public static final Item iron_pickaxe = get("iron_pickaxe");
|
||||||
public static final ItemShears iron_shears = (ItemShears)get("iron_shears");
|
public static final ItemShears iron_shears = (ItemShears)get("iron_shears");
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package common.inventory;
|
package common.inventory;
|
||||||
|
|
||||||
|
import common.block.BlockWorkbench;
|
||||||
import common.entity.npc.EntityNPC;
|
import common.entity.npc.EntityNPC;
|
||||||
import common.init.Blocks;
|
|
||||||
import common.init.CraftingRegistry;
|
import common.init.CraftingRegistry;
|
||||||
import common.item.ItemStack;
|
import common.item.ItemStack;
|
||||||
import common.util.BlockPos;
|
import common.util.BlockPos;
|
||||||
|
@ -9,25 +9,28 @@ import common.world.World;
|
||||||
|
|
||||||
public class ContainerWorkbench extends Container
|
public class ContainerWorkbench extends Container
|
||||||
{
|
{
|
||||||
/** The crafting matrix inventory (3x3). */
|
private final int craftSlots;
|
||||||
public InventoryCrafting craftMatrix = new InventoryCrafting(this, 3, 3);
|
public final InventoryCrafting craftMatrix;
|
||||||
public IInventory craftResult = new InventoryCraftResult();
|
public final IInventory craftResult = new InventoryCraftResult();
|
||||||
private World worldObj;
|
private final World worldObj;
|
||||||
|
private final BlockPos pos;
|
||||||
|
private final BlockWorkbench block;
|
||||||
|
|
||||||
/** Position of the workbench */
|
public ContainerWorkbench(InventoryPlayer playerInventory, World worldIn, BlockPos posIn, BlockWorkbench block)
|
||||||
private BlockPos pos;
|
|
||||||
|
|
||||||
public ContainerWorkbench(InventoryPlayer playerInventory, World worldIn, BlockPos posIn)
|
|
||||||
{
|
{
|
||||||
|
int size = block.getSize();
|
||||||
|
this.block = block;
|
||||||
this.worldObj = worldIn;
|
this.worldObj = worldIn;
|
||||||
this.pos = posIn;
|
this.pos = posIn;
|
||||||
this.addSlotToContainer(new SlotCrafting(playerInventory.player, this.craftMatrix, this.craftResult, 0, 124, 35));
|
this.craftSlots = size * size;
|
||||||
|
this.craftMatrix = new InventoryCrafting(this, size, size);
|
||||||
|
this.addSlotToContainer(new SlotCrafting(playerInventory.player, this.craftMatrix, this.craftResult, 0, 134, 17 + ((size - 1) * 18) / 2));
|
||||||
|
|
||||||
for (int i = 0; i < 3; ++i)
|
for (int i = 0; i < size; ++i)
|
||||||
{
|
{
|
||||||
for (int j = 0; j < 3; ++j)
|
for (int j = 0; j < size; ++j)
|
||||||
{
|
{
|
||||||
this.addSlotToContainer(new Slot(this.craftMatrix, j + i * 3, 30 + j * 18, 17 + i * 18));
|
this.addSlotToContainer(new Slot(this.craftMatrix, j + i * size, 26 + j * 18, 17 + i * 18));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,13 +38,13 @@ public class ContainerWorkbench extends Container
|
||||||
{
|
{
|
||||||
for (int i1 = 0; i1 < 9; ++i1)
|
for (int i1 = 0; i1 < 9; ++i1)
|
||||||
{
|
{
|
||||||
this.addSlotToContainer(new Slot(playerInventory, i1 + k * 9 + 9, 8 + i1 * 18, 84 + k * 18));
|
this.addSlotToContainer(new Slot(playerInventory, i1 + k * 9 + 9, 8 + i1 * 18, 30 + size * 18 + k * 18));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int l = 0; l < 9; ++l)
|
for (int l = 0; l < 9; ++l)
|
||||||
{
|
{
|
||||||
this.addSlotToContainer(new Slot(playerInventory, l, 8 + l * 18, 142));
|
this.addSlotToContainer(new Slot(playerInventory, l, 8 + l * 18, 88 + size * 18));
|
||||||
}
|
}
|
||||||
|
|
||||||
this.onCraftMatrixChanged(this.craftMatrix);
|
this.onCraftMatrixChanged(this.craftMatrix);
|
||||||
|
@ -64,7 +67,7 @@ public class ContainerWorkbench extends Container
|
||||||
|
|
||||||
if (!this.worldObj.client)
|
if (!this.worldObj.client)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < 9; ++i)
|
for (int i = 0; i < this.craftSlots; ++i)
|
||||||
{
|
{
|
||||||
ItemStack itemstack = this.craftMatrix.removeStackFromSlot(i);
|
ItemStack itemstack = this.craftMatrix.removeStackFromSlot(i);
|
||||||
|
|
||||||
|
@ -78,7 +81,7 @@ public class ContainerWorkbench extends Container
|
||||||
|
|
||||||
public boolean canInteractWith(EntityNPC playerIn)
|
public boolean canInteractWith(EntityNPC playerIn)
|
||||||
{
|
{
|
||||||
return this.worldObj.getState(this.pos).getBlock() != Blocks.crafting_table ? false : playerIn.getDistanceSq((double)this.pos.getX() + 0.5D, (double)this.pos.getY() + 0.5D, (double)this.pos.getZ() + 0.5D) <= 64.0D;
|
return this.worldObj.getState(this.pos).getBlock() != this.block ? false : playerIn.getDistanceSq((double)this.pos.getX() + 0.5D, (double)this.pos.getY() + 0.5D, (double)this.pos.getZ() + 0.5D) <= 64.0D;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -87,7 +90,7 @@ public class ContainerWorkbench extends Container
|
||||||
public ItemStack transferStackInSlot(EntityNPC playerIn, int index)
|
public ItemStack transferStackInSlot(EntityNPC playerIn, int index)
|
||||||
{
|
{
|
||||||
ItemStack itemstack = null;
|
ItemStack itemstack = null;
|
||||||
Slot slot = (Slot)this.inventorySlots.get(index);
|
Slot slot = this.inventorySlots.get(index);
|
||||||
|
|
||||||
if (slot != null && slot.getHasStack())
|
if (slot != null && slot.getHasStack())
|
||||||
{
|
{
|
||||||
|
@ -96,28 +99,28 @@ public class ContainerWorkbench extends Container
|
||||||
|
|
||||||
if (index == 0)
|
if (index == 0)
|
||||||
{
|
{
|
||||||
if (!this.mergeItemStack(itemstack1, 10, 46, true))
|
if (!this.mergeItemStack(itemstack1, this.craftSlots + 1, this.craftSlots + 37, true))
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
slot.onSlotChange(itemstack1, itemstack);
|
slot.onSlotChange(itemstack1, itemstack);
|
||||||
}
|
}
|
||||||
else if (index >= 10 && index < 37)
|
else if (index >= this.craftSlots + 1 && index < this.craftSlots + 28)
|
||||||
{
|
{
|
||||||
if (!this.mergeItemStack(itemstack1, 37, 46, false))
|
if (!this.mergeItemStack(itemstack1, this.craftSlots + 28, this.craftSlots + 37, false))
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (index >= 37 && index < 46)
|
else if (index >= this.craftSlots + 28 && index < this.craftSlots + 37)
|
||||||
{
|
{
|
||||||
if (!this.mergeItemStack(itemstack1, 10, 37, false))
|
if (!this.mergeItemStack(itemstack1, this.craftSlots + 1, this.craftSlots + 28, false))
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (!this.mergeItemStack(itemstack1, 10, 46, false))
|
else if (!this.mergeItemStack(itemstack1, this.craftSlots + 1, this.craftSlots + 37, false))
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -521,7 +521,7 @@ public abstract class Converter {
|
||||||
mapBlockData(Blocks.redstone, 55);
|
mapBlockData(Blocks.redstone, 55);
|
||||||
mapBlock(Blocks.diamond_ore, 56);
|
mapBlock(Blocks.diamond_ore, 56);
|
||||||
mapBlock(Blocks.diamond_block, 57);
|
mapBlock(Blocks.diamond_block, 57);
|
||||||
mapBlock(Blocks.crafting_table, 58);
|
mapBlock(Blocks.workbench, 58);
|
||||||
mapBlockData(Blocks.wheat, 59);
|
mapBlockData(Blocks.wheat, 59);
|
||||||
mapBlockData(Blocks.farmland, 60);
|
mapBlockData(Blocks.farmland, 60);
|
||||||
mapBlockData(Blocks.furnace, 61);
|
mapBlockData(Blocks.furnace, 61);
|
||||||
|
|
|
@ -650,7 +650,7 @@ public class StructureScattered
|
||||||
this.setBlockState(worldIn, Blocks.air.getState(), 5, 3, 4, structureBoundingBoxIn);
|
this.setBlockState(worldIn, Blocks.air.getState(), 5, 3, 4, structureBoundingBoxIn);
|
||||||
this.setBlockState(worldIn, Blocks.air.getState(), 5, 3, 5, structureBoundingBoxIn);
|
this.setBlockState(worldIn, Blocks.air.getState(), 5, 3, 5, structureBoundingBoxIn);
|
||||||
this.setBlockState(worldIn, Blocks.flower_pot.getState().withProperty(BlockFlowerPot.CONTENTS, 2 + BlockFlower.EnumFlowerType.BLACK_LOTUS.getMeta()), 1, 3, 5, structureBoundingBoxIn);
|
this.setBlockState(worldIn, Blocks.flower_pot.getState().withProperty(BlockFlowerPot.CONTENTS, 2 + BlockFlower.EnumFlowerType.BLACK_LOTUS.getMeta()), 1, 3, 5, structureBoundingBoxIn);
|
||||||
this.setBlockState(worldIn, Blocks.crafting_table.getState(), 3, 2, 6, structureBoundingBoxIn);
|
this.setBlockState(worldIn, Blocks.workbench.getState(), 3, 2, 6, structureBoundingBoxIn);
|
||||||
this.setBlockState(worldIn, Blocks.cauldron.getState(), 4, 2, 6, structureBoundingBoxIn);
|
this.setBlockState(worldIn, Blocks.cauldron.getState(), 4, 2, 6, structureBoundingBoxIn);
|
||||||
this.setBlockState(worldIn, Blocks.oak_fence.getState(), 1, 2, 1, structureBoundingBoxIn);
|
this.setBlockState(worldIn, Blocks.oak_fence.getState(), 1, 2, 1, structureBoundingBoxIn);
|
||||||
this.setBlockState(worldIn, Blocks.oak_fence.getState(), 5, 2, 1, structureBoundingBoxIn);
|
this.setBlockState(worldIn, Blocks.oak_fence.getState(), 5, 2, 1, structureBoundingBoxIn);
|
||||||
|
|
|
@ -806,7 +806,7 @@ public class StructureVillage
|
||||||
this.setBlockState(worldIn, Blocks.wooden_pressure_plate.getState(), 6, 2, 3, structureBoundingBoxIn);
|
this.setBlockState(worldIn, Blocks.wooden_pressure_plate.getState(), 6, 2, 3, structureBoundingBoxIn);
|
||||||
this.setBlockState(worldIn, Blocks.oak_fence.getState(), 4, 1, 3, structureBoundingBoxIn);
|
this.setBlockState(worldIn, Blocks.oak_fence.getState(), 4, 1, 3, structureBoundingBoxIn);
|
||||||
this.setBlockState(worldIn, Blocks.wooden_pressure_plate.getState(), 4, 2, 3, structureBoundingBoxIn);
|
this.setBlockState(worldIn, Blocks.wooden_pressure_plate.getState(), 4, 2, 3, structureBoundingBoxIn);
|
||||||
this.setBlockState(worldIn, Blocks.crafting_table.getState(), 7, 1, 1, structureBoundingBoxIn);
|
this.setBlockState(worldIn, Blocks.workbench.getState(), 7, 1, 1, structureBoundingBoxIn);
|
||||||
this.setBlockState(worldIn, Blocks.air.getState(), 1, 1, 0, structureBoundingBoxIn);
|
this.setBlockState(worldIn, Blocks.air.getState(), 1, 1, 0, structureBoundingBoxIn);
|
||||||
this.setBlockState(worldIn, Blocks.air.getState(), 1, 2, 0, structureBoundingBoxIn);
|
this.setBlockState(worldIn, Blocks.air.getState(), 1, 2, 0, structureBoundingBoxIn);
|
||||||
this.placeDoorCurrentPosition(worldIn, structureBoundingBoxIn, randomIn, 1, 1, 0, Facing.getHorizontal(this.getMetadataWithOffset(Blocks.oak_door, 1)));
|
this.placeDoorCurrentPosition(worldIn, structureBoundingBoxIn, randomIn, 1, 1, 0, Facing.getHorizontal(this.getMetadataWithOffset(Blocks.oak_door, 1)));
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue