From 64128a241f4211c39f73b488b04188a10b96b6eb Mon Sep 17 00:00:00 2001 From: tterrag1098 Date: Sun, 8 Feb 2015 16:18:01 -0500 Subject: [PATCH 1/6] Fix antiblocks not being chiselable even with config set to true Closes #213 --- src/main/java/com/cricketcraft/chisel/Features.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/cricketcraft/chisel/Features.java b/src/main/java/com/cricketcraft/chisel/Features.java index 7dc20134..92e80a0d 100644 --- a/src/main/java/com/cricketcraft/chisel/Features.java +++ b/src/main/java/com/cricketcraft/chisel/Features.java @@ -110,14 +110,15 @@ public enum Features { void addBlocks() { BlockCarvable antiBlock = (BlockCarvable) new BlockCarvableAntiBlock().setCreativeTab(ChiselTabs.tabOtherChiselBlocks); antiBlock.carverHelper.setChiselBlockName("Anti Block"); - if (!Configurations.allowChiselCrossColors) + if (!Configurations.allowChiselCrossColors) { antiBlock.carverHelper.forbidChiseling = true; + } for (int i = 0; i < 16; i++) { antiBlock.carverHelper.addVariation("tile.antiBlock." + ItemDye.field_150921_b[i] + ".desc", i, "antiblock/" + ItemDye.field_150921_b[i] + "-antiBlock"); } - antiBlock.carverHelper.registerBlock(antiBlock, "antiBlock"); + antiBlock.carverHelper.registerAll(antiBlock, "antiBlock"); OreDictionary.registerOre("antiBlock", antiBlock); } @@ -312,8 +313,9 @@ public enum Features { carpet_block.carverHelper.addVariation("tile.carpet_block.13.desc", 13, "carpet/green"); carpet_block.carverHelper.addVariation("tile.carpet_block.14.desc", 14, "carpet/red"); carpet_block.carverHelper.addVariation("tile.carpet_block.15.desc", 15, "carpet/black"); - if (!Configurations.allowChiselCrossColors) + if (!Configurations.allowChiselCrossColors) { carpet_block.carverHelper.forbidChiseling = true; + } carpet_block.carverHelper.registerAll(carpet_block, "carpet_block"); OreDictionary.registerOre("blockCarpet", carpet_block); } @@ -352,8 +354,9 @@ public enum Features { carpet.carverHelper.addVariation("tile.carpet.13.desc", 13, "carpet/green"); carpet.carverHelper.addVariation("tile.carpet.14.desc", 14, "carpet/red"); carpet.carverHelper.addVariation("tile.carpet.15.desc", 15, "carpet/black"); - if (!Configurations.allowChiselCrossColors) + if (!Configurations.allowChiselCrossColors) { carpet.carverHelper.forbidChiseling = true; + } carpet.carverHelper.registerAll(carpet, "carpet"); // for (int i = 0; i < 16; i++) { From 0425ac5b4d824164fc4ca13d41bb883c2b6ecac8 Mon Sep 17 00:00:00 2001 From: Steven Blom Date: Mon, 9 Feb 2015 10:10:04 +1030 Subject: [PATCH 2/6] Favour for Drullkus, change V4 and V9 textures to tiling instead of stair-casing --- .../chisel/carving/CarvableHelper.java | 43 ++++++++++++++----- 1 file changed, 32 insertions(+), 11 deletions(-) diff --git a/src/main/java/com/cricketcraft/chisel/carving/CarvableHelper.java b/src/main/java/com/cricketcraft/chisel/carving/CarvableHelper.java index 10b431cb..fe3e0ad5 100644 --- a/src/main/java/com/cricketcraft/chisel/carving/CarvableHelper.java +++ b/src/main/java/com/cricketcraft/chisel/carving/CarvableHelper.java @@ -255,19 +255,40 @@ public class CarvableHelper { else if (n) return variation.seamsCtmVert.icons[reverse ? 3 : 2]; return variation.seamsCtmVert.icons[0]; - case V9: - case V4: - int index = x + y + z; - if ((side==2)||(side==5)) - { - index=-index; - } - while (index < 0) - { - index = index+10000; + case V9: + case V4: + int variationSize = (variation.kind == V9) ? 3 : 2; + + int xModulus = x % variationSize; + int zModulus = z % variationSize; + //This ensures that blocks placed near 0,0 or it's axis' do not misbehave + int textureX = (xModulus < 0) ? (xModulus + variationSize) : xModulus; + int textureZ = (zModulus < 0) ? (zModulus + variationSize) : zModulus; + //Always invert the y index + int textureY = (variationSize - (y % variationSize) - 1); + + if (side == 2 || side == 5) { + //For WEST, SOUTH reverse the indexes for both X and Z + textureX = (variationSize - textureX - 1); + textureZ = (variationSize - textureZ - 1); + } else if (side == 0) { + //For DOWN, reverse the indexes for only Z + textureZ = (variationSize - textureZ - 1); } - return variation.variations9.icons[index % ((variation.kind == V9) ? 9 : 4)]; + int index; + if (side == 0 || side == 1) { + // DOWN || UP + index = textureX + textureZ * variationSize; + } else if (side == 2 || side == 3) { + // NORTH || SOUTH + index = textureX + textureY * variationSize; + } else { + // WEST || EAST + index = textureZ + textureY * variationSize; + } + + return variation.variations9.icons[index]; case CTMX: return variation.icon; case R16: From 63ea14f44e561c8eea4c5a10478fd994a9c9b545 Mon Sep 17 00:00:00 2001 From: CptSpaceToaster Date: Sun, 8 Feb 2015 23:37:56 -0500 Subject: [PATCH 3/6] Added 16 configuration options to control the color overlay of HexBlocks --- .../client/render/BlockGlowRenderer.java | 5 +++-- .../chisel/config/Configurations.java | 22 +++++++++++++++++-- 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/cricketcraft/chisel/client/render/BlockGlowRenderer.java b/src/main/java/com/cricketcraft/chisel/client/render/BlockGlowRenderer.java index 00503ee0..365127e5 100644 --- a/src/main/java/com/cricketcraft/chisel/client/render/BlockGlowRenderer.java +++ b/src/main/java/com/cricketcraft/chisel/client/render/BlockGlowRenderer.java @@ -1,5 +1,6 @@ package com.cricketcraft.chisel.client.render; +import com.cricketcraft.chisel.config.Configurations; import net.minecraft.block.Block; import net.minecraft.client.renderer.RenderBlocks; import net.minecraft.client.renderer.Tessellator; @@ -25,7 +26,7 @@ public class BlockGlowRenderer implements ISimpleBlockRenderingHandler { @Override public void renderInventoryBlock(Block block, int metadata, int modelId, RenderBlocks renderer) { GL11.glTranslatef(-0.5F, -0.5F, -0.5F); - GeneralClient.setGLColorFromInt(ItemDye.field_150922_c[metadata]); + GeneralClient.setGLColorFromInt(Configurations.configColors[metadata]); GL11.glDisable(GL11.GL_LIGHTING); Drawing.drawBlock(block, ((BlockCarvableGlow)block).getGlowTexture(), renderer); GL11.glEnable(GL11.GL_LIGHTING); @@ -36,7 +37,7 @@ public class BlockGlowRenderer implements ISimpleBlockRenderingHandler { @Override public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) { - Tessellator.instance.setColorOpaque_I(ItemDye.field_150922_c[world.getBlockMetadata(x, y, z)]); + Tessellator.instance.setColorOpaque_I(Configurations.configColors[world.getBlockMetadata(x, y, z)]); Tessellator.instance.setBrightness(0xF000F0); Drawing.renderAllFaces(renderer, block, x, y, z, ((BlockCarvableGlow) block).getGlowTexture()); renderer.renderStandardBlock(block, x, y, z); diff --git a/src/main/java/com/cricketcraft/chisel/config/Configurations.java b/src/main/java/com/cricketcraft/chisel/config/Configurations.java index 2cec134d..76c812c5 100644 --- a/src/main/java/com/cricketcraft/chisel/config/Configurations.java +++ b/src/main/java/com/cricketcraft/chisel/config/Configurations.java @@ -1,6 +1,8 @@ package com.cricketcraft.chisel.config; +import com.cricketcraft.chisel.Chisel; import com.cricketcraft.chisel.Features; +import net.minecraft.item.ItemDye; import net.minecraftforge.common.config.Configuration; import org.apache.commons.lang3.StringUtils; @@ -47,6 +49,8 @@ public class Configurations { public static String getRoadLineTool; public static int roadLineToolLevel; + public static int[] configColors = new int[ItemDye.field_150923_a.length]; + public static boolean refreshConfig() { String category; @@ -63,8 +67,7 @@ public class Configurations { enableFMP = config.get(category, "enableFMP", true, "Do you want to enable FMP").getBoolean(true); chiselStoneToCobbleBricks = config.get(category, "chiselStoneToCobbleBricks", true, "Chisel stone to cobblestone and bricks by left clicking.").getBoolean(false); chiselBackToVanillaLeaves = config.get(category, "chiselBackToVanillaLeaves", false, "If this is true, you can chisel from the chisel leaves back to vanilla ones. If it is false, you cannot.") - .getBoolean( - false); + .getBoolean(false); /* worldgen */ category = "worldgen"; @@ -103,6 +106,21 @@ public class Configurations { "The lowest harvest level of the tool able to break the road lines (requires useRoadLineTool to be true to take effect) (0 = Wood/Gold, 1 = Stone, 2 = Iron, 3 = Diamond) Default: 0") .getInt(); + /* hexColors */ + category = "hexColors"; + + for(int i = 0; i < ItemDye.field_150923_a.length; i++) { + // tterrag... don't kill me over this formatting. + String temp = config.get(category, "hex" + ItemDye.field_150923_a[i], "#" + Integer.toHexString(ItemDye.field_150922_c[i]), Character.toUpperCase(ItemDye.field_150923_a[i].charAt(0)) + ItemDye.field_150923_a[i].substring(1) + " color for hex block overlay #RRGGBB").getString(); + // Or this + try { + configColors[i] = Integer.decode(temp); + } catch (NumberFormatException e) { + Chisel.logger.warn("Configuration error, " + temp + " was not recognized as a color. Using default: #" + Integer.toHexString(ItemDye.field_150922_c[i])); + configColors[i] = ItemDye.field_150922_c[i]; + } + } + if (config.hasChanged()) { config.save(); } From ffc4ca93084d97454040debea769c195c4eb5b5f Mon Sep 17 00:00:00 2001 From: tterrag1098 Date: Wed, 11 Feb 2015 22:03:53 -0500 Subject: [PATCH 4/6] Fix reamining present issues: - Fix dupes - Fix bounding boxes - Fix inventory order being swapped in the GUI - Fix in-world chiseling not working - Fix losing items when metadata changes --- .../chisel/block/BlockPresent.java | 28 +++++-- .../chisel/block/tileentity/IDoubleChest.java | 29 +++++++ .../block/tileentity/TileEntityPresent.java | 79 ++++++++++++++----- .../client/render/tile/RenderPresent.java | 12 +-- .../chisel/item/chisel/ChiselMode.java | 6 +- 5 files changed, 119 insertions(+), 35 deletions(-) create mode 100644 src/main/java/com/cricketcraft/chisel/block/tileentity/IDoubleChest.java diff --git a/src/main/java/com/cricketcraft/chisel/block/BlockPresent.java b/src/main/java/com/cricketcraft/chisel/block/BlockPresent.java index dc8aff01..6990e035 100644 --- a/src/main/java/com/cricketcraft/chisel/block/BlockPresent.java +++ b/src/main/java/com/cricketcraft/chisel/block/BlockPresent.java @@ -14,6 +14,7 @@ import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.MathHelper; +import net.minecraft.util.MovingObjectPosition; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; @@ -76,13 +77,13 @@ public class BlockPresent extends Block implements ICarvable { super.onBlockPlacedBy(world, x, y, z, player, stack); int heading = MathHelper.floor_double(player.rotationYaw * 4.0F / 360.0F + 0.5D) & 3; TileEntityPresent te = (TileEntityPresent) world.getTileEntity(x, y, z); - world.setBlockMetadataWithNotify(x, y, z, heading, 3); + world.setBlockMetadataWithNotify(x, y, z, stack.getItemDamage(), 3); + te.setRotation(heading); te.findConnections(); if (te.isConnected()) { TileEntityPresent other = te.getConnection(); - world.setBlockMetadataWithNotify(other.xCoord, other.yCoord, other.zCoord, heading, 3); + other.setRotation(heading); } - te.setType(stack.getItemDamage()); world.markBlockForUpdate(x, y, z); } @@ -92,8 +93,8 @@ public class BlockPresent extends Block implements ICarvable { TileEntityPresent tileEntityPresent = (TileEntityPresent) world.getTileEntity(x, y, z); if (tileEntityPresent != null) { - for (int c = 0; c < tileEntityPresent.getSizeInventory(); c++) { - ItemStack itemStack = tileEntityPresent.getStackInSlot(c); + for (int c = 0; c < tileEntityPresent.getTrueSizeInventory(); c++) { + ItemStack itemStack = tileEntityPresent.getTrueStackInSlot(c); if (itemStack != null) { dropBlockAsItem(world, x, y, z, itemStack); @@ -127,12 +128,14 @@ public class BlockPresent extends Block implements ICarvable { public AxisAlignedBB getBoundingBox(TileEntityPresent me) { if (me == null) { + System.out.println(-1); return AxisAlignedBB.getBoundingBox(minX, minY, minZ, maxX, maxY, maxZ); } int x = me.xCoord, y = me.yCoord, z = me.zCoord; if (me.isConnected()) { ForgeDirection dir = me.getConnectionDir(); - if (dir != ForgeDirection.NORTH && (!me.isParent() || dir == ForgeDirection.SOUTH)) { + // warning: magic below! Do not change this conditional + if (dir == ForgeDirection.EAST || (me.isParent() && dir == ForgeDirection.SOUTH) || (!me.isParent() && dir == ForgeDirection.SOUTH)) { return AxisAlignedBB.getBoundingBox(x + minX, y + minY, z + minZ, x + maxX + dir.offsetX, y + maxY, z + maxZ + dir.offsetZ); } else { return AxisAlignedBB.getBoundingBox(x + dir.offsetX + minX, y + minY, z + dir.offsetZ + minZ, x + maxX, y + maxY, z + maxZ); @@ -191,6 +194,16 @@ public class BlockPresent extends Block implements ICarvable { } return 0; } + + @Override + public int damageDropped(int meta) { + return meta; + } + + @Override + public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z) { + return new ItemStack(this, 1, world.getBlockMetadata(x, y, z)); + } @Override @SideOnly(Side.CLIENT) @@ -200,8 +213,7 @@ public class BlockPresent extends Block implements ICarvable { @Override public CarvableVariation getVariation(IBlockAccess world, int x, int y, int z, int metadata) { - TileEntity te = world.getTileEntity(x, y, z); - return te instanceof TileEntityPresent ? carverHelper.getVariation(((TileEntityPresent) te).getType()) : carverHelper.getVariation(metadata); + return carverHelper.getVariation(metadata); } @Override diff --git a/src/main/java/com/cricketcraft/chisel/block/tileentity/IDoubleChest.java b/src/main/java/com/cricketcraft/chisel/block/tileentity/IDoubleChest.java new file mode 100644 index 00000000..90ded712 --- /dev/null +++ b/src/main/java/com/cricketcraft/chisel/block/tileentity/IDoubleChest.java @@ -0,0 +1,29 @@ +package com.cricketcraft.chisel.block.tileentity; + +import net.minecraft.item.ItemStack; + +public interface IDoubleChest { + + /** + * @return The size of this specific chest's inventory. Does not account for the connection. + */ + int getTrueSizeInventory(); + + /** + * @param slot + * The true slot index. + * @return The actual stack in this chest's slot. Does not account for the connection. + */ + ItemStack getTrueStackInSlot(int slot); + + /** + * Puts a stack in this chest's real slot at the given true index. + * + * @param slot + * The true slot index. + * @param stack + * The ItemStack to place in the slot. + */ + void putStackInTrueSlot(int slot, ItemStack stack); + +} diff --git a/src/main/java/com/cricketcraft/chisel/block/tileentity/TileEntityPresent.java b/src/main/java/com/cricketcraft/chisel/block/tileentity/TileEntityPresent.java index f60c7864..944c62e1 100644 --- a/src/main/java/com/cricketcraft/chisel/block/tileentity/TileEntityPresent.java +++ b/src/main/java/com/cricketcraft/chisel/block/tileentity/TileEntityPresent.java @@ -1,5 +1,6 @@ package com.cricketcraft.chisel.block.tileentity; +import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.IInventory; import net.minecraft.item.ItemStack; @@ -10,19 +11,20 @@ import net.minecraft.network.Packet; import net.minecraft.network.play.server.S35PacketUpdateTileEntity; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.AxisAlignedBB; +import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; import com.cricketcraft.chisel.init.ChiselBlocks; import com.cricketcraft.chisel.network.PacketHandler; import com.cricketcraft.chisel.network.message.MessagePresentConnect; -public class TileEntityPresent extends TileEntity implements IInventory { +public class TileEntityPresent extends TileEntity implements IInventory, IDoubleChest { private TileEntityPresent connection = null; private ForgeDirection cachedDir = null; private boolean isParent; - private ItemStack[] inventory = new ItemStack[27]; - private int type; + private final ItemStack[] inventory = new ItemStack[27]; + private int rotation; private boolean autoSearch = true; @Override @@ -46,12 +48,14 @@ public class TileEntityPresent extends TileEntity implements IInventory { } private boolean connectTo(TileEntityPresent present, ForgeDirection dir) { - if (present.type == type && !present.isConnected() && Math.abs(present.xCoord - xCoord + present.yCoord - yCoord + present.zCoord - zCoord) == 1) { + if (present.getBlockMetadata() == getBlockMetadata() && !present.isConnected() && Math.abs(present.xCoord - xCoord + present.yCoord - yCoord + present.zCoord - zCoord) == 1) { connection = present; connection.connection = this; connection.cachedDir = dir.getOpposite(); + connection.markDirty(); cachedDir = dir; isParent = !present.isParent; + markDirty(); PacketHandler.INSTANCE.sendToDimension(new MessagePresentConnect(this, dir, true), worldObj.provider.dimensionId); return true; } @@ -70,8 +74,10 @@ public class TileEntityPresent extends TileEntity implements IInventory { if (isConnected()) { this.connection.cachedDir = null; this.connection.connection = null; + this.connection.markDirty(); this.cachedDir = null; this.connection = null; + this.markDirty(); PacketHandler.INSTANCE.sendToDimension(new MessagePresentConnect(this, ForgeDirection.UNKNOWN, false), worldObj.provider.dimensionId); } } @@ -88,12 +94,12 @@ public class TileEntityPresent extends TileEntity implements IInventory { return isParent || !isConnected(); } - public int getType() { - return type; + public int getRotation() { + return rotation; } - public void setType(int type) { - this.type = type; + public void setRotation(int rot) { + this.rotation = rot; } public void findConnections() { @@ -123,7 +129,7 @@ public class TileEntityPresent extends TileEntity implements IInventory { super.writeToNBT(tag); NBTTagList nbttaglist = new NBTTagList(); - for (int i = 0; i < inventory.length; ++i) + for (int i = 0; i < getTrueSizeInventory(); ++i) { if (inventory[i] != null) { @@ -136,7 +142,7 @@ public class TileEntityPresent extends TileEntity implements IInventory { tag.setTag("Items", nbttaglist); tag.setBoolean("isParent", isParent); - tag.setInteger("presentType", type); + tag.setInteger("rotation", rotation); if (cachedDir != null) { tag.setInteger("conDir", cachedDir.ordinal()); } @@ -147,14 +153,13 @@ public class TileEntityPresent extends TileEntity implements IInventory { { super.readFromNBT(tag); NBTTagList nbttaglist = tag.getTagList("Items", 10); - inventory = new ItemStack[this.getSizeInventory()]; for (int i = 0; i < nbttaglist.tagCount(); ++i) { NBTTagCompound nbttagcompound1 = nbttaglist.getCompoundTagAt(i); int j = nbttagcompound1.getByte("Slot") & 255; - if (j >= 0 && j < inventory.length) + if (j >= 0 && j < getTrueSizeInventory()) { inventory[j] = ItemStack.loadItemStackFromNBT(nbttagcompound1); } @@ -162,7 +167,7 @@ public class TileEntityPresent extends TileEntity implements IInventory { this.isParent = tag.getBoolean("isParent"); - this.type = tag.getInteger("presentType"); + this.rotation = tag.getInteger("rotation"); if (tag.hasKey("conDir")) { cachedDir = ForgeDirection.values()[tag.getInteger("conDir")]; } @@ -180,18 +185,33 @@ public class TileEntityPresent extends TileEntity implements IInventory { public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity packet) { readFromNBT(packet.func_148857_g()); } + + @Override + public boolean shouldRefresh(Block oldBlock, Block newBlock, int oldMeta, int newMeta, World world, int x, int y, int z) { + // prevent losing TE data when in-world chiseling + return oldBlock != newBlock; + } + private int getAdjustedSlot(int slot) { + slot %= getSizeInventory(); + if (isConnected() && !isParent) { + slot = (slot + getTrueSizeInventory()) % getSizeInventory(); + } + return slot; + } + /* IInventory */ @Override public int getSizeInventory() { - return isConnected() ? inventory.length + connection.inventory.length : inventory.length; + return isConnected() ? getTrueSizeInventory() + connection.getTrueSizeInventory() : getTrueSizeInventory(); } @Override public ItemStack getStackInSlot(int slot) { - if (slot >= inventory.length) { - return isConnected() ? connection.inventory[slot % inventory.length] : null; + slot = getAdjustedSlot(slot); + if (slot >= getTrueSizeInventory()) { + return isConnected() ? connection.inventory[slot % getTrueSizeInventory()] : null; } else { return inventory[slot]; } @@ -200,10 +220,11 @@ public class TileEntityPresent extends TileEntity implements IInventory { @Override public ItemStack decrStackSize(int slot, int amount) { + slot = getAdjustedSlot(slot); ItemStack[] inv = inventory; - if (isConnected() && slot >= inventory.length) { + if (isConnected() && slot >= getTrueSizeInventory()) { inv = connection.inventory; - slot %= inventory.length; + slot %= getTrueSizeInventory(); } if (inv[slot] != null) @@ -243,10 +264,11 @@ public class TileEntityPresent extends TileEntity implements IInventory { @Override public void setInventorySlotContents(int slot, ItemStack stack) { - if (slot < inventory.length) { + slot = getAdjustedSlot(slot); + if (slot < getTrueSizeInventory()) { inventory[slot] = stack; } else if (isConnected()) { - connection.inventory[slot % inventory.length] = stack; + connection.inventory[slot % getTrueSizeInventory()] = stack; } } @@ -284,4 +306,21 @@ public class TileEntityPresent extends TileEntity implements IInventory { public boolean isItemValidForSlot(int p_94041_1_, ItemStack p_94041_2_) { return true; } + + /* IDoubleChest */ + + @Override + public int getTrueSizeInventory() { + return inventory.length; + } + + @Override + public ItemStack getTrueStackInSlot(int slot) { + return inventory[slot % getTrueSizeInventory()]; + } + + @Override + public void putStackInTrueSlot(int slot, ItemStack stack) { + inventory[slot % getTrueSizeInventory()] = stack; + } } diff --git a/src/main/java/com/cricketcraft/chisel/client/render/tile/RenderPresent.java b/src/main/java/com/cricketcraft/chisel/client/render/tile/RenderPresent.java index dcf906cf..0c66ba49 100644 --- a/src/main/java/com/cricketcraft/chisel/client/render/tile/RenderPresent.java +++ b/src/main/java/com/cricketcraft/chisel/client/render/tile/RenderPresent.java @@ -34,11 +34,11 @@ public class RenderPresent extends TileEntitySpecialRenderer implements IItemRen GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glTranslatef((float) x, (float) y + 1.0F, (float) z + 1.0F); GL11.glScalef(1.0F, -1.0F, -1.0F); - int meta = present.getBlockMetadata(); + int rotation = present.getRotation(); bindTexture(present); if (!present.isConnected()) { - GL11.glRotatef(90 * meta + 180, 0, 1, 0); - switch(present.getBlockMetadata()) { + GL11.glRotatef(90 * rotation + 180, 0, 1, 0); + switch(rotation) { case 0: GL11.glTranslatef(-1, 0, -1); break; @@ -67,7 +67,7 @@ public class RenderPresent extends TileEntitySpecialRenderer implements IItemRen default: break; } - if (meta == 0 || meta == 3) { + if (rotation == 0 || rotation == 3) { GL11.glRotatef(180, 0, 1, 0); GL11.glTranslatef(-2, 0, -1); } @@ -77,10 +77,10 @@ public class RenderPresent extends TileEntitySpecialRenderer implements IItemRen } private void bindTexture(TileEntityPresent present) { - int idx = present.getType() + (present.isConnected() ? 0 : 16); + int idx = present.getWorldObj().getBlockMetadata(present.xCoord, present.yCoord, present.zCoord) + (present.isConnected() ? 0 : 16); ResourceLocation rl = textureCache.get(idx); if (rl == null) { - String res = ChiselBlocks.present.getModelTexture(present.getType()); + String res = ChiselBlocks.present.getModelTexture(idx % 16); res += present.isConnected() ? "_double.png" : ".png"; rl = new ResourceLocation("chisel", res); textureCache.put(idx, rl); diff --git a/src/main/java/com/cricketcraft/chisel/item/chisel/ChiselMode.java b/src/main/java/com/cricketcraft/chisel/item/chisel/ChiselMode.java index 0d2446c5..96c39d7f 100644 --- a/src/main/java/com/cricketcraft/chisel/item/chisel/ChiselMode.java +++ b/src/main/java/com/cricketcraft/chisel/item/chisel/ChiselMode.java @@ -102,7 +102,11 @@ public enum ChiselMode implements IChiselMode { } if (held != null && held.getItem() instanceof IChiselItem) { - world.setBlock(x, y, z, v.getBlock(), v.getBlockMeta(), 3); + if (origBlock == block) { + world.setBlockMetadataWithNotify(x, y, z, v.getBlockMeta(), 3); + } else { + world.setBlock(x, y, z, v.getBlock(), v.getBlockMeta(), 3); + } boolean breakChisel = false; if (((IChiselItem) player.getCurrentEquippedItem().getItem()).onChisel(world, player.getCurrentEquippedItem(), v)) { player.getCurrentEquippedItem().damageItem(1, player); From 6a4619ddae1ca25eae06571a331bfbca99d3ed84 Mon Sep 17 00:00:00 2001 From: tterrag1098 Date: Wed, 11 Feb 2015 22:53:05 -0500 Subject: [PATCH 5/6] Whoops left a sysout --- src/main/java/com/cricketcraft/chisel/block/BlockPresent.java | 1 - 1 file changed, 1 deletion(-) diff --git a/src/main/java/com/cricketcraft/chisel/block/BlockPresent.java b/src/main/java/com/cricketcraft/chisel/block/BlockPresent.java index 6990e035..feff0d69 100644 --- a/src/main/java/com/cricketcraft/chisel/block/BlockPresent.java +++ b/src/main/java/com/cricketcraft/chisel/block/BlockPresent.java @@ -128,7 +128,6 @@ public class BlockPresent extends Block implements ICarvable { public AxisAlignedBB getBoundingBox(TileEntityPresent me) { if (me == null) { - System.out.println(-1); return AxisAlignedBB.getBoundingBox(minX, minY, minZ, maxX, maxY, maxZ); } int x = me.xCoord, y = me.yCoord, z = me.zCoord; From e1d2afccd5496ce94048cb653343c09776bb94c4 Mon Sep 17 00:00:00 2001 From: Cricket Date: Thu, 12 Feb 2015 21:33:58 -0500 Subject: [PATCH 6/6] I have 2 done, I am not that creative --- .../com/cricketcraft/chisel/Features.java | 15 +++++++ .../chisel/init/ChiselBlocks.java | 37 ++---------------- .../resources/assets/chisel/lang/en_US.lang | 5 +++ .../textures/blocks/valentines/bricks.png | Bin 0 -> 512 bytes .../textures/blocks/valentines/companion.png | Bin 0 -> 504 bytes 5 files changed, 24 insertions(+), 33 deletions(-) create mode 100644 src/main/resources/assets/chisel/textures/blocks/valentines/bricks.png create mode 100644 src/main/resources/assets/chisel/textures/blocks/valentines/companion.png diff --git a/src/main/java/com/cricketcraft/chisel/Features.java b/src/main/java/com/cricketcraft/chisel/Features.java index 415eeb4d..f8ff591c 100644 --- a/src/main/java/com/cricketcraft/chisel/Features.java +++ b/src/main/java/com/cricketcraft/chisel/Features.java @@ -2454,6 +2454,21 @@ public enum Features { } }, + VALENTINES { + @Override void addBlocks() { + BlockCarvable valentines = (BlockCarvable) new BlockCarvable(Material.wood).setStepSound(Block.soundTypeStone).setCreativeTab(ChiselTabs.tabOtherChiselBlocks).setHardness(2F) + .setResistance(10F); + valentines.carverHelper.addVariation("tile.valentines.0.desc", 0, "valentines/bricks"); + valentines.carverHelper.addVariation("tile.valentines.1.desc", 1, "valentines/companion"); + valentines.carverHelper.registerAll(valentines, "valentines"); + Carving.chisel.registerOre("valentines", "blockValentines"); + } + + @Override void addRecipes() { + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ChiselBlocks.valentines, 8, 0), "***", "*X*", "***", '*', "stone", 'X', new ItemStack(Items.dye, 1, 9))); + } + }, + VOIDSTONE { @Override diff --git a/src/main/java/com/cricketcraft/chisel/init/ChiselBlocks.java b/src/main/java/com/cricketcraft/chisel/init/ChiselBlocks.java index 49d0e78a..808de56b 100644 --- a/src/main/java/com/cricketcraft/chisel/init/ChiselBlocks.java +++ b/src/main/java/com/cricketcraft/chisel/init/ChiselBlocks.java @@ -1,40 +1,9 @@ package com.cricketcraft.chisel.init; -import net.minecraft.block.Block; - import com.cricketcraft.chisel.Chisel; -import com.cricketcraft.chisel.block.BlockCarvable; -import com.cricketcraft.chisel.block.BlockCarvableGlass; -import com.cricketcraft.chisel.block.BlockCarvableGlowstone; -import com.cricketcraft.chisel.block.BlockCarvableIce; -import com.cricketcraft.chisel.block.BlockCarvableIcePillar; -import com.cricketcraft.chisel.block.BlockCarvableIceStairs; -import com.cricketcraft.chisel.block.BlockCarvableLayered; -import com.cricketcraft.chisel.block.BlockCarvablePackedIce; -import com.cricketcraft.chisel.block.BlockCarvablePackedIcePillar; -import com.cricketcraft.chisel.block.BlockCarvablePackedIceStairs; -import com.cricketcraft.chisel.block.BlockCarvablePane; -import com.cricketcraft.chisel.block.BlockCarvablePillar; -import com.cricketcraft.chisel.block.BlockCarvablePowered; -import com.cricketcraft.chisel.block.BlockCarvablePumpkin; -import com.cricketcraft.chisel.block.BlockCarvableSlab; -import com.cricketcraft.chisel.block.BlockCarvableStairs; -import com.cricketcraft.chisel.block.BlockCarvableTorch; -import com.cricketcraft.chisel.block.BlockCloud; -import com.cricketcraft.chisel.block.BlockConcrete; -import com.cricketcraft.chisel.block.BlockGrimstone; -import com.cricketcraft.chisel.block.BlockHolystone; -import com.cricketcraft.chisel.block.BlockLavastone; -import com.cricketcraft.chisel.block.BlockMarbleCarpet; -import com.cricketcraft.chisel.block.BlockMarbleTexturedOre; -import com.cricketcraft.chisel.block.BlockMarbleWall; -import com.cricketcraft.chisel.block.BlockPresent; -import com.cricketcraft.chisel.block.BlockRoadLine; -import com.cricketcraft.chisel.block.BlockSnakestone; -import com.cricketcraft.chisel.block.BlockSnakestoneObsidian; -import com.cricketcraft.chisel.block.BlockWaterstone; - +import com.cricketcraft.chisel.block.*; import cpw.mods.fml.common.registry.GameRegistry.ObjectHolder; +import net.minecraft.block.Block; @ObjectHolder(Chisel.MOD_ID) public final class ChiselBlocks { @@ -122,6 +91,8 @@ public final class ChiselBlocks { public static final BlockCarvable bloodRune = null; public static final BlockCarvable bloodBrick = null; + // Holidays + public static final BlockCarvable valentines = null; public static final BlockPresent present = null; // Arrays can't be final because of how @ObjectHolder works diff --git a/src/main/resources/assets/chisel/lang/en_US.lang b/src/main/resources/assets/chisel/lang/en_US.lang index 782950ee..c7265062 100644 --- a/src/main/resources/assets/chisel/lang/en_US.lang +++ b/src/main/resources/assets/chisel/lang/en_US.lang @@ -29,6 +29,11 @@ item.upgrade_stack.desc=Allows it to manufacture stacks at a time #Chisel 2 +#Valentines +tile.chisel.valentines.name=Valentines Block +tile.valentines.0.desc=Valentines Bricks +tile.valentines.1.desc=If it speaks, I wouldn't touch it + #AntiBlocks tile.chisel.antiBlock.name=Anti Block tile.antiBlock.black.desc=Black Anti Block diff --git a/src/main/resources/assets/chisel/textures/blocks/valentines/bricks.png b/src/main/resources/assets/chisel/textures/blocks/valentines/bricks.png new file mode 100644 index 0000000000000000000000000000000000000000..57f3a8380893409da538007d6fbed96441cec970 GIT binary patch literal 512 zcmV+b0{{JqP)Px#1ZP1_K>z@;j|==^1poj532;bRa{vGmbN~PnbOGLGA9w%&02p*dSaefwW^{L9 za%BK;VQFr3E^cLXAT%y8E;VI^GGzb&0dYx0K~y+TZIVArf>9KQ?-xq#iv$+FX(mB) z4Mq_}Btm5nnr1X4L@q5&5r%{s8Z;F(1kq45G*m-dLqqS|^ZJW}MDTDq_x!)-T=%`+ z4RUS2&LeoECor;h-ogpaAi zN^HWB6_rqo%)r%T;&0-m&4}k{K*`K(@j^sMH8nk$CE z)33M2wJkzdmLG(bUl z3;BcrgDODKy!8XfVwE8bP#h=#;VNEKOUUMD{8q3#`3PV*?8j;<5hqrMSPx#1ZP1_K>z@;j|==^1poj532;bRa{vGmbN~PnbOGLGA9w%&02p*dSaefwW^{L9 za%BK;VQFr3E^cLXAT%y8E;VI^GGzb&0clA@K~y+TUD7vBgFzGo;Jq)wIl&El779c( zjyM4g4HuxH;skW?ErSq38m(WLdC7m-tR}nlbibJ`rkD4Nn?|Sou$?bwSM2Tm-Eq4m zzM5ZiF};N^0Sr6>wj3~;-HvjM$K8Sqq4-%ZZ%H|wK_9q)H@~~!_D@E{B4HN1Fb*2W ztzK7$?r?C_YW7CMcE2ZLDo_zetDg=My0bIe(|(yksZFVnJ+&=(kkJV~$1i}SWNdM+ z+4R9I5<+}$WlY{a&t60Q7(c`N_`%%{n+>wMv@ZNyv+};#q5cXCW-$UIlyukOcZPp# zz;OnIx&t*G0SEpH!WMMjoCLWzvw0lRltNAsUVvdYH_UwvR;bl*I8Bw2);jF`_iEu8 z!Jl21P7T)J^aSK`w*aa^a$at- u%4Ng)X=HBcd~KAfh=XpK&`YyfO}+p%2mms?OP?wL0000