So to get new flowers to spawn like flowers it takes alot more then just putting 128 lol. Basically I had to copy the BlockFlower to my new flower then had to copy and modify the WorldGenFlower file to new file. I tried using the code as is like you showed but since the flowers us a differnet generator file I had to change a bunch of stuff.
This is the the GenerateSurface code from the mod_ file
public void GenerateSurface(World worldObj, Random rand, int k, int l)
{
for(int j11 = 0; j11 < 2; j11++)
{
int r15 = k + rand.nextInt(16) + 8;
int t18 = rand.nextInt(128);
int y21 = l + rand.nextInt(16) + 8;
(new WorldGenNewFlowers(mod_NewFlowers.plantblue.blockID)).generate(worldObj, rand, r15, t18, y21);
}
}
Basically I changed WorldGenFlowers to WorldGenNewFlowers, also changed Block.plantYellow to mod_NewFlowers.plantblue. The int(int r15, int t18, int y21) were renamed too but idk if that was a must or not.
This is the Modified WorldGenFlower Class
public class WorldGenNewFlowers extends WorldGenerator
{
public WorldGenNewFlowers(int i)
{
plantBlockId = i;
}
public boolean generate(World world, Random random, int i, int j, int k)
{
for(int l = 0; l < 64; l++)
{
int i1 = (i + random.nextInt(8)) - random.nextInt(8);
int j1 = (j + random.nextInt(4)) - random.nextInt(4);
int k1 = (k + random.nextInt(8)) - random.nextInt(8);
if(world.isAirBlock(i1, j1, k1) && ((BlockPlantBlue)Block.blocksList[plantBlockId]).canBlockStay(world, i1, j1, k1))
{
world.setBlock(i1, j1, k1, plantBlockId);
}
}
For This I just added New between Gen & Flower in the appropriate spots. Also the BlockFlower was changed to BlockPlantBlue
And this is the modified BlockFlower class
public class BlockPlantBlue extends Block
{
public BlockPlantBlue(int i, int j)
{
super(i, Material.plants);
blockIndexInTexture = j;
setTickOnLoad(true);
float f = 0.2F;
setBlockBounds(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, f * 3F, 0.5F + f);
}
public boolean canPlaceBlockAt(World world, int i, int j, int k)
{
return canThisPlantGrowOnThisBlockID(world.getBlockId(i, j - 1, k));
}
protected boolean canThisPlantGrowOnThisBlockID(int i)
{
return i == Block.grass.blockID || i == Block.dirt.blockID || i == Block.tilledField.blockID;
}
public void onNeighborBlockChange(World world, int i, int j, int k, int l)
{
super.onNeighborBlockChange(world, i, j, k, l);
func_268_h(world, i, j, k);
}
public void updateTick(World world, int i, int j, int k, Random random)
{
func_268_h(world, i, j, k);
}
protected final void func_268_h(World world, int i, int j, int k)
{
if(!canBlockStay(world, i, j, k))
{
dropBlockAsItem(world, i, j, k, world.getBlockMetadata(i, j, k));
world.setBlockWithNotify(i, j, k, 0);
}
}
public boolean canBlockStay(World world, int i, int j, int k)
{
return (world.getBlockLightValue(i, j, k) >= 8 || world.canBlockSeeTheSky(i, j, k)) && canThisPlantGrowOnThisBlockID(world.getBlockId(i, j - 1, k));
}
public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int i, int j, int k)
{
return null;
}
public boolean isOpaqueCube()
{
return false;
}
public boolean renderAsNormalBlock()
{
return false;
}
public int getRenderType()
{
return 1;
}
}
And this is pretty much just a copy of the Block flower changed it to BlockBluePlant. I had to do all this because before I made the new world gen class and block flower it kept crashing the game, recompile worked fine but game still wouldn't run. I figure the new flowers and old flowers where just trying to be in the same place at the same time and the game just crashed. idk if any of this makes sense I'm a newb at coding and I just guess till something works.
@gnarvin: The way you are making it is normal modding, not ModLoader modding. Go to the IRC channel #mcp to get help with normal modding. As a note, your modified WorldGenFlower needs to import java.util.Random.
Sorry I can't help, I just don't do standard modding.
how do i get block drops when i break them? even with bare hands? because i cant get any out of the new blocks i made
here are my class files http://pastebin.com/WrCN3ngT BlockAiriumOre.class http://pastebin.com/q4ifCf8Q mod_Airium.class
mod_Airium.class
package net.minecraft.src;
import java.util.Random;
//Use for searching
//Setting news ##^1
//Registering ##^2
//Ore generating ##^3
public class mod_Airium extends BaseMod {
//Separating ;;;REGISTERING - ##^2;;;
public mod_Airium()
{
//Separating *-REGISTER BLOCKS-*
ModLoader.RegisterBlock(AiriumOre);
ModLoader.RegisterBlock(AiriumBlock);
//Separating *-IMAGES-*
AiriumOre.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/WEmod/AiriumOre.png");
AiriumBlock.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/WEmod/AiriumBlock.png");
AiriumCompressed.iconIndex = ModLoader.addOverride("/gui/items.png", "/WEmod/AiriumCompressed.png");
//Separating *-NAMES-*
ModLoader.AddName(AiriumBlock, "Airium Block");
ModLoader.AddName(AiriumOre, "Airium Ore");
ModLoader.AddName(AiriumCompressed, "Compressed Airium");
//Separating *-CRAFTING RECIPES-*
ModLoader.AddRecipe(new ItemStack(AiriumCompressed, 1), new Object[] {
"XXX", "XXX", "XXX", Character.valueOf('X'), AiriumBlock
});
ModLoader.AddRecipe(new ItemStack(AiriumBlock, 9), new Object[] {
"X", Character.valueOf('X'), AiriumCompressed
});
ModLoader.AddRecipe(new ItemStack(AiriumOre, 3), new Object[] {
"X", Character.valueOf('X'), Block.dirt
});
//Separating *-SMELTING RECIPES-*
//ModLoader.AddSmelting(Block.block you want to be smeltable.blockID, new ItemStack(output, amount);
};
//Separating ;;;end of REGISTERING - ##^2;;
//Separating ;;;ORE GENERATING - ##^3;;;
public void GenerateSurface(World world, Random rand, int chunkX, int chunkZ)
{
for(int i = 0; i < 20; i++)
{
int randPosX = chunkX + rand.nextInt(16);
int randPosY = rand.nextInt(128);
int randPosZ = chunkZ + rand.nextInt(16);
(new WorldGenMinable(mod_Airium.AiriumOre.blockID, 32)).generate(world, rand, randPosX, randPosY, randPosZ);
}
}
//Separating ;;;end of ORE GENERATING - ##^3;;;
//Separating ;;;SETTING THINGS;;; - ##^1
public static final Block AiriumOre = new BlockAiriumOre(255, 0).setLightValue(0.959F).setHardness(0.3F).setResistance(10F).setBlockName("AiriumOre");
public static final Block AiriumBlock = new BlockAiriumBlock(254, 0).setLightValue(0.9995F).setHardness(0.3F).setResistance(8F).setBlockName("Airium Block");
public static final Item AiriumCompressed = new ItemAiriumCompressed(7400).setItemName("AiriumCompressed");
//Separating ;;;end of SETTING THINGS;;; - ##^1
public String Version()
{
return "1.4_01";
};
}
BlockAiriumOre.class
package net.minecraft.src;
import java.util.Random;
public class BlockAiriumOre extends Block
{
protected BlockAiriumOre(int i, int j)
{ super(i, j, Material.rock); };
public int idDropped(int i, Random random)
{
return mod_Airium.AiriumBlock.blockID;
}
public int quantityDropped(Random random)
{
return 3;
}
}
EDIT:add BlockAiriumBlock.class incase any helper needs it, well, it's too basic but,... just in case
package net.minecraft.src;
import java.util.Random;
public class BlockAiriumBlock extends Block
{
protected BlockAiriumBlock(int i, int j)
{
super(i, j, Material.rock);
}
}
how do i get block drops when i break them? even with bare hands? because i cant get any out of the new blocks i made
here are my class files http://pastebin.com/WrCN3ngT BlockAiriumOre.class http://pastebin.com/q4ifCf8Q mod_Airium.class
mod_Airium.class
package net.minecraft.src;
import java.util.Random;
//Use for searching
//Setting news ##^1
//Registering ##^2
//Ore generating ##^3
public class mod_Airium extends BaseMod {
//Separating ;;;REGISTERING - ##^2;;;
public mod_Airium()
{
//Separating *-REGISTER BLOCKS-*
ModLoader.RegisterBlock(AiriumOre);
ModLoader.RegisterBlock(AiriumBlock);
//Separating *-IMAGES-*
AiriumOre.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/WEmod/AiriumOre.png");
AiriumBlock.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/WEmod/AiriumBlock.png");
AiriumCompressed.iconIndex = ModLoader.addOverride("/gui/items.png", "/WEmod/AiriumCompressed.png");
//Separating *-NAMES-*
ModLoader.AddName(AiriumBlock, "Airium Block");
ModLoader.AddName(AiriumOre, "Airium Ore");
ModLoader.AddName(AiriumCompressed, "Compressed Airium");
//Separating *-CRAFTING RECIPES-*
ModLoader.AddRecipe(new ItemStack(AiriumCompressed, 1), new Object[] {
"XXX", "XXX", "XXX", Character.valueOf('X'), AiriumBlock
});
ModLoader.AddRecipe(new ItemStack(AiriumBlock, 9), new Object[] {
"X", Character.valueOf('X'), AiriumCompressed
});
ModLoader.AddRecipe(new ItemStack(AiriumOre, 3), new Object[] {
"X", Character.valueOf('X'), Block.dirt
});
//Separating *-SMELTING RECIPES-*
//ModLoader.AddSmelting(Block.block you want to be smeltable.blockID, new ItemStack(output, amount);
};
//Separating ;;;end of REGISTERING - ##^2;;
//Separating ;;;ORE GENERATING - ##^3;;;
public void GenerateSurface(World world, Random rand, int chunkX, int chunkZ)
{
for(int i = 0; i < 20; i++)
{
int randPosX = chunkX + rand.nextInt(16);
int randPosY = rand.nextInt(128);
int randPosZ = chunkZ + rand.nextInt(16);
(new WorldGenMinable(mod_Airium.AiriumOre.blockID, 32)).generate(world, rand, randPosX, randPosY, randPosZ);
}
}
//Separating ;;;end of ORE GENERATING - ##^3;;;
//Separating ;;;SETTING THINGS;;; - ##^1
public static final Block AiriumOre = new BlockAiriumOre(255, 0).setLightValue(0.959F).setHardness(0.3F).setResistance(10F).setBlockName("AiriumOre");
public static final Block AiriumBlock = new BlockAiriumBlock(254, 0).setLightValue(0.9995F).setHardness(0.3F).setResistance(8F).setBlockName("Airium Block");
public static final Item AiriumCompressed = new ItemAiriumCompressed(7400).setItemName("AiriumCompressed");
//Separating ;;;end of SETTING THINGS;;; - ##^1
public String Version()
{
return "1.4_01";
};
}
BlockAiriumOre.class
package net.minecraft.src;
import java.util.Random;
public class BlockAiriumOre extends Block
{
protected BlockAiriumOre(int i, int j)
{ super(i, j, Material.rock); };
public int idDropped(int i, Random random)
{
return mod_Airium.AiriumBlock.blockID;
}
public int quantityDropped(Random random)
{
return 3;
}
}
EDIT:add BlockAiriumBlock.class incase any helper needs it, well, it's too basic but,... just in case
package net.minecraft.src;
import java.util.Random;
public class BlockAiriumBlock extends Block
{
protected BlockAiriumBlock(int i, int j)
{
super(i, j, Material.rock);
}
}
At the bottom of mod_Arium, change the hardness of the one you want to be broken by hand to 0.1. If this doesn't work, try 0.0. This should work.
I tried adding in a custom item drop to the BlockBloodStone.java, but I can't get it to work ingame.
Here's my edited BlockBloodStone.java code.
package net.minecraft.src;
// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.kpdus.com/jad.html
// Decompiler options: packimports(3) braces deadcode
public class BlockBloodStone extends Block
{
public BlockBloodStone(int i, int j)
{
super(i, j, Material.rock);
}
public int idDropped(int i, Random random)
{
return mod_NetherDust.netherDust.shiftedIndex;
}
}
And here's my mod_NetherDust.java code:
package net.minecraft.src;
public class mod_NetherDust extends BaseMod
{
public mod_NetherDust()
{
netherDust.iconIndex = ModLoader.addOverride("/gui/item.png", "/Shoop/NetherDust.png");
ModLoader.AddName(netherDust, "NetherDust");
}
public String Version()
{
return "1.4_01";
}
public static final Item netherDust = new ItemNetherDust(102).setIconCoord(1, 0).setItemName("netherdust");
static
{
}
}
When I add the files to minecraft.jar and break a netherrack block, it still drops netherrack. Why is this happening?
I tried adding in a custom item drop to the BlockBloodStone.java, but I can't get it to work ingame.
Here's my edited BlockBloodStone.java code.
package net.minecraft.src;
// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.kpdus.com/jad.html
// Decompiler options: packimports(3) braces deadcode
public class BlockBloodStone extends Block
{
public BlockBloodStone(int i, int j)
{
super(i, j, Material.rock);
}
public int idDropped(int i, Random random)
{
return mod_NetherDust.netherDust.shiftedIndex;
}
}
And here's my mod_NetherDust.java code:
package net.minecraft.src;
public class mod_NetherDust extends BaseMod
{
public mod_NetherDust()
{
netherDust.iconIndex = ModLoader.addOverride("/gui/item.png", "/Shoop/NetherDust.png");
ModLoader.AddName(netherDust, "NetherDust");
}
public String Version()
{
return "1.4_01";
}
public static final Item netherDust = new ItemNetherDust(102).setIconCoord(1, 0).setItemName("netherdust");
static
{
}
}
When I add the files to minecraft.jar and break a netherrack block, it still drops netherrack. Why is this happening?
EDIT: Just look at these classes, I fixed and tested, it works.
mod_NetherDust:
package net.minecraft.src;
public class mod_NetherDust extends BaseMod
{
public mod_NetherDust()
{
netherdust.iconIndex = ModLoader.addOverride("/gui/items.png", "/Shoop/NetherDust.png");
ModLoader.AddName(netherdust, "Nether Dust");
}
public String Version()
{
return "1.4_01";
}
public static final Item netherdust = new Item(2000).setItemName("netherdust");
static
{
}
}
BlockBloodStone:
package net.minecraft.src;
// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.kpdus.com/jad.html
// Decompiler options: packimports(3) braces deadcode
import java.util.Random;
public class BlockBloodStone extends Block
{
public BlockBloodStone(int i, int j)
{
super(i, j, Material.rock);
}
public int idDropped(int i, Random random)
{
return mod_NetherDust.netherdust.shiftedIndex;
}
}
It works. Have fun, and remember to get put the textures in, or MC won't load.
Any help? i'm only stuck at this point so for any1 who can help me out
EDIT :major, i dont get drops back only when i break AiriumOre, AiriumBlock is still fine
EDIT AGAIN: my AiriumOre.class
package net.minecraft.src;
import java.util.Random;
public class BlockAiriumOre extends Block
{
protected BlockAiriumOre(int i, int j)
{
super(i, j, Material.ground);
}
public int idDropped(int i, Random random)
{
return Block.dirt.blockID;
}
public int quantityDropped(Random random)
{
return 1;
}
}
i set the quantityDropped to return 1 instead of return 3 so it worked, thanks for all the helps even if they dont work :biggrin.gif:
i also changed the block material of Airium Ore to ground , it was rock before so there u go, i fixed my problem, if any of you have the same problem, just try to change the block material
btw, thanks for the great tutorial Zid
Confirmed with different materialsMaterial.rock does NOT drop any blocks when you break them(maybe just with barehand) wood, ground,... do
Any help? i'm only stuck at this point so for any1 who can help me out
EDIT :major, i dont get drops back only when i break AiriumOre, AiriumBlock is still fine
EDIT AGAIN: my AiriumOre.class
package net.minecraft.src;
import java.util.Random;
public class BlockAiriumOre extends Block
{
protected BlockAiriumOre(int i, int j)
{
super(i, j, Material.ground);
}
public int idDropped(int i, Random random)
{
return Block.dirt.blockID;
}
public int quantityDropped(Random random)
{
return 1;
}
}
i set the quantityDropped to return 1 instead of return 3 so it worked, thanks for all the helps even if they dont work :biggrin.gif:
i also changed the block material of Airium Ore to ground , it was rock before so there u go, i fixed my problem, if any of you have the same problem, just try to change the block material
btw, thanks for the great tutorial Zid
Confirmed with different materialsMaterial.rock does NOT drop any blocks when you break them(maybe just with barehand) wood, ground,... do
Ahaha just realized your problem just after youposted this. Think about it. Rock(stone) can't be broken with hands. Wood can. Dirt(ground) can be broken with hands. If you look in materials.java (I think) you will find all the materials, and it's not hard to figure out which ones will drop when broken by hand.
Thanks for using my tuts, I wanna test this mod when it comes out :biggrin.gif:
I believe you should put 128. I'll edit this when I'm certain.
Ok thanks I'll play around with it and see what I can do.
This is the the GenerateSurface code from the mod_ file
Basically I changed WorldGenFlowers to WorldGenNewFlowers, also changed Block.plantYellow to mod_NewFlowers.plantblue. The int(int r15, int t18, int y21) were renamed too but idk if that was a must or not.
This is the Modified WorldGenFlower Class
For This I just added New between Gen & Flower in the appropriate spots. Also the BlockFlower was changed to BlockPlantBlue
And this is the modified BlockFlower class
And this is pretty much just a copy of the Block flower changed it to BlockBluePlant. I had to do all this because before I made the new world gen class and block flower it kept crashing the game, recompile worked fine but game still wouldn't run. I figure the new flowers and old flowers where just trying to be in the same place at the same time and the game just crashed. idk if any of this makes sense I'm a newb at coding and I just guess till something works.
Go into your EmeraldOre.java or whatever you called it(NOT your mod_ class!), and modify it to read like this:
e.g. to make it have a stone step sound change (Chosensound) to soundStoneFootstep.
Ask me if theres any problems.
Sorry I can't help, I just don't do standard modding.
here are my class files
http://pastebin.com/WrCN3ngT BlockAiriumOre.class
http://pastebin.com/q4ifCf8Q mod_Airium.class
mod_Airium.class
BlockAiriumOre.class
EDIT:add BlockAiriumBlock.class incase any helper needs it, well, it's too basic but,... just in case
At the bottom of mod_Arium, change the hardness of the one you want to be broken by hand to 0.1. If this doesn't work, try 0.0. This should work.
are there any other fixes?
Take a look at other classes that were made by Notch, I don't know why it won't work :/
Here's my edited BlockBloodStone.java code.
And here's my mod_NetherDust.java code:
When I add the files to minecraft.jar and break a netherrack block, it still drops netherrack. Why is this happening?
here it is : Adding sound
MODLOADER FUNCTIONS!!!
i still cant figure out why that happens, is there any other way to force drop a block?
isnt it
its suppose to be a dot not a comma? and isnt it in brackets? and also i think u have to put setHardness, not just hardness.
MODLOADER FUNCTIONS!!!
well i said "hardness" , 0,1F and 0,0F just for fast typing, was going to bed then
any other ideas? i still cant understand why i'm the only one who experience this problem
EDIT: Just look at these classes, I fixed and tested, it works.
mod_NetherDust:
BlockBloodStone:
It works. Have fun, and remember to get put the textures in, or MC won't load.
Any help? i'm only stuck at this point so for any1 who can help me outEDIT :major, i dont get drops back only when i break AiriumOre, AiriumBlock is still fine
EDIT AGAIN: my AiriumOre.class
i set the quantityDropped to return 1 instead of return 3 so it worked, thanks for all the helps even if they dont work :biggrin.gif:
i also changed the block material of Airium Ore to ground , it was rock before so there u go, i fixed my problem, if any of you have the same problem, just try to change the block material
btw, thanks for the great tutorial Zid
Confirmed with different materialsMaterial.rock does NOT drop any blocks when you break them(maybe just with barehand) wood, ground,... do
Ahaha just realized your problem just after youposted this. Think about it. Rock(stone) can't be broken with hands. Wood can. Dirt(ground) can be broken with hands. If you look in materials.java (I think) you will find all the materials, and it's not hard to figure out which ones will drop when broken by hand.
Thanks for using my tuts, I wanna test this mod when it comes out :biggrin.gif: