btw. yesterday when i code it first, it works. the sword was on the right place.
Srry for my question but im not really good in Java ._.
Just put this in your swords class.
public boolean isFull3D()
{
return true;
}
Rollback Post to RevisionRollBack
“Computers are incredibly fast, accurate and stupid; humans are incredibly slow, inaccurate and brilliant; together they are powerful beyond imagination."
Just make your entity class extend theirs. Except, new mobs are invisible at the moment without adding them into EntityTracker so you'll have to do that as well.
Check your PMs.
Blocks use blockID instead of shiftedIndex.
public int idDropped(int i, Random random, int j)
{
return mod_zombie.dirt.blockID;
}
Add one more} after the generateSurface method and before getVersion().
The title of the NPC tutorials are not green. Therefore they are not updated. Therefore they will not work. The top of the OP states not to ask about updates or I will get this thread locked.
Just don't add the AchievementList part of it.
public static final Achievement nameHere = new Achievement(4560, "nameHere", 5, 7, Item.diamond, null).registerAchievement();
public static final Achievement nameHere2 = new Achievement(4560, "nameHere", 5, 7, Item.diamond, nameHere).registerAchievement();
Haven't tested it but it should work.
In the super statement in the constructor of the block class you need to add in the blockIndexInTexture parameter, j.
super(i, j, Material.plants);
You need to edit RenderBiped. I haven't found another way to do it yet.
Do you mean you want to add a button to the player's inventory?
Just change the 0 next to the block's id in the public static final line of the block. Then delete the
Yes, I want to add a button to the players inventory. Preferably by not editing base files. I already know how to add the button by editing GUIInventory, but is there a way (through ModLoader or otherwise) to add it without editing that file?
package net.minecraft.src;
import java.util.Random;
public class BlockDirtcrop extends BlockFlower
{
public BlockDirtcrop(int i, int j)
{
super(i, j);
blockIndexInTexture = j;
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.
* This basically checks to see if the block below is a tilled field/tilled dirt. If it is true then the crop can grow.
*/
protected boolean canThisPlantGrowOnThisBlockID(int par1)
{
return par1 == Block.tilledField.blockID;
}
/**
* Ticks the block if it's been scheduled. This method gets scheduled to run because of the setTickRandomly part in the constructor of the class.
*/
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 < 8)
{
float f = getGrowthRate(par1World, par2, par3, par4);
if (par5Random.nextInt((int)(25F / f) + 1) == 0)
{
i++;
par1World.setBlockMetadataWithNotify(par2, par3, par4, i);
}
}
}
}
/**
* 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;
}
/**
* The type of render function that is called for this block. The render type of 6 gets the texture and places it four times around the sides of the block and leaves nothing on the top or bottom.
*/
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(mod_dirtcrop.dirtseed));
entityitem.delayBeforeCanPickup = 10;
par1World.spawnEntityInWorld(entityitem);
}
}
}
/**
* Returns the ID of the items to drop on destruction. "i" is equal to the blocks metadata value(explained slightly more in the getBlockTextureFromSideAndMetadata method below). This means that it will check that that value is equal to 8(the final stage of growth) and if it is then it will drop wheat. It may be fairly obvious, but the 'else' statement means that if the growth state is not equal to 7 then drop nothing (-1 means nothing)
*/
public int idDropped(int i, Random random, int j)
{
int n = random.nextInt(2);
if (i == 8)
{
if ( n == 1)
{
return mod_dirtcrop2.dirtseed2.shiftedIndex;
}
else
{
return mod_Sean.hd1.blockID;
}
}
else
{
return -1;
}
}
/**
* Returns the quantity of items to drop on block destruction.
*/
public int quantityDropped(Random random)
{
return 1;
}
/**
* From the specified side and block metadata retrieves the blocks texture. Args: side, metadata.
* As you may have been able to tell from the line above, "j" is equal to the metadata value of the block. This checks if that value is equal to a certain number then sets the blocks texture to what you have defined.
* The things that are being returned are the ints in your mod_ class which you created and set to your texture for the specific stages of growth.
*/
public int getBlockTextureFromSideAndMetadata(int i, int j)
{
if(j == 0)
{
return mod_dirtcrop.cropStageOne;
}
if(j == 1)
{
return mod_dirtcrop.cropStageOne;
}
if(j == 2)
{
return mod_dirtcrop.cropStageTwo;
}
if(j == 3)
{
return mod_dirtcrop.cropStageThree;
}
if(j == 4)
{
return mod_dirtcrop.cropStageFour;
}
if(j == 5)
{
return mod_dirtcrop.cropStageFive;
}
if(j == 6)
{
return mod_dirtcrop.cropStageSix;
}
if(j == 7)
{
return mod_dirtcrop.cropStageSeven;
}
if(j == 8)
{
return mod_dirtcrop.cropStageEight;
}
return j;
}
}
mod_dirtcrop
package net.minecraft.src;
public class mod_dirtcrop extends BaseMod
{
//Just a standard block.
public static final Block dirtcrop = new BlockDirtcrop(220, 0).setBlockName("dirtcrop");
//This is a fairly standard item but it has two new arguments. The first is the block it plants, in this case is our new crop "cropNameHere". The second is the block that is required to be right clicked on to plant the seeds.
//We are using tilled field/dirt for this crop but you can change it to whatever you like. Remember to change it in the block class as well.
public static final Item dirtseed = new ItemDirtseed(2500, dirtcrop.blockID, Block.tilledField.blockID).setItemName("dirtseed");
//These static ints are the textures of the crop in its various stages of growth.
public static int cropStageOne = ModLoader.addOverride("/terrain.png", "crop1.png");
public static int cropStageTwo = ModLoader.addOverride("/terrain.png", "crop2.png");
public static int cropStageThree = ModLoader.addOverride("/terrain.png", "crop3.png");
public static int cropStageFour = ModLoader.addOverride("/terrain.png", "crop4.png");
public static int cropStageFive = ModLoader.addOverride("/terrain.png", "crop5.png");
public static int cropStageSix = ModLoader.addOverride("/terrain.png", "crop6.png");
public static int cropStageSeven = ModLoader.addOverride("/terrain.png", "crop7.png");
public static int cropStageEight = ModLoader.addOverride("/terrain.png", "crop8.png");
public void load()
{
dirtcrop.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "crop.png");
ModLoader.registerBlock(dirtcrop);
ModLoader.addName(dirtcrop, "Nutrition Absorption");
dirtseed.iconIndex = ModLoader.addOverride("/gui/items.png", "seed.png");
ModLoader.addName(dirtseed, "Absorption Seeds");
ModLoader.addRecipe(new ItemStack(dirtseed), new Object [] {
"N", "S",
'N', mod_Sean.SeanFood,
'S', Item.seeds
});
}
public String getVersion()
{
return "1.3.1";
}
}
I want to ask more about crops.
I know how to change the crop final stage to from 8 to 4 5 or 6 but the problem is the random seeds it drop.
At stage 4 it drop nearly 0 seed or 1 seed. How can i change it ? The code is quite complex and I could not understand it.
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(mod_dirtcrop.dirtseed));
entityitem.delayBeforeCanPickup = 10;
par1World.spawnEntityInWorld(entityitem);
}
}
}
Also, I want the crop to grow faster. I do not think it is related with
public void updateTick
so It might be related with this complex code :
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;
}
hey techguy answering that conversation we had I could not find where to change the players view height I even decompiled an old mod that does this but I still couldn't find it please help
Yes, I want to add a button to the players inventory. Preferably by not editing base files. I already know how to add the button by editing GUIInventory, but is there a way (through ModLoader or otherwise) to add it without editing that file?
package net.minecraft.src;
import java.util.Random;
public class BlockDirtcrop extends BlockFlower
{
public BlockDirtcrop(int i, int j)
{
super(i, j);
blockIndexInTexture = j;
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.
* This basically checks to see if the block below is a tilled field/tilled dirt. If it is true then the crop can grow.
*/
protected boolean canThisPlantGrowOnThisBlockID(int par1)
{
return par1 == Block.tilledField.blockID;
}
/**
* Ticks the block if it's been scheduled. This method gets scheduled to run because of the setTickRandomly part in the constructor of the class.
*/
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 < 8)
{
float f = getGrowthRate(par1World, par2, par3, par4);
if (par5Random.nextInt((int)(25F / f) + 1) == 0)
{
i++;
par1World.setBlockMetadataWithNotify(par2, par3, par4, i);
}
}
}
}
/**
* 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;
}
/**
* The type of render function that is called for this block. The render type of 6 gets the texture and places it four times around the sides of the block and leaves nothing on the top or bottom.
*/
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(mod_dirtcrop.dirtseed));
entityitem.delayBeforeCanPickup = 10;
par1World.spawnEntityInWorld(entityitem);
}
}
}
/**
* Returns the ID of the items to drop on destruction. "i" is equal to the blocks metadata value(explained slightly more in the getBlockTextureFromSideAndMetadata method below). This means that it will check that that value is equal to 8(the final stage of growth) and if it is then it will drop wheat. It may be fairly obvious, but the 'else' statement means that if the growth state is not equal to 7 then drop nothing (-1 means nothing)
*/
public int idDropped(int i, Random random, int j)
{
int n = random.nextInt(2);
if (i == 8)
{
if ( n == 1)
{
return mod_dirtcrop2.dirtseed2.shiftedIndex;
}
else
{
return mod_Sean.hd1.blockID;
}
}
else
{
return -1;
}
}
/**
* Returns the quantity of items to drop on block destruction.
*/
public int quantityDropped(Random random)
{
return 1;
}
/**
* From the specified side and block metadata retrieves the blocks texture. Args: side, metadata.
* As you may have been able to tell from the line above, "j" is equal to the metadata value of the block. This checks if that value is equal to a certain number then sets the blocks texture to what you have defined.
* The things that are being returned are the ints in your mod_ class which you created and set to your texture for the specific stages of growth.
*/
public int getBlockTextureFromSideAndMetadata(int i, int j)
{
if(j == 0)
{
return mod_dirtcrop.cropStageOne;
}
if(j == 1)
{
return mod_dirtcrop.cropStageOne;
}
if(j == 2)
{
return mod_dirtcrop.cropStageTwo;
}
if(j == 3)
{
return mod_dirtcrop.cropStageThree;
}
if(j == 4)
{
return mod_dirtcrop.cropStageFour;
}
if(j == 5)
{
return mod_dirtcrop.cropStageFive;
}
if(j == 6)
{
return mod_dirtcrop.cropStageSix;
}
if(j == 7)
{
return mod_dirtcrop.cropStageSeven;
}
if(j == 8)
{
return mod_dirtcrop.cropStageEight;
}
return j;
}
}
mod_dirtcrop
package net.minecraft.src;
public class mod_dirtcrop extends BaseMod
{
//Just a standard block.
public static final Block dirtcrop = new BlockDirtcrop(220, 0).setBlockName("dirtcrop");
//This is a fairly standard item but it has two new arguments. The first is the block it plants, in this case is our new crop "cropNameHere". The second is the block that is required to be right clicked on to plant the seeds.
//We are using tilled field/dirt for this crop but you can change it to whatever you like. Remember to change it in the block class as well.
public static final Item dirtseed = new ItemDirtseed(2500, dirtcrop.blockID, Block.tilledField.blockID).setItemName("dirtseed");
//These static ints are the textures of the crop in its various stages of growth.
public static int cropStageOne = ModLoader.addOverride("/terrain.png", "crop1.png");
public static int cropStageTwo = ModLoader.addOverride("/terrain.png", "crop2.png");
public static int cropStageThree = ModLoader.addOverride("/terrain.png", "crop3.png");
public static int cropStageFour = ModLoader.addOverride("/terrain.png", "crop4.png");
public static int cropStageFive = ModLoader.addOverride("/terrain.png", "crop5.png");
public static int cropStageSix = ModLoader.addOverride("/terrain.png", "crop6.png");
public static int cropStageSeven = ModLoader.addOverride("/terrain.png", "crop7.png");
public static int cropStageEight = ModLoader.addOverride("/terrain.png", "crop8.png");
public void load()
{
dirtcrop.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "crop.png");
ModLoader.registerBlock(dirtcrop);
ModLoader.addName(dirtcrop, "Nutrition Absorption");
dirtseed.iconIndex = ModLoader.addOverride("/gui/items.png", "seed.png");
ModLoader.addName(dirtseed, "Absorption Seeds");
ModLoader.addRecipe(new ItemStack(dirtseed), new Object [] {
"N", "S",
'N', mod_Sean.SeanFood,
'S', Item.seeds
});
}
public String getVersion()
{
return "1.3.1";
}
}
I want to ask more about crops.
I know how to change the crop final stage to from 8 to 4 5 or 6 but the problem is the random seeds it drop.
At stage 4 it drop nearly 0 seed or 1 seed. How can i change it ? The code is quite complex and I could not understand it.
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(mod_dirtcrop.dirtseed));
entityitem.delayBeforeCanPickup = 10;
par1World.spawnEntityInWorld(entityitem);
}
}
}
Also, I want the crop to grow faster. I do not think it is related with
public void updateTick
so It might be related with this complex code :
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;
}
The tutorial has been updated, you should no longer get errors. Not sure about yourother problems. I don't work with blocks much.
Hello somemoene who can help me i get an error when adding two new items, a recipe, and a smelting recipe.
this is the error
== ERRORS FOUND ==
src\minecraft\net\minecraft\src\mod_MoreNether.java:15: error: cannot find symbo
l
ModLoader.addSmelting(Item.NetherBall.ItemID, new ItemS
tack(Item.NetherBar, 1), 5.0F);
^
symbol: variable NetherBall
location: class Item
src\minecraft\net\minecraft\src\mod_MoreNether.java:15: error: cannot find symbo
l
ModLoader.addSmelting(Item.NetherBall.ItemID, new ItemS
tack(Item.NetherBar, 1), 5.0F);
^
symbol: variable NetherBar
location: class Item
2 errors
==================
the mod_file
package net.minecraft.src;
public class mod_MoreNether extends BaseMod
{
public static final Item NetherBall = new NetherBall(953).setItemName("NetherBall");
public static final Item NetherBar = new NetherBar(954).setItemName("NetherBar");
public void load()
{
NetherBall.iconIndex = ModLoader.addOverride("/gui/items.png", "/Mods/NetherBall.png");
NetherBar.iconIndex = ModLoader.addOverride("/gui/items.png", "/Mods/NetherBar.png");
ModLoader.addName(NetherBall, "Nether Ball");
ModLoader.addName(NetherBar, "Nether Bar");
ModLoader.addRecipe(new ItemStack(NetherBall, 1), new Object [] {"#@#", "^#^", "#@#", Character.valueOf('#'), Block.netherrack, Character.valueOf('@'), Item.magmaCream, Character.valueOf('^'), Item.blazePowder});
ModLoader.addSmelting(Item.NetherBall.ItemID, new ItemStack(Item.NetherBar, 1), 5.0F);
}
public String getVersion()
{
return "1.3.1";
}
}
The NetherBall FIle
package net.minecraft.src;
public class NetherBall extends Item
{
public NetherBall(int i)
{
super(i);
maxStackSize = 64;
}
}
the NetherBar file
package net.minecraft.src;
public class NetherBar extends Item
{
public NetherBar(int i)
{
super(i);
maxStackSize = 64;
}
}
Your items are not in Item.java so do not try and reference them to there. Just use NetherBar.shiftedIndex and NetherBall.shifted index without the Item. path.
I keep getting the same error in my mod, i'm working on a mod wich adds more crops.
this is my code
package net.minecraft.src;
import java.util.Random;
public class BlockPotatoCrop extends BlockFlower
{
public BlockPotatoCrop(int i, int j)
{
super(i, j);
blockIndexInTexture = j;
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.
* This basically checks to see if the block below is a tilled field/tilled dirt. If it is true then the crop can grow.
*/
protected boolean canThisPlantGrowOnThisBlockID(int par1)
{
return par1 == Block.tilledField.blockID;
}
/**
* Ticks the block if it's been scheduled. This method gets scheduled to run because of the setTickRandomly part in the constructor of the class.
*/
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 < 8)
{
float f = getGrowthRate(par1World, par2, par3, par4);
if (par5Random.nextInt((int)(25F / f) + 1) == 0)
{
i++;
par1World.setBlockMetadataWithNotify(par2, par3, par4, i);
}
}
}
}
/**
* This method allows you to use bonemeal on your crop. Code explanation below:
ItemStack itemstack = entityplayer.inventory.getCurrentItem(); - This line makes "itemstack" equal to the item currently in the players hand.
if(itemstack != null && itemstack.itemID == Item.dyePowder.shiftedIndex) - This line checks if the item in players hand is equal to dye.
if(itemstack.getItemDamage() == 15) - This line checks if the damage value of that item is 15. Item.dyePowder's damage value of 15 is bonemeal.
world.setBlockMetadataWithNotify(i, j, k, 8); - This line sets the metadata value of the block to 8 which is the final growth stage.
itemstack.stackSize--; - This line makes the stack size go down by one.
world.notifyBlockChange(i, j, k, 0); - This line notifys adjacent blocks that this block has updated its state.
*/
public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9)
{
ItemStack itemstack = par5EntityPlayer.inventory.getCurrentItem();
if(itemstack != null && itemstack.itemID == Item.dyePowder.shiftedIndex)
{
if(itemstack.getItemDamage() == 15)
{
par1World.setBlockMetadataWithNotify(par2, par3, par4, 8);
itemstack.stackSize--;
par1World.notifyBlockChange(par2, par3, par4, 0);
}
}
return super.onBlockActivated(par1World, par2, par3, par4, par5EntityPlayer);
}
/**
* 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;
}
/**
* The type of render function that is called for this block. The render type of 6 gets the texture and places it four times around the sides of the block and leaves nothing on the top or bottom.
*/
public int getRenderType()
{
return 1;
}
/**
* 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(mod_MF.Potato));
entityitem.delayBeforeCanPickup = 10;
par1World.spawnEntityInWorld(entityitem);
}
}
}
/**
* Returns the ID of the items to drop on destruction. "i" is equal to the blocks metadata value(explained slightly more in the getBlockTextureFromSideAndMetadata method below). This means that it will check that that value is equal to 8(the final stage of growth) and if it is then it will drop wheat. It may be fairly obvious, but the 'else' statement means that if the growth state is not equal to 7 then drop nothing (-1 means nothing)
*/
public int idDropped(int i, Random random, int j)
{
if (i == 8)
{
return Item.wheat.shiftedIndex;
}
else
{
return -1;
}
}
/**
* Returns the quantity of items to drop on block destruction.
*/
public int quantityDropped(Random random)
{
return 3;
}
/**
* From the specified side and block metadata retrieves the blocks texture. Args: side, metadata.
* As you may have been able to tell from the line above, "j" is equal to the metadata value of the block. This checks if that value is equal to a certain number then sets the blocks texture to what you have defined.
* The things that are being returned are the ints in your mod_ class which you created and set to your texture for the specific stages of growth.
*/
public int getBlockTextureFromSideAndMetadata(int i, int j)
{
if(j == 0)
{
return blockIndexInTexture;
}
if(j == 1)
{
return mod_MF.cropStageOne;
}
if(j == 2)
{
return mod_MF.cropStageTwo;
}
if(j == 3)
{
return mod_MF.cropStageThree;
}
if(j == 4)
{
return mod_MF.cropStageFour;
}
if(j == 5)
{
return mod_MF.cropStageFive;
}
if(j == 6)
{
return mod_MF.cropStageSix;
}
if(j == 7)
{
return mod_MF.cropStageSeven;
}
if(j == 8)
{
return mod_MF.cropStageEight;
}
return j;
}
}
the error i'm getting
src/minecraft/net/minecraft/src/BlockPotatoCrop.java:64: cannot find symbol
symbol : method onBlockActivated(net.minecraft.src.World,int,int,int,net.minecraft.src.EntityPlayer)
location: class net.minecraft.src.BlockFlower
return super.onBlockActivated(par1World, par2, par3, par4, par5EntityPlayer);
Change the super statement in the bottom of the onBlockActivated method to:
I entered the code correctly, but nothing has happened
You've done something wrong. It does work.
Rollback Post to RevisionRollBack
“Computers are incredibly fast, accurate and stupid; humans are incredibly slow, inaccurate and brilliant; together they are powerful beyond imagination."
The tutorial has been updated, you should no longer get errors. Not sure about yourother problems. I don't work with blocks much.
Your items are not in Item.java so do not try and reference them to there. Just use NetherBar.shiftedIndex and NetherBall.shifted index without the Item. path.
I know how to do it, I just don't have the time to make a new tutorial at the moment.
Change the super statement in the bottom of the onBlockActivated method to:
Anything wrong?! I do the same thing in mcp62 and it's work well.
I don't know how you've set it up or what mistake you've made so I cannot help.
Rollback Post to RevisionRollBack
“Computers are incredibly fast, accurate and stupid; humans are incredibly slow, inaccurate and brilliant; together they are powerful beyond imagination."
I am currently making a 1.2.5 mod with your 1.3.1 tool tutorial so I wanted to know if they are compatible or not. If they are then the problem is that I have this code error I get in Eclipse and I checked over it soooo many times but I still couldn't figure it out. I didn't test it yet because I wanted to fix the code first but if I have to I will. The errors are at the public static final line for my tools, and all my other classes are fine. It tells me to edit something in ItemCatafystTool.java but if I do that the rest of the code will malfunction.
mod_TheRealmOfHerobrine.java
package net.minecraft.src;
public class mod_TheRealmOfHerobrine extends BaseMod
{
public static final Block BlockOmegarock = new BlockOmegarock(160,0).setBlockName("Omegarock").setHardness(1000F).setResistance(6000F).setLightValue(5F);
public static final Item ItemCatafystTool = new ItemCatafystTool(2001, EnumToolMaterialOmegarock.BlockOmegarock).setItemName("The Catafyst");
public void load()
{
ItemCatafystTool.shiftedIndex = ModLoader.addOverride("/gui/items.png", "/mod/catafyst.png");
ModLoader.addName(ItemCatafystTool, "The Catafyst");
ModLoader.addRecipe(new ItemStack(ItemCatafystTool, 1), new Object [] {"###", " #", "###", '#', Character.valueOf('#'), BlockOmegarock,});
}
public String getVersion()
{
return "1.2.5";
}
}
ItemCatafystTool.java
package net.minecraft.src;
public class ItemCatafystTool extends Item
{
private Block blocksEffectiveAgainst[];
protected float efficiencyOnProperMaterial;
private int damageVsEntity;
protected EnumToolMaterialOmegarock toolMaterial;
protected ItemCatafystTool(int i, int j, EnumToolMaterialOmegarock par3EnumToolMaterialOmegarock, Block par4ArrayOfBlock[])
{
super(i);
efficiencyOnProperMaterial = 1F;
toolMaterial = par3EnumToolMaterialOmegarock;
blocksEffectiveAgainst = par4ArrayOfBlock;
maxStackSize = 1;
setMaxDamage(par3EnumToolMaterialOmegarock.getMaxUses());
efficiencyOnProperMaterial = par3EnumToolMaterialOmegarock.getEfficiencyOnProperMaterial();
damageVsEntity = j + par3EnumToolMaterialOmegarock.getDamageVsEntity();
}
public float getStrVsBlock(ItemStack par1ItemStack, Block par2Block)
{
for(int i = 0; i < blocksEffectiveAgainst.length; i++)
{
if(blocksEffectiveAgainst[i] == par2Block)
{
return efficiencyOnProperMaterial;
}
}
return 1.0F;
}
public boolean hitEntity(ItemStack par1ItemStack, EntityLiving par2EntityLiving, EntityLiving par3EntityLiving)
{
par1ItemStack.damageItem(0, par3EntityLiving);
return true;
}
public boolean func_77660_a(ItemStack par1ItemStack, World par2World, int par3, int par4, int par5, int par6, EntityLiving par7EntityLiving)
{
if ((double)Block.blocksList[par3].getHardness() != 0.0D)
{
par1ItemStack.damageItem(1, par7EntityLiving);
}
return true;
}
public int getDamageVsEntity(Entity par1Entity)
{
return damageVsEntity;
}
public boolean isFull3D()
{
return true;
}
public int getItemEnchantability()
{
return toolMaterial.getEnchantability();
}
}
EnumToolMaterialOmegarock.java
package net.minecraft.src;
public enum EnumToolMaterialOmegarock
{
BlockOmegarock(10000000, 99999999, 1.0F, 200, 30);
private final int harvestLevel;
private final int maxUses;
private final float efficiencyOnProperMaterial;
private final int damageVsEntity;
private final int enchantability;
private EnumToolMaterialOmegarock(int par3, int par4, float par5, int par6, int par7)
{
harvestLevel = par3;
maxUses = par4;
efficiencyOnProperMaterial = par5;
damageVsEntity = par6;
enchantability = par7;
}
public int getMaxUses()
{
return maxUses;
}
public float getEfficiencyOnProperMaterial()
{
return efficiencyOnProperMaterial;
}
public int getDamageVsEntity()
{
return damageVsEntity;
}
public int getHarvestLevel()
{
return harvestLevel;
}
public int getEnchantability()
{
return enchantability;
}
}
BlockOmegarock.java
package net.minecraft.src;
import java.util.Random;
public class BlockOmegarock extends Block
{
public BlockOmegarock(int i, int j)
{
super(i, j, Material.rock);
}
public int idDropped(int i, Random random, int j)
{
return mod_TheRealmOfHerobrine.BlockOmegarock.blockID;
}
public int quantityDropped(Random random)
{
return 1;
}
}
Can somebody help me resolve this issue or what I'm doing wrong?
package net.minecraft.src;
public class mod_Deathlands extends BaseMod
{
public static final Block nameHere = new BlockDeathdirt(160, 0).setBlockName("Deathdirt").setHardness(3F).setResistance(4F).setLightValue(0F);
public void load()
{
Deathdirt.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/deathdirt.png");
ModLoader.registerBlock(Deathdirt);
ModLoader.addName(Deathdirt, "Deathdirt");
ModLoader.addRecipe(new ItemStack(Deathdirt, 1), new Object [] {"#", Character.valueOf('#'), });
}
public String getVersion()
{
return "1.3.1";
}
}
BlockDeathdirt:
package net.minecraft.src;
import java.util.Random;
public class BlockDeathdirt extends Block
{
public BlockDeathdirt(int i, int j)
{
super(i, j, Material.grass);
}
public int idDropped(int i, Random random, int j)
{
return mod_Deathlands.BlockDeathdirt.blockID;
}
public int quantityDropped(Random random)
{
return 1;
}
}
I am currently making a 1.2.5 mod with your 1.3.1 tool tutorial so I wanted to know if they are compatible or not. If they are then the problem is that I have this code error I get in Eclipse and I checked over it soooo many times but I still couldn't figure it out. I didn't test it yet because I wanted to fix the code first but if I have to I will. The errors are at the public static final line for my tools, and all my other classes are fine. It tells me to edit something in ItemCatafystTool.java but if I do that the rest of the code will malfunction.
mod_TheRealmOfHerobrine.java
package net.minecraft.src;
public class mod_TheRealmOfHerobrine extends BaseMod
{
public static final Block BlockOmegarock = new BlockOmegarock(160,0).setBlockName("Omegarock").setHardness(1000F).setResistance(6000F).setLightValue(5F);
public static final Item ItemCatafystTool = new ItemCatafystTool(2001, EnumToolMaterialOmegarock.BlockOmegarock).setItemName("The Catafyst");
public void load()
{
ItemCatafystTool.shiftedIndex = ModLoader.addOverride("/gui/items.png", "/mod/catafyst.png");
ModLoader.addName(ItemCatafystTool, "The Catafyst");
ModLoader.addRecipe(new ItemStack(ItemCatafystTool, 1), new Object [] {"###", " #", "###", '#', Character.valueOf('#'), BlockOmegarock,});
}
public String getVersion()
{
return "1.2.5";
}
}
ItemCatafystTool.java
package net.minecraft.src;
public class ItemCatafystTool extends Item
{
private Block blocksEffectiveAgainst[];
protected float efficiencyOnProperMaterial;
private int damageVsEntity;
protected EnumToolMaterialOmegarock toolMaterial;
protected ItemCatafystTool(int i, int j, EnumToolMaterialOmegarock par3EnumToolMaterialOmegarock, Block par4ArrayOfBlock[])
{
super(i);
efficiencyOnProperMaterial = 1F;
toolMaterial = par3EnumToolMaterialOmegarock;
blocksEffectiveAgainst = par4ArrayOfBlock;
maxStackSize = 1;
setMaxDamage(par3EnumToolMaterialOmegarock.getMaxUses());
efficiencyOnProperMaterial = par3EnumToolMaterialOmegarock.getEfficiencyOnProperMaterial();
damageVsEntity = j + par3EnumToolMaterialOmegarock.getDamageVsEntity();
}
public float getStrVsBlock(ItemStack par1ItemStack, Block par2Block)
{
for(int i = 0; i < blocksEffectiveAgainst.length; i++)
{
if(blocksEffectiveAgainst[i] == par2Block)
{
return efficiencyOnProperMaterial;
}
}
return 1.0F;
}
public boolean hitEntity(ItemStack par1ItemStack, EntityLiving par2EntityLiving, EntityLiving par3EntityLiving)
{
par1ItemStack.damageItem(0, par3EntityLiving);
return true;
}
public boolean func_77660_a(ItemStack par1ItemStack, World par2World, int par3, int par4, int par5, int par6, EntityLiving par7EntityLiving)
{
if ((double)Block.blocksList[par3].getHardness() != 0.0D)
{
par1ItemStack.damageItem(1, par7EntityLiving);
}
return true;
}
public int getDamageVsEntity(Entity par1Entity)
{
return damageVsEntity;
}
public boolean isFull3D()
{
return true;
}
public int getItemEnchantability()
{
return toolMaterial.getEnchantability();
}
}
EnumToolMaterialOmegarock.java
package net.minecraft.src;
public enum EnumToolMaterialOmegarock
{
BlockOmegarock(10000000, 99999999, 1.0F, 200, 30);
private final int harvestLevel;
private final int maxUses;
private final float efficiencyOnProperMaterial;
private final int damageVsEntity;
private final int enchantability;
private EnumToolMaterialOmegarock(int par3, int par4, float par5, int par6, int par7)
{
harvestLevel = par3;
maxUses = par4;
efficiencyOnProperMaterial = par5;
damageVsEntity = par6;
enchantability = par7;
}
public int getMaxUses()
{
return maxUses;
}
public float getEfficiencyOnProperMaterial()
{
return efficiencyOnProperMaterial;
}
public int getDamageVsEntity()
{
return damageVsEntity;
}
public int getHarvestLevel()
{
return harvestLevel;
}
public int getEnchantability()
{
return enchantability;
}
}
BlockOmegarock.java
package net.minecraft.src;
import java.util.Random;
public class BlockOmegarock extends Block
{
public BlockOmegarock(int i, int j)
{
super(i, j, Material.rock);
}
public int idDropped(int i, Random random, int j)
{
return mod_TheRealmOfHerobrine.BlockOmegarock.blockID;
}
public int quantityDropped(Random random)
{
return 1;
}
}
Can somebody help me resolve this issue or what I'm doing wrong?
No, there were changes in 1.3.1 so they are incompatible.
package net.minecraft.src;
public class mod_Deathlands extends BaseMod
{
public static final Block nameHere = new BlockDeathdirt(160, 0).setBlockName("Deathdirt").setHardness(3F).setResistance(4F).setLightValue(0F);
public void load()
{
Deathdirt.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/deathdirt.png");
ModLoader.registerBlock(Deathdirt);
ModLoader.addName(Deathdirt, "Deathdirt");
ModLoader.addRecipe(new ItemStack(Deathdirt, 1), new Object [] {"#", Character.valueOf('#'), });
}
public String getVersion()
{
return "1.3.1";
}
}
BlockDeathdirt:
package net.minecraft.src;
import java.util.Random;
public class BlockDeathdirt extends Block
{
public BlockDeathdirt(int i, int j)
{
super(i, j, Material.grass);
}
public int idDropped(int i, Random random, int j)
{
return mod_Deathlands.BlockDeathdirt.blockID;
}
public int quantityDropped(Random random)
{
return 1;
}
}
As minionmancake115 said, you need to post your error. We cannot help you without it.
“Computers are incredibly fast, accurate and stupid; humans are incredibly slow, inaccurate and brilliant; together they are powerful beyond imagination."
The Meaning of Life, the Universe, and Everything.
Join Date:
7/1/2012
Posts:
76
Minecraft:
Nukeannihilation
Member Details
Quick question: Is it possible to make a block (or set of blocks) available only in creative? If so what would I have to put (or remove) to make it do so?
Excellent tutorial by the way, only one so far that I have actually been able to learn from so far, haha.
Quick question: Is it possible to make a block (or set of blocks) available only in creative? If so what would I have to put (or remove) to make it do so?
Excellent tutorial by the way, only one so far that I have actually been able to learn from so far, haha.
That's easy. All you would have to do is not make the blocks craftable (not add a crafting recipe), and add the block to the creative inventory.
Rollback Post to RevisionRollBack
When life gives you a potato, wonder why the heck life just gave you a potato. Why not something else? Like money? Or a combustable lemon? No, you get a potato. Nothing else.
Techguy do you have any knowlegde of making explosives?
Just copy and paste the TNT code, or just make a block that's a new instance of Block TNT (depends how customizable you want it). I've never tried it, but it's definitely possible.
When life gives you a potato, wonder why the heck life just gave you a potato. Why not something else? Like money? Or a combustable lemon? No, you get a potato. Nothing else.
When rightclick on grass/dirt it happens nothing.
Is the code for an working hoe or just for an hoe?
Same with the Sword. I cant Block.
and the Weapons dont get damage.
Pls Help
Hoe:
package net.minecraft.src;
public class ItemCoHoe extends Item
{
public ItemCoHoe(int par1, EnumCoToolMaterial par2EnumCoToolMaterial)
{
super(par1);
maxStackSize = 1;
setMaxDamage(par2EnumCoToolMaterial.getMaxUses());
}
public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7)
{
if (!par2EntityPlayer.canPlayerEdit(par4, par5, par6))
{
return false;
}
int i = par3World.getBlockId(par4, par5, par6);
int j = par3World.getBlockId(par4, par5 + 1, par6);
if (par7 != 0 && j == 0 && i == Block.grass.blockID || i == Block.dirt.blockID)
{
Block block = Block.tilledField;
par3World.playSoundEffect((float)par4 + 0.5F, (float)par5 + 0.5F, (float)par6 + 0.5F, block.stepSound.getStepSound(), (block.stepSound.getVolume() + 1.0F) / 2.0F, block.stepSound.getPitch() * 0.8F);
if (par3World.isRemote)
{
return true;
}
else
{
par3World.setBlockWithNotify(par4, par5, par6, block.blockID);
par1ItemStack.damageItem(1, par2EntityPlayer);
return true;
}
}
else
{
return false;
}
}
public boolean isFull3D()
{
return true;
}
}
Sword:
package net.minecraft.src;
public class ItemCoSword extends Item
{
private int weaponDamage;
private final EnumCoToolMaterial toolMaterial;
public ItemCoSword(int par1, EnumCoToolMaterial par2EnumCoToolMaterial)
{
super(par1);
toolMaterial = par2EnumCoToolMaterial;
maxStackSize = 1;
setMaxDamage(par2EnumCoToolMaterial.getMaxUses());
weaponDamage = 10 + par2EnumCoToolMaterial.getDamageVsEntity();
}
/**
* Returns the strength of the stack against a given block. 1.0F base, (Quality+1)*2 if correct blocktype, 1.5F if
* sword
*/
public float getStrVsBlock(ItemStack par1ItemStack, Block par2Block)
{
return par2Block.blockID != Block.web.blockID ? 1.5F : 15F;
}
/**
* Current implementations of this method in child classes do not use the entry argument beside ev. They just raise
* the damage on the stack.
*/
public boolean hitEntity(ItemStack par1ItemStack, EntityLiving par2EntityLiving, EntityLiving par3EntityLiving)
{
par1ItemStack.damageItem(1, par3EntityLiving);
return true;
}
public boolean onBlockDestroyed(ItemStack par1ItemStack, int par2, int par3, int par4, int par5, EntityLiving par6EntityLiving)
{
par1ItemStack.damageItem(2, par6EntityLiving);
return true;
}
/**
* Returns the damage against a given entity.
*/
public int getDamageVsEntity(Entity par1Entity)
{
return weaponDamage;
}
}
Just put this in your swords class.
public boolean isFull3D() { return true; }together they are powerful beyond imagination."
sorry but I have already looked in there and in renderplayer but it isn't there but I will check again
This is my first time testing my mod in Minecraft 1.3.1, so I may have done something wrong. I hope someone can help me!
Thanks,
~~CNSoup
EDIT: Nevermind! I fixed it! I forgot to decompile mcp after I added the server.jar!
please check it out. I am not the only one.
BlockDirtcrop
package net.minecraft.src; import java.util.Random; public class BlockDirtcrop extends BlockFlower { public BlockDirtcrop(int i, int j) { super(i, j); blockIndexInTexture = j; 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. * This basically checks to see if the block below is a tilled field/tilled dirt. If it is true then the crop can grow. */ protected boolean canThisPlantGrowOnThisBlockID(int par1) { return par1 == Block.tilledField.blockID; } /** * Ticks the block if it's been scheduled. This method gets scheduled to run because of the setTickRandomly part in the constructor of the class. */ 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 < 8) { float f = getGrowthRate(par1World, par2, par3, par4); if (par5Random.nextInt((int)(25F / f) + 1) == 0) { i++; par1World.setBlockMetadataWithNotify(par2, par3, par4, i); } } } } /** * 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; } /** * The type of render function that is called for this block. The render type of 6 gets the texture and places it four times around the sides of the block and leaves nothing on the top or bottom. */ 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(mod_dirtcrop.dirtseed)); entityitem.delayBeforeCanPickup = 10; par1World.spawnEntityInWorld(entityitem); } } } /** * Returns the ID of the items to drop on destruction. "i" is equal to the blocks metadata value(explained slightly more in the getBlockTextureFromSideAndMetadata method below). This means that it will check that that value is equal to 8(the final stage of growth) and if it is then it will drop wheat. It may be fairly obvious, but the 'else' statement means that if the growth state is not equal to 7 then drop nothing (-1 means nothing) */ public int idDropped(int i, Random random, int j) { int n = random.nextInt(2); if (i == 8) { if ( n == 1) { return mod_dirtcrop2.dirtseed2.shiftedIndex; } else { return mod_Sean.hd1.blockID; } } else { return -1; } } /** * Returns the quantity of items to drop on block destruction. */ public int quantityDropped(Random random) { return 1; } /** * From the specified side and block metadata retrieves the blocks texture. Args: side, metadata. * As you may have been able to tell from the line above, "j" is equal to the metadata value of the block. This checks if that value is equal to a certain number then sets the blocks texture to what you have defined. * The things that are being returned are the ints in your mod_ class which you created and set to your texture for the specific stages of growth. */ public int getBlockTextureFromSideAndMetadata(int i, int j) { if(j == 0) { return mod_dirtcrop.cropStageOne; } if(j == 1) { return mod_dirtcrop.cropStageOne; } if(j == 2) { return mod_dirtcrop.cropStageTwo; } if(j == 3) { return mod_dirtcrop.cropStageThree; } if(j == 4) { return mod_dirtcrop.cropStageFour; } if(j == 5) { return mod_dirtcrop.cropStageFive; } if(j == 6) { return mod_dirtcrop.cropStageSix; } if(j == 7) { return mod_dirtcrop.cropStageSeven; } if(j == 8) { return mod_dirtcrop.cropStageEight; } return j; } }mod_dirtcrop
package net.minecraft.src; public class mod_dirtcrop extends BaseMod { //Just a standard block. public static final Block dirtcrop = new BlockDirtcrop(220, 0).setBlockName("dirtcrop"); //This is a fairly standard item but it has two new arguments. The first is the block it plants, in this case is our new crop "cropNameHere". The second is the block that is required to be right clicked on to plant the seeds. //We are using tilled field/dirt for this crop but you can change it to whatever you like. Remember to change it in the block class as well. public static final Item dirtseed = new ItemDirtseed(2500, dirtcrop.blockID, Block.tilledField.blockID).setItemName("dirtseed"); //These static ints are the textures of the crop in its various stages of growth. public static int cropStageOne = ModLoader.addOverride("/terrain.png", "crop1.png"); public static int cropStageTwo = ModLoader.addOverride("/terrain.png", "crop2.png"); public static int cropStageThree = ModLoader.addOverride("/terrain.png", "crop3.png"); public static int cropStageFour = ModLoader.addOverride("/terrain.png", "crop4.png"); public static int cropStageFive = ModLoader.addOverride("/terrain.png", "crop5.png"); public static int cropStageSix = ModLoader.addOverride("/terrain.png", "crop6.png"); public static int cropStageSeven = ModLoader.addOverride("/terrain.png", "crop7.png"); public static int cropStageEight = ModLoader.addOverride("/terrain.png", "crop8.png"); public void load() { dirtcrop.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "crop.png"); ModLoader.registerBlock(dirtcrop); ModLoader.addName(dirtcrop, "Nutrition Absorption"); dirtseed.iconIndex = ModLoader.addOverride("/gui/items.png", "seed.png"); ModLoader.addName(dirtseed, "Absorption Seeds"); ModLoader.addRecipe(new ItemStack(dirtseed), new Object [] { "N", "S", 'N', mod_Sean.SeanFood, 'S', Item.seeds }); } public String getVersion() { return "1.3.1"; } }I want to ask more about crops.
I know how to change the crop final stage to from 8 to 4 5 or 6 but the problem is the random seeds it drop.
At stage 4 it drop nearly 0 seed or 1 seed. How can i change it ? The code is quite complex and I could not understand it.
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(mod_dirtcrop.dirtseed)); entityitem.delayBeforeCanPickup = 10; par1World.spawnEntityInWorld(entityitem); } } }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; }You'll need to edit GuiInventory, unfortunately.
The tutorial has been updated, you should no longer get errors. Not sure about yourother problems. I don't work with blocks much.
Your items are not in Item.java so do not try and reference them to there. Just use NetherBar.shiftedIndex and NetherBall.shifted index without the Item. path.
I know how to do it, I just don't have the time to make a new tutorial at the moment.
Change the super statement in the bottom of the onBlockActivated method to: The tutorial has been fixed.
You've done something wrong. It does work.
together they are powerful beyond imagination."
Anything wrong?! I do the same thing in mcp62 and it's work well.
Sorry, something went wrong with saving it. Should be fixed.
I don't know how you've set it up or what mistake you've made so I cannot help.
together they are powerful beyond imagination."
mod_TheRealmOfHerobrine.java
package net.minecraft.src; public class mod_TheRealmOfHerobrine extends BaseMod { public static final Block BlockOmegarock = new BlockOmegarock(160,0).setBlockName("Omegarock").setHardness(1000F).setResistance(6000F).setLightValue(5F); public static final Item ItemCatafystTool = new ItemCatafystTool(2001, EnumToolMaterialOmegarock.BlockOmegarock).setItemName("The Catafyst"); public void load() { ItemCatafystTool.shiftedIndex = ModLoader.addOverride("/gui/items.png", "/mod/catafyst.png"); ModLoader.addName(ItemCatafystTool, "The Catafyst"); ModLoader.addRecipe(new ItemStack(ItemCatafystTool, 1), new Object [] {"###", " #", "###", '#', Character.valueOf('#'), BlockOmegarock,}); } public String getVersion() { return "1.2.5"; } }ItemCatafystTool.java
package net.minecraft.src; public class ItemCatafystTool extends Item { private Block blocksEffectiveAgainst[]; protected float efficiencyOnProperMaterial; private int damageVsEntity; protected EnumToolMaterialOmegarock toolMaterial; protected ItemCatafystTool(int i, int j, EnumToolMaterialOmegarock par3EnumToolMaterialOmegarock, Block par4ArrayOfBlock[]) { super(i); efficiencyOnProperMaterial = 1F; toolMaterial = par3EnumToolMaterialOmegarock; blocksEffectiveAgainst = par4ArrayOfBlock; maxStackSize = 1; setMaxDamage(par3EnumToolMaterialOmegarock.getMaxUses()); efficiencyOnProperMaterial = par3EnumToolMaterialOmegarock.getEfficiencyOnProperMaterial(); damageVsEntity = j + par3EnumToolMaterialOmegarock.getDamageVsEntity(); } public float getStrVsBlock(ItemStack par1ItemStack, Block par2Block) { for(int i = 0; i < blocksEffectiveAgainst.length; i++) { if(blocksEffectiveAgainst[i] == par2Block) { return efficiencyOnProperMaterial; } } return 1.0F; } public boolean hitEntity(ItemStack par1ItemStack, EntityLiving par2EntityLiving, EntityLiving par3EntityLiving) { par1ItemStack.damageItem(0, par3EntityLiving); return true; } public boolean func_77660_a(ItemStack par1ItemStack, World par2World, int par3, int par4, int par5, int par6, EntityLiving par7EntityLiving) { if ((double)Block.blocksList[par3].getHardness() != 0.0D) { par1ItemStack.damageItem(1, par7EntityLiving); } return true; } public int getDamageVsEntity(Entity par1Entity) { return damageVsEntity; } public boolean isFull3D() { return true; } public int getItemEnchantability() { return toolMaterial.getEnchantability(); } }EnumToolMaterialOmegarock.java
package net.minecraft.src; public enum EnumToolMaterialOmegarock { BlockOmegarock(10000000, 99999999, 1.0F, 200, 30); private final int harvestLevel; private final int maxUses; private final float efficiencyOnProperMaterial; private final int damageVsEntity; private final int enchantability; private EnumToolMaterialOmegarock(int par3, int par4, float par5, int par6, int par7) { harvestLevel = par3; maxUses = par4; efficiencyOnProperMaterial = par5; damageVsEntity = par6; enchantability = par7; } public int getMaxUses() { return maxUses; } public float getEfficiencyOnProperMaterial() { return efficiencyOnProperMaterial; } public int getDamageVsEntity() { return damageVsEntity; } public int getHarvestLevel() { return harvestLevel; } public int getEnchantability() { return enchantability; } }BlockOmegarock.java
package net.minecraft.src; import java.util.Random; public class BlockOmegarock extends Block { public BlockOmegarock(int i, int j) { super(i, j, Material.rock); } public int idDropped(int i, Random random, int j) { return mod_TheRealmOfHerobrine.BlockOmegarock.blockID; } public int quantityDropped(Random random) { return 1; } }Can somebody help me resolve this issue or what I'm doing wrong?
can you give us the error?
No, there were changes in 1.3.1 so they are incompatible.
As minionmancake115 said, you need to post your error. We cannot help you without it.
together they are powerful beyond imagination."
Excellent tutorial by the way, only one so far that I have actually been able to learn from so far, haha.
-
View User Profile
-
View Posts
-
Send Message
Retired StaffThat's easy. All you would have to do is not make the blocks craftable (not add a crafting recipe), and add the block to the creative inventory.
Thank you very much.
-
View User Profile
-
View Posts
-
Send Message
Retired StaffNo problem. It's even easier in 1.3 to add blocks to the creative inventory.
Crafting recipes are totally optional, but the name, texture, and general item definitions are always required.
Just copy and paste the TNT code, or just make a block that's a new instance of Block TNT (depends how customizable you want it). I've never tried it, but it's definitely possible.
-
View User Profile
-
View Posts
-
Send Message
Curse PremiumWhen rightclick on grass/dirt it happens nothing.
Is the code for an working hoe or just for an hoe?
Same with the Sword. I cant Block.
and the Weapons dont get damage.
Pls Help
Hoe:
package net.minecraft.src; public class ItemCoHoe extends Item { public ItemCoHoe(int par1, EnumCoToolMaterial par2EnumCoToolMaterial) { super(par1); maxStackSize = 1; setMaxDamage(par2EnumCoToolMaterial.getMaxUses()); } public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7) { if (!par2EntityPlayer.canPlayerEdit(par4, par5, par6)) { return false; } int i = par3World.getBlockId(par4, par5, par6); int j = par3World.getBlockId(par4, par5 + 1, par6); if (par7 != 0 && j == 0 && i == Block.grass.blockID || i == Block.dirt.blockID) { Block block = Block.tilledField; par3World.playSoundEffect((float)par4 + 0.5F, (float)par5 + 0.5F, (float)par6 + 0.5F, block.stepSound.getStepSound(), (block.stepSound.getVolume() + 1.0F) / 2.0F, block.stepSound.getPitch() * 0.8F); if (par3World.isRemote) { return true; } else { par3World.setBlockWithNotify(par4, par5, par6, block.blockID); par1ItemStack.damageItem(1, par2EntityPlayer); return true; } } else { return false; } } public boolean isFull3D() { return true; } }Sword:
package net.minecraft.src; public class ItemCoSword extends Item { private int weaponDamage; private final EnumCoToolMaterial toolMaterial; public ItemCoSword(int par1, EnumCoToolMaterial par2EnumCoToolMaterial) { super(par1); toolMaterial = par2EnumCoToolMaterial; maxStackSize = 1; setMaxDamage(par2EnumCoToolMaterial.getMaxUses()); weaponDamage = 10 + par2EnumCoToolMaterial.getDamageVsEntity(); } /** * Returns the strength of the stack against a given block. 1.0F base, (Quality+1)*2 if correct blocktype, 1.5F if * sword */ public float getStrVsBlock(ItemStack par1ItemStack, Block par2Block) { return par2Block.blockID != Block.web.blockID ? 1.5F : 15F; } /** * Current implementations of this method in child classes do not use the entry argument beside ev. They just raise * the damage on the stack. */ public boolean hitEntity(ItemStack par1ItemStack, EntityLiving par2EntityLiving, EntityLiving par3EntityLiving) { par1ItemStack.damageItem(1, par3EntityLiving); return true; } public boolean onBlockDestroyed(ItemStack par1ItemStack, int par2, int par3, int par4, int par5, EntityLiving par6EntityLiving) { par1ItemStack.damageItem(2, par6EntityLiving); return true; } /** * Returns the damage against a given entity. */ public int getDamageVsEntity(Entity par1Entity) { return weaponDamage; } }