diff --git a/gradle.properties b/gradle.properties index e4c88c93..c44b0c99 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,9 +3,9 @@ minecraft_version=1.7.10 forge_version=10.13.2.1277 waila_version=1.5.3 -ccl_version=1.1.1.95 -ccc_version=1.0.2.11 -nei_version=1.0.2.26 -fmp_version=1.1.0.297 +ccl_version=1.1.1.110 +ccc_version=1.0.4.29 +nei_version=1.0.3.74 +fmp_version=1.1.1.320 projectId='225236' \ No newline at end of file diff --git a/src/main/java/com/cricketcraft/chisel/Features.java b/src/main/java/com/cricketcraft/chisel/Features.java index 8eca5f10..4c0e0eb1 100644 --- a/src/main/java/com/cricketcraft/chisel/Features.java +++ b/src/main/java/com/cricketcraft/chisel/Features.java @@ -63,8 +63,8 @@ import com.cricketcraft.chisel.init.ChiselItems; import com.cricketcraft.chisel.init.ChiselTabs; import com.cricketcraft.chisel.item.ItemBallOMoss; import com.cricketcraft.chisel.item.ItemCarvable; +import com.cricketcraft.chisel.item.ItemCarvableSlab; import com.cricketcraft.chisel.item.ItemCloudInABottle; -import com.cricketcraft.chisel.item.ItemMarbleSlab; import com.cricketcraft.chisel.item.ItemSmashingRock; import com.cricketcraft.chisel.item.ItemUpgrade; import com.cricketcraft.chisel.item.chisel.ItemChisel; @@ -197,6 +197,16 @@ public enum Features { ItemUpgrade upgrade = (ItemUpgrade) new ItemUpgrade("upgrade").setCreativeTab(ChiselTabs.tabChisel); GameRegistry.registerItem(upgrade, "upgrade"); } + + @Override + void addRecipes() { + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ChiselItems.upgrade, 1, 0), new Object[] { "IEI", "EUE", "RRR", 'I', "ingotIron", 'E', Items.emerald, 'R', Items.redstone, 'U', + Items.sugar })); + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ChiselItems.upgrade, 1, 1), new Object[] { "IEI", "EUE", "RRR", 'I', "ingotIron", 'E', Items.emerald, 'R', Items.redstone, 'U', + Blocks.hopper })); + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ChiselItems.upgrade, 1, 2), new Object[] { "IEI", "EUE", "RRR", 'I', "ingotIron", 'E', Items.emerald, 'R', Items.redstone, 'U', + Blocks.crafting_table })); + } }, BALL_OF_MOSS { @@ -481,7 +491,7 @@ public enum Features { @Override void addBlocks() { - BlockCarvableSand colored_sand = (BlockCarvableSand) new BlockCarvableSand().setCreativeTab(ChiselTabs.tabOtherChiselBlocks); + BlockCarvableSand colored_sand = (BlockCarvableSand) new BlockCarvableSand().setCreativeTab(ChiselTabs.tabOtherChiselBlocks).setStepSound(Block.soundTypeSand); colored_sand.carverHelper.setChiselBlockName("Colored Sand"); for (int i = 0; i < 16; i++) @@ -1279,7 +1289,7 @@ public enum Features { OreDictionary.registerOre("limestone", limestone); Carving.chisel.registerOre("limestone", "limestone"); - BlockCarvable limestone_slab = (BlockCarvableSlab) new BlockCarvableSlab(limestone).setCreativeTab(ChiselTabs.tabStoneChiselBlocks).setHardness(2.0F).setResistance(10F); + BlockCarvableSlab limestone_slab = (BlockCarvableSlab) new BlockCarvableSlab(limestone).setCreativeTab(ChiselTabs.tabStoneChiselBlocks).setHardness(2.0F).setResistance(10F); limestone_slab.carverHelper.setChiselBlockName("Limestone Slab"); limestone_slab.carverHelper.addVariation("tile.limestoneSlab.0.desc", 0, "limestone"); limestone_slab.carverHelper.addVariation("tile.limestoneSlab.1.desc", 1, "limestone/terrain-cobbsmalltilelight"); @@ -1297,7 +1307,8 @@ public enum Features { limestone_slab.carverHelper.addVariation("tile.limestoneSlab.13.desc", 13, "limestone/terrain-pistonback-lightfour"); limestone_slab.carverHelper.addVariation("tile.limestoneSlab.14.desc", 14, "limestone/terrain-pistonback-lightmarker"); limestone_slab.carverHelper.addVariation("tile.limestoneSlab.15.desc", 15, "limestone/terrain-pistonback-lightpanel"); - limestone_slab.carverHelper.register(limestone_slab, "limestone_slab", ItemMarbleSlab.class); + limestone_slab.carverHelper.register(limestone_slab, "limestone_slab", ItemCarvableSlab.class); + GameRegistry.registerBlock(limestone_slab.top, Block.blockRegistry.getNameForObject(limestone_slab) + "_top"); Carving.chisel.registerOre("limestone_slab", "limestone_slab"); BlockMarbleStairsMaker makerLimestoneStairs = new BlockMarbleStairsMaker(limestone); @@ -1356,7 +1367,7 @@ public enum Features { OreDictionary.registerOre("blockMarble", marble); Carving.chisel.registerOre("marble", "marble"); - BlockCarvable marble_slab = (BlockCarvableSlab) new BlockCarvableSlab(marble).setHardness(2.0F).setResistance(10F); + BlockCarvableSlab marble_slab = (BlockCarvableSlab) new BlockCarvableSlab(marble).setHardness(2.0F).setResistance(10F); marble_slab.carverHelper.setChiselBlockName("Marble Slab"); marble_slab.carverHelper.addVariation("tile.marbleSlab.0.desc", 0, "marble"); marble_slab.carverHelper.addVariation("tile.marbleSlab.1.desc", 1, "marbleslab/a1-stoneornamental-marblebrick"); @@ -1374,7 +1385,8 @@ public enum Features { marble_slab.carverHelper.addVariation("tile.marbleSlab.13.desc", 13, "marbleslab/marble-arranged-bricks"); marble_slab.carverHelper.addVariation("tile.marbleSlab.14.desc", 14, "marbleslab/marble-fancy-bricks"); marble_slab.carverHelper.addVariation("tile.marbleSlab.15.desc", 15, "marbleslab/marble-blocks"); - marble_slab.carverHelper.register(marble_slab, "marble_slab", ItemMarbleSlab.class); + marble_slab.carverHelper.register(marble_slab, "marble_slab", ItemCarvableSlab.class); + GameRegistry.registerBlock(marble_slab.top, Block.blockRegistry.getNameForObject(marble_slab) + "_top"); Carving.chisel.registerOre("marble_slab", "marble_slab"); BlockMarbleStairsMaker makerMarbleStairs = new BlockMarbleStairsMaker(marble); @@ -1455,7 +1467,7 @@ public enum Features { marble_pillar.carverHelper.register(marble_pillar, "marble_pillar"); Carving.chisel.setGroupClass("marble_pillar", "marble"); - BlockCarvable marble_pillar_slab = (BlockCarvableSlab) new BlockCarvableSlab(marble_pillar).setCreativeTab(ChiselTabs.tabStoneChiselBlocks).setHardness(2.0F).setResistance(10F) + BlockCarvableSlab marble_pillar_slab = (BlockCarvableSlab) new BlockCarvableSlab(marble_pillar).setCreativeTab(ChiselTabs.tabStoneChiselBlocks).setHardness(2.0F).setResistance(10F) .setStepSound(Block.soundTypeStone); marble_pillar_slab.carverHelper.setChiselBlockName("Marble Pillar Slab"); if (Configurations.oldPillars) { @@ -1493,7 +1505,8 @@ public enum Features { marble_pillar_slab.carverHelper.addVariation("tile.marblePillarSlab.14.desc", 14, "marblepillarslab/carved"); marble_pillar_slab.carverHelper.addVariation("tile.marblePillarSlab.15.desc", 15, "marblepillarslab/ornamental"); } - marble_pillar_slab.carverHelper.register(marble_pillar_slab, "marble_pillar_slab", ItemMarbleSlab.class); + marble_pillar_slab.carverHelper.register(marble_pillar_slab, "marble_pillar_slab", ItemCarvableSlab.class); + GameRegistry.registerBlock(marble_pillar_slab.top, Block.blockRegistry.getNameForObject(marble_pillar_slab) + "_top"); } @Override diff --git a/src/main/java/com/cricketcraft/chisel/block/BlockCarvableSlab.java b/src/main/java/com/cricketcraft/chisel/block/BlockCarvableSlab.java index 34dc90df..23d4afcc 100644 --- a/src/main/java/com/cricketcraft/chisel/block/BlockCarvableSlab.java +++ b/src/main/java/com/cricketcraft/chisel/block/BlockCarvableSlab.java @@ -13,6 +13,7 @@ import net.minecraft.util.IIcon; import net.minecraft.util.MovingObjectPosition; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; +import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; diff --git a/src/main/java/com/cricketcraft/chisel/block/tileentity/TileEntityAutoChisel.java b/src/main/java/com/cricketcraft/chisel/block/tileentity/TileEntityAutoChisel.java index 02ab2c8d..11a14ec5 100644 --- a/src/main/java/com/cricketcraft/chisel/block/tileentity/TileEntityAutoChisel.java +++ b/src/main/java/com/cricketcraft/chisel/block/tileentity/TileEntityAutoChisel.java @@ -272,7 +272,6 @@ public class TileEntityAutoChisel extends TileEntity implements ISidedInventory if (worldObj.isRemote && slot == BASE && stack != null) { lastBase = stack.copy(); - lastBase.stackSize++; } if (!worldObj.isRemote) { diff --git a/src/main/java/com/cricketcraft/chisel/client/gui/GuiAutoChisel.java b/src/main/java/com/cricketcraft/chisel/client/gui/GuiAutoChisel.java index 81ecdf03..4584664e 100644 --- a/src/main/java/com/cricketcraft/chisel/client/gui/GuiAutoChisel.java +++ b/src/main/java/com/cricketcraft/chisel/client/gui/GuiAutoChisel.java @@ -2,10 +2,12 @@ package com.cricketcraft.chisel.client.gui; import java.util.List; +import net.minecraft.client.gui.GuiScreen; import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.client.renderer.RenderHelper; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.Slot; +import net.minecraft.tileentity.TileEntity; import net.minecraft.util.ResourceLocation; import net.minecraft.util.StatCollector; @@ -59,5 +61,20 @@ public class GuiAutoChisel extends GuiContainer { int x = (width - xSize) / 2; int y = (height - ySize) / 2; this.drawTexturedModalRect(x, y, 0, 0, xSize, ySize); + + for (int i = TileEntityAutoChisel.BASE; i < TileEntityAutoChisel.CHISEL; i++) { + if (autochisel.getStackInSlot(i) == null) { + drawSlotOverlay(this, x, y, inventorySlots.getSlot(i), xSize, 0, 8); + } + } + + if (autochisel.getStackInSlot(TileEntityAutoChisel.CHISEL) == null) { + drawSlotOverlay(this, x, y, inventorySlots.getSlot(TileEntityAutoChisel.CHISEL), xSize, 24, 0); + } + } + + public static void drawSlotOverlay(GuiContainer gui, int x, int y, Slot slot, int u, int v, int padding) { + padding /= 2; + gui.drawTexturedModalRect(x + (slot.xDisplayPosition - padding), y + (slot.yDisplayPosition - padding), u, v, 18 + padding, 18 + padding); } } diff --git a/src/main/java/com/cricketcraft/chisel/client/gui/GuiChisel.java b/src/main/java/com/cricketcraft/chisel/client/gui/GuiChisel.java index 301368d9..38353a33 100644 --- a/src/main/java/com/cricketcraft/chisel/client/gui/GuiChisel.java +++ b/src/main/java/com/cricketcraft/chisel/client/gui/GuiChisel.java @@ -53,6 +53,14 @@ public class GuiChisel extends GuiContainer { GeneralClient.bind(texture); drawTexturedModalRect(i, j, 0, 0, xSize, ySize); + + int x = (width - xSize) / 2; + int y = (height - ySize) / 2; + + Slot main = (Slot) container.inventorySlots.get(InventoryChiselSelection.normalSlots); + if (main.getStack() == null) { + GuiAutoChisel.drawSlotOverlay(this, x + 14, y + 14, main, 0, ySize, 60); + } } @Override diff --git a/src/main/java/com/cricketcraft/chisel/compat/NEIChiselConfig.java b/src/main/java/com/cricketcraft/chisel/compat/NEIChiselConfig.java new file mode 100644 index 00000000..cc2c0a7f --- /dev/null +++ b/src/main/java/com/cricketcraft/chisel/compat/NEIChiselConfig.java @@ -0,0 +1,29 @@ +package com.cricketcraft.chisel.compat; + +import net.minecraft.item.ItemStack; +import codechicken.nei.api.API; +import codechicken.nei.api.IConfigureNEI; + +import com.cricketcraft.chisel.Chisel; + +import cpw.mods.fml.common.registry.GameRegistry; + +public class NEIChiselConfig implements IConfigureNEI { + + @Override + public String getName() { + return "Chisel NEI Plugin"; + } + + @Override + public String getVersion() { + return Chisel.VERSION; + } + + @Override + public void loadConfig() { + API.hideItem(new ItemStack(GameRegistry.findBlock("chisel", "limestone_slab_top"))); + API.hideItem(new ItemStack(GameRegistry.findBlock("chisel", "marble_slab_top"))); + API.hideItem(new ItemStack(GameRegistry.findBlock("chisel", "marble_pillar_slab_top"))); + } +} diff --git a/src/main/java/com/cricketcraft/chisel/inventory/ContainerAutoChisel.java b/src/main/java/com/cricketcraft/chisel/inventory/ContainerAutoChisel.java index 4b116c2a..7081e191 100644 --- a/src/main/java/com/cricketcraft/chisel/inventory/ContainerAutoChisel.java +++ b/src/main/java/com/cricketcraft/chisel/inventory/ContainerAutoChisel.java @@ -8,19 +8,21 @@ import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; import com.cricketcraft.chisel.block.tileentity.TileEntityAutoChisel; +import com.cricketcraft.chisel.network.PacketHandler; +import com.cricketcraft.chisel.network.message.MessageAutoChisel; public class ContainerAutoChisel extends Container { - public static TileEntityAutoChisel autoChisel; - public static EntityPlayer player; + public TileEntityAutoChisel autoChisel; + public EntityPlayer player; public ContainerAutoChisel(InventoryPlayer player, TileEntityAutoChisel tileEntityAutoChisel) { - ContainerAutoChisel.player = player.player; + this.player = player.player; autoChisel = tileEntityAutoChisel; addSlot(tileEntityAutoChisel, 0, 53, 15); - addSlot(tileEntityAutoChisel, 1, 78, 51); + addSlot(tileEntityAutoChisel, 1, 78, 52); addSlot(tileEntityAutoChisel, 2, 103, 15); addSlot(tileEntityAutoChisel, 3, 8, 62); addSlot(tileEntityAutoChisel, 4, 151, 11); @@ -92,6 +94,23 @@ public class ContainerAutoChisel extends Container { return itemStack; } + @Override + public ItemStack slotClick(int slotId, int p_75144_2_, int p_75144_3_, EntityPlayer player) { + if (slotId >= 0 && slotId < this.inventorySlots.size()) { + Slot slot = (Slot) this.inventorySlots.get(slotId); + ItemStack stack = slot.getStack(); + ItemStack ret = super.slotClick(slotId, p_75144_2_, p_75144_3_, player); + + if (!player.worldObj.isRemote && slot.slotNumber == TileEntityAutoChisel.BASE && !ItemStack.areItemStacksEqual(stack, slot.getStack())) { + int chiseled = stack == null ? 0 : slot.getStack() == null ? stack.stackSize : stack.stackSize - slot.getStack().stackSize; + PacketHandler.INSTANCE.sendToDimension(new MessageAutoChisel(autoChisel, chiseled, false), player.worldObj.provider.dimensionId); + } + + return ret; + } + return super.slotClick(slotId, p_75144_2_, p_75144_3_, player); + } + /** * Added validation of slot input * diff --git a/src/main/java/com/cricketcraft/chisel/inventory/ContainerChisel.java b/src/main/java/com/cricketcraft/chisel/inventory/ContainerChisel.java index 682d565c..3f9df4a4 100644 --- a/src/main/java/com/cricketcraft/chisel/inventory/ContainerChisel.java +++ b/src/main/java/com/cricketcraft/chisel/inventory/ContainerChisel.java @@ -62,7 +62,8 @@ public class ContainerChisel extends Container { @Override public ItemStack slotClick(int par1, int par2, int par3, EntityPlayer par4EntityPlayer) { - if (par3 == 2 && par2 == currentIndex) + // we need to subtract away all the other slots + if (par1 - inventory.getSizeInventory() - 27 == currentIndex) return null; return super.slotClick(par1, par2, par3, par4EntityPlayer); diff --git a/src/main/java/com/cricketcraft/chisel/item/ItemCarvableSlab.java b/src/main/java/com/cricketcraft/chisel/item/ItemCarvableSlab.java new file mode 100644 index 00000000..a7e02f45 --- /dev/null +++ b/src/main/java/com/cricketcraft/chisel/item/ItemCarvableSlab.java @@ -0,0 +1,72 @@ +package com.cricketcraft.chisel.item; + +import net.minecraft.block.Block; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.world.World; +import net.minecraftforge.common.util.ForgeDirection; + +import com.cricketcraft.chisel.block.BlockCarvableSlab; + +public class ItemCarvableSlab extends ItemCarvable { + + public ItemCarvableSlab(Block block) { + super(block); + } + + @Override + public boolean func_150936_a(World world, int x, int y, int z, int side, EntityPlayer player, ItemStack stack) { + return true; + } + + @Override + public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hx, float hy, float hz) { + BlockCarvableSlab block = (BlockCarvableSlab) Block.getBlockFromItem(this); + int meta = stack.getItemDamage(); + + ForgeDirection dir = ForgeDirection.VALID_DIRECTIONS[side]; + Block clicked = world.getBlock(x, y, z); + + // the position of the block that we are attempting to place at + int x2 = x + dir.offsetX; + int y2 = y + dir.offsetY; + int z2 = z + dir.offsetZ; + + Block at = world.getBlock(x2, y2, z2); + + boolean metaEquals = world.getBlockMetadata(x2, y2, z2) == meta; + // if the metadata at the place target matches, and the block there matches either the top of bottom slab, try to fill in the rest of the block + if (metaEquals && ((at == block.top && (dir == ForgeDirection.DOWN || hy == 1.0D)) || (at == block.bottom && (dir == ForgeDirection.UP || hy == 0)))) { + place(stack, world, x2, y2, z2, block.master, meta); + return true; + } + + // else if the block clicked on is a top or bottom slab of this type, try to fill in that block if possible + boolean clickedMetaEquals = world.getBlockMetadata(x, y, z) == meta; + if (clickedMetaEquals && ((clicked == block.bottom && dir == ForgeDirection.UP) || (clicked == block.top && dir == ForgeDirection.DOWN))) { + place(stack, world, x, y, z, block.master, meta); + return true; + } + + // finally just try to place a normal slab + if (metaEquals || at.isReplaceable(world, x, y, z)) { + boolean top = hy > 0.5D && dir != ForgeDirection.UP || dir == ForgeDirection.DOWN; + Block toPlace = top ? block.top : block.bottom; + // if we can replace the clicked block do so + if (clicked.isReplaceable(world, x, y, z)) { + place(stack, world, x, y, z, toPlace, meta); + } else { + place(stack, world, x2, y2, z2, toPlace, meta); + } + return true; + } + return false; + } + + private void place(ItemStack stack, World world, int x, int y, int z, Block toPlace, int metadata) { + world.setBlock(x, y, z, toPlace, metadata, 2); + stack.stackSize -= 1; + world.playSoundEffect(x + 0.5f, y + 0.5f, z + 0.5f, this.field_150939_a.stepSound.func_150496_b(), (this.field_150939_a.stepSound.getVolume() + 1.0F) / 2.0F, + this.field_150939_a.stepSound.getPitch() * 0.8F); + } +} diff --git a/src/main/java/com/cricketcraft/chisel/item/ItemMarbleSlab.java b/src/main/java/com/cricketcraft/chisel/item/ItemMarbleSlab.java deleted file mode 100644 index 884e364c..00000000 --- a/src/main/java/com/cricketcraft/chisel/item/ItemMarbleSlab.java +++ /dev/null @@ -1,108 +0,0 @@ -package com.cricketcraft.chisel.item; - -import net.minecraft.block.Block; -import net.minecraft.entity.Entity; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.world.World; - -import com.cricketcraft.chisel.block.BlockCarvableSlab; - -public class ItemMarbleSlab extends ItemCarvable { - - public ItemMarbleSlab(Block block) { - super(block); - } - - @Override - public boolean func_150936_a(World world, int x, int y, int z, int side, EntityPlayer player, ItemStack stack) { - BlockCarvableSlab block = (BlockCarvableSlab) Block.getBlockFromItem(this); - - switch (side) { - case 0: - --y; - break; - case 1: - ++y; - break; - case 2: - --z; - break; - case 3: - ++z; - break; - case 4: - --x; - break; - case 5: - ++x; - break; - } - - Block targetBlock = world.getBlock(x, y, z); - int meta = world.getBlockMetadata(x, y, z); - - return (targetBlock.equals(block) || targetBlock.equals(block.top)) && meta == stack.getItemDamage() || world.canPlaceEntityOnSide(block, x, y, z, false, side, (Entity) null, stack); - - } - - @Override - public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hx, float hy, float hz) { - BlockCarvableSlab block = (BlockCarvableSlab) Block.getBlockFromItem(this); - - Block targetBlock = world.getBlock(x, y, z); - int meta = world.getBlockMetadata(x, y, z); - boolean metaMatches = meta == stack.getItemDamage(); - - if (metaMatches && side == 0 && targetBlock.equals(block.top)) { - world.setBlock(x, y, z, block.master, meta, 2); - stack.stackSize -= 1; - return true; - } else if (metaMatches && side == 1 && targetBlock.equals(block.bottom)) { - world.setBlock(x, y, z, block.master, meta, 2); - stack.stackSize -= 1; - return true; - } - - boolean result = super.onItemUse(stack, player, world, x, y, z, side, hz, hy, hz); - - switch (side) { - case 0: - --y; - break; - case 1: - ++y; - break; - case 2: - --z; - break; - case 3: - ++z; - break; - case 4: - --x; - break; - case 5: - ++x; - break; - } - - targetBlock = world.getBlock(x, y, z); - meta = world.getBlockMetadata(x, y, z); - - if (!result && (targetBlock.equals(block.top) || targetBlock.equals(block.bottom)) && meta == stack.getItemDamage()) { - world.setBlock(x, y, z, block.master, meta, 2); - return true; - } - - if (!result) - return false; - - if (side != 0 && (side == 1 || hy <= 0.5D)) - return true; - - // TODO allow top slabs - // world.setBlock(x, y, z, block.top, meta, 2); - return true; - } -} diff --git a/src/main/resources/assets/chisel/textures/autochisel-gui.png b/src/main/resources/assets/chisel/textures/autochisel-gui.png index 05503451..9fad5cea 100644 Binary files a/src/main/resources/assets/chisel/textures/autochisel-gui.png and b/src/main/resources/assets/chisel/textures/autochisel-gui.png differ diff --git a/src/main/resources/assets/chisel/textures/chisel2Gui.png b/src/main/resources/assets/chisel/textures/chisel2Gui.png index c581c605..ef0f5852 100644 Binary files a/src/main/resources/assets/chisel/textures/chisel2Gui.png and b/src/main/resources/assets/chisel/textures/chisel2Gui.png differ