//mod_EvilMinecraft_Fragment.java: package net.minecraft.src; import org.lwjgl.opengl.GL11; public class mod_EvilMinecraft_Fragment extends BaseMod { public static int planterPotModelID; public static int hypercubeModelID; public static Block planterPot; public static Block hypercube; public static Item itemPlanterPot; public mod_EvilMinecraft_Fragment() { //BlockPlanterPot int planterPotID = 160; int planterTextureIndex = 72; //Clay texture planterPot = new BlockPlanterPot(planterPotID, planterTextureIndex, Material.glass); planterPot.setHardness(0.2F); planterPot.setBlockName("planterPot"); ModLoader.RegisterBlock(planterPot); ModLoader.AddName(planterPot, "Planter Pot"); //ItemPlanterPot int itemPlanterPotID = 500 - 256; int itemPlanterTextureIndex = 156; //Cauldron itemPlanterPot = new ItemPlanterPot(itemPlanterPotID); itemPlanterPot.setIconIndex(itemPlanterTextureIndex); itemPlanterPot.setItemName("itemPlanterPot"); ModLoader.AddName(itemPlanterPot, "Planter Pot"); ModLoader.AddSmelting(Block.blockClay.blockID, new ItemStack(itemPlanterPot)); //BlockHypercube int hypercubeID = 161; int hypercubeTextureIndex = 14; //NetherPortal? hypercube = new BlockHypercube(hypercubeID, hypercubeTextureIndex, Material.portal); hypercube.setBlockName("hypercube"); ModLoader.RegisterBlock(hypercube); ModLoader.AddName(hypercube, "Hyper Cube"); ModLoader.AddRecipe(new ItemStack(hypercube), new Object[]{"B", Character.valueOf('B'), Block.bedrock}); } public String getVersion() { return "1.1.0"; } public void load() { planterPotModelID = ModLoader.getUniqueBlockModelID(this, true); hypercubeModelID = ModLoader.getUniqueBlockModelID(this, true); } private boolean RenderPlanterPotInWorld(RenderBlocks renderblocks, IBlockAccess iblockaccess, int i, int j, int k, Block block) { //Base block.setBlockBounds(0.1875F, 0.0F, 0.1875F, 0.8125F, 0.0625F, 0.8125F); renderblocks.renderStandardBlock(block, i, j, k); //Inner sides, also collision box block.setBlockBounds(0.1875F, 0.0F, 0.125F, 0.875F, 0.8125F, 0.1875F); renderblocks.renderStandardBlock(block, i, j, k); block.setBlockBounds(0.1875F, 0.0F, 0.8125F, 0.875F, 0.8125F, 0.875F); renderblocks.renderStandardBlock(block, i, j, k); block.setBlockBounds(0.125F, 0.0F, 0.1875F, 0.1875F, 0.875F, 0.8125F); renderblocks.renderStandardBlock(block, i, j, k); block.setBlockBounds(0.8125F, 0.0F, 0.1875F, 0.875F, 0.875F, 0.8125F); renderblocks.renderStandardBlock(block, i, j, k); //Inner side-lip block.setBlockBounds(0.125F, 0.8125F, 0.125F, 0.875F, 0.875F, 0.1875F); renderblocks.renderStandardBlock(block, i, j, k); block.setBlockBounds(0.125F, 0.8125F, 0.8125F, 0.875F, 0.875F, 0.875F); renderblocks.renderStandardBlock(block, i, j, k); //Outer sides block.setBlockBounds(0.25F, 0.0F, 0.0625F, 0.75F, 0.8125F, 0.125F); renderblocks.renderStandardBlock(block, i, j, k); block.setBlockBounds(0.25F, 0.0F, 0.875F, 0.75F, 0.8125F, 0.9375F); renderblocks.renderStandardBlock(block, i, j, k); block.setBlockBounds(0.0625F, 0.0F, 0.25F, 0.125F, 0.8125F, 0.75F); renderblocks.renderStandardBlock(block, i, j, k); block.setBlockBounds(0.875F, 0.0F, 0.25F, 0.9375F, 0.8125F, 0.75F); renderblocks.renderStandardBlock(block, i, j, k); //Inner lip block.setBlockBounds(0.1875F, 0.8125F, 0.0625F, 0.8125F, 0.875F, 0.125F); renderblocks.renderStandardBlock(block, i, j, k); block.setBlockBounds(0.1875F, 0.8125F, 0.875F, 0.8125F, 0.875F, 0.9375F); renderblocks.renderStandardBlock(block, i, j, k); block.setBlockBounds(0.0625F, 0.8125F, 0.1875F, 0.125F, 0.875F, 0.8125F); renderblocks.renderStandardBlock(block, i, j, k); block.setBlockBounds(0.875F, 0.8125F, 0.1875F, 0.9375F, 0.875F, 0.8125F); renderblocks.renderStandardBlock(block, i, j, k); //Outer lip block.setBlockBounds(0.25F, 0.8125F, 0.0F, 0.75F, 0.875F, 0.0625F); renderblocks.renderStandardBlock(block, i, j, k); block.setBlockBounds(0.25F, 0.8125F, 0.9375F, 0.75F, 0.875F, 1.0F); renderblocks.renderStandardBlock(block, i, j, k); block.setBlockBounds(0.0F, 0.8125F, 0.25F, 0.0625F, 0.875F, 0.75F); renderblocks.renderStandardBlock(block, i, j, k); block.setBlockBounds(0.9375F, 0.8125F, 0.25F, 1.0F, 0.875F, 0.75F); renderblocks.renderStandardBlock(block, i, j, k); return false; } private boolean RenderHypercubeInWorld(RenderBlocks renderblocks, IBlockAccess iblockaccess, int i, int j, int k, Block block) { for(int layer = 0; layer < 7; layer++) { float offset = (float)layer / 16F; block.setBlockBounds(0.0F + offset, 0.0F + offset, 0.0F + offset, 0.0625F + offset, 0.0625F + offset, 1.0F - offset); renderblocks.renderStandardBlock(block, i, j, k); block.setBlockBounds(0.9275F - offset, 0.0F + offset, 0.0F + offset, 1.0F - offset, 0.0625F + offset, 1.0F - offset); renderblocks.renderStandardBlock(block, i, j, k); block.setBlockBounds(0.0F + offset, 0.9375F - offset, 0.0F + offset, 0.0625F + offset, 1.0F - offset, 1.0F - offset); renderblocks.renderStandardBlock(block, i, j, k); block.setBlockBounds(0.9375F - offset, 0.9375F - offset, 0.0F + offset, 1.0F - offset, 1.0F - offset, 1.0F - offset); renderblocks.renderStandardBlock(block, i, j, k); block.setBlockBounds(0.0625F + offset, 0.0F + offset, 0.0F + offset, 0.9375F - offset, 0.0625F + offset, 0.0625F + offset); renderblocks.renderStandardBlock(block, i, j, k); block.setBlockBounds(0.0625F + offset, 0.0F + offset, 0.9375F - offset, 0.9375F - offset, 0.0625F + offset, 1.0F - offset); renderblocks.renderStandardBlock(block, i, j, k); block.setBlockBounds(0.0625F + offset, 0.9375F - offset, 0.0F + offset, 0.9375F - offset, 1.0F - offset, 0.0625F + offset); renderblocks.renderStandardBlock(block, i, j, k); block.setBlockBounds(0.0625F + offset, 0.9375F - offset, 0.9375F - offset, 0.9375F - offset, 1.0F - offset, 1.0F - offset); renderblocks.renderStandardBlock(block, i, j, k); block.setBlockBounds(0.0F + offset, 0.0625F + offset, 0.0F + offset, 0.0625F + offset, 0.9375F - offset, 0.0625F + offset); renderblocks.renderStandardBlock(block, i, j, k); block.setBlockBounds(0.0F + offset, 0.0625F + offset, 0.9375F - offset, 0.0625F + offset, 0.9375F - offset, 1.0F - offset); renderblocks.renderStandardBlock(block, i, j, k); block.setBlockBounds(0.9375F - offset, 0.0625F + offset, 0.0F + offset, 1.0F - offset, 0.9375F - offset, 0.0625F + offset); renderblocks.renderStandardBlock(block, i, j, k); block.setBlockBounds(0.9375F - offset, 0.0625F + offset, 0.9375F - offset, 1.0F - offset, 0.9375F - offset, 1.0F - offset); renderblocks.renderStandardBlock(block, i, j, k); } block.setBlockBounds(0.4375F, 0.4375F, 0.4375F, 0.5625F, 0.5625F, 0.5625F); renderblocks.renderStandardBlock(block, i, j, k); return false; } public boolean RenderWorldBlock(RenderBlocks renderblocks, IBlockAccess iblockaccess, int i, int j, int k, Block block, int l) { if(l == planterPotModelID) { return RenderPlanterPotInWorld(renderblocks, iblockaccess, i, j, k, block); } else if(l == hypercubeModelID) { return RenderHypercubeInWorld(renderblocks, iblockaccess, i, j, k, block); } else { return false; } } } ----------------------------------------------- //BlockPlanterPot.java: package net.minecraft.src; import java.util.ArrayList; import java.util.Random; public class BlockPlanterPot extends Block { public BlockPlanterPot(int id, int textureIndex, Material mat) { super(id, textureIndex, mat); } public void getCollidingBoundingBoxes(World world, int i, int j, int k, AxisAlignedBB axisalignedbb, ArrayList arraylist) { setBlockBounds(0.125F, 0.0F, 0.125F, 0.875F, 0.0625F, 0.875F); super.getCollidingBoundingBoxes(world, i, j, k, axisalignedbb, arraylist); setBlockBounds(0.125F, 0.0625F, 0.125F, 0.875F, 0.875F, 0.1875F); super.getCollidingBoundingBoxes(world, i, j, k, axisalignedbb, arraylist); setBlockBounds(0.125F, 0.0625F, 0.8125F, 0.875F, 0.875F, 0.875F); super.getCollidingBoundingBoxes(world, i, j, k, axisalignedbb, arraylist); setBlockBounds(0.125F, 0.0625F, 0.1875F, 0.1875F, 0.875F, 0.8125F); super.getCollidingBoundingBoxes(world, i, j, k, axisalignedbb, arraylist); setBlockBounds(0.8125F, 0.0625F, 0.1875F, 0.875F, 0.875F, 0.8125F); super.getCollidingBoundingBoxes(world, i, j, k, axisalignedbb, arraylist); setBlockBoundsForItemRender(); } public void setBlockBoundsForItemRender() //Controls hitbox! { setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.875F, 1.0F); } public int getRenderType() { return mod_EvilMinecraft_Fragment.planterPotModelID; } public boolean isOpaqueCube() { return false; } public boolean renderAsNormalBlock() { return false; } public int colorMultiplier(IBlockAccess iblockaccess, int i, int j, int k) { return 0xff2020; } public int idDropped(int i, Random random, int j) { return mod_EvilMinecraft_Fragment.itemPlanterPot.shiftedIndex; } public int quantityDropped(Random random) { return 1; } } ---------------------------------- //ItemPlanterPot.java: package net.minecraft.src; public class ItemPlanterPot extends Item { public ItemPlanterPot(int i) { super(i); } public boolean onItemUse(ItemStack itemstack, EntityPlayer entityplayer, World world, int i, int j, int k, int l) { if (world.getBlockId(i, j, k) != Block.snow.blockID) { if (l == 0) { j--; } if (l == 1) { j++; } if (l == 2) { k--; } if (l == 3) { k++; } if (l == 4) { i--; } if (l == 5) { i++; } if (!world.isAirBlock(i, j, k)) { return false; } } if (!entityplayer.canPlayerEdit(i, j, k)) { return false; } if (mod_EvilMinecraft_Fragment.planterPot.canPlaceBlockAt(world, i, j, k)) { itemstack.stackSize--; world.setBlockWithNotify(i, j, k, mod_EvilMinecraft_Fragment.planterPot.blockID); } return true; } public int getColorFromDamage(int i, int j) { return 0xff2020; } } ---------------------------------- //BlockHypercube.java: package net.minecraft.src; public class BlockHypercube extends Block { public BlockHypercube(int id, int textureIndex, Material mat) { super(id, textureIndex, mat); } public void setBlockBoundsForItemRender() { setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); } public int getRenderType() { return mod_EvilMinecraft_Fragment.hypercubeModelID; } public boolean isOpaqueCube() { return false; } public boolean renderAsNormalBlock() { return false; } }