Heya guys, 3vil_squirrel here just wanted to let you know the time we've taken to make this team and work on these tutorials and hopefully you can understand how to make your own mods now. If these helped please leave a comment and maybe even a diamond
I Will not explain much for now, i jus want to get all of the new tutorials up, then explain them all. so this will just be a copy & paste tutorial for now, just replace things as usual.
Mod_Fixeruperrer
//Coded/Tutorial by GoldenClawStudio Representatives Hawkz and 3vil_Squirrel
package net.minecraft.src;
import java.util.Random;
public class mod_Fixeruperrer extends BaseMod{
public mod_Fixeruperrer()
{
//TODO List
addNames();
setTextures();
registerBlocks();
addRecipes();
addSmelting();
}
public void addNames()
{
//***
//* This adds the name for your Item/Block then the in game name.
//***
ModLoader.addName(LimestoneBow, "Limestone Bow");
}
public void setTextures()
{
//***
//* This adds the Textures for you Item's/Block's
//***
LimestoneBow.iconIndex = ModLoader.addOverride("/gui/items.png", "/Fixeruperrer/LimestoneBow.png");
}
public void registerBlocks()
{
//***
//* This will register the block. (This Has to be added if you're making a block no items go here)
//***
}
public void addRecipes()
{
//***
//* Be Creative! This part will be how you craft your Item's/Block's
//***
ModLoader.addRecipe(new ItemStack(LimestoneBow, 1), new Object[] {
"ab ", "a b", "ab ", Character.valueOf('a'), Block.dirt, Character.valueOf('b'), Item.stick
});
}
public void addSmelting()
{
//***
//* This part is where we add our Smelting Recipes.
//***
}
//***
//* This is where we Register our Items/Blocks for the part below.
//***
public static Item LimestoneBow;
public static int LimestoneBow1 = ModLoader.addOverride("/gui/items.png", "/Fixeruperrer/LimestoneBow1.png");
public static int LimestoneBow2 = ModLoader.addOverride("/gui/items.png", "/Fixeruperrer/LimestoneBow2.png");
public static int LimestoneBow3 = ModLoader.addOverride("/gui/items.png", "/Fixeruperrer/LimestoneBow3.png");
public static int LimestoneBow4 = ModLoader.addOverride("/gui/items.png", "/Fixeruperrer/LimestoneBow4.png");
static
{
//***
//* This is where the fun begins with some food and blocks.
//***
LimestoneBow = (new ItemLimestoneBow(1001)).setItemName("LimestoneBow");
}
public String getVersion()
{
//***
//* This is where we name our mod.
//***
return "Fixer Uper'er - 1.2.5";
}
public void load()
{
//***
//* This is where Some NPC Stuff will go.
//***
}
}
ItemLimestoneBow
package net.minecraft.src;
import java.util.Random;
public class ItemLimestoneBow extends Item
{
public ItemLimestoneBow(int par1)
{
super(par1);
maxStackSize = 1;
setMaxDamage(384);
}
public void onUpdate(ItemStack itemstack, World world, Entity entity, int i, boolean flag)
{
EntityPlayer entityplayer = (EntityPlayer)entity;
ItemStack itemstack1 = entityplayer.inventory.getCurrentItem();
if(entityplayer.isUsingItem() && itemstack1.itemID == mod_Fixeruperrer.LimestoneBow.shiftedIndex)
{
int k = itemstack.getMaxItemUseDuration() - entityplayer.getItemInUseCount();
if (k >= 18) {
iconIndex = mod_Fixeruperrer.LimestoneBow4;} else if(k > 13) {
iconIndex = mod_Fixeruperrer.LimestoneBow3;} else if(k > 0) {
iconIndex = mod_Fixeruperrer.LimestoneBow2;}
} else {
iconIndex = mod_Fixeruperrer.LimestoneBow1;}
}
/**
* called when the player releases the use item button. Args: itemstack, world, entityplayer, itemInUseCount
*/
public void onPlayerStoppedUsing(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer, int par4)
{
boolean flag = par3EntityPlayer.capabilities.isCreativeMode || EnchantmentHelper.getEnchantmentLevel(Enchantment.infinity.effectId, par1ItemStack) > 0;
if (flag || par3EntityPlayer.inventory.hasItem(Item.arrow.shiftedIndex))
{
int i = getMaxItemUseDuration(par1ItemStack) - par4;
float f = (float)i / 20F;
f = (f * f + f * 2.0F) / 3F;
if ((double)f < 0.10000000000000001D)
{
return;
}
if (f > 1.0F)
{
f = 1.0F;
}
EntityArrow entityarrow = new EntityArrow(par2World, par3EntityPlayer, f * 2.0F);
if (f == 1.0F)
{
entityarrow.arrowCritical = true;
}
int j = EnchantmentHelper.getEnchantmentLevel(Enchantment.power.effectId, par1ItemStack);
if (j > 0)
{
entityarrow.setDamage(entityarrow.getDamage() + (double)j * 0.5D + 0.5D);
}
int k = EnchantmentHelper.getEnchantmentLevel(Enchantment.punch.effectId, par1ItemStack);
if (k > 0)
{
entityarrow.func_46023_b(k);
}
if (EnchantmentHelper.getEnchantmentLevel(Enchantment.flame.effectId, par1ItemStack) > 0)
{
entityarrow.setFire(100);
}
par1ItemStack.damageItem(1, par3EntityPlayer);
par2World.playSoundAtEntity(par3EntityPlayer, "random.bow", 1.0F, 1.0F / (itemRand.nextFloat() * 0.4F + 1.2F) + f * 0.5F);
if (!flag)
{
par3EntityPlayer.inventory.consumeInventoryItem(Item.arrow.shiftedIndex);
}
else
{
entityarrow.doesArrowBelongToPlayer = false;
}
if (!par2World.isRemote)
{
par2World.spawnEntityInWorld(entityarrow);
}
}
}
public ItemStack onFoodEaten(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
{
return par1ItemStack;
}
/**
* How long it takes to use or consume an item
*/
public int getMaxItemUseDuration(ItemStack par1ItemStack)
{
return 0x11940;
}
/**
* returns the action that specifies what animation to play when the items is being used
*/
public EnumAction getItemUseAction(ItemStack par1ItemStack)
{
return EnumAction.bow;
}
/**
* Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer
*/
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
{
if (par3EntityPlayer.capabilities.isCreativeMode || par3EntityPlayer.inventory.hasItem(Item.arrow.shiftedIndex))
{
par3EntityPlayer.setItemInUse(par1ItemStack, getMaxItemUseDuration(par1ItemStack));
}
return par1ItemStack;
}
/**
* Return the enchantability factor of the item, most of the time is based on material.
*/
public int getItemEnchantability()
{
return 1;
}
}
ItemTutorialNo# 2 - Fertilizer
I Will not explain much for now, i jus want to get all of the new tutorials up, then explain them all. so this will just be a copy & paste tutorial for now, just replace things as usual.
Mod_Fixeruperrer
//Coded/Tutorial by GoldenClawStudio Representatives Hawkz and 3vil_Squirrel
package net.minecraft.src;
import java.util.Random;
public class mod_Fixeruperrer extends BaseMod{
public mod_Fixeruperrer()
{
//TODO List
addNames();
setTextures();
registerBlocks();
addRecipes();
addSmelting();
}
public void addNames()
{
//***
//* This adds the name for your Item/Block then the in game name.
//***
ModLoader.addName(LimestoneF, "Limestone Fertilizer");
}
public void setTextures()
{
//***
//* This adds the Textures for you Item's/Block's
//***
LimestoneF.iconIndex = ModLoader.addOverride("/gui/items.png", "/Fixeruperrer/LimestoneF.png");
}
public void registerBlocks()
{
//***
//* This will register the block. (This Has to be added if you're making a block no items go here)
//***
}
public void addRecipes()
{
//***
//* Be Creative! This part will be how you craft your Item's/Block's
//***
ModLoader.addRecipe(new ItemStack(LimestoneF, 1), new Object[] {
"aa", Character.valueOf('a'), Block.dirt
});
}
public void addSmelting()
{
//***
//* This part is where we add our Smelting Recipes.
//***
}
//***
//* This is where we Register our Items/Blocks for the part below.
//***
public static Item LimestoneBow;
static
{
//***
//* This is where the fun begins with some food and blocks.
//***
LimestoneF = (new ItemLimestoneF(1002)).setItemName("LimestoneF");
}
public String getVersion()
{
//***
//* This is where we name our mod.
//***
return "Fixer Uper'er - 1.2.5";
}
public void load()
{
//***
//* This is where Some NPC Stuff will go.
//***
}
}
//Coded/Tutorial by GoldenClawStudio Representatives Hawkz and 3vil_Squirrel
package net.minecraft.src;
import java.util.Random;
public class mod_Fixeruperrer extends BaseMod{
public mod_Fixeruperrer()
{
//TODO List
addNames();
setTextures();
registerBlocks();
addRecipes();
addSmelting();
}
public void addNames()
{
//***
//* This adds the name for your Item/Block then the in game name.
//***
ModLoader.addName(LimestoneT, "Limestone Torch");
}
public void setTextures()
{
//***
//* This adds the Textures for you Item's/Block's
//***
LimestoneT.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/Fixeruperrer/LimestoneT.png");
}
public void registerBlocks()
{
//***
//* This will register the block. (This Has to be added if you're making a block no items go here)
//***
ModLoader.registerBlock(LimestoneT);
}
public void addRecipes()
{
//***
//* Be Creative! This part will be how you craft your Item's/Block's
//***
ModLoader.addRecipe(new ItemStack(LimestoneT, 1), new Object[] {
"a", "b", Character.valueOf('a'), Block.dirt, Character.valueOf('b'), Limestone
});
}
public void addSmelting()
{
//***
//* This part is where we add our Smelting Recipes.
//***
}
//***
//* This is where we Register our Items/Blocks for the part below.
//***
public static Block LimestoneT;
static
{
//***
//* This is where the fun begins with some food and blocks.
//***
LimestoneT = new BlockLimestoneT(252, 0, Material.circuits).setHardness(0F).setLightValue(0.975F).setBlockName("LimestoneT");
}
public String getVersion()
{
//***
//* This is where we name our mod.
//***
return "Fixer Uper'er - 1.2.5";
}
public void load()
{
//***
//* This is where Some NPC Stuff will go.
//***
}
}
BlockLimestoneT
package net.minecraft.src;
import java.util.Random;
public class BlockLimestoneT extends Block
{
protected BlockLimestoneT(int par1, int par2)
{
super(par1, par2, Material.circuits);
setTickRandomly(true);
}
public BlockLimestoneT(int i, int j, Material material)
{
super(i, Material.circuits);
}
/**
* Returns a bounding box from the pool of bounding boxes (this means this box can change after the pool has been
* cleared to be reused)
*/
public AxisAlignedBB getCollisionBoundingBoxFromPool(World par1World, int par2, int par3, int i)
{
return null;
}
/**
* Is this block (a) opaque and (B) a full 1m cube? This determines whether or not to render the shared face of two
* adjacent blocks and also whether the player can attach torches, redstone wire, etc to this block.
*/
public boolean isOpaqueCube()
{
return false;
}
/**
* If this block doesn't render as an ordinary block it will return False (examples: signs, buttons, stairs, etc)
*/
public boolean renderAsNormalBlock()
{
return false;
}
/**
* The type of render function that is called for this block
*/
public int getRenderType()
{
return 2;
}
/**
* Gets if we can place a torch on a block.
*/
private boolean canPlaceTorchOn(World par1World, int par2, int par3, int par4)
{
if (par1World.isBlockNormalCubeDefault(par2, par3, par4, true))
{
return true;
}
int i = par1World.getBlockId(par2, par3, par4);
if (i == Block.fence.blockID || i == Block.netherFence.blockID || i == Block.glass.blockID)
{
return true;
}
if (Block.blocksList[i] != null && (Block.blocksList[i] instanceof BlockStairs))
{
int j = par1World.getBlockMetadata(par2, par3, par4);
if ((4 & j) != 0)
{
return true;
}
}
return false;
}
/**
* Checks to see if its valid to put this block at the specified coordinates. Args: world, x, y, z
*/
public boolean canPlaceBlockAt(World par1World, int par2, int par3, int par4)
{
if (par1World.isBlockNormalCubeDefault(par2 - 1, par3, par4, true))
{
return true;
}
if (par1World.isBlockNormalCubeDefault(par2 + 1, par3, par4, true))
{
return true;
}
if (par1World.isBlockNormalCubeDefault(par2, par3, par4 - 1, true))
{
return true;
}
if (par1World.isBlockNormalCubeDefault(par2, par3, par4 + 1, true))
{
return true;
}
return canPlaceTorchOn(par1World, par2, par3 - 1, par4);
}
/**
* Called when a block is placed using an item. Used often for taking the facing and figuring out how to position
* the item. Args: x, y, z, facing
*/
public void onBlockPlaced(World par1World, int par2, int par3, int par4, int par5)
{
int i = par1World.getBlockMetadata(par2, par3, par4);
if (par5 == 1 && canPlaceTorchOn(par1World, par2, par3 - 1, par4))
{
i = 5;
}
if (par5 == 2 && par1World.isBlockNormalCubeDefault(par2, par3, par4 + 1, true))
{
i = 4;
}
if (par5 == 3 && par1World.isBlockNormalCubeDefault(par2, par3, par4 - 1, true))
{
i = 3;
}
if (par5 == 4 && par1World.isBlockNormalCubeDefault(par2 + 1, par3, par4, true))
{
i = 2;
}
if (par5 == 5 && par1World.isBlockNormalCubeDefault(par2 - 1, par3, par4, true))
{
i = 1;
}
par1World.setBlockMetadataWithNotify(par2, par3, par4, i);
}
/**
* Ticks the block if it's been scheduled
*/
public void updateTick(World par1World, int par2, int par3, int par4, Random par5Random)
{
super.updateTick(par1World, par2, par3, par4, par5Random);
if (par1World.getBlockMetadata(par2, par3, par4) == 0)
{
onBlockAdded(par1World, par2, par3, par4);
}
}
/**
* Called whenever the block is added into the world. Args: world, x, y, z
*/
public void onBlockAdded(World par1World, int par2, int par3, int par4)
{
if (par1World.isBlockNormalCubeDefault(par2 - 1, par3, par4, true))
{
par1World.setBlockMetadataWithNotify(par2, par3, par4, 1);
}
else if (par1World.isBlockNormalCubeDefault(par2 + 1, par3, par4, true))
{
par1World.setBlockMetadataWithNotify(par2, par3, par4, 2);
}
else if (par1World.isBlockNormalCubeDefault(par2, par3, par4 - 1, true))
{
par1World.setBlockMetadataWithNotify(par2, par3, par4, 3);
}
else if (par1World.isBlockNormalCubeDefault(par2, par3, par4 + 1, true))
{
par1World.setBlockMetadataWithNotify(par2, par3, par4, 4);
}
else if (canPlaceTorchOn(par1World, par2, par3 - 1, par4))
{
par1World.setBlockMetadataWithNotify(par2, par3, par4, 5);
}
dropTorchIfCantStay(par1World, par2, par3, par4);
}
/**
* Lets the block know when one of its neighbor changes. Doesn't know which neighbor changed (coordinates passed are
* their own) Args: x, y, z, neighbor blockID
*/
public void onNeighborBlockChange(World par1World, int par2, int par3, int par4, int par5)
{
if (dropTorchIfCantStay(par1World, par2, par3, par4))
{
int i = par1World.getBlockMetadata(par2, par3, par4);
boolean flag = false;
if (!par1World.isBlockNormalCubeDefault(par2 - 1, par3, par4, true) && i == 1)
{
flag = true;
}
if (!par1World.isBlockNormalCubeDefault(par2 + 1, par3, par4, true) && i == 2)
{
flag = true;
}
if (!par1World.isBlockNormalCubeDefault(par2, par3, par4 - 1, true) && i == 3)
{
flag = true;
}
if (!par1World.isBlockNormalCubeDefault(par2, par3, par4 + 1, true) && i == 4)
{
flag = true;
}
if (!canPlaceTorchOn(par1World, par2, par3 - 1, par4) && i == 5)
{
flag = true;
}
if (flag)
{
dropBlockAsItem(par1World, par2, par3, par4, par1World.getBlockMetadata(par2, par3, par4), 0);
par1World.setBlockWithNotify(par2, par3, par4, 0);
}
}
}
/**
* Tests if the block can remain at its current location and will drop as an item if it is unable to stay. Returns
* True if it can stay and False if it drops. Args: world, x, y, z
*/
private boolean dropTorchIfCantStay(World par1World, int par2, int par3, int par4)
{
if (!canPlaceBlockAt(par1World, par2, par3, par4))
{
if (par1World.getBlockId(par2, par3, par4) == blockID)
{
dropBlockAsItem(par1World, par2, par3, par4, par1World.getBlockMetadata(par2, par3, par4), 0);
par1World.setBlockWithNotify(par2, par3, par4, 0);
}
return false;
}
else
{
return true;
}
}
/**
* Ray traces through the blocks collision from start vector to end vector returning a ray trace hit. Args: world,
* x, y, z, startVec, endVec
*/
public MovingObjectPosition collisionRayTrace(World par1World, int par2, int par3, int par4, Vec3D par5Vec3D, Vec3D par6Vec3D)
{
int i = par1World.getBlockMetadata(par2, par3, par4) & 7;
float f = 0.15F;
if (i == 1)
{
setBlockBounds(0.0F, 0.2F, 0.5F - f, f * 2.0F, 0.8F, 0.5F + f);
}
else if (i == 2)
{
setBlockBounds(1.0F - f * 2.0F, 0.2F, 0.5F - f, 1.0F, 0.8F, 0.5F + f);
}
else if (i == 3)
{
setBlockBounds(0.5F - f, 0.2F, 0.0F, 0.5F + f, 0.8F, f * 2.0F);
}
else if (i == 4)
{
setBlockBounds(0.5F - f, 0.2F, 1.0F - f * 2.0F, 0.5F + f, 0.8F, 1.0F);
}
else
{
float f1 = 0.1F;
setBlockBounds(0.5F - f1, 0.0F, 0.5F - f1, 0.5F + f1, 0.6F, 0.5F + f1);
}
return super.collisionRayTrace(par1World, par2, par3, par4, par5Vec3D, par6Vec3D);
}
/**
* Below is the Code for the animations of the torch, the flames and smoke.
* I'm Not very good with the particles stuff, but i'm pretty sure thats the colour
* and what I, J, K, to let the particles spawn.
*/
public void randomDisplayTick(World par1World, int par2, int par3, int par4, Random par5Random)
{
int i = par1World.getBlockMetadata(par2, par3, par4);
double d = (float)par2 + 0.5F;
double d1 = (float)par3 + 0.7F;
double d2 = (float)par4 + 0.5F;
double d3 = 0.2199999988079071D;
double d4 = 0.27000001072883606D;
if (i == 1)
{
par1World.spawnParticle("smoke", d - d4, d1 + d3, d2, 0.0D, 0.0D, 0.0D);
par1World.spawnParticle("flame", d - d4, d1 + d3, d2, 0.0D, 0.0D, 0.0D);
}
else if (i == 2)
{
par1World.spawnParticle("smoke", d + d4, d1 + d3, d2, 0.0D, 0.0D, 0.0D);
par1World.spawnParticle("flame", d + d4, d1 + d3, d2, 0.0D, 0.0D, 0.0D);
}
else if (i == 3)
{
par1World.spawnParticle("smoke", d, d1 + d3, d2 - d4, 0.0D, 0.0D, 0.0D);
par1World.spawnParticle("flame", d, d1 + d3, d2 - d4, 0.0D, 0.0D, 0.0D);
}
else if (i == 4)
{
par1World.spawnParticle("smoke", d, d1 + d3, d2 + d4, 0.0D, 0.0D, 0.0D);
par1World.spawnParticle("flame", d, d1 + d3, d2 + d4, 0.0D, 0.0D, 0.0D);
}
else
{
par1World.spawnParticle("smoke", d, d1, d2, 0.0D, 0.0D, 0.0D);
par1World.spawnParticle("flame", d, d1, d2, 0.0D, 0.0D, 0.0D);
}
}
}
Block Tutorial No# 3 - Bed
*This Section Is Under Construction*
Block Tutorial No# 4 - Stairs
Mod_Fixeruperrer
//Coded/Tutorial by GoldenClawStudio Representatives Hawkz and 3vil_Squirrel
package net.minecraft.src;
import java.util.Random;
public class mod_Fixeruperrer extends BaseMod{
public mod_Fixeruperrer()
{
//TODO List
addNames();
setTextures();
registerBlocks();
addRecipes();
addSmelting();
}
public void addNames()
{
//***
//* This adds the name for your Item/Block then the in game name.
//***
ModLoader.addName(LimestoneS, "Limestone Stairs");
}
public void setTextures()
{
//***
//* This adds the Textures for you Item's/Block's
//***
LimestoneS.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/Fixeruperrer/LimestoneS.png");
}
public void registerBlocks()
{
//***
//* This will register the block. (This Has to be added if you're making a block no items go here)
//***
ModLoader.registerBlock(LimestoneS);
}
public void addRecipes()
{
//***
//* Be Creative! This part will be how you craft your Item's/Block's
//***
ModLoader.addRecipe(new ItemStack(LimestoneS, 3), new Object[] {
"aa", Character.valueOf('a'), Block.dirt
});
}
public void addSmelting()
{
//***
//* This part is where we add our Smelting Recipes.
//***
}
//***
//* This is where we Register our Items/Blocks for the part below.
//***
public static Block LimestoneS;
static
{
//***
//* This is where the fun begins with some food and blocks.
//***
LimestoneS = new BlockLimestoneS(251, 0, Material.rock).setHardness(4F).setBlockName("LimestoneS");
}
public String getVersion()
{
//***
//* This is where we name our mod.
//***
return "Fixer Uper'er - 1.2.5";
}
public void load()
{
//***
//* This is where Some NPC Stuff will go.
//***
}
}
BlockLimestoneS
//Coded/Tutorial by GoldenClawStudio Representatives Hawkz and 3vil_Squirrel
package net.minecraft.src;
import java.util.ArrayList;
import java.util.Random;
public class BlockLimestoneS extends Block
{
//This tells minecraft that your stairs are rock, and sounds like stone.
public BlockLimestoneS(int i, int j, Material material)
{
super(i, Material.rock);
setStepSound(soundStoneFootstep);
}
//This sets the Area of the stairs, other wise it would look like stairs but you could walk through it.
public void setBlockBoundsBasedOnState(IBlockAccess par1IBlockAccess, int par2, int par3, int par4)
{
setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
}
//this stops you from walking through it, but over it.
public AxisAlignedBB getCollisionBoundingBoxFromPool(World par1World, int par2, int par3, int par4)
{
return super.getCollisionBoundingBoxFromPool(par1World, par2, par3, par4);
}
public void getCollidingBoundingBoxes(World par1World, int par2, int par3, int par4, AxisAlignedBB par5AxisAlignedBB, ArrayList par6ArrayList)
{
int i = par1World.getBlockMetadata(par2, par3, par4);
int j = i & 3;
float f = 0.0F;
float f1 = 0.5F;
float f2 = 0.5F;
float f3 = 1.0F;
if ((i & 4) != 0)
{
f = 0.5F;
f1 = 1.0F;
f2 = 0.0F;
f3 = 0.5F;
}
setBlockBounds(0.0F, f, 0.0F, 1.0F, f1, 1.0F);
super.getCollidingBoundingBoxes(par1World, par2, par3, par4, par5AxisAlignedBB, par6ArrayList);
if (j == 0)
{
setBlockBounds(0.5F, f2, 0.0F, 1.0F, f3, 1.0F);
super.getCollidingBoundingBoxes(par1World, par2, par3, par4, par5AxisAlignedBB, par6ArrayList);
}
else if (j == 1)
{
setBlockBounds(0.0F, f2, 0.0F, 0.5F, f3, 1.0F);
super.getCollidingBoundingBoxes(par1World, par2, par3, par4, par5AxisAlignedBB, par6ArrayList);
}
else if (j == 2)
{
setBlockBounds(0.0F, f2, 0.5F, 1.0F, f3, 1.0F);
super.getCollidingBoundingBoxes(par1World, par2, par3, par4, par5AxisAlignedBB, par6ArrayList);
}
else if (j == 3)
{
setBlockBounds(0.0F, f2, 0.0F, 1.0F, f3, 0.5F);
super.getCollidingBoundingBoxes(par1World, par2, par3, par4, par5AxisAlignedBB, par6ArrayList);
}
setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
}
//this also allows you to turn it into stairs
public boolean isOpaqueCube()
{
return false;
}
//this just allows you to turn it into stairs
public boolean renderAsNormalBlock()
{
return false;
}
//this renders the block as stairs not a normal cube block.
public int getRenderType()
{
return 10;
}
public void onBlockPlacedBy(World par1World, int par2, int par3, int par4, EntityLiving par5EntityLiving)
{
int i = MathHelper.floor_double((double)((par5EntityLiving.rotationYaw * 4F) / 360F) + 0.5D) & 3;
int j = par1World.getBlockMetadata(par2, par3, par4) & 4;
if (i == 0)
{
par1World.setBlockMetadataWithNotify(par2, par3, par4, 2 | j);
}
if (i == 1)
{
par1World.setBlockMetadataWithNotify(par2, par3, par4, 1 | j);
}
if (i == 2)
{
par1World.setBlockMetadataWithNotify(par2, par3, par4, 3 | j);
}
if (i == 3)
{
par1World.setBlockMetadataWithNotify(par2, par3, par4, 0 | j);
}
}
public void onBlockPlaced(World par1World, int par2, int par3, int par4, int par5)
{
if (par5 == 0)
{
int i = par1World.getBlockMetadata(par2, par3, par4);
par1World.setBlockMetadataWithNotify(par2, par3, par4, i | 4);
}
}
//this is the item/blocks dropped when you destroy it
public int idDropped(int i, Random random, int j)
{
return mod_Fixeruperrer.LimestoneS.blockID;
}
//this is the amount of items/blocks dropped.
public int quantityDropped(Random random)
{
return 1;
}
}
Block Tutorial No# 5 - Slab
*This Section Is Under Construction*
Block Tutorial No# 6 - Crops
mod_LimeCrop
package net.minecraft.src;
import java.util.Random;
public class mod_LimeCrop extends BaseMod
{
// STATICS - notice that newSeeds is using ItemSeeds which means we have to add some more info
public static final Block LimeCrop = new BlockLimeCrop(212, 0).setHardness(0.0F).setBlockName("LimeCrop").disableStats().setRequiresSelfNotify();
public static final Item LimeSeeds = new ItemSeeds(1029, mod_LimeCrop.LimeCrop.blockID, Block.tilledField.blockID).setItemName("LimeSeeds");
// I made this one food so you can see an example of that. Wohoo ;D
public static final Item LimeStarch = new ItemFood(1030, 2, 0.6F, false).setItemName("LimeStarch");
//CROP IMAGE DECLARATION - Why when we're doing it again below? Im not sure atm but it seems to work ;D
public static int LimeCrop1 = ModLoader.addOverride("/terrain.png", "/Fixeruperrer/LimeCrop1.png");
public static int LimeCrop2 = ModLoader.addOverride("/terrain.png", "/Fixeruperrer/LimeCrop2.png");
public static int LimeCrop3 = ModLoader.addOverride("/terrain.png", "/Fixeruperrer/LimeCrop3.png");
public static int LimeCrop4 = ModLoader.addOverride("/terrain.png", "/Fixeruperrer/LimeCrop4.png");
public mod_LimeCrop()
{
//NEW BLOCK REGISTER
ModLoader.registerBlock(LimeCrop);
//NEW ITEM NAMES
ModLoader.addName(LimeSeeds, "Lime Seeds");
ModLoader.addName(LimeStarch, "Lime Starch");
//NEW BLOCK AND CROP GROWTH IMAGE OVERRIDES
LimeCrop.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/Fixeruperrer/LimeCrop.png");
LimeCrop1 = ModLoader.addOverride("/terrain.png", "/Fixeruperrer/LimeCrop1.png");
LimeCrop2 = ModLoader.addOverride("/terrain.png", "/Fixeruperrer/LimeCrop2.png");
LimeCrop3 = ModLoader.addOverride("/terrain.png", "/Fixeruperrer/LimeCrop3.png");
LimeCrop4 = ModLoader.addOverride("/terrain.png", "/Fixeruperrer/LimeCrop4.png");
// You can have up to 8 textures with this tutorial, but you need as little as 2 since we can resue them.
// NEW ITEM IMAGE OVERRIDES
LimeSeeds.iconIndex = ModLoader.addOverride("/gui/items.png", "/Fixeruperrer/LimeSeeds.png");
LimeStarch.iconIndex = ModLoader.addOverride("/gui/items.png", "/Fixeruperrer/LimeRock.png");
//Seed Exchange RECIPE "Exchange regular seeds for YOUR custom seeds" Also different amounts could = different seeds
// like 1 seeds = your new seed and then 2 seeds can = a seed you make later"
ModLoader.addShapelessRecipe(new ItemStack(LimeSeeds, 1), new Object[] {
new ItemStack(Item.seeds, 1)
});
}
public String getVersion() // changed from before. No biggie.
{
return "mod_Fixeruperrer - Crops Extension!";
}
public void load() // Required to have, but not to use.
{
}
}
BlockLimeCrop
package net.minecraft.src;
import java.util.Random;
public class BlockLimeCrop extends BlockFlower
{
protected BlockLimeCrop(int par1, int par2)
{
super(par1, par2);
blockIndexInTexture = par2;
setTickRandomly(true);
float f = 0.5F;
setBlockBounds(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, 0.25F, 0.5F + f);
}
/**
* Gets passed in the blockID of the block below and supposed to return true if its allowed to grow on the type of
* blockID passed in. Args: blockID
*/
protected boolean canThisPlantGrowOnThisBlockID(int par1)
{
return par1 == Block.tilledField.blockID;
}
/**
* Ticks the block if it's been scheduled
*/
public void updateTick(World par1World, int par2, int par3, int par4, Random par5Random)
{
super.updateTick(par1World, par2, par3, par4, par5Random);
if (par1World.getBlockLightValue(par2, par3 + 1, par4) >= 9)
{
int i = par1World.getBlockMetadata(par2, par3, par4);
if (i < 7)
{
float f = getGrowthRate(par1World, par2, par3, par4);
if (par5Random.nextInt((int)(25F / f) + 1) == 0)
{
i++;
par1World.setBlockMetadataWithNotify(par2, par3, par4, i);
}
}
}
}
/**
* Apply bonemeal to the crops.
*/
public void fertilize(World par1World, int par2, int par3, int par4)
{
par1World.setBlockMetadataWithNotify(par2, par3, par4, 7);
}
/**
* Gets the growth rate for the crop. Setup to encourage rows by halving growth rate if there is diagonals, crops on
* different sides that aren't opposing, and by adding growth for every crop next to this one (and for crop below
* this one). Args: x, y, z
*/
private float getGrowthRate(World par1World, int par2, int par3, int par4)
{
float f = 1.0F;
int i = par1World.getBlockId(par2, par3, par4 - 1);
int j = par1World.getBlockId(par2, par3, par4 + 1);
int k = par1World.getBlockId(par2 - 1, par3, par4);
int l = par1World.getBlockId(par2 + 1, par3, par4);
int i1 = par1World.getBlockId(par2 - 1, par3, par4 - 1);
int j1 = par1World.getBlockId(par2 + 1, par3, par4 - 1);
int k1 = par1World.getBlockId(par2 + 1, par3, par4 + 1);
int l1 = par1World.getBlockId(par2 - 1, par3, par4 + 1);
boolean flag = k == blockID || l == blockID;
boolean flag1 = i == blockID || j == blockID;
boolean flag2 = i1 == blockID || j1 == blockID || k1 == blockID || l1 == blockID;
for (int i2 = par2 - 1; i2 <= par2 + 1; i2++)
{
for (int j2 = par4 - 1; j2 <= par4 + 1; j2++)
{
int k2 = par1World.getBlockId(i2, par3 - 1, j2);
float f1 = 0.0F;
if (k2 == Block.tilledField.blockID)
{
f1 = 1.0F;
if (par1World.getBlockMetadata(i2, par3 - 1, j2) > 0)
{
f1 = 3F;
}
}
if (i2 != par2 || j2 != par4)
{
f1 /= 4F;
}
f += f1;
}
}
if (flag2 || flag && flag1)
{
f /= 2.0F;
}
return f;
}
/**
* From the specified side and block metadata retrieves the blocks texture. Args: side, metadata
*/
public int getBlockTextureFromSideAndMetadata(int i, int j)
{
if(j == 0)
{
return blockIndexInTexture;
}
if(j == 1)
{
return mod_LimeCrop.LimeCrop1;
}
if(j == 2)
{
return mod_LimeCrop.LimeCrop1; // In order to not have to change a lot more code we can just make
} // the plant grow the same but make it "look" like it has fewer steps
if(j == 3) // Through 8 steps the sequence is 0, 1, 1, 2, 2, 3, 3, 4.
{
return mod_LimeCrop.LimeCrop2;
}
if(j == 4)
{
return mod_LimeCrop.LimeCrop2;
}
if(j == 5)
{
return mod_LimeCrop.LimeCrop3;
}
if(j == 6)
{
return mod_LimeCrop.LimeCrop3;
}
if(j == 7)
{
return mod_LimeCrop.LimeCrop4;
}
return -1;
}
/**
* The type of render function that is called for this block
*/
public int getRenderType()
{
return 6;
}
/**
* Drops the block items with a specified chance of dropping the specified items
*/
public void dropBlockAsItemWithChance(World par1World, int par2, int par3, int par4, int par5, float par6, int par7)
{
super.dropBlockAsItemWithChance(par1World, par2, par3, par4, par5, par6, 0);
if (par1World.isRemote)
{
return;
}
int i = 3 + par7;
for (int j = 0; j < i; j++)
{
if (par1World.rand.nextInt(15) <= par5)
{
float f = 0.7F;
float f1 = par1World.rand.nextFloat() * f + (1.0F - f) * 0.5F;
float f2 = par1World.rand.nextFloat() * f + (1.0F - f) * 0.5F;
float f3 = par1World.rand.nextFloat() * f + (1.0F - f) * 0.5F;
EntityItem entityitem = new EntityItem(par1World, (float)par2 + f1, (float)par3 + f2, (float)par4 + f3, new ItemStack(Item.seeds));
entityitem.delayBeforeCanPickup = 10;
par1World.spawnEntityInWorld(entityitem);
}
}
}
/**
* Returns the ID of the items to drop on destruction.
*/
public int idDropped(int par1, Random par2Random, int par3)
{
if (par1 == 7)
{
return Item.wheat.shiftedIndex;
}
else
{
return -1;
}
}
/**
* Returns the quantity of items to drop on block destruction.
*/
public int quantityDropped(Random par1Random)
{
return 1;
}
}
Block Tutorial No# 7 - Liquid
*This Section Is Under Construction*
Block Tutorial No# 8 - Chest
*This Section Is Under Construction*
Block Tutorial No# 9 - Fence
*This Section Is Under Construction*
Block Tutorial No# 10 - Ladder
*This Section Is Under Construction*
Block Tutorial No# 11 - Furnace
*This Section Is Under Construction*
Block Tutorial No# 12 - Block Extensions
*This Section Is Under Construction*
Block Tutorial No# 13 - TrapDoor
Mod_Fixeruperrer
//Coded/Tutorial by GoldenClawStudio Representatives Hawkz and 3vil_Squirrel
package net.minecraft.src;
import java.util.Random;
public class mod_Fixeruperrer extends BaseMod{
public mod_Fixeruperrer()
{
//TODO List
addNames();
setTextures();
registerBlocks();
addRecipes();
addSmelting();
}
public void addNames()
{
//***
//* This adds the name for your Item/Block then the in game name.
//***
ModLoader.addName(LimestoneTD, "Limestone TrapDoor");
}
public void setTextures()
{
//***
//* This adds the Textures for you Item's/Block's
//***
LimestoneTD.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/Fixeruperrer/LimestoneTD.png");
}
public void registerBlocks()
{
//***
//* This will register the block. (This Has to be added if you're making a block no items go here)
//***
ModLoader.registerBlock(LimestoneTD);
}
public void addRecipes()
{
//***
//* Be Creative! This part will be how you craft your Item's/Block's
//***
ModLoader.addShapelessRecipe(new ItemStack(LimestoneTD, 64), new Object[] {
Block.dirt, Block.dirt, Block.dirt, Block.dirt
});
}
public void addSmelting()
{
//***
//* This part is where we add our Smelting Recipes.
//***
}
//***
//* This is where we Register our Items/Blocks for the part below.
//***
public static Block LimestoneTD;
static
{
//***
//* This is where the fun begins with some food and blocks.
//***
LimestoneTD= new BlockLimestoneTD(254, 0, Material.rock).setHardness(6F).setBlockName("LimestoneB").disableStats().setRequiresSelfNotify();
}
public String getVersion()
{
//***
//* This is where we name our mod.
//***
return "Fixer Uper'er - 1.2.5";
}
public void load()
{
//***
//* This is where Some NPC Stuff will go.
//***
}
}
BlockLimestoneTD
package net.minecraft.src;
public class BlockLimestoneTD extends Block
{
public BlockLimestoneTD(int i, int j, Material material)
{
super(i, Material.rock);
setStepSound(soundStoneFootstep);
}
protected BlockLimestoneTD(int par1, Material par2Material)
{
super(par1, par2Material);
blockIndexInTexture = 84;
if (par2Material == Material.iron)
{
blockIndexInTexture++;
}
float f = 0.5F;
float f1 = 1.0F;
setBlockBounds(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, f1, 0.5F + f);
}
/**
* Is this block (a) opaque and (B) a full 1m cube? This determines whether or not to render the shared face of two
* adjacent blocks and also whether the player can attach torches, redstone wire, etc to this block.
*/
public boolean isOpaqueCube()
{
return false;
}
/**
* If this block doesn't render as an ordinary block it will return False (examples: signs, buttons, stairs, etc)
*/
public boolean renderAsNormalBlock()
{
return false;
}
public boolean getBlocksMovement(IBlockAccess par1IBlockAccess, int par2, int par3, int par4)
{
return !isTrapdoorOpen(par1IBlockAccess.getBlockMetadata(par2, par3, par4));
}
/**
* The type of render function that is called for this block
*/
public int getRenderType()
{
return 0;
}
/**
* Returns the bounding box of the wired rectangular prism to render.
*/
public AxisAlignedBB getSelectedBoundingBoxFromPool(World par1World, int par2, int par3, int par4)
{
setBlockBoundsBasedOnState(par1World, par2, par3, par4);
return super.getSelectedBoundingBoxFromPool(par1World, par2, par3, par4);
}
/**
* Returns a bounding box from the pool of bounding boxes (this means this box can change after the pool has been
* cleared to be reused)
*/
public AxisAlignedBB getCollisionBoundingBoxFromPool(World par1World, int par2, int par3, int par4)
{
setBlockBoundsBasedOnState(par1World, par2, par3, par4);
return super.getCollisionBoundingBoxFromPool(par1World, par2, par3, par4);
}
/**
* Updates the blocks bounds based on its current state. Args: world, x, y, z
*/
public void setBlockBoundsBasedOnState(IBlockAccess par1IBlockAccess, int par2, int par3, int par4)
{
setBlockBoundsForBlockRender(par1IBlockAccess.getBlockMetadata(par2, par3, par4));
}
/**
* Sets the block's bounds for rendering it as an item
*/
public void setBlockBoundsForItemRender()
{
float f = 0.1875F;
setBlockBounds(0.0F, 0.5F - f / 2.0F, 0.0F, 1.0F, 0.5F + f / 2.0F, 1.0F);
}
public void setBlockBoundsForBlockRender(int par1)
{
float f = 0.1875F;
setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, f, 1.0F);
if (isTrapdoorOpen(par1))
{
if ((par1 & 3) == 0)
{
setBlockBounds(0.0F, 0.0F, 1.0F - f, 1.0F, 1.0F, 1.0F);
}
if ((par1 & 3) == 1)
{
setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, f);
}
if ((par1 & 3) == 2)
{
setBlockBounds(1.0F - f, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
}
if ((par1 & 3) == 3)
{
setBlockBounds(0.0F, 0.0F, 0.0F, f, 1.0F, 1.0F);
}
}
}
/**
* Called when the block is clicked by a player. Args: x, y, z, entityPlayer
*/
public void onBlockClicked(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer)
{
blockActivated(par1World, par2, par3, par4, par5EntityPlayer);
}
/**
* Called upon block activation (left or right click on the block.). The three integers represent x,y,z of the
* block.
*/
public boolean blockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer)
{
if (blockMaterial == Material.iron)
{
return true;
}
else
{
int i = par1World.getBlockMetadata(par2, par3, par4);
par1World.setBlockMetadataWithNotify(par2, par3, par4, i ^ 4);
par1World.playAuxSFXAtEntity(par5EntityPlayer, 1003, par2, par3, par4, 0);
return true;
}
}
public void onPoweredBlockChange(World par1World, int par2, int par3, int par4, boolean par5)
{
int i = par1World.getBlockMetadata(par2, par3, par4);
boolean flag = (i & 4) > 0;
if (flag == par5)
{
return;
}
else
{
par1World.setBlockMetadataWithNotify(par2, par3, par4, i ^ 4);
par1World.playAuxSFXAtEntity(null, 1003, par2, par3, par4, 0);
return;
}
}
/**
* Lets the block know when one of its neighbor changes. Doesn't know which neighbor changed (coordinates passed are
* their own) Args: x, y, z, neighbor blockID
*/
public void onNeighborBlockChange(World par1World, int par2, int par3, int par4, int par5)
{
if (par1World.isRemote)
{
return;
}
int i = par1World.getBlockMetadata(par2, par3, par4);
int j = par2;
int k = par4;
if ((i & 3) == 0)
{
k++;
}
if ((i & 3) == 1)
{
k--;
}
if ((i & 3) == 2)
{
j++;
}
if ((i & 3) == 3)
{
j--;
}
if (!isValidSupportBlock(par1World.getBlockId(j, par3, k)))
{
par1World.setBlockWithNotify(par2, par3, par4, 0);
dropBlockAsItem(par1World, par2, par3, par4, i, 0);
}
boolean flag = par1World.isBlockIndirectlyGettingPowered(par2, par3, par4);
if (flag || par5 > 0 && Block.blocksList[par5].canProvidePower() || par5 == 0)
{
onPoweredBlockChange(par1World, par2, par3, par4, flag);
}
}
/**
* Ray traces through the blocks collision from start vector to end vector returning a ray trace hit. Args: world,
* x, y, z, startVec, endVec
*/
public MovingObjectPosition collisionRayTrace(World par1World, int par2, int par3, int par4, Vec3D par5Vec3D, Vec3D par6Vec3D)
{
setBlockBoundsBasedOnState(par1World, par2, par3, par4);
return super.collisionRayTrace(par1World, par2, par3, par4, par5Vec3D, par6Vec3D);
}
/**
* Called when a block is placed using an item. Used often for taking the facing and figuring out how to position
* the item. Args: x, y, z, facing
*/
public void onBlockPlaced(World par1World, int par2, int par3, int par4, int par5)
{
byte byte0 = 0;
if (par5 == 2)
{
byte0 = 0;
}
if (par5 == 3)
{
byte0 = 1;
}
if (par5 == 4)
{
byte0 = 2;
}
if (par5 == 5)
{
byte0 = 3;
}
par1World.setBlockMetadataWithNotify(par2, par3, par4, byte0);
}
/**
* checks to see if you can place this block can be placed on that side of a block: BlockLever overrides
*/
public boolean canPlaceBlockOnSide(World par1World, int par2, int par3, int par4, int par5)
{
if (par5 == 0)
{
return false;
}
if (par5 == 1)
{
return false;
}
if (par5 == 2)
{
par4++;
}
if (par5 == 3)
{
par4--;
}
if (par5 == 4)
{
par2++;
}
if (par5 == 5)
{
par2--;
}
return isValidSupportBlock(par1World.getBlockId(par2, par3, par4));
}
public static boolean isTrapdoorOpen(int par0)
{
return (par0 & 4) != 0;
}
/**
* Checks if the block ID is a valid support block for the trap door to connect with. If it is not the trapdoor is
* dropped into the world.
*/
private static boolean isValidSupportBlock(int par0)
{
if (par0 <= 0)
{
return false;
}
else
{
Block block = Block.blocksList[par0];
return block != null && block.blockMaterial.isOpaque() && block.renderAsNormalBlock() || block == Block.glowStone;
}
}
}
Block Tutorial No# 14 - Crafting Table
*This Section Is Under Construction*
Block Tutorial No# 15 - Pressure Plate
Mod_Fixeruperrer
//Coded/Tutorial by GoldenClawStudio Representatives Hawkz and 3vil_Squirrel
package net.minecraft.src;
import java.util.Random;
public class mod_Fixeruperrer extends BaseMod{
public mod_Fixeruperrer()
{
//TODO List
addNames();
setTextures();
registerBlocks();
addRecipes();
addSmelting();
}
public void addNames()
{
//***
//* This adds the name for your Item/Block then the in game name.
//***
ModLoader.addName(LimestonePP, "Pressure Plate");
}
public void setTextures()
{
//***
//* This adds the Textures for you Item's/Block's
//***
LimestonePP.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/Fixeruperrer/LimestonePP.png");
}
public void registerBlocks()
{
//***
//* This will register the block. (This Has to be added if you're making a block no items go here)
//***
ModLoader.registerBlock(LimestonePP);
}
public void addRecipes()
{
//***
//* Be Creative! This part will be how you craft your Item's/Block's
//***
ModLoader.addRecipe(new ItemStack(LimestonePP, 2), new Object[] {
"aa", "aa", Character.valueOf('a'), Block.dirt
});
}
public void addSmelting()
{
//***
//* This part is where we add our Smelting Recipes.
//***
}
//***
//* This is where we Register our Items/Blocks for the part below.
//***
public static Block LimestonePP;
static
{
//***
//* This is where the fun begins with some food and blocks.
//***
LimestonePP = new BlockLimestonePP(253, 0, EnumMobType.mobs, Material.cloth).setHardness(3F).setStepSound(Block.soundClothFootstep).setBlockName("LimestoneP");
}
public String getVersion()
{
//***
//* This is where we name our mod.
//***
return "Fixer Uper'er - 1.2.5";
}
public void load()
{
//***
//* This is where Some NPC Stuff will go.
//***
}
}
BlockLimestonePP
package net.minecraft.src;
import java.util.List;
import java.util.Random;
public class BlockLimestonePP extends Block
{
/** The mob type that can trigger this pressure plate. */
private EnumMobType triggerMobType;
protected BlockLimestonePP(int par1, int par2, EnumMobType par3EnumMobType, Material par4Material)
{
super(par1, par2, par4Material);
triggerMobType = par3EnumMobType;
setTickRandomly(true);
float f = 0.0625F;
setBlockBounds(f, 0.0F, f, 1.0F - f, 0.03125F, 1.0F - f);
}
public BlockLimestonePP(int i, int j, Material material)
{
super(i, Material.circuits);
setStepSound(soundStoneFootstep);
}
/**
* How many world ticks before ticking
*/
public int tickRate()
{
return 20;
}
/**
* Returns a bounding box from the pool of bounding boxes (this means this box can change after the pool has been
* cleared to be reused)
*/
public AxisAlignedBB getCollisionBoundingBoxFromPool(World par1World, int par2, int par3, int i)
{
return null;
}
/**
* Is this block (a) opaque and (B) a full 1m cube? This determines whether or not to render the shared face of two
* adjacent blocks and also whether the player can attach torches, redstone wire, etc to this block.
*/
public boolean isOpaqueCube()
{
return false;
}
/**
* If this block doesn't render as an ordinary block it will return False (examples: signs, buttons, stairs, etc)
*/
public boolean renderAsNormalBlock()
{
return false;
}
public boolean getBlocksMovement(IBlockAccess par1IBlockAccess, int par2, int par3, int i)
{
return true;
}
/**
* Checks to see if its valid to put this block at the specified coordinates. Args: world, x, y, z
*/
public boolean canPlaceBlockAt(World par1World, int par2, int par3, int par4)
{
return par1World.isBlockNormalCube(par2, par3 - 1, par4) || par1World.getBlockId(par2, par3 - 1, par4) == Block.fence.blockID;
}
/**
* Called whenever the block is added into the world. Args: world, x, y, z
*/
public void onBlockAdded(World world, int i, int j, int k)
{
}
/**
* Lets the block know when one of its neighbor changes. Doesn't know which neighbor changed (coordinates passed are
* their own) Args: x, y, z, neighbor blockID
*/
public void onNeighborBlockChange(World par1World, int par2, int par3, int par4, int par5)
{
boolean flag = false;
if (!par1World.isBlockNormalCube(par2, par3 - 1, par4) && par1World.getBlockId(par2, par3 - 1, par4) != Block.fence.blockID)
{
flag = true;
}
if (flag)
{
dropBlockAsItem(par1World, par2, par3, par4, par1World.getBlockMetadata(par2, par3, par4), 0);
par1World.setBlockWithNotify(par2, par3, par4, 0);
}
}
/**
* Ticks the block if it's been scheduled
*/
public void updateTick(World par1World, int par2, int par3, int par4, Random par5Random)
{
if (par1World.isRemote)
{
return;
}
if (par1World.getBlockMetadata(par2, par3, par4) == 0)
{
return;
}
else
{
setStateIfMobInteractsWithPlate(par1World, par2, par3, par4);
return;
}
}
/**
* Triggered whenever an entity collides with this block (enters into the block). Args: world, x, y, z, entity
*/
public void onEntityCollidedWithBlock(World par1World, int par2, int par3, int par4, Entity par5Entity)
{
if (par1World.isRemote)
{
return;
}
if (par1World.getBlockMetadata(par2, par3, par4) == 1)
{
return;
}
else
{
setStateIfMobInteractsWithPlate(par1World, par2, par3, par4);
return;
}
}
/**
* Checks if there are mobs on the plate. If a mob is on the plate and it is off, it turns it on, and vice versa.
*/
private void setStateIfMobInteractsWithPlate(World par1World, int par2, int par3, int par4)
{
boolean flag = par1World.getBlockMetadata(par2, par3, par4) == 1;
boolean flag1 = false;
float f = 0.125F;
List list = null;
if (triggerMobType == EnumMobType.everything)
{
list = par1World.getEntitiesWithinAABBExcludingEntity(null, AxisAlignedBB.getBoundingBoxFromPool((float)par2 + f, par3, (float)par4 + f, (float)(par2 + 1) - f, (double)par3 + 0.25D, (float)(par4 + 1) - f));
}
if (triggerMobType == EnumMobType.mobs)
{
list = par1World.getEntitiesWithinAABB(net.minecraft.src.EntityLiving.class, AxisAlignedBB.getBoundingBoxFromPool((float)par2 + f, par3, (float)par4 + f, (float)(par2 + 1) - f, (double)par3 + 0.25D, (float)(par4 + 1) - f));
}
if (triggerMobType == EnumMobType.players)
{
list = par1World.getEntitiesWithinAABB(net.minecraft.src.EntityPlayer.class, AxisAlignedBB.getBoundingBoxFromPool((float)par2 + f, par3, (float)par4 + f, (float)(par2 + 1) - f, (double)par3 + 0.25D, (float)(par4 + 1) - f));
}
if (list.size() > 0)
{
flag1 = true;
}
if (flag1 && !flag)
{
par1World.setBlockMetadataWithNotify(par2, par3, par4, 1);
par1World.notifyBlocksOfNeighborChange(par2, par3, par4, blockID);
par1World.notifyBlocksOfNeighborChange(par2, par3 - 1, par4, blockID);
par1World.markBlocksDirty(par2, par3, par4, par2, par3, par4);
par1World.playSoundEffect((double)par2 + 0.5D, (double)par3 + 0.10000000000000001D, (double)par4 + 0.5D, "random.click", 0.3F, 0.6F);
}
if (!flag1 && flag)
{
par1World.setBlockMetadataWithNotify(par2, par3, par4, 0);
par1World.notifyBlocksOfNeighborChange(par2, par3, par4, blockID);
par1World.notifyBlocksOfNeighborChange(par2, par3 - 1, par4, blockID);
par1World.markBlocksDirty(par2, par3, par4, par2, par3, par4);
par1World.playSoundEffect((double)par2 + 0.5D, (double)par3 + 0.10000000000000001D, (double)par4 + 0.5D, "random.click", 0.3F, 0.5F);
}
if (flag1)
{
par1World.scheduleBlockUpdate(par2, par3, par4, blockID, tickRate());
}
}
/**
* Called whenever the block is removed.
*/
public void onBlockRemoval(World par1World, int par2, int par3, int par4)
{
int i = par1World.getBlockMetadata(par2, par3, par4);
if (i > 0)
{
par1World.notifyBlocksOfNeighborChange(par2, par3, par4, blockID);
par1World.notifyBlocksOfNeighborChange(par2, par3 - 1, par4, blockID);
}
super.onBlockRemoval(par1World, par2, par3, par4);
}
/**
* Updates the blocks bounds based on its current state. Args: world, x, y, z
*/
public void setBlockBoundsBasedOnState(IBlockAccess par1IBlockAccess, int par2, int par3, int par4)
{
boolean flag = par1IBlockAccess.getBlockMetadata(par2, par3, par4) == 1;
float f = 0.0625F;
if (flag)
{
setBlockBounds(f, 0.0F, f, 1.0F - f, 0.03125F, 1.0F - f);
}
else
{
setBlockBounds(f, 0.0F, f, 1.0F - f, 0.0625F, 1.0F - f);
}
}
/**
* Is this block powering the block on the specified side
*/
public boolean isPoweringTo(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5)
{
return par1IBlockAccess.getBlockMetadata(par2, par3, par4) > 0;
}
/**
* Is this block indirectly powering the block on the specified side
*/
public boolean isIndirectlyPoweringTo(World par1World, int par2, int par3, int par4, int par5)
{
if (par1World.getBlockMetadata(par2, par3, par4) == 0)
{
return false;
}
else
{
return par5 == 1;
}
}
/**
* Can this block provide power. Only wire currently seems to have this change based on its state.
*/
public boolean canProvidePower()
{
return true;
}
/**
* Sets the block's bounds for rendering it as an item
*/
public void setBlockBoundsForItemRender()
{
float f = 0.5F;
float f1 = 0.125F;
float f2 = 0.5F;
setBlockBounds(0.5F - f, 0.5F - f1, 0.5F - f2, 0.5F + f, 0.5F + f1, 0.5F + f2);
}
/**
* Returns the mobility information of the block, 0 = free, 1 = can't push but can move over, 2 = total immobility
* and stop pistons
*/
public int getMobilityFlag()
{
return 1;
}
public int idDropped(int i, Random random, int j)
{
return mod_Fixeruperrer.LimestonePP.blockID;
}
public int quantityDropped(Random random)
{
return 1;
}
}
In this section of Entity Tutorial, i will be adding multiple things, such as too follow:
No.1 ~ Saddled Entity
No.2 ~ Ride able Entity ("Without Saddle Item Use")
No.3 ~ Evolve Entity on Item Use
No.4 ~ Evolve Entity on Death
No.5 ~ Evolve Entity on Temperature ("how bright an area is")
No.6 ~ Gui Opening on Interaction
No.7 ~ Gui Opening on Interaction ("With a Certain Object")
Split off No.1:Saddled Entity
Split off No.2: Ride able Entity
Split off No.3: Evolution on Item Use
EntityNameHere (This Chunk of Code goes into your Entity File, below the top stats.)
Fertilizer uploaded, Im working on the crops code, you might have to make a new Mod_**** for crops, to items because MC crashes when they're in the same Mod_ File for some reason, but they dont when they're in seperate files, ill do some further research, and upload my result soon for you.
Midnattsregn, so for the fertilizer, your basically making a new item, but he item code is as i have posted, thats pretty much all you have to do, just then youll have to add the code into your composter or whatever you want
Especially the Tutorial of Crops, Really help a lot of people.
Thanks
Thanks!, i have found an error with the code, that it doesn't update properly, so i'm just playing around with that then ill update it, but until then, the one that's currently up should work. thanks for your feedback ;D
Very good tutorial! I finally have some real "organic" output from my compost
Do you by any chance know if it is possible (in some easy way) to switch the positions of the input boxes in the furnace? In my case I have the different organic materials (weed, flowers, leaves) in the "fuel" slot and dirt in the "ore" slot in my compost. But it would be better to have the static element, dirt, to be in the fuel slot and the organic material in the top slot.
If this is a custom furnace that is a very simple fix ;D, all you need to do, is play around with your ****Recipes, so it looks like this:
addComposting(Item.FLOWER.shiftedIndex, new ItemStack(COMPOST));
Then for the fuel, goto Tileentity**** change the fuel stuff so its like:
private int getItemCompostTime(ItemStack itemstack)
{
if(itemstack == null)
{
return 0;
}
int i = itemstack.getItem().shiftedIndex;
if (i == Block.dirt.blockID)
{
return 400; (200 = 1 cycle)
}
else
{
return 0;
}
}
however, if your just using the furnace, i know how to do that but come on thats not even a compost D:
ALSO, if your just using the furnace im uploading a furnace + crafting table tutorial soon, so stay tuned ;D
Your trap-door tutorial is not working, I assume that you just copied the BlockTrapDoor class and pasted it onto here without even testing it. Here's the error:
java.lang.Error: Unresolved compilation problem:
The constructor AluminumTrapDoor(int, int) is undefined
at net.minecraft.src.mod_Aluminum.<init>(mod_Aluminum.java:10)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at java.lang.Class.newInstance0(Unknown Source)
at java.lang.Class.newInstance(Unknown Source)
at net.minecraft.src.ModLoader.addMod(ModLoader.java:287)
at net.minecraft.src.ModLoader.readFromClassPath(ModLoader.java:1279)
at net.minecraft.src.ModLoader.init(ModLoader.java:849)
at net.minecraft.src.ModLoader.addAllRenderers(ModLoader.java:157)
at net.minecraft.src.RenderManager.<init>(RenderManager.java:85)
at net.minecraft.src.RenderManager.<clinit>(RenderManager.java:12)
at net.minecraft.client.Minecraft.startGame(Minecraft.java:424)
at net.minecraft.client.Minecraft.run(Minecraft.java:786)
at java.lang.Thread.run(Unknown Source)
Your trap-door tutorial is not working, I assume that you just copied the BlockTrapDoor class and pasted it onto here without even testing it. Here's the error:
java.lang.Error: Unresolved compilation problem:
The constructor AluminumTrapDoor(int, int) is undefined
at net.minecraft.src.mod_Aluminum.<init>(mod_Aluminum.java:10)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at java.lang.Class.newInstance0(Unknown Source)
at java.lang.Class.newInstance(Unknown Source)
at net.minecraft.src.ModLoader.addMod(ModLoader.java:287)
at net.minecraft.src.ModLoader.readFromClassPath(ModLoader.java:1279)
at net.minecraft.src.ModLoader.init(ModLoader.java:849)
at net.minecraft.src.ModLoader.addAllRenderers(ModLoader.java:157)
at net.minecraft.src.RenderManager.<init>(RenderManager.java:85)
at net.minecraft.src.RenderManager.<clinit>(RenderManager.java:12)
at net.minecraft.client.Minecraft.startGame(Minecraft.java:424)
at net.minecraft.client.Minecraft.run(Minecraft.java:786)
at java.lang.Thread.run(Unknown Source)
Yes i did copy the code, but i edited part, then got the mod_ to work properly, it seems that you are missing the constructor in you BlockAluminumTrappDoor from reading this:
The constructor AluminumTrapDoor(int, int) is undefined
that means you might be missing this:
public BlockAluminumTrapDoor(int i, int j, Material material)
{
super(i, Material.rock);
setStepSound(soundStoneFootstep);
}AluminumTrapDoor(int par1, Material par2Material)
{
super(par1, par2Material);
blockIndexInTexture = 84;
if (par2Material == Material.iron)
{
blockIndexInTexture++;
}
float f = 0.5F;
float f1 = 1.0F;
setBlockBounds(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, f1, 0.5F + f);
}
I think you may have not renamed one of them correctly, i have renamed them for you, just replace the other chunk of code between this:
public class BlockAluminumTrapDoor extends Block
{
And This:
public boolean isOpaqueCube()
{
return false;
}
if you did that correctly it will work, also. are you using eclipse?, cus if you're not it would help greatly.
Thank you, I figured as much. But I would still want the different "burning" times. A flower would not "burn", and thus create as much fertilizer as say a block of leaves would. I was more thinking of keeping the slots properties, and only switch their places... I don't know if it's even possible!
And yes, of course is a custom "furnace". With wooden panels
i think, your asking about the cycle times... 1 cycle = 1 item tranformed, for example 1 cycle of iron ore gives you 1 iron ingot. 1 cycle = 200, so for say if you want your flower to compost one item, you'd make it:
int i = itemstack.getItem().shiftedIndex;
if (i == Block.FLOWER.blockID)
{
return 200; (200 = 1 cycle)
}
BUT!, since you want the flowers to have different cycle times, your gunna have to make the flower leaves ETC, the fuels. it IS possible to swap the slots around, you would do that as following:
1. open up your Container Compost (or whatever its called)
2. find:
public ContainerCompot(InventoryPlayer par1InventoryPlayer, TileEntityCompost par2TileEntityCompost)
3. just below that you should see some line that look like this:
what you have now done, is swap the positions around, the fuel now goes uptop, and the input goes bottom.
now to make your flower take the same amount of time is leaves etc, make the flowers leaves etc fuel and change the cycles.
(200 = 1 cycle, 400 = 2 cycles and so forth)
Im changing the accounts over because the original creator of the GCS Group has claimed the name, and ive gotten sick of it anyways.
I WILL NOT remove what is currently in this tutorial.
But I WILL NOT be updating this page under the GCS Account.
Sorry for the inconveniance ~ Josh
FullMetalScripting
- Easy -
- Medium -
- Hard -
Stick
Food
Bow
Arrow
Tools
Armour
Fuel
Shiny Items
Lightning Rod
Spawning Book
Teleportation Stick
Block Spawning Wand
Blocks:
Bed
Stairs
Slab
Liquid
Chest
Fence
Ladder
Furnace
Jump Pad
Trap Door
Health Pad
Crafting Table
Pressure Plate
Entity's:
Mine Cart
Evil Mob
Friendly Mob
Neutral Mob
Boat
AI Mobs
Houses
Mob Spawners
Chests
Trees
Dimension:
Portal
Dimension
Chunk Generator
Mobs
ERROR REPORTING ETC:
How to post errors:
How to Request Tutorials?:
Just request them ;D
With the creation of my new youtube account, MeritoriusAquilaa i will start to upload videos for Minecraft modding!
I'm going to start off with the more simple of Blocks & Items. Mainly because im not exactly the best youtuber out there haha...
I will also be updating all the tutorials i currently have. my NEW tutorial upload queue goes as following:
Furnace
Chest
Arrow
Gun
I will upload more after them, but i am going to start working on the youtube videos
NO LONGER WORKING ON THE PREVIOUS MOD, WILL UPDATE TO CURRENT MOD SOON! ;D
Non-Team Credits:
Tutorial Recommendations:
Team Credits:
3vil_squirrel - Head Community/Part Scriptor
Yodog14114 - Head Art/Part Scriptor
Item Tutorial No# 1 - Bow (With Animations!)
I Will not explain much for now, i jus want to get all of the new tutorials up, then explain them all. so this will just be a copy & paste tutorial for now, just replace things as usual.
Mod_Fixeruperrer
ItemLimestoneBow
Item Tutorial No# 2 - Fertilizer
I Will not explain much for now, i jus want to get all of the new tutorials up, then explain them all. so this will just be a copy & paste tutorial for now, just replace things as usual.
Mod_Fixeruperrer
ItemLimestoneF
www.soundcloud.com/netroaki
Be sure to check out my texture pack: Easy Ores!
*This Section Is Under Construction*
Block Tutorial No# 2 - Torch
Mod_Fixeruperrer
BlockLimestoneT
Block Tutorial No# 3 - Bed
*This Section Is Under Construction*
Block Tutorial No# 4 - Stairs
Mod_Fixeruperrer
BlockLimestoneS
Block Tutorial No# 5 - Slab
*This Section Is Under Construction*
Block Tutorial No# 6 - Crops
mod_LimeCrop
BlockLimeCrop
Block Tutorial No# 7 - Liquid
*This Section Is Under Construction*
Block Tutorial No# 8 - Chest
*This Section Is Under Construction*
Block Tutorial No# 9 - Fence
*This Section Is Under Construction*
Block Tutorial No# 10 - Ladder
*This Section Is Under Construction*
Block Tutorial No# 11 - Furnace
*This Section Is Under Construction*
Block Tutorial No# 12 - Block Extensions
*This Section Is Under Construction*
Block Tutorial No# 13 - TrapDoor
Mod_Fixeruperrer
BlockLimestoneTD
Block Tutorial No# 14 - Crafting Table
*This Section Is Under Construction*
Block Tutorial No# 15 - Pressure Plate
Mod_Fixeruperrer
Entity Tutorial No# 1 - Minecart
*This Section Is Under Construction*
Entity Tutorial No# 2 - Evil Mob
*This Section Is Under Construction*
Entity Tutorial No# 3 - Friendly Mob
*This Section Is Under Construction*
Entity Tutorial No# 4 - Neutral Mob
*This Section Is Under Construction*
Entity Tutorial No# 5 - Boat
*This Section Is Under Construction*
Entity Tutorial No# 6 - Entity AI
*This Section Is Under Construction*
Entity Tutorial No# 7 - Entity Extensions
Split off No.1: Saddled Entity
Split off No.2: Ride able Entity
Split off No.3: Evolution on Item Use
EntityNameHere (This Chunk of Code goes into your Entity File, below the top stats.)
Explanation:
There isnt much to explain, this is a fairly Simple code
This line however, calls for your current held item, if it is rottenFlesh, it will basically Evolve your NPC into a Zombie.
These lines, call the update when you use the rottenFlesh, and tells the Mob to evolve into whats stated
Which currently is EntityZombie
Split off No.4: Evolution on Death
EntityNameHere (This Chunk of Code goes into your Entity File, preferably down the bottom.)
Explanation:
There isnt much to explain, this is a fairly Simple code
This line however, checks how it was killed, by an arrow, hit, fall etc.
I will add in soon how to make it just a specific thing
These line are like the item use, but they've been altered to fit into the on death method, instead of dying, it will evolve into a Skeleton.
Split off No.5: Evolution on Temperature
EntityNameHere (This Chunk of Code goes into your Entity File, usually above the bottom)
Explanation:
There isnt much to explain, but this piece of code gets complex
These line, call for the current time, which in this case it wants to be Daytime, and a certain temperature.
These line are more similar to the OnDeath method, they do the exact same thing, then the
Basically ends the method.
Split off No.6: Gui Opening on Interaction
Split off No.7: Gui Opening on Item Use
UNDER CONSTRUCTION!
Midnattsregn, so for the fertilizer, your basically making a new item, but he item code is as i have posted, thats pretty much all you have to do, just then youll have to add the code into your composter or whatever you want
Sincerely,
Hawkz
Huh?, please explain what you mean by "Edit"
Sweet Thanks! ;D
i see where you're coming from, i dont really like that type of coding, because its pretty messy, but yeah, ill add it in if ya want ;D
Especially the Tutorial of Crops, Really help a lot of people.
Thanks
Thanks!, i have found an error with the code, that it doesn't update properly, so i'm just playing around with that then ill update it, but until then, the one that's currently up should work. thanks for your feedback ;D
If this is a custom furnace that is a very simple fix ;D, all you need to do, is play around with your ****Recipes, so it looks like this:
Then for the fuel, goto Tileentity**** change the fuel stuff so its like:
however, if your just using the furnace, i know how to do that but come on thats not even a compost D:
ALSO, if your just using the furnace im uploading a furnace + crafting table tutorial soon, so stay tuned ;D
java.lang.Error: Unresolved compilation problem:
The constructor AluminumTrapDoor(int, int) is undefined
at net.minecraft.src.mod_Aluminum.<init>(mod_Aluminum.java:10)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at java.lang.Class.newInstance0(Unknown Source)
at java.lang.Class.newInstance(Unknown Source)
at net.minecraft.src.ModLoader.addMod(ModLoader.java:287)
at net.minecraft.src.ModLoader.readFromClassPath(ModLoader.java:1279)
at net.minecraft.src.ModLoader.init(ModLoader.java:849)
at net.minecraft.src.ModLoader.addAllRenderers(ModLoader.java:157)
at net.minecraft.src.RenderManager.<init>(RenderManager.java:85)
at net.minecraft.src.RenderManager.<clinit>(RenderManager.java:12)
at net.minecraft.client.Minecraft.startGame(Minecraft.java:424)
at net.minecraft.client.Minecraft.run(Minecraft.java:786)
at java.lang.Thread.run(Unknown Source)
Yes i did copy the code, but i edited part, then got the mod_ to work properly, it seems that you are missing the constructor in you BlockAluminumTrappDoor from reading this:
that means you might be missing this:
I think you may have not renamed one of them correctly, i have renamed them for you, just replace the other chunk of code between this:
And This:
if you did that correctly it will work, also. are you using eclipse?, cus if you're not it would help greatly.
i think, your asking about the cycle times... 1 cycle = 1 item tranformed, for example 1 cycle of iron ore gives you 1 iron ingot. 1 cycle = 200, so for say if you want your flower to compost one item, you'd make it:
BUT!, since you want the flowers to have different cycle times, your gunna have to make the flower leaves ETC, the fuels. it IS possible to swap the slots around, you would do that as following:
1. open up your Container Compost (or whatever its called)
2. find:
3. just below that you should see some line that look like this:
4. replace them with this:
what you have now done, is swap the positions around, the fuel now goes uptop, and the input goes bottom.
now to make your flower take the same amount of time is leaves etc, make the flowers leaves etc fuel and change the cycles.
(200 = 1 cycle, 400 = 2 cycles and so forth)
Ill get started on it now, ill put preffered over my ones, then faster over your suggesteds ;D