Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package net.minecraft.src;
- import net.minecraft.src.forge.*;
- import java.util.*;
- public class mod_cutter extends BaseMod{
- public CraftingManager craftingManager = CraftingManager.getInstance();
- public CraftingManagerKnife craftingManagerKnife = CraftingManagerKnife.getInstance();
- public static final EnumToolMaterial KRYPTONIUM = EnumHelper.addToolMaterial("KRYPTONIUM", 3, 1561, 8.0F, 3, 10);
- public static final EnumToolMaterial FLINT = EnumHelper.addToolMaterial("FLINT", 3, 100, 4.0F, 2, 5);
- public static final Block oak = (new BlockOak(250, 0)).setHardness(2.0F).setBlockName("logOak").setRequiresSelfNotify();
- public static final Block oakLeaves = (new BlockOakLeaves(251, 3)).setHardness(0.2F).setLightOpacity(1).setStepSound(Block.soundGrassFootstep).setBlockName("oakLeaves").setRequiresSelfNotify();
- public static final Block storageTank = (new BlockStorageTank(252,4).setHardness(2.0F).setBlockName("storageTank").setRequiresSelfNotify());
- public static final Block melterIdle = (new BlockMelter(253, false)).setHardness(3.5F).setStepSound(Block.soundStoneFootstep).setBlockName("melter").setRequiresSelfNotify();
- public static final Block melterActive = (new BlockFurnace(254, true)).setHardness(3.5F).setStepSound(Block.soundStoneFootstep).setLightValue(0.875F).setBlockName("melter").setRequiresSelfNotify();
- public static final Item kryptoniumPickaxe = (new ItemKryptoniumPickaxe(1001,KRYPTONIUM)).setIconCoord(0,0).setItemName("kryptoniumPickaxe");
- public static final Item bucketWoodEmpty = (new ItemBucketWood(1002,0)).setIconCoord(1,0).setItemName("bucketWood");
- public static final Item bucketWoodWater = (new ItemBucketWood(1003, Block.waterMoving.blockID)).setIconCoord(2, 0).setItemName("bucketWoodWater").setContainerItem(bucketWoodEmpty);
- public static final Item flintKnife = (new ItemKnifeFlint(1004)).setIconCoord(3,0).setItemName("flintKnife");
- public static final Block fluidBed = (new BlockFluidBed(255, 80, Material.wood)).setHardness(2.0F).setBlockName("fluidBed").setRequiresSelfNotify();
- public static int storageTankRenderID;
- public static int fluidBedRenderID;
- @Override
- public void load() {
- MinecraftForgeClient.preloadTexture("/cutter/Blocks.png");
- MinecraftForgeClient.preloadTexture("/cutter/Gems.png");
- MinecraftForgeClient.preloadTexture("/cutter/Items.png");
- MinecraftForgeClient.preloadTexture("/cutter/Machines.png");
- registerBlocks();
- //remove recipes MUST go before add recipes
- removeRecipes();
- addRecipes();
- storageTankRenderID = ModLoader.getUniqueBlockModelID(this, false);
- fluidBedRenderID = ModLoader.getUniqueBlockModelID(this, false);
- }
- public void generateSurface(World world, Random rand, int chunkX, int chunkZ){
- BiomeGenBase biome = world.getBiomeGenForCoords(chunkX, chunkZ);
- WorldGenOak tree = new WorldGenOak(false);
- if (biome instanceof BiomeGenForest||biome instanceof BiomeGenPlains||biome instanceof BiomeGenTaiga||biome instanceof BiomeGenHills||
- biome instanceof BiomeGenJungle||biome instanceof BiomeGenSwamp||biome instanceof BiomeGenSnow){
- for(int l = 0; l < 5; l++){
- int i1 = chunkX + rand.nextInt(16);
- int k1 = chunkZ + rand.nextInt(16);
- int j1 = world.getHeightValue(k1, i1);
- tree.generate(world, rand, i1, j1, k1);
- }
- }
- /*for(int l = 0; l < 100; l++){
- int i1 = chunkX + rand.nextInt(16);
- int j1 = rand.nextInt(80);
- int k1 = chunkZ + rand.nextInt(16);
- (new WorldGenMinable(oak.blockID, 10)).generate(world, rand, i1, j1, k1);
- }
- */
- }
- public void registerBlocks(){
- ModLoader.registerBlock(oak);
- ModLoader.addName(oak, "BlockOak");
- ModLoader.registerBlock(storageTank, net.minecraft.src.ItemBlockStorageTank.class);
- ModLoader.addName(new ItemStack(storageTank, 252, 0), "BlockStorageTank0");
- ModLoader.addName(new ItemStack(storageTank, 252, 1), "BlockStorageTank1");
- ModLoader.addName(new ItemStack(storageTank, 252, 2), "BlockStorageTank2");
- ModLoader.addName(new ItemStack(storageTank, 252, 3), "BlockStorageTank3");
- ModLoader.addName(new ItemStack(storageTank, 252, 4), "BlockStorageTank4");
- ModLoader.registerBlock(melterIdle);
- ModLoader.addName(melterIdle, "melterIdle");
- ModLoader.registerBlock(melterActive);
- ModLoader.addName(melterActive, "melterActive");
- ModLoader.registerTileEntity(net.minecraft.src.TileEntityMelter.class, "melter");
- ModLoader.registerBlock(fluidBed);
- ModLoader.addName(fluidBed, "fluidBed");
- ModLoader.addName(kryptoniumPickaxe, "kryptoniumPickaxe");
- ModLoader.addName(bucketWoodEmpty, "bucketWoodEmpty");
- ModLoader.addName(bucketWoodWater, "bucketWoodWater");
- ModLoader.addName(flintKnife, "flintKnife");
- }
- public boolean renderWorldBlock(RenderBlocks renderBlocks, IBlockAccess blockAccess, int x, int y, int z, Block block, int l){
- if (l == storageTankRenderID){
- return renderStorageTank(block, x, y, z, renderBlocks);
- }else if(l == fluidBedRenderID){
- return renderFluidBed(block, x, y, z, renderBlocks);
- }
- return false;
- }
- public boolean renderStorageTank(Block block, int x, int y, int z, RenderBlocks renderBlocks){
- Tessellator tes = Tessellator.instance;
- tes.setBrightness(block.getMixedBrightnessForBlock(renderBlocks.blockAccess, x, y, z));
- int metaData = renderBlocks.blockAccess.getBlockMetadata(x, y, z);
- short texture = 11;
- switch(metaData){
- default:
- break;
- case 1:
- renderBlocks.renderTopFace(block, (double)x, (double)y - 0.75F, (double)z, texture);
- break;
- case 2:
- renderBlocks.renderTopFace(block, (double)x, (double)y - 0.5F, (double)z, texture);
- break;
- case 3:
- renderBlocks.renderTopFace(block, (double)x, (double)y - 0.25F, (double)z, texture);
- break;
- }
- block.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
- renderBlocks.renderStandardBlock(block, x, y, z);
- return true;
- }
- public boolean renderFluidBed(Block block, int x, int y, int z, RenderBlocks renderBlocks){
- int metaData = renderBlocks.blockAccess.getBlockMetadata(x, y, z);
- short topTexture = (short)block.getBlockTextureFromSide(1);
- short sideTexture = (short)block.getBlockTextureFromSide(2);
- short bottomTexture = 80;
- block.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.25F, 1.0F);
- renderBlocks.renderStandardBlock(block, x, y, z);
- //renders custom polygons to the block
- renderBlocks.renderTopFace(block, (double)x, (double)y, (double)z, topTexture);
- renderBlocks.renderSouthFace(block, (double)x-0.875F, (double)y, (double)z, sideTexture);
- renderBlocks.renderSouthFace(block, (double)x-0.4375F, (double)y, (double)z, sideTexture);
- renderBlocks.renderNorthFace(block, (double)x+0.875F, (double)y, (double)z, sideTexture);
- renderBlocks.renderNorthFace(block, (double)x+0.4375F, (double)y, (double)z, sideTexture);
- renderBlocks.renderEastFace(block, (double)x, (double)y, (double)z+0.875F, sideTexture);
- renderBlocks.renderWestFace(block, (double)x, (double)y, (double)z-0.875F, sideTexture);
- renderBlocks.renderTopFace(block, (double)x, (double)y-0.1875F, (double)z, bottomTexture);
- renderBlocks.renderBottomFace(block, (double)x, (double)y, (double)z, bottomTexture);
- /*switch(metaData){
- default:
- break;
- case 1:
- renderBlocks.renderTopFace(block, (double)x, (double)y - 0.75F, (double)z, texture);
- break;
- case 2:
- renderBlocks.renderTopFace(block, (double)x, (double)y - 0.5F, (double)z, texture);
- break;
- case 3:
- renderBlocks.renderTopFace(block, (double)x, (double)y - 0.25F, (double)z, texture);
- break;
- }*/
- return true;
- }
- public void addRecipes(){
- craftingManager.addRecipe(new ItemStack(storageTank, 1), new Object[] {"XX", Character.valueOf('X'), Block.dirt});
- craftingManager.addRecipe(new ItemStack(melterIdle, 1), new Object[] {"X", Character.valueOf('X'), Block.sand});
- craftingManager.addRecipe(new ItemStack(flintKnife, 1), new Object[] {" X", "# ", '#', Item.stick, 'X', Item.flint});
- craftingManager.addRecipe(new ItemStack(Block.stoneOvenIdle), new Object[] {"###", "# #", "###", '#', Block.stone});
- craftingManager.addRecipe(new ItemStack(flintKnife, 1), new Object[] {"#", '#', Item.stick});
- craftingManagerKnife.addRecipe(new ItemStack(bucketWoodEmpty, 1), new Object[] {"# #", " # ", '#', Block.planks});
- craftingManagerKnife.addRecipe(new ItemStack(fluidBed, 1), new Object[] {" # ", "###"," # ", '#', Block.planks});
- }
- public void removeRecipes(){
- List craftingList = CraftingManager.getInstance().getRecipeList();
- removeRecipe(Block.stoneOvenIdle, craftingList);
- }
- public void removeRecipe(Block block, List list){
- for(int i = 0; i<list.size();i++){
- Object tmp = list.get(i);
- if(tmp instanceof ShapedRecipes){
- ShapedRecipes a = (ShapedRecipes)tmp;
- if((a.getRecipeOutput().itemID==block.blockID) && (a.getRecipeOutput().getItem() instanceof ItemBlock)){
- System.out.println("removed "+a.getRecipeOutput().getItem().getItemName()+" at "+i+" ShapedRecipe list");
- list.remove(i);
- }
- }
- }
- }
- public void removeRecipe(Item item, List list){
- for(int i = 0; i<list.size();i++){
- Object tmp = list.get(i);
- if(tmp instanceof ShapedRecipes){
- ShapedRecipes a = (ShapedRecipes)tmp;
- if((a.getRecipeOutput().itemID==item.shiftedIndex) && !(a.getRecipeOutput().getItem() instanceof ItemBlock)){
- System.out.println("removed "+a.getRecipeOutput().getItem().getItemName()+" at "+i+" ShapedRecipe list");
- list.remove(i);
- }
- }
- }
- }
- @Override
- public String getVersion() {
- return "1.2.5";
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement