Advertisement
WackoMcGoose

mod_EvilMinecraft in its entirety

Feb 6th, 2012
149
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 24.06 KB | None | 0 0
  1. //WackoMcGoose's stuff for EvilMinecraft
  2.  
  3. package net.minecraft.src;
  4.  
  5. import org.lwjgl.opengl.GL11;
  6.  
  7. public class mod_EvilMinecraft extends BaseMod
  8. {
  9.     public static int planterPotModelID;
  10.     public static int hypercubeModelID;
  11.     public static int chancePotModelID;
  12.     public static int grassModelID;
  13.     public static Block planterPot;
  14.     public static Block hypercube;
  15.     public static Block chancePot;
  16.     public static Block trapDoorMetal;
  17.     public static Block cactusPoison;
  18.     public static Block blockSlime;
  19.     public static Block blockSlimeBlock;
  20.     public static Item itemPlanterPot;
  21.     public static Item itemNetherFertilizer;
  22.  
  23.     //These are defined out here because BlockCactusPoison.getBlockTextureFromSide needs to know where to find them
  24.     public static int poisonCactusTextureIndexTop = ModLoader.addOverride("/terrain.png", "/evmc/blockCactusPoisonTop.png");
  25.     public static int poisonCactusTextureIndexSide = ModLoader.addOverride("/terrain.png", "/evmc/blockCactusPoisonSide.png");
  26.     public static int poisonCactusTextureIndexBottom = ModLoader.addOverride("/terrain.png", "/evmc/blockCactusPoisonBottom.png");
  27.    
  28.     public mod_EvilMinecraft_Fragment()
  29.     {
  30.         //BlockPlanterPot
  31.         int planterPotID = 160;
  32.         int planterTextureIndex = 72; //Clay texture
  33.         planterPot = new BlockPlanterPot(planterPotID, planterTextureIndex, Material.glass);
  34.         planterPot.setHardness(0.5F);
  35.         planterPot.setBlockName("planterPot");
  36.         ModLoader.RegisterBlock(planterPot);
  37.         ModLoader.AddName(planterPot, "Planter Pot");
  38.        
  39.         //ItemPlanterPot
  40.         int itemPlanterPotID = 6500 - 256;
  41.         int itemPlanterTextureIndex = 156; //Cauldron
  42.         itemPlanterPot = new ItemPlanterPot(itemPlanterPotID);
  43.         itemPlanterPot.setIconIndex(itemPlanterTextureIndex);
  44.         itemPlanterPot.setItemName("itemPlanterPot");
  45.         ModLoader.AddName(itemPlanterPot, "Planter Pot");
  46.         ModLoader.AddSmelting(Block.blockClay.blockID, new ItemStack(itemPlanterPot));
  47.        
  48.         //BlockHypercube
  49.         int hypercubeID = 200;
  50.         int hypercubeTextureIndex = ModLoader.addOverride("/terrain.png", "/evmc/blackholeOverride.png"); //NetherPortal?
  51.         hypercube = new BlockHypercube(hypercubeID, hypercubeTextureIndex, Material.portal);
  52.         hypercube.setBlockName("hypercube");
  53.         ModLoader.RegisterBlock(hypercube);
  54.         ModLoader.AddName(hypercube, "Hyper Cube");
  55.         ModLoader.AddRecipe(new ItemStack(hypercube), new Object[]{"B", Character.valueOf('B'), Block.bedrock});
  56.        
  57.         //BlockChancePot
  58.         int chancePotID = 161;
  59.         int chancePotTextureIndex = 54; //Stonebrick texture
  60.         chancePot = new BlockChancePot(chancePotID, chancePotTextureIndex, Material.glass);
  61.         chancePot.setHardness(0.5F);
  62.         chancePot.setBlockName("chancePot");
  63.         ModLoader.RegisterBlock(chancePot);
  64.         ModLoader.AddName(chancePot, "Pot of Chance");
  65.         ModLoader.AddRecipe(new ItemStack(chancePot), new Object[]{"BB", Character.valueOf('B'), Block.dirt}); //For testification only
  66.        
  67.         //ItemNetherFertilizer
  68.         int itemNetherFertilizerID = 6501 - 256;
  69.         int itemNetherFertilizerTextureIndex = ModLoader.addOverride("/gui/items.png", "/evmc/itemNetherFertilizer.png");//191; //Bonemeal for now
  70.         itemNetherFertilizer = new ItemNetherFertilizer(itemNetherFertilizerID);
  71.         itemNetherFertilizer.setIconIndex(itemNetherFertilizerTextureIndex);
  72.         itemNetherFertilizer.setItemName("netherFertilizer");
  73.         ModLoader.AddName(itemNetherFertilizer, "Nether Fertilizer");
  74.         ModLoader.AddShapelessRecipe(new ItemStack(itemNetherFertilizer, 3), new Object[]{new ItemStack(Item.dyePowder, 1, 15), Item.rottenFlesh, Item.blazePowder});
  75.  
  76.         //BlockTrapDoorMetal
  77.         int blockTrapDoorMetalID = 162;
  78.         int blockTrapDoorMetalTextureIndex = ModLoader.addOverride("/terrain.png", "/evmc/blockTrapdoorMetal.png");
  79.         trapDoorMetal = new BlockTrapDoorMetal(blockTrapDoorMetalID, blockTrapDoorMetalTextureIndex, Material.iron);
  80.         trapDoorMetal.setHardness(5F);
  81.         trapDoorMetal.setBlockName("trapDoorMetal");
  82.         ModLoader.RegisterBlock(trapDoorMetal);
  83.         ModLoader.AddName(trapDoorMetal, "Iron Trap Door");
  84.         ModLoader.AddRecipe(new ItemStack(trapDoorMetal), new Object[]{"II", "II", Character.valueOf('I'), Item.ingotIron});
  85.        
  86.         //BlockCactusPoison
  87.         int poisonCactusID = 163;
  88.         //Textures are defined up above so they can be public
  89.         cactusPoison = new BlockCactusPoison(poisonCactusID, poisonCactusTextureIndexSide);
  90.         cactusPoison.setHardness(0.4F);
  91.         cactusPoison.setBlockName("cactusPoison");
  92.         ModLoader.RegisterBlock(cactusPoison);
  93.         ModLoader.AddName(cactusPoison, "Poison Cactus");
  94.         ModLoader.AddShapelessRecipe(new ItemStack(cactusPoison), new Object[]{Block.cactus}); //For testification only
  95.        
  96.         //BlockSlime - sticky and placed by slimes like snow and snow golems
  97.         int blockSlimeID = 164;
  98.         int blockSlimeTextureIndex = ModLoader.addOverride("/terrain.png", "/evmc/blockSlime.png");
  99.         blockSlime = new BlockSlime(blockSlimeID, blockSlimeTextureIndex); //Same code as BlockSoulSand, which presets Material.sand
  100.         blockSlime.setHardness(0.5F);
  101.         blockSlime.setBlockName("slimeLayer");
  102.         ModLoader.RegisterBlock(blockSlime);
  103.         ModLoader.AddName(blockSlime, "Slime Block");
  104.        
  105.         //BlockSlimeBlock - crafted only and BOUNCY!
  106.         int blockSlimeBlockID = 165;
  107.         blockSlimeBlock = new BlockSlimeBlock(blockSlimeBlockID, blockSlimeTextureIndex);
  108.         blockSlimeBlock.setHardness(0.5F);
  109.         blockSlimeBlock.setBlockName("craftedSlime");
  110.         ModLoader.RegisterBlock(blockSlimeBlock);
  111.         ModLoader.AddName(blockSlimeBlock, "Slime Block");
  112.         ModLoader.AddRecipe(new ItemStack(blockSlimeBlock), new Object[]{"SS", "SS", Character.valueOf('S'), Item.slimeBall});
  113.     }
  114.    
  115.     public String getVersion()
  116.     {
  117.         return "1.1.0";
  118.     }
  119.    
  120.     public void load()
  121.     {
  122.         planterPotModelID = ModLoader.getUniqueBlockModelID(this, true);
  123.         hypercubeModelID = ModLoader.getUniqueBlockModelID(this, true);
  124.         chancePotModelID = ModLoader.getUniqueBlockModelID(this, true);
  125.         grassModelID = ModLoader.getUniqueBlockModelID(this, true);
  126.     }
  127.    
  128.     private boolean RenderPlanterPotInWorld(RenderBlocks renderblocks, IBlockAccess iblockaccess, int i, int j, int k, Block block)
  129.     {
  130.         //Base
  131.         block.setBlockBounds(0.1875F, 0.0F, 0.1875F, 0.8125F, 0.0625F, 0.8125F);
  132.         renderblocks.renderStandardBlock(block, i, j, k);
  133.         //Inner sides, also collision box
  134.         block.setBlockBounds(0.1875F, 0.0F, 0.125F, 0.875F, 0.8125F, 0.1875F);
  135.         renderblocks.renderStandardBlock(block, i, j, k);
  136.         block.setBlockBounds(0.1875F, 0.0F, 0.8125F, 0.875F, 0.8125F, 0.875F);
  137.         renderblocks.renderStandardBlock(block, i, j, k);
  138.         block.setBlockBounds(0.125F, 0.0F, 0.1875F, 0.1875F, 0.875F, 0.8125F);
  139.         renderblocks.renderStandardBlock(block, i, j, k);
  140.         block.setBlockBounds(0.8125F, 0.0F, 0.1875F, 0.875F, 0.875F, 0.8125F);
  141.         renderblocks.renderStandardBlock(block, i, j, k);
  142.         //Inner side-lip
  143.         block.setBlockBounds(0.125F, 0.8125F, 0.125F, 0.875F, 0.875F, 0.1875F);
  144.         renderblocks.renderStandardBlock(block, i, j, k);
  145.         block.setBlockBounds(0.125F, 0.8125F, 0.8125F, 0.875F, 0.875F, 0.875F);
  146.         renderblocks.renderStandardBlock(block, i, j, k);
  147.         //Outer sides
  148.         block.setBlockBounds(0.25F, 0.0F, 0.0625F, 0.75F, 0.8125F, 0.125F);
  149.         renderblocks.renderStandardBlock(block, i, j, k);
  150.         block.setBlockBounds(0.25F, 0.0F, 0.875F, 0.75F, 0.8125F, 0.9375F);
  151.         renderblocks.renderStandardBlock(block, i, j, k);
  152.         block.setBlockBounds(0.0625F, 0.0F, 0.25F, 0.125F, 0.8125F, 0.75F);
  153.         renderblocks.renderStandardBlock(block, i, j, k);
  154.         block.setBlockBounds(0.875F, 0.0F, 0.25F, 0.9375F, 0.8125F, 0.75F);
  155.         renderblocks.renderStandardBlock(block, i, j, k);
  156.         //Inner lip
  157.         block.setBlockBounds(0.1875F, 0.8125F, 0.0625F, 0.8125F, 0.875F, 0.125F);
  158.         renderblocks.renderStandardBlock(block, i, j, k);
  159.         block.setBlockBounds(0.1875F, 0.8125F, 0.875F, 0.8125F, 0.875F, 0.9375F);
  160.         renderblocks.renderStandardBlock(block, i, j, k);
  161.         block.setBlockBounds(0.0625F, 0.8125F, 0.1875F, 0.125F, 0.875F, 0.8125F);
  162.         renderblocks.renderStandardBlock(block, i, j, k);
  163.         block.setBlockBounds(0.875F, 0.8125F, 0.1875F, 0.9375F, 0.875F, 0.8125F);
  164.         renderblocks.renderStandardBlock(block, i, j, k);
  165.         //Outer lip
  166.         block.setBlockBounds(0.25F, 0.8125F, 0.0F, 0.75F, 0.875F, 0.0625F);
  167.         renderblocks.renderStandardBlock(block, i, j, k);
  168.         block.setBlockBounds(0.25F, 0.8125F, 0.9375F, 0.75F, 0.875F, 1.0F);
  169.         renderblocks.renderStandardBlock(block, i, j, k);
  170.         block.setBlockBounds(0.0F, 0.8125F, 0.25F, 0.0625F, 0.875F, 0.75F);
  171.         renderblocks.renderStandardBlock(block, i, j, k);
  172.         block.setBlockBounds(0.9375F, 0.8125F, 0.25F, 1.0F, 0.875F, 0.75F);
  173.         renderblocks.renderStandardBlock(block, i, j, k);
  174.         //Not rendered, just fix the stupid hitbox
  175.         block.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.875F, 1.0F);
  176.         return false;
  177.     }
  178.    
  179.     private boolean RenderHypercubeInWorld(RenderBlocks renderblocks, IBlockAccess iblockaccess, int i, int j, int k, Block block)
  180.     {
  181.         for(int layer = 0; layer < 7; layer++)
  182.         {
  183.             float offset = (float)layer / 16F;
  184.             block.setBlockBounds(0.0F + offset, 0.0F + offset, 0.0F + offset, 0.0625F + offset, 0.0625F + offset, 1.0F - offset);
  185.             renderblocks.renderStandardBlock(block, i, j, k);
  186.             block.setBlockBounds(0.9275F - offset, 0.0F + offset, 0.0F + offset, 1.0F - offset, 0.0625F + offset, 1.0F - offset);
  187.             renderblocks.renderStandardBlock(block, i, j, k);
  188.             block.setBlockBounds(0.0F + offset, 0.9375F - offset, 0.0F + offset, 0.0625F + offset, 1.0F - offset, 1.0F - offset);
  189.             renderblocks.renderStandardBlock(block, i, j, k);
  190.             block.setBlockBounds(0.9375F - offset, 0.9375F - offset, 0.0F + offset, 1.0F - offset, 1.0F - offset, 1.0F - offset);
  191.             renderblocks.renderStandardBlock(block, i, j, k);
  192.            
  193.             block.setBlockBounds(0.0625F + offset, 0.0F + offset, 0.0F + offset, 0.9375F - offset, 0.0625F + offset, 0.0625F + offset);
  194.             renderblocks.renderStandardBlock(block, i, j, k);
  195.             block.setBlockBounds(0.0625F + offset, 0.0F + offset, 0.9375F - offset, 0.9375F - offset, 0.0625F + offset, 1.0F - offset);
  196.             renderblocks.renderStandardBlock(block, i, j, k);
  197.             block.setBlockBounds(0.0625F + offset, 0.9375F - offset, 0.0F + offset, 0.9375F - offset, 1.0F - offset, 0.0625F + offset);
  198.             renderblocks.renderStandardBlock(block, i, j, k);
  199.             block.setBlockBounds(0.0625F + offset, 0.9375F - offset, 0.9375F - offset, 0.9375F - offset, 1.0F - offset, 1.0F - offset);
  200.             renderblocks.renderStandardBlock(block, i, j, k);
  201.            
  202.             block.setBlockBounds(0.0F + offset, 0.0625F + offset, 0.0F + offset, 0.0625F + offset, 0.9375F - offset, 0.0625F + offset);
  203.             renderblocks.renderStandardBlock(block, i, j, k);
  204.             block.setBlockBounds(0.0F + offset, 0.0625F + offset, 0.9375F - offset, 0.0625F + offset, 0.9375F - offset, 1.0F - offset);
  205.             renderblocks.renderStandardBlock(block, i, j, k);
  206.             block.setBlockBounds(0.9375F - offset, 0.0625F + offset, 0.0F + offset, 1.0F - offset, 0.9375F - offset, 0.0625F + offset);
  207.             renderblocks.renderStandardBlock(block, i, j, k);
  208.             block.setBlockBounds(0.9375F - offset, 0.0625F + offset, 0.9375F - offset, 1.0F - offset, 0.9375F - offset, 1.0F - offset);
  209.             renderblocks.renderStandardBlock(block, i, j, k);
  210.         }
  211.         block.setBlockBounds(0.4375F, 0.4375F, 0.4375F, 0.5625F, 0.5625F, 0.5625F);
  212.         renderblocks.renderStandardBlock(block, i, j, k);
  213.         return false;
  214.     }
  215.    
  216.     private boolean RenderChancePotInWorld(RenderBlocks renderblocks, IBlockAccess iblockaccess, int i, int j, int k, Block block)
  217.     {
  218.         //Inner sides and lid
  219.         block.setBlockBounds(0.1875F, 0.0F, 0.125F, 0.8125F, 0.9375F, 0.875F);
  220.         renderblocks.renderStandardBlock(block, i, j, k);
  221.         block.setBlockBounds(0.125F, 0.0F, 0.1875F, 0.1875F, 0.9375F, 0.8125F);
  222.         renderblocks.renderStandardBlock(block, i, j, k);
  223.         block.setBlockBounds(0.8125F, 0.0F, 0.1875F, 0.875F, 0.9375F, 0.8125F);
  224.         renderblocks.renderStandardBlock(block, i, j, k);
  225.         block.setBlockBounds(0.4375F, 0.9375F, 0.4375F, 0.5625F, 1.0F, 0.5625F);
  226.         renderblocks.renderStandardBlock(block, i, j, k);
  227.         //Inner side-lip
  228.         block.setBlockBounds(0.125F, 0.8125F, 0.125F, 0.875F, 0.875F, 0.1875F);
  229.         renderblocks.renderStandardBlock(block, i, j, k);
  230.         block.setBlockBounds(0.125F, 0.8125F, 0.8125F, 0.875F, 0.875F, 0.875F);
  231.         renderblocks.renderStandardBlock(block, i, j, k);
  232.         //Outer sides
  233.         block.setBlockBounds(0.25F, 0.0F, 0.0625F, 0.75F, 0.8125F, 0.125F);
  234.         renderblocks.renderStandardBlock(block, i, j, k);
  235.         block.setBlockBounds(0.25F, 0.0F, 0.875F, 0.75F, 0.8125F, 0.9375F);
  236.         renderblocks.renderStandardBlock(block, i, j, k);
  237.         block.setBlockBounds(0.0625F, 0.0F, 0.25F, 0.125F, 0.8125F, 0.75F);
  238.         renderblocks.renderStandardBlock(block, i, j, k);
  239.         block.setBlockBounds(0.875F, 0.0F, 0.25F, 0.9375F, 0.8125F, 0.75F);
  240.         renderblocks.renderStandardBlock(block, i, j, k);
  241.         //Inner lip
  242.         block.setBlockBounds(0.1875F, 0.8125F, 0.0625F, 0.8125F, 0.875F, 0.125F);
  243.         renderblocks.renderStandardBlock(block, i, j, k);
  244.         block.setBlockBounds(0.1875F, 0.8125F, 0.875F, 0.8125F, 0.875F, 0.9375F);
  245.         renderblocks.renderStandardBlock(block, i, j, k);
  246.         block.setBlockBounds(0.0625F, 0.8125F, 0.1875F, 0.125F, 0.875F, 0.8125F);
  247.         renderblocks.renderStandardBlock(block, i, j, k);
  248.         block.setBlockBounds(0.875F, 0.8125F, 0.1875F, 0.9375F, 0.875F, 0.8125F);
  249.         renderblocks.renderStandardBlock(block, i, j, k);
  250.         //Outer lip
  251.         block.setBlockBounds(0.25F, 0.8125F, 0.0F, 0.75F, 0.875F, 0.0625F);
  252.         renderblocks.renderStandardBlock(block, i, j, k);
  253.         block.setBlockBounds(0.25F, 0.8125F, 0.9375F, 0.75F, 0.875F, 1.0F);
  254.         renderblocks.renderStandardBlock(block, i, j, k);
  255.         block.setBlockBounds(0.0F, 0.8125F, 0.25F, 0.0625F, 0.875F, 0.75F);
  256.         renderblocks.renderStandardBlock(block, i, j, k);
  257.         block.setBlockBounds(0.9375F, 0.8125F, 0.25F, 1.0F, 0.875F, 0.75F);
  258.         renderblocks.renderStandardBlock(block, i, j, k);
  259.         //Not rendered, just fix the stupid hitbox
  260.         block.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
  261.         return false;
  262.     }
  263.    
  264.     private boolean RenderGrassBlockInWorld(RenderBlocks renderblocks, IBlockAccess iblockaccess, int i, int j, int k, Block block)
  265.     {
  266.         int northBlockID = iblockaccess.getBlockId(i, j, k + 1);
  267.         if(northBlockID == 0) { northBlockID = 36; }
  268.         int eastBlockID = iblockaccess.getBlockId(i + 1, j, k);
  269.         if(eastBlockID == 0) { eastBlockID = 36; }
  270.         int southBlockID = iblockaccess.getBlockId(i, j, k - 1);
  271.         if(southBlockID == 0) { southBlockID = 36; }
  272.         int westBlockID = iblockaccess.getBlockId(i - 1, j, k);
  273.         if(westBlockID == 0) { westBlockID = 36; }
  274.         //System.out.println((new StringBuilder()).append("n=").append(northBlockID).append(" e=").append(eastBlockID).append(" s=").append(southBlockID).append(" w=").append(westBlockID).toString());
  275.         boolean blockToNW = (Block.blocksList[northBlockID].isOpaqueCube() && Block.blocksList[westBlockID].isOpaqueCube());
  276.         boolean blockToNE = (Block.blocksList[northBlockID].isOpaqueCube() && Block.blocksList[eastBlockID].isOpaqueCube());
  277.         boolean blockToSE = (Block.blocksList[southBlockID].isOpaqueCube() && Block.blocksList[eastBlockID].isOpaqueCube());
  278.         boolean blockToSW = (Block.blocksList[southBlockID].isOpaqueCube() && Block.blocksList[westBlockID].isOpaqueCube());
  279.         //Default case - Grass surrounded by solid blocks on all sides
  280.         if(blockToNW && blockToNE && blockToSE && blockToSW)
  281.         {
  282.             block.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
  283.             renderblocks.renderStandardBlock(block, i, j, k);
  284.         }
  285.         else
  286.         {
  287.             //Base half-layer, placed even if grass has no solid blocks around it
  288.             block.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.5F, 1.0F);
  289.             renderblocks.renderStandardBlock(block, i, j, k);
  290.             //Corner cases, NOT mutually exclusive (will usually have more than one!)
  291.             if(blockToNW)
  292.             {
  293.                 block.setBlockBounds(0.0F, 0.5F, 0.5F, 0.5F, 1.0F, 1.0F);
  294.                 renderblocks.renderStandardBlock(block, i, j, k);
  295.             }
  296.             if(blockToNE)
  297.             {
  298.                 block.setBlockBounds(0.5F, 0.5F, 0.5F, 1.0F, 1.0F, 1.0F);
  299.                 renderblocks.renderStandardBlock(block, i, j, k);
  300.             }
  301.             if(blockToSE)
  302.             {
  303.                 block.setBlockBounds(0.5F, 0.5F, 0.0F, 1.0F, 1.0F, 0.5F);
  304.                 renderblocks.renderStandardBlock(block, i, j, k);
  305.             }
  306.             if(blockToSW)
  307.             {
  308.                 block.setBlockBounds(0.0F, 0.5F, 0.0F, 0.5F, 1.0F, 0.5F);
  309.                 renderblocks.renderStandardBlock(block, i, j, k);
  310.             }
  311.         }
  312.         //Not rendered, just fix the stupid hitbox
  313.         block.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
  314.         return false;
  315.     }
  316.    
  317.     public boolean RenderWorldBlock(RenderBlocks renderblocks, IBlockAccess iblockaccess, int i, int j, int k, Block block, int l)
  318.     {
  319.         if(l == planterPotModelID)
  320.         {
  321.             return RenderPlanterPotInWorld(renderblocks, iblockaccess, i, j, k, block);
  322.         }
  323.         else if(l == hypercubeModelID)
  324.         {
  325.             return RenderHypercubeInWorld(renderblocks, iblockaccess, i, j, k, block);
  326.         }
  327.         else if(l == chancePotModelID)
  328.         {
  329.             return RenderChancePotInWorld(renderblocks, iblockaccess, i, j, k, block);
  330.         }
  331.         else if(l == grassModelID)
  332.         {
  333.             return RenderGrassBlockInWorld(renderblocks, iblockaccess, i, j, k, block);
  334.         }
  335.         else
  336.         {
  337.             return false;
  338.         }
  339.     }
  340.    
  341.     private void RenderBlockPlaceholderInInv(RenderBlocks renderblocks, Block block, int i)
  342.     {
  343.         Tessellator tessellator = Tessellator.instance;
  344.         block.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
  345.         GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
  346.         tessellator.startDrawingQuads();
  347.         tessellator.setNormal(0.0F, -1F, 0.0F);
  348.         renderblocks.renderBottomFace(block, 0.0D, 0.0D, 0.0D, block.getBlockTextureFromSideAndMetadata(0, i));
  349.         tessellator.draw();
  350.         tessellator.startDrawingQuads();
  351.         tessellator.setNormal(0.0F, 1.0F, 0.0F);
  352.         renderblocks.renderTopFace(block, 0.0D, 0.0D, 0.0D, block.getBlockTextureFromSideAndMetadata(1, i));
  353.         tessellator.draw();
  354.         tessellator.startDrawingQuads();
  355.         tessellator.setNormal(0.0F, 0.0F, -1F);
  356.         renderblocks.renderEastFace(block, 0.0D, 0.0D, 0.0D, block.getBlockTextureFromSideAndMetadata(2, i));
  357.         tessellator.draw();
  358.         tessellator.startDrawingQuads();
  359.         tessellator.setNormal(0.0F, 0.0F, 1.0F);
  360.         renderblocks.renderWestFace(block, 0.0D, 0.0D, 0.0D, block.getBlockTextureFromSideAndMetadata(3, i));
  361.         tessellator.draw();
  362.         tessellator.startDrawingQuads();
  363.         tessellator.setNormal(-1F, 0.0F, 0.0F);
  364.         renderblocks.renderNorthFace(block, 0.0D, 0.0D, 0.0D, block.getBlockTextureFromSideAndMetadata(4, i));
  365.         tessellator.draw();
  366.         tessellator.startDrawingQuads();
  367.         tessellator.setNormal(1.0F, 0.0F, 0.0F);
  368.         renderblocks.renderSouthFace(block, 0.0D, 0.0D, 0.0D, block.getBlockTextureFromSideAndMetadata(5, i));
  369.         tessellator.draw();
  370.         GL11.glTranslatef(0.5F, 0.5F, 0.5F);
  371.         block.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
  372.     }
  373.    
  374.     public void RenderInvBlock(RenderBlocks renderblocks, Block block, int i, int j)
  375.     {
  376.         if(j == planterPotModelID || j == hypercubeModelID || j == chancePotModelID)
  377.         {
  378.             RenderBlockPlaceholderInInv(renderblocks, block, i);
  379.         }
  380.     }
  381. }
  382. //=========================================================================================================
  383. //BlockGrass.java
  384. package net.minecraft.src;
  385.  
  386. import java.util.Random;
  387.  
  388. public class BlockGrass extends Block
  389. {
  390.     protected BlockGrass(int i)
  391.     {
  392.         super(i, Material.grass);
  393.         blockIndexInTexture = 3;
  394.         setTickOnLoad(true);
  395.     }
  396.  
  397.     public int getBlockTextureFromSideAndMetadata(int i, int j)
  398.     {
  399.         if (i == 1)
  400.         {
  401.             return 0;
  402.         }
  403.         return i != 0 ? 3 : 2;
  404.     }
  405.  
  406.     public int getBlockTexture(IBlockAccess iblockaccess, int i, int j, int k, int l)
  407.     {
  408.         if (l == 1)
  409.         {
  410.             return 0;
  411.         }
  412.         if (l == 0)
  413.         {
  414.             return 2;
  415.         }
  416.         Material material = iblockaccess.getBlockMaterial(i, j + 1, k);
  417.         return material != Material.snow && material != Material.craftedSnow ? 3 : 68;
  418.     }
  419.  
  420.     public int getBlockColor()
  421.     {
  422.         double d = 0.5D;
  423.         double d1 = 1.0D;
  424.         return ColorizerGrass.getGrassColor(d, d1);
  425.     }
  426.  
  427.     public int getRenderColor(int i)
  428.     {
  429.         return getBlockColor();
  430.     }
  431.  
  432.     public int colorMultiplier(IBlockAccess iblockaccess, int i, int j, int k)
  433.     {
  434.         int l = 0;
  435.         int i1 = 0;
  436.         int j1 = 0;
  437.         for (int k1 = -1; k1 <= 1; k1++)
  438.         {
  439.             for (int l1 = -1; l1 <= 1; l1++)
  440.             {
  441.                 int i2 = iblockaccess.getWorldChunkManager().getBiomeGenAt(i + l1, k + k1).getGrassColorAtCoords(iblockaccess, i + l1, j, k + k1);
  442.                 l += (i2 & 0xff0000) >> 16;
  443.                 i1 += (i2 & 0xff00) >> 8;
  444.                 j1 += i2 & 0xff;
  445.             }
  446.         }
  447.  
  448.         return (l / 9 & 0xff) << 16 | (i1 / 9 & 0xff) << 8 | j1 / 9 & 0xff;
  449.     }
  450.  
  451.     public void updateTick(World world, int i, int j, int k, Random random)
  452.     {
  453.         if (world.multiplayerWorld)
  454.         {
  455.             return;
  456.         }
  457.         if (world.getBlockLightValue(i, j + 1, k) < 4 && Block.lightOpacity[world.getBlockId(i, j + 1, k)] > 2)
  458.         {
  459.             world.setBlockWithNotify(i, j, k, Block.dirt.blockID);
  460.         }
  461.         else if (world.getBlockLightValue(i, j + 1, k) >= 9)
  462.         {
  463.             for (int l = 0; l < 4; l++)
  464.             {
  465.                 int i1 = (i + random.nextInt(3)) - 1;
  466.                 int j1 = (j + random.nextInt(5)) - 3;
  467.                 int k1 = (k + random.nextInt(3)) - 1;
  468.                 int l1 = world.getBlockId(i1, j1 + 1, k1);
  469.                 if (world.getBlockId(i1, j1, k1) == Block.dirt.blockID && world.getBlockLightValue(i1, j1 + 1, k1) >= 4 && Block.lightOpacity[l1] <= 2)
  470.                 {
  471.                     world.setBlockWithNotify(i1, j1, k1, Block.grass.blockID);
  472.                 }
  473.             }
  474.         }
  475.     }
  476.  
  477.     public int idDropped(int i, Random random, int j)
  478.     {
  479.         return Block.dirt.idDropped(0, random, j);
  480.     }
  481.    
  482.     public int getRenderType()
  483.     {
  484.         return mod_EvilMinecraft_Fragment.grassModelID;
  485.     }
  486. }
  487. //=========================================================================================================
  488. //BlockCactusPoison.java, where the derped textures are actually being used
  489. package net.minecraft.src;
  490.  
  491. public class BlockCactusPoison extends BlockCactus
  492. {
  493.     protected BlockCactusPoison(int i, int j)
  494.     {
  495.         super(i, j); //Params %blockID%, %textureIndex%, Material.cactus
  496.         setTickOnLoad(true);
  497.     }
  498.    
  499.     @Override
  500.     public void onEntityCollidedWithBlock(World world, int i, int j, int k, Entity entity)
  501.     {
  502.         //le EntityCaveSpider spork
  503.         if (entity instanceof EntityLiving)
  504.         {
  505.             byte byte0 = 0;
  506.             if (world.difficultySetting > 0)
  507.             {
  508.                 if (world.difficultySetting == 1)
  509.                 {
  510.                     byte0 = 7;
  511.                 }
  512.                 else if (world.difficultySetting == 2)
  513.                 {
  514.                     byte0 = 9;
  515.                 }
  516.                 else if (world.difficultySetting == 3)
  517.                 {
  518.                     byte0 = 15;
  519.                 }
  520.             }
  521.             if (byte0 > 0)
  522.             {
  523.                 ((EntityLiving)entity).addPotionEffect(new PotionEffect(Potion.poison.id, byte0 * 20, 0));
  524.             }
  525.         }
  526.         //end spork
  527.         entity.attackEntityFrom(DamageSource.cactus, 1);
  528.     }
  529.    
  530.     @Override
  531.     public int getBlockTextureFromSide(int i)
  532.     {
  533.         if (i == 1)
  534.         {
  535.             return mod_EvilMinecraft.poisonCactusTextureIndexTop;
  536.         }
  537.         if (i == 0)
  538.         {
  539.             return mod_EvilMinecraft.poisonCactusTextureIndexBottom;
  540.         }
  541.         else
  542.         {
  543.             return mod_EvilMinecraft.poisonCactusTextureIndexSide;
  544.         }
  545.     }
  546.    
  547.     @Override
  548.     public boolean canBlockStay(World world, int i, int j, int k)
  549.     {
  550.         if (world.getBlockMaterial(i - 1, j, k).isSolid())
  551.         {
  552.             return false;
  553.         }
  554.         if (world.getBlockMaterial(i + 1, j, k).isSolid())
  555.         {
  556.             return false;
  557.         }
  558.         if (world.getBlockMaterial(i, j, k - 1).isSolid())
  559.         {
  560.             return false;
  561.         }
  562.         if (world.getBlockMaterial(i, j, k + 1).isSolid())
  563.         {
  564.             return false;
  565.         }
  566.         else
  567.         {
  568.             int l = world.getBlockId(i, j - 1, k);
  569.             return l == this.blockID || l == Block.sand.blockID;
  570.         }
  571.     }
  572. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement