• 2

    posted a message on SuperKittyMoa's Advanced ModLoader Tuts! [1.8.1]
    These are my first tuts and I think they are quite good.

    THIS POST ASSUMES YOU KNOW HOW TO SET UP THE JDK AND JRE PLUS YOUR JAVA EDITOR!
    IF YOU HAVE NOT DONE THIS VISIT THIS POST

    Note:when I have "above" that means above the mod_XXX()

    Tutorial list:
    Block
    Item
    2 input furnace (not mine, link to original post in tut) (Removed ItemStack modifications)
    normal furnace (soon)
    food (soon)
    liquid (soon)
    properties file
    ore generation
    Structure Generation! (It is mine)


    Tutorials Soon To Come:
    Making Your Mod SMP!
    Flowers!
    Reeds!
    Adding Your Blocks and Items to Creative!
    Mod Updating
    Suggestions?



    New Block:

    Its easy as pie:
    first off create a mod_NAMEHERE file.
    In that file use this as a template
    IT IS REQUIRED
    package net.minecraft.src;
    
    import java.util.Random;
    import java.util.Map;
    import java.io.File;
    import java.util.Random;
    import net.minecraft.client.Minecraft;
    
    
    public class mod_XXX extends BaseMod
    {
    
        public String Version()
        {
            return "Mod Version Here";
        }
     
    
        public mod_SuperCraft()
        {
                                                        				
        
             
        }
            
          
       
    
     
       
       
    
        static 
        {
    
        }
    }


    to add the block add this to the public mod_XXX()
     ModLoader.RegisterBlock(XXX);
     XXX.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "XXX.png");
     ModLoader.AddName(XXX, "NAME");


    now add this before the mod_XXX()
     public static Block XXX;

    in the static:
    XXX = new Block (ID, 0 , Material.rock).setResitance(0.0F).setHardness(0.0F).setBlockName("name");

    Now your block is done!

    Items:

    mod_XXX()
    ModLoader.AddName(XXX, "Item Name");
    XXX.iconIndex = ModLoader.addOverride("/gui/items.png", "XXX.png

    and above:
    public static Item XXX = new Item(ID, 0).setItemName("Name");


    2 input furnace: http://www.zidmc.info/viewtopic.php?f=15&t=1815&sid=fb50d63e2f49b6f8b1533f7eace57949

    mod_XXX()
     ModLoader.RegisterBlock(blast);
           ModLoader.RegisterBlock(blastActive);
           ModLoader.RegisterTileEntity(net.minecraft.src.TileEntityBlast.class, "Blast");
           blastTop = ModLoader.addOverride("/terrain.png", "/MMtextures/MMblock/blastTop.png");
           blastOn = ModLoader.addOverride("/terrain.png", "/MMtextures/MMblock/blastOn.png");
           blastOff = ModLoader.addOverride("/terrain.png", "/MMtextures/MMblock/blastOff.png");
           ModLoader.AddName(blast, "Blast Furnace");

    above:
    public static int blastTop;
    	public static int blastOn;
    	public static int blastOff;
    	public static final Block blast;
    	public static final Block blastActive;
    public static ItemStack getOutPut(int i, int j)
    	{
    		if (i == Item.ingotIron.shiftedIndex && j == Block.sand.blockID)
    		{
    			return new ItemStack(mod_SuperCraft.HardenedGlass , 4);
    		}
    		else
    		{
    			return null;
    		}
    	}

    in the staic
    {
    }
     blast = new BlockBlast(ID, false).setHardness(3.0F).setResistance(5F).setBlockName("blast");
     blastActive = new BlockBlast(ID, true).setHardness(3.0F).setLightValue(0.875F).setResistance(5F).setBlockName("refiner");

    BlockBlast:
    package net.minecraft.src;
    
    import java.util.ArrayList;
    import java.util.Random;
    
    public class BlockBlast extends BlockContainer
    {
    
        protected BlockBlast(int i, boolean flag)
        {
            super(i, Material.rock);
            blastRand = new Random();
            isActive = flag;
            blockIndexInTexture = 45;
        }
    
      public int idDropped(int i, Random random)
        {
            return mod_SuperCraft.blast.blockID;
        }
    
        public void onBlockAdded(World world, int i, int j, int k)
        {
            super.onBlockAdded(world, i, j, k);
            setDefaultDirection(world, i, j, k);
        }
    
        private void setDefaultDirection(World world, int i, int j, int k)
        {
            if(world.multiplayerWorld)
            {
                return;
            }
            int l = world.getBlockId(i, j, k - 1);
            int i1 = world.getBlockId(i, j, k + 1);
            int j1 = world.getBlockId(i - 1, j, k);
            int k1 = world.getBlockId(i + 1, j, k);
            byte byte0 = 3;
            if(Block.opaqueCubeLookup[l] && !Block.opaqueCubeLookup[i1])
            {
                byte0 = 3;
            }
            if(Block.opaqueCubeLookup[i1] && !Block.opaqueCubeLookup[l])
            {
                byte0 = 2;
            }
            if(Block.opaqueCubeLookup[j1] && !Block.opaqueCubeLookup[k1])
            {
                byte0 = 5;
            }
            if(Block.opaqueCubeLookup[k1] && !Block.opaqueCubeLookup[j1])
            {
                byte0 = 4;
            }
            world.setBlockMetadataWithNotify(i, j, k, byte0);
        }
    
        public int getBlockTexture(IBlockAccess iblockaccess, int i, int j, int k, int l)
        {
            if(l == 1)
            {
                return mod_SuperCraft.blastTop;
            }
            if(l == 0)
            {
                return mod_SuperCraft.blastTop;
            }
            int i1 = iblockaccess.getBlockMetadata(i, j, k);
            if(l != i1)
            {
                return blockIndexInTexture;
            }
            if(isActive)
            {
                return mod_SuperCraft.blastOn;
            } else
            {
                return mod_SuperCraft.blastOff;
            }
        }
    
        public void randomDisplayTick(World world, int i, int j, int k, Random random)
        {
            if(!isActive)
            {
                return;
            }
            int l = world.getBlockMetadata(i, j, k);
            float f = (float)i + 0.5F;
            float f1 = (float)j + 0.0F + (random.nextFloat() * 6F) / 16F;
            float f2 = (float)k + 0.5F;
            float f3 = 0.52F;
            float f4 = random.nextFloat() * 0.6F - 0.3F;
            if(l == 4)
            {
                world.spawnParticle("smoke", f - f3, f1, f2 + f4, 0.0D, 0.0D, 0.0D);
                world.spawnParticle("flame", f - f3, f1, f2 + f4, 0.0D, 0.0D, 0.0D);
            } else
            if(l == 5)
            {
                world.spawnParticle("smoke", f + f3, f1, f2 + f4, 0.0D, 0.0D, 0.0D);
                world.spawnParticle("flame", f + f3, f1, f2 + f4, 0.0D, 0.0D, 0.0D);
            } else
            if(l == 2)
            {
                world.spawnParticle("smoke", f + f4, f1, f2 - f3, 0.0D, 0.0D, 0.0D);
                world.spawnParticle("flame", f + f4, f1, f2 - f3, 0.0D, 0.0D, 0.0D);
            } else
            if(l == 3)
            {
                world.spawnParticle("smoke", f + f4, f1, f2 + f3, 0.0D, 0.0D, 0.0D);
                world.spawnParticle("flame", f + f4, f1, f2 + f3, 0.0D, 0.0D, 0.0D);
            }
        }
    
        public int getBlockTextureFromSide(int i)
        {
            if(i == 1)
            {
                return mod_SuperCraft.blastTop;
            }
            if(i == 0)
            {
                return mod_SuperCraft.blastTop;
            }
            if(i == 3)
            {
                return mod_SuperCraft.blastOff;
            } else
            {
                return blockIndexInTexture;
            }
        }
    
        public boolean blockActivated(World world, int i, int j, int k, EntityPlayer entityplayer)
        {
            if(world.multiplayerWorld)
            {
                return true;
            }
            TileEntityBlast tileentityblast = (TileEntityBlast)world.getBlockTileEntity(i, j, k);
            if(tileentityblast != null)
            {
            	ModLoader.OpenGUI(ModLoader.getMinecraftInstance().thePlayer, new GuiBlast(ModLoader.getMinecraftInstance().thePlayer.inventory, tileentityblast));
    
            }
            return true;
        }
    
        public static void updateBlastBlockState(boolean flag, World world, int i, int j, int k)
        {
            int l = world.getBlockMetadata(i, j, k);
            TileEntity tileentity = world.getBlockTileEntity(i, j, k);
            keepBlastInventory = true;
            if(flag)
            {
                world.setBlockWithNotify(i, j, k, mod_SuperCraft.blastActive.blockID);
            } else
            {
                world.setBlockWithNotify(i, j, k, mod_SuperCraft.blast.blockID);
            }
            keepBlastInventory = false;
            world.setBlockMetadataWithNotify(i, j, k, l);
            if(tileentity != null)
            {
                tileentity.validate();
                world.setBlockTileEntity(i, j, k, tileentity);
            }
        }
    
        public TileEntity getBlockEntity()
        {
            return new TileEntityBlast();
        }
    
        public void onBlockPlacedBy(World world, int i, int j, int k, EntityLiving entityliving)
        {
            int l = MathHelper.floor_double((double)((entityliving.rotationYaw * 4F) / 360F) + 0.5D) & 3;
            if(l == 0)
            {
                world.setBlockMetadataWithNotify(i, j, k, 2);
            }
            if(l == 1)
            {
                world.setBlockMetadataWithNotify(i, j, k, 5);
            }
            if(l == 2)
            {
                world.setBlockMetadataWithNotify(i, j, k, 3);
            }
            if(l == 3)
            {
                world.setBlockMetadataWithNotify(i, j, k, 4);
            }
        }
    
        public void onBlockRemoval(World world, int i, int j, int k)
        {
            if(!keepBlastInventory)
            {
                TileEntityBlast tileentityblast = (TileEntityBlast)world.getBlockTileEntity(i, j, k);
                if(tileentityblast != null)
                {
    label0:
                    for(int l = 0; l < tileentityblast.getSizeInventory(); l++)
                    {
                        ItemStack itemstack = tileentityblast.getStackInSlot(l);
                        if(itemstack == null)
                        {
                            continue;
                        }
                        float f = blastRand.nextFloat() * 0.8F + 0.1F;
                        float f1 = blastRand.nextFloat() * 0.8F + 0.1F;
                        float f2 = blastRand.nextFloat() * 0.8F + 0.1F;
                        do
                        {
                            if(itemstack.stackSize <= 0)
                            {
                                continue label0;
                            }
                            int i1 = blastRand.nextInt(21) + 10;
                            if(i1 > itemstack.stackSize)
                            {
                                i1 = itemstack.stackSize;
                            }
                            itemstack.stackSize -= i1;
                            EntityItem entityitem = new EntityItem(world, (float)i + f, (float)j + f1, (float)k + f2, new ItemStack(itemstack.itemID, i1, itemstack.getItemDamage()));
                            float f3 = 0.05F;
                            entityitem.motionX = (float)blastRand.nextGaussian() * f3;
                            entityitem.motionY = (float)blastRand.nextGaussian() * f3 + 0.2F;
                            entityitem.motionZ = (float)blastRand.nextGaussian() * f3;
                            world.entityJoinedWorld(entityitem);
                        } while(true);
                    }
    
                }
            }
            super.onBlockRemoval(world, i, j, k);
        }
    
        private Random blastRand;
        private final boolean isActive;
        private static boolean keepBlastInventory = false;
    
    }


    ContainerBlast:
    package net.minecraft.src;
    
    import java.util.List;
    
    public class ContainerBlast extends Container
    {
    
        public ContainerBlast(InventoryPlayer inventoryplayer, TileEntityBlast tileentityblast)
        {
            lastCookTime = 0;
            lastBurnTime = 0;
            lastItemBurnTime = 0;
            blast = tileentityblast;
            addSlot(new Slot(tileentityblast, 0, 38, 17));
            addSlot(new Slot(tileentityblast, 1, 74, 17));
            addSlot(new Slot(tileentityblast, 2, 56, 53));
            addSlot(new SlotBlast(inventoryplayer.player, tileentityblast, 3, 116, 35));
            for(int i = 0; i < 3; i++)
            {
                for(int k = 0; k < 9; k++)
                {
                    addSlot(new Slot(inventoryplayer, k + i * 9 + 9, 8 + k * 18, 84 + i * 18));
                }
    
            }
    
            for(int j = 0; j < 9; j++)
            {
                addSlot(new Slot(inventoryplayer, j, 8 + j * 18, 142));
            }
    
        }
    
        public void updateCraftingResults()
        {
            super.updateCraftingResults();
            for(int i = 0; i < crafters.size(); i++)
            {
                ICrafting icrafting = (ICrafting)crafters.get(i);
                if(lastCookTime != blast.blastCookTime)
                {
                    icrafting.updateCraftingInventoryInfo(this, 0, blast.blastCookTime);
                }
                if(lastBurnTime != blast.blastBurnTime)
                {
                    icrafting.updateCraftingInventoryInfo(this, 1, blast.blastBurnTime);
                }
                if(lastItemBurnTime != blast.currentItemBurnTime)
                {
                    icrafting.updateCraftingInventoryInfo(this, 2, blast.currentItemBurnTime);
                }
            }
    
            lastCookTime = blast.blastCookTime;
            lastBurnTime = blast.blastBurnTime;
            lastItemBurnTime = blast.currentItemBurnTime;
        }
    
        public void func_20112_a(int i, int j)
        {
            if(i == 0)
            {
                blast.blastCookTime = j;
            }
            if(i == 1)
            {
                blast.blastBurnTime = j;
            }
            if(i == 2)
            {
                blast.currentItemBurnTime = j;
            }
        }
    
        public boolean canInteractWith(EntityPlayer entityplayer)
        {
            return blast.canInteractWith(entityplayer);
        }
    
        public ItemStack getStackInSlot(int i)
        {
            ItemStack itemstack = null;
            Slot slot = (Slot)inventorySlots.get(i);
            if(slot != null && slot.getHasStack())
            {
                ItemStack itemstack1 = slot.getStack();
                itemstack = itemstack1.copy();
                if(i == 2)
                {
                    if(!func_28125_a(itemstack1, 3, 39, true))
                    {
                        return null;
                    }
                } else
                if(i >= 3 && i < 30)
                {
                    if(!func_28125_a(itemstack1, 30, 39, false))
                    {
                        return null;
                    }
                } else
                if(i >= 30 && i < 39)
                {
                    if(!func_28125_a(itemstack1, 3, 30, false))
                    {
                        return null;
                    }
                } else
                if(!func_28125_a(itemstack1, 3, 39, false))
                {
                    return null;
                }
                if(itemstack1.stackSize == 0)
                {
                    slot.putStack(null);
                } else
                {
                    slot.onSlotChanged();
                }
                if(itemstack1.stackSize != itemstack.stackSize)
                {
                    slot.onPickupFromSlot(itemstack1);
                } else
                {
                    return null;
                }
            }
            return itemstack;
        }
    
        private TileEntityBlast blast;
        private int lastCookTime;
        private int lastBurnTime;
        private int lastItemBurnTime;
    }


    TileEntityBlast:
    package net.minecraft.src;
    
    public class TileEntityBlast extends TileEntity
        implements IInventory
    {
    
        public TileEntityBlast()
        {
            blastItemStacks = new ItemStack[4];
            blastBurnTime = 0;
            currentItemBurnTime = 0;
            blastCookTime = 0;
        }
    
        public int getSizeInventory()
        {
            return blastItemStacks.length;
        }
    
        public ItemStack getStackInSlot(int i)
        {
            return blastItemStacks[i];
        }
    
        public ItemStack decrStackSize(int i, int j)
        {
            if(blastItemStacks[i] != null)
            {
                if(blastItemStacks[i].stackSize <= j)
                {
                    ItemStack itemstack = blastItemStacks[i];
                    blastItemStacks[i] = null;
                    return itemstack;
                }
                ItemStack itemstack1 = blastItemStacks[i].splitStack(j);
                if(blastItemStacks[i].stackSize == 0)
                {
                    blastItemStacks[i] = null;
                }
                return itemstack1;
            } else
            {
                return null;
            }
        }
    
        public void setInventorySlotContents(int i, ItemStack itemstack)
        {
            blastItemStacks[i] = itemstack;
            if(itemstack != null && itemstack.stackSize > getInventoryStackLimit())
            {
                itemstack.stackSize = getInventoryStackLimit();
            }
        }
    
        public String getInvName()
        {
            return "Blast";
        }
    
        public void readFromNBT(NBTTagCompound nbttagcompound)
        {
            super.readFromNBT(nbttagcompound);
            NBTTagList nbttaglist = nbttagcompound.getTagList("Items");
            blastItemStacks = new ItemStack[getSizeInventory()];
            for(int i = 0; i < nbttaglist.tagCount(); i++)
            {
                NBTTagCompound nbttagcompound1 = (NBTTagCompound)nbttaglist.tagAt(i);
                byte byte0 = nbttagcompound1.getByte("Slot");
                if(byte0 >= 0 && byte0 < blastItemStacks.length)
                {
                    blastItemStacks[byte0] = ItemStack.func_35864_a(nbttagcompound1);
                }
            }
    
            blastBurnTime = nbttagcompound.getShort("BurnTime");
            blastCookTime = nbttagcompound.getShort("CookTime");
            currentItemBurnTime = getItemBurnTime(blastItemStacks[1]);
        }
    
        public void writeToNBT(NBTTagCompound nbttagcompound)
        {
            super.writeToNBT(nbttagcompound);
            nbttagcompound.setShort("BurnTime", (short)blastBurnTime);
            nbttagcompound.setShort("CookTime", (short)blastCookTime);
            NBTTagList nbttaglist = new NBTTagList();
            for(int i = 0; i < blastItemStacks.length; i++)
            {
                if(blastItemStacks[i] != null)
                {
                    NBTTagCompound nbttagcompound1 = new NBTTagCompound();
                    nbttagcompound1.setByte("Slot", (byte)i);
                    blastItemStacks[i].writeToNBT(nbttagcompound1);
                    nbttaglist.setTag(nbttagcompound1);
                }
            }
    
            nbttagcompound.setTag("Items", nbttaglist);
        }
    
        public int getInventoryStackLimit()
        {
            return 64;
        }
    
        public int getCookProgressScaled(int i)
        {
            return (blastCookTime * i) / 200;
        }
    
        public int getBurnTimeRemainingScaled(int i)
        {
            if(currentItemBurnTime == 0)
            {
                currentItemBurnTime = 200;
            }
            return (blastBurnTime * i) / currentItemBurnTime;
        }
    
        public boolean isBurning()
        {
            return blastBurnTime > 0;
        }
    
        public void updateEntity()
        {
            boolean flag = blastBurnTime > 0;
            boolean flag1 = false;
            if(blastBurnTime > 0)
            {
                blastBurnTime--;
            }
            if(!worldObj.multiplayerWorld)
            {
                if(blastBurnTime == 0 && canSmelt())
                {
                    currentItemBurnTime = blastBurnTime = getItemBurnTime(blastItemStacks[2]);
                    if(blastBurnTime > 0)
                    {
                        flag1 = true;
                        if(blastItemStacks[2] != null)
                        {
                            if(blastItemStacks[2].getItem().hasContainerItem())
                            {
                                blastItemStacks[2] = new ItemStack(blastItemStacks[2].getItem().getContainerItem());
                            } else
                            {
                                blastItemStacks[2].stackSize--;
                            }
                            if(blastItemStacks[2].stackSize == 0)
                            {
                                blastItemStacks[2] = null;
                            }
                        }
                    }
                }
                if(isBurning() && canSmelt())
                {
                    blastCookTime++;
                    if(blastCookTime == 200)
                    {
                        blastCookTime = 0;
                        smeltItem();
                        flag1 = true;
                    }
                } else
                {
                    blastCookTime = 0;
                }
                if(flag != (blastBurnTime > 0))
                {
                    flag1 = true;
                    BlockBlast.updateBlastBlockState(blastBurnTime > 0, worldObj, xCoord, yCoord, zCoord);
                }
            }
            if(flag1)
            {
                onInventoryChanged();
            }
        }
    
        private boolean canSmelt()
        {
            if(blastItemStacks[0]== null || blastItemStacks[1]== null)
            {
    			System.out.println("NO INPUT");
                return false;
            }
            ItemStack itemstack = BlastRecipes.getSmeltingResult(blastItemStacks[0].getItem().shiftedIndex, blastItemStacks[1].getItem().shiftedIndex);
            if(itemstack == null)
            {	
    			//System.out.println("NO RECIPE");
                return false;
            }
            if(blastItemStacks[3] == null)
            {
                return true;
            }
    		//System.out.println("NO SPACE");
            if(!blastItemStacks[3].isItemEqual(itemstack))
            {
    			//System.out.println("WRONG PRODUCT");
                return false;
            }
            if(blastItemStacks[3].stackSize < getInventoryStackLimit() && blastItemStacks[3].stackSize < blastItemStacks[3].getMaxStackSize())
            {
                return true;
            }
            return blastItemStacks[3].stackSize < itemstack.getMaxStackSize();
        }
    
        public void smeltItem()
        {
            if(!canSmelt())
            {
                return;
            }
            ItemStack itemstack = BlastRecipes.getSmeltingResult(blastItemStacks[0].getItem().shiftedIndex, blastItemStacks[1].getItem().shiftedIndex);
            if(blastItemStacks[3] == null)
            {
                blastItemStacks[3] = itemstack.copy();
            }
    		else if(blastItemStacks[3].itemID == itemstack.itemID)
            {
                blastItemStacks[3].stackSize++;
            }
    		for(int i = 0; i < 2; i++)
    		{
    			if(blastItemStacks[i].getItem().hasContainerItem())
    			{
    				blastItemStacks[i] = new ItemStack(blastItemStacks[i].getItem().getContainerItem());
    			}
    			else
    			{
    				blastItemStacks[i].stackSize--;
    			}
    			if(blastItemStacks[i].stackSize <= 0)
    			{
    				blastItemStacks[i] = null;
    			}
    		}
        }
    
        private int getItemBurnTime(ItemStack itemstack)
        {
            if(itemstack == null)
            {
                return 0;
            }
            int i = itemstack.getItem().shiftedIndex;
            if(i < 256 && Block.blocksList[i].blockMaterial == Material.wood)
            {
                return 300;
            }
            if(i == Item.stick.shiftedIndex)
            {
                return 100;
            }
            if(i == Block.wood.blockID)
            {
                return 1600;
            }
            if(i == Item.coal.shiftedIndex)
            {
                return 1600;
            }
            if(i == Item.bucketLava.shiftedIndex)
            {
                return 20000;
            }
            if(i == Block.sapling.blockID)
            {
                return 100;
            } else
            {
                return ModLoader.AddAllFuel(i, itemstack.getItemDamage());
            }
        }
    
        public boolean canInteractWith(EntityPlayer entityplayer)
        {
            if(worldObj.getBlockTileEntity(xCoord, yCoord, zCoord) != this)
            {
                return false;
            }
            return entityplayer.getDistanceSq((double)xCoord + 0.5D, (double)yCoord + 0.5D, (double)zCoord + 0.5D) <= 64D;
        }
    
        public void openChest()
        {
        }
    
        public void closeChest()
        {
        }
    
        private ItemStack blastItemStacks[];
        public int blastBurnTime;
        public int currentItemBurnTime;
        public int blastCookTime;
    	@Override
    	public void func_35142_x_() {
    		
    		
    	}
    
    	@Override
    	public void func_35141_y_() {
    		
    		
    	}
    
    }




    and lastly BlastRecipes:
    package net.minecraft.src;
    
    import java.util.ArrayList;
    import java.util.HashMap;
    import java.util.Map;
    
    public class BlastRecipes
    {
        public static ItemStack getSmeltingResult(int i, int j)
        {
            return getOutput(i, j);
        }
    	
    	private static ItemStack getOutput(int i, int j)
        {
    		if((i == Item.coal.shiftedIndex && j == Block.oreIron.blockID) || (i == Item.coal.shiftedIndex && j == Block.oreGold.blockID))
    		{
    			return new ItemStack(Item.diamond, 4);
    		}
    		else if(i == Item.bucketLava.shiftedIndex && j == Item.coal.shiftedIndex)
    		{
    			return new ItemStack(Block.obsidian, 4);
    		}
    		else if(i == Block.sand.blockID && j == Item.gunpowder.shiftedIndex)
    		{
    			return new ItemStack(Block.tnt, 4);
    		}
    		else if(i == Block.oreIron.blockID && j == Item.coal.shiftedIndex)
    		{
    			return new ItemStack(Item.ingotGold, 4);
    		}
    		else if(i == Item.coal.shiftedIndex && j == Item.fishRaw.shiftedIndex)
    		{
    			return new ItemStack(Item.slimeBall, 4);
    		}
    		else
    		{
    			return mod_SuperCraft.getOutPut(i, j);
    		}
        }
    }



    properties file

    create a new file named XXXProps with this in it:
    // Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
    // Jad home page: http://www.kpdus.com/jad.html
    // Decompiler options: packimports(3) braces deadcode 
    
    package net.minecraft.src;
    
    import java.io.*;
    import java.util.*;
    
    public final class XXXProps
    {
    
        public XXXProps(String s)
        {
            lines = new ArrayList();
            props = new HashMap();
            fileName = s;
            File file = new File(fileName);
            if(file.exists())
            {
                try
                {
                    load();
                }
                catch(IOException ioexception)
                {
                    System.out.println((new StringBuilder()).append("[Props] Unable to load ").append(fileName).append("!").toString());
                }
            } else
            {
                save();
            }
        }
    
        public void load()
            throws IOException
        {
            BufferedReader bufferedreader = new BufferedReader(new InputStreamReader(new FileInputStream(fileName), "UTF8"));
            lines.clear();
            props.clear();
            String s;
            while((s = bufferedreader.readLine()) != null) 
            {
                s = new String(s.getBytes(), "UTF-8");
                char c = '\0';
                int i;
                for(i = 0; i < s.length() && Character.isWhitespace(c = s.charAt(i)); i++) { }
                if(s.length() - i == 0 || s.charAt(i) == '#' || s.charAt(i) == '!')
                {
                    lines.add(s);
                } else
                {
                    int j = i;
                    boolean flag = s.indexOf('\\', i) != -1;
                    StringBuffer stringbuffer = flag ? new StringBuffer() : null;
                    if(stringbuffer != null)
                    {
                        do
                        {
                            if(i >= s.length() || Character.isWhitespace(c = s.charAt(i++)) || c == '=' || c == ':')
                            {
                                break;
                            }
                            if(flag && c == '\\')
                            {
                                if(i == s.length())
                                {
                                    s = bufferedreader.readLine();
                                    if(s == null)
                                    {
                                        s = "";
                                    }
                                    i = 0;
                                    while(i < s.length() && Character.isWhitespace(c = s.charAt(i))) 
                                    {
                                        i++;
                                    }
                                    continue;
                                }
                                c = s.charAt(i++);
                            }
                            switch(c)
                            {
                            case 110: // 'n'
                                stringbuffer.append('\n');
                                break;
    
                            case 116: // 't'
                                stringbuffer.append('\t');
                                break;
    
                            case 114: // 'r'
                                stringbuffer.append('\r');
                                break;
    
                            case 117: // 'u'
                                if(i + 4 <= s.length())
                                {
                                    char c5 = (char)Integer.parseInt(s.substring(i, i + 4), 16);
                                    stringbuffer.append(c5);
                                    i += 4;
                                }
                                break;
    
                            case 111: // 'o'
                            case 112: // 'p'
                            case 113: // 'q'
                            case 115: // 's'
                            default:
                                stringbuffer.append('\0');
                                break;
                            }
                        } while(true);
                    }
                    boolean flag1 = c == ':' || c == '=';
                    String s1;
                    if(flag)
                    {
                        s1 = stringbuffer.toString();
                    } else
                    if(flag1 || Character.isWhitespace(c))
                    {
                        s1 = s.substring(j, i - 1);
                    } else
                    {
                        s1 = s.substring(j, i);
                    }
                    for(; i < s.length() && Character.isWhitespace(c = s.charAt(i)); i++) { }
                    if(!flag1 && (c == ':' || c == '='))
                    {
                        char c1;
                        for(i++; i < s.length() && Character.isWhitespace(c1 = s.charAt(i)); i++) { }
                    }
                    if(!flag)
                    {
                        lines.add(s);
                    } else
                    {
                        StringBuilder stringbuilder = new StringBuilder(s.length() - i);
                        do
                        {
                            if(i >= s.length())
                            {
                                break;
                            }
                            char c2 = s.charAt(i++);
                            if(c2 == '\\')
                            {
                                if(i == s.length())
                                {
                                    s = bufferedreader.readLine();
                                    if(s == null)
                                    {
                                        break;
                                    }
                                    char c3;
                                    for(i = 0; i < s.length() && Character.isWhitespace(c3 = s.charAt(i)); i++) { }
                                    stringbuilder.ensureCapacity((s.length() - i) + stringbuilder.length());
                                    continue;
                                }
                                char c4 = s.charAt(i++);
                                switch(c4)
                                {
                                case 110: // 'n'
                                    stringbuilder.append('\n');
                                    break;
    
                                case 116: // 't'
                                    stringbuilder.append('\t');
                                    break;
    
                                case 114: // 'r'
                                    stringbuilder.append('\r');
                                    break;
    
                                case 117: // 'u'
                                    if(i + 4 <= s.length())
                                    {
                                        char c6 = (char)Integer.parseInt(s.substring(i, i + 4), 16);
                                        stringbuilder.append(c6);
                                        i += 4;
                                        break;
                                    }
                                    continue;
    
                                case 111: // 'o'
                                case 112: // 'p'
                                case 113: // 'q'
                                case 115: // 's'
                                default:
                                    stringbuilder.append('\0');
                                    break;
                                }
                            }
                            stringbuilder.append('\0');
                        } while(true);
                        lines.add((new StringBuilder()).append(s1).append("=").append(stringbuilder.toString()).toString());
                    }
                }
            }
            bufferedreader.close();
        }
    
        public void save()
        {
            FileOutputStream fileoutputstream = null;
            try
            {
                fileoutputstream = new FileOutputStream(fileName);
            }
            catch(FileNotFoundException filenotfoundexception)
            {
                System.out.println((new StringBuilder()).append("[Props] Unable to open ").append(fileName).append("!").toString());
            }
            PrintStream printstream = null;
            try
            {
                printstream = new PrintStream(fileoutputstream, true, "UTF-8");
            }
            catch(UnsupportedEncodingException unsupportedencodingexception)
            {
                System.out.println((new StringBuilder()).append("[Props] Unable to write to ").append(fileName).append("!").toString());
            }
            ArrayList arraylist = new ArrayList();
            for(Iterator iterator = lines.iterator(); iterator.hasNext():wink.gif:
            {
                String s = (String)iterator.next();
                if(s.trim().length() == 0)
                {
                    printstream.println(s);
                } else
                if(s.charAt(0) == '#')
                {
                    printstream.println(s);
                } else
                if(s.contains("="))
                {
                    int i = s.indexOf('=');
                    String s1 = s.substring(0, i).trim();
                    if(props.containsKey(s1))
                    {
                        String s2 = (String)props.get(s1);
                        printstream.println((new StringBuilder()).append(s1).append("=").append(s2).toString());
                        arraylist.add(s1);
                    } else
                    {
                        printstream.println(s);
                    }
                } else
                {
                    printstream.println(s);
                }
            }
    
            Iterator iterator1 = props.entrySet().iterator();
            do
            {
                if(!iterator1.hasNext())
                {
                    break;
                }
                java.util.Map.Entry entry = (java.util.Map.Entry)iterator1.next();
                if(!arraylist.contains(entry.getKey()))
                {
                    printstream.println((new StringBuilder()).append((String)entry.getKey()).append("=").append((String)entry.getValue()).toString());
                }
            } while(true);
            printstream.close();
            try
            {
                props.clear();
                lines.clear();
                load();
            }
            catch(IOException ioexception)
            {
                System.out.println((new StringBuilder()).append("[Props] Unable to load ").append(fileName).append("!").toString());
            }
        }
    
        public Map returnMap()
            throws Exception
        {
            HashMap hashmap = new HashMap();
            BufferedReader bufferedreader = new BufferedReader(new FileReader(fileName));
            do
            {
                String s;
                if((s = bufferedreader.readLine()) == null)
                {
                    break;
                }
                if(s.trim().length() != 0 && s.charAt(0) != '#' && s.contains("="))
                {
                    int i = s.indexOf('=');
                    String s1 = s.substring(0, i).trim();
                    String s2 = s.substring(i + 1).trim();
                    hashmap.put(s1, s2);
                }
            } while(true);
            bufferedreader.close();
            return hashmap;
        }
    
        public boolean containsKey(String s)
        {
            for(Iterator iterator = lines.iterator(); iterator.hasNext():wink.gif:
            {
                String s1 = (String)iterator.next();
                if(s1.trim().length() != 0 && s1.charAt(0) != '#' && s1.contains("="))
                {
                    int i = s1.indexOf('=');
                    String s2 = s1.substring(0, i);
                    if(s2.equals(s))
                    {
                        return true;
                    }
                }
            }
    
            return false;
        }
    
        public String getProperty(String s)
        {
            for(Iterator iterator = lines.iterator(); iterator.hasNext():wink.gif:
            {
                String s1 = (String)iterator.next();
                if(s1.trim().length() != 0 && s1.charAt(0) != '#' && s1.contains("="))
                {
                    int i = s1.indexOf('=');
                    String s2 = s1.substring(0, i).trim();
                    String s3 = s1.substring(i + 1);
                    if(s2.equals(s))
                    {
                        return s3;
                    }
                }
            }
    
            return "";
        }
    
        public void removeKey(String s)
        {
            Boolean boolean1 = Boolean.valueOf(false);
            if(props.containsKey(s))
            {
                props.remove(s);
                boolean1 = Boolean.valueOf(true);
            }
            try
            {
                for(int i = 0; i < lines.size(); i++)
                {
                    String s1 = (String)lines.get(i);
                    if(s1.trim().length() != 0 && s1.charAt(0) != '#' && s1.contains("="))
                    {
                        int j = s1.indexOf('=');
                        String s2 = s1.substring(0, j).trim();
                        if(s2.equals(s))
                        {
                            lines.remove(i);
                            boolean1 = Boolean.valueOf(true);
                        }
                    }
                }
    
            }
            catch(ConcurrentModificationException concurrentmodificationexception)
            {
                removeKey(s);
                return;
            }
            if(boolean1.booleanValue())
            {
                save();
            }
        }
    
        public boolean keyExists(String s)
        {
            try
            {
                return containsKey(s);
            }
            catch(Exception exception)
            {
                return false;
            }
        }
    
        public String getString(String s)
        {
            if(containsKey(s))
            {
                return getProperty(s);
            } else
            {
                return "";
            }
        }
    
        public String getString(String s, String s1)
        {
            if(containsKey(s))
            {
                return getProperty(s);
            } else
            {
                setString(s, s1);
                return s1;
            }
        }
    
        public void setString(String s, String s1)
        {
            props.put(s, s1);
            save();
        }
    
        public int getInt(String s)
        {
            if(containsKey(s))
            {
                return Integer.parseInt(getProperty(s));
            } else
            {
                return 0;
            }
        }
    
        public int getInt(String s, int i)
        {
            if(containsKey(s))
            {
                return Integer.parseInt(getProperty(s));
            } else
            {
                setInt(s, i);
                return i;
            }
        }
    
        public void setInt(String s, int i)
        {
            props.put(s, String.valueOf(i));
            save();
        }
    
        public double getDouble(String s)
        {
            if(containsKey(s))
            {
                return Double.parseDouble(getProperty(s));
            } else
            {
                return 0.0D;
            }
        }
    
        public double getDouble(String s, double d)
        {
            if(containsKey(s))
            {
                return Double.parseDouble(getProperty(s));
            } else
            {
                setDouble(s, d);
                return d;
            }
        }
    
        public void setDouble(String s, double d)
        {
            props.put(s, String.valueOf(d));
            save();
        }
    
        public long getLong(String s)
        {
            if(containsKey(s))
            {
                return Long.parseLong(getProperty(s));
            } else
            {
                return 0L;
            }
        }
    
        public long getLong(String s, long l)
        {
            if(containsKey(s))
            {
                return Long.parseLong(getProperty(s));
            } else
            {
                setLong(s, l);
                return l;
            }
        }
    
        public void setLong(String s, long l)
        {
            props.put(s, String.valueOf(l));
            save();
        }
    
        public boolean getBoolean(String s)
        {
            if(containsKey(s))
            {
                return Boolean.parseBoolean(getProperty(s));
            } else
            {
                return false;
            }
        }
    
        public boolean getBoolean(String s, boolean flag)
        {
            if(containsKey(s))
            {
                return Boolean.parseBoolean(getProperty(s));
            } else
            {
                setBoolean(s, flag);
                return flag;
            }
        }
    
        public void setBoolean(String s, boolean flag)
        {
            props.put(s, String.valueOf(flag));
            save();
        }
    
        private String fileName;
        private List lines;
        private Map props;
    }


    in your mod_XXX file add this:

    public static void prepareProps()
        {
          props.getInt("BLOCK OR ITEM NAME HERE", ID);
    
    
         }
    private static XXXProps props;

    in the static:
    props = new XXXProps((new File((new StringBuilder()).append(Minecraft.getMinecraftDir()).append("/").append("XXX.props").toString())).getPath());
            prepareProps();

    to make items or blocks use the props file instead of ID put this:
    props.getInt("ITEM OR BLOCK NAME USED ABOVE")


    Ore Generation (not Tested for 1.8.1):

    public void GenerateSurface(World world, Random random, int i, int j)
       {
               for ( int a = 0; a < 20; a++ )
               {
                       int posX = i + random.nextInt(16);
                       int posY = random.nextInt(128);
                       int posZ = j + random.nextInt(16);
                       (new WorldGenMinable(OreNAMEHERE.blockID, 16)).generate(world, random, posX, posY, posZ);
               
               }
       }


    for multiple generation use this:
    public void GenerateSurface(World world, Random random, int i, int j)
       {
               for ( int a = 0; a < 20; a++ )
               {
                       int posX = i + random.nextInt(16);
                       int posY = random.nextInt(128);
                       int posZ = j + random.nextInt(16);
                       (new WorldGenMinable(ore1.blockID, 16)).generate(world, random, posX, posY, posZ);
               
               for ( int b = 0; b < 20; b++ )
               {
                       posX = i + random.nextInt(16);
                       posY = random.nextInt(128);
                       posZ = j + random.nextInt(16);
                       (new WorldGenMinable(ore2.blockID, 8)).generate(world, random, posX, posY, posZ);
               
               
               }
               for ( int b = 0; b < 20; b++ )
               {
                       posX = i + random.nextInt(16);
                       posY = random.nextInt(128);
                       posZ = j + random.nextInt(16);
                       (new WorldGenMinable(ore3.blockID,1)).generate(world, random, posX, posY, posZ);
               
                   
               }
               
               }
       }


    for nether just change the "surface" to "nether"

    Structure Generation:

    This Tutorial Is VERY advanced and will require patience and a basic understanding of minecraft and Java work so if you don't have those go get them.

    First of add this to the mod_ file just inside the main class
    public void GenerateSurface(World world, Random rand, int i, int j)
    	   {
    	      for(int k = 0; k < 1; k++)
    	      {
    	         int RandPosX = i + rand.nextInt(16);
    	         int RandPosY = rand.nextInt(128);
    	         int RandPosZ = j + rand.nextInt(16);
    	         (new WorldGenYOURSTURCTUREGENFILENAMEHERE()).generate(world, rand, RandPosX, RandPosY, RandPosZ);
    	      }
    }

    Im calling my file "WorldGenTest"

    Firstly create a file looking like this to begin:
    package net.minecraft.src;
    
    import java.util.Random;
    
    public class WorldGenTest extends WorldGenerator 
    {
    public WorldGenTest()
    {
    	
    }
    	
    	public boolean generate(World world, Random rand, int i, int j, int k)
    	{
    		if(world.getBlockId(i, j, k)!= Block.sand.blockID || world.getBlockId(i, j + 1, k)!= 0)
          {
             return false;
          }
    	  
    	   for(int i1 = 0; i1 < X; i1++)
    	   {
    	      for(int j1 = 0; j1 < Y; j1++)
    	      {
    	         for(int k1 = 0; k1 < Z; k1++)
    	         {
    	            if((i1 >= 1 && i1 <= X) && (j1 >= 1 && j1 <= Y) && (k1 >= 1 && k1 <= Z))
    	            {
    	               continue;      
    	            }
    	          //Stuff here soon
    	            }
    	            
    	         }
    	      }
    	   }
    	   return true;
    	}   
    }


    X is the X axis so input your number there (i.e. 10)
    Y is Y axis and Z is Z axis but normaly inside the structure gen code X =i Y = j Z = k
    (This is only how big we want the building to be i.e. x=5 y=10 z=3 = 5,10,3)
    now I found my structures sometimes spawned just slightly floating so I used a bit of code from zidMC to get rid of that:\
    replace this:
     if(world.getBlockId(i, j, k)!= Block.sand.blockID || world.getBlockId(i, j + 1, k)!= 0)

    With this:
    if(world.getBlockId(i, j, k) != Block.sand.blockID || world.getBlockId(i, j + 1, k) != 0 || world.getBlockId(i + 7, j, k) != Block.sand.blockID || world.getBlockId(i + 7, j, k + 7) != Block.sand.blockID || world.getBlockId(i, j, k + 7) != Block.sand.blockID || world.getBlockId(i + 7, j + 1, k) != 0 || world.getBlockId(i + 7, j + 1, k + 7) != 0 || world.getBlockId(i, j + 1, k + 7) != 0)


    Now adding and removing blocks:
    to add a block add this in the "//stuff here" area:
    i.e.
    //2nd Floor
                   world.setBlock(i + 1, j + 4, k + 5, Block.stone.blockID); 
                   world.setBlock(i + 2, j + 4, k + 5, Block.stone.blockID); 
                   world.setBlock(i + 3, j + 4, k + 5, Block.stone.blockID); 
                   world.setBlock(i + 4, j + 4, k + 5, Block.stone.blockID); 
                   world.setBlock(i + 5, j + 4, k + 5, Block.stone.blockID); 
                   world.setBlock(i + 1, j + 4, k + 4, Block.stone.blockID); 
                   world.setBlock(i + 2, j + 4, k + 4, Block.stone.blockID); 
                   world.setBlock(i + 3, j + 4, k + 4, Block.stone.blockID); 
                   world.setBlock(i + 4, j + 4, k + 4, Block.stone.blockID); 
                   world.setBlock(i + 5, j + 4, k + 4, Block.stone.blockID); 
                   world.setBlock(i + 1, j + 4, k + 3, Block.stone.blockID); 
                   world.setBlock(i + 2, j + 4, k + 3, Block.stone.blockID); 
                   world.setBlock(i + 3, j + 4, k + 3, Block.stone.blockID); 
                   world.setBlock(i + 4, j + 4, k + 3, Block.stone.blockID); 
                   world.setBlock(i + 5, j + 4, k + 3, Block.stone.blockID); 
                   world.setBlock(i + 1, j + 4, k + 2, Block.stone.blockID); 
                   world.setBlock(i + 2, j + 4, k + 2, Block.stone.blockID); 
                   world.setBlock(i + 3, j + 4, k + 2, Block.stone.blockID); 
                   world.setBlock(i + 4, j + 4, k + 2, Block.stone.blockID); 
                   world.setBlock(i + 5, j + 4, k + 2, Block.stone.blockID); 

    to remove a block just change the Block.!@#[email protected] to 0, just rememeber all of this and it shouldn't be to hard.

    If This Post Helped Click The Like Button and Rate It On The Pole =)
    Note:
    IF you post these tuts somewhere else (not talking about the props file and 2 input furnace) you MUST ASK FOR PERMISSION! The only place you are allowed to post ANY of these tuts is on zidMC WITH THE ORIGINAL POST LINK TO HERE IN THE DESCRIPTION!
    Posted in: Tutorials
  • To post a comment, please .