I tested your code but the grenade doesn't render for me, I also used the snowball render code but that didn't work either.
im not sure if it will work or not but try rendering it like this
public void load()
{
ModLoader.registerEntityID(Entityyourentityname.class, "yourentityname", 12);//registers the mobs name and id
public void addRenderer(Map var1)
{
var1.put(Entityyourentityname.class, new Renderyourrenderfilename(new Modelyourmodelfilenameifyouhaveone(),.5f));//says that the entity should use the living renderer and the biped model note you can change the renderer and the model
}
}
I'm having a problem with adding my block. I did the code just like you did, and got no errors at all. But when I load up MC, the block doesn't show up in the creative menu. I decided to add a crafting recipe for it, and temporarily made it one piece of dirt. But when I put the block in, the game crashed.
This is part of the crash code
at net.minecraft.src.ModLoader.initStats(ModLoader.java:837)
at net.minecraft.src.ModLoader.init(ModLoader.java:810)
at net.minecraft.src.ModLoader.addAllRenderers(ModLoader.java:180)
at net.minecraft.src.RenderManager.(RenderManager.java:96)
at net.minecraft.src.RenderManager.(RenderManager.java:14)
at net.minecraft.client.Minecraft.startGame(Minecraft.java:417)
at net.minecraft.src.MinecraftAppletImpl.startGame(MinecraftAppletImpl.java:41)
at net.minecraft.client.Minecraft.run(Minecraft.java:726)
at java.lang.Thread.run(Unknown Source)
By the way, I really like your tutorials, keep it up
I was wondering how I might go about making a block drop several items when broken. I looked at minecraft's vanilla code, but couldn't find how to make several things drop.
I was wondering how I might go about making a block drop several items when broken. I looked at minecraft's vanilla code, but couldn't find how to make several things drop.
idDropped is an int, so it can only handle one block, you would need to change it into an array so it can handle different blocks.
I was wondering how I might go about making a block drop several items when broken. I looked at minecraft's vanilla code, but couldn't find how to make several things drop.
idDropped is an int, so it can only handle one block, you would need to change it into an array so it can handle different blocks.
I found a workaround to this problem, add these three voids to your BlockName.java:
public int idDropped(int par1, Random par2Random, int par3){
return mod_fun.funBlock.blockID;
}
public int idDropped2(int par1, Random par2Random, int par3){
return mod_fun.mineralBlock.blockID;
}
public void dropBlockAsItemWithChance(World par1World, int par2, int par3, int par4, int par5, float par6, int par7){
if (!par1World.isRemote){
int var8 = this.quantityDroppedWithBonus(par7, par1World.rand);
for (int var9 = 0; var9 < var8; ++var9)
{
if (par1World.rand.nextFloat() <= par6)
{
int var10 = this.idDropped2(par5, par1World.rand, par7);
int var11 = this.idDropped(par5, par1World.rand, par7);
if (var10 > 0)
{
this.dropBlockAsItem_do(par1World, par2, par3, par4, new ItemStack(var10, 1, this.damageDropped(par5)));
this.dropBlockAsItem_do(par1World, par2, par3, par4, new ItemStack(var11, 1, this.damageDropped(par5)));
}
}
}
}
}
I found a workaround to this problem, add these three voids to your BlockName.java:
public int idDropped(int par1, Random par2Random, int par3){
return mod_fun.funBlock.blockID;
}
public int idDropped2(int par1, Random par2Random, int par3){
return mod_fun.mineralBlock.blockID;
}
public void dropBlockAsItemWithChance(World par1World, int par2, int par3, int par4, int par5, float par6, int par7){
if (!par1World.isRemote){
int var8 = this.quantityDroppedWithBonus(par7, par1World.rand);
for (int var9 = 0; var9 < var8; ++var9)
{
if (par1World.rand.nextFloat() <= par6)
{
int var10 = this.idDropped2(par5, par1World.rand, par7);
int var11 = this.idDropped(par5, par1World.rand, par7);
if (var10 > 0)
{
this.dropBlockAsItem_do(par1World, par2, par3, par4, new ItemStack(var10, 1, this.damageDropped(par5)));
this.dropBlockAsItem_do(par1World, par2, par3, par4, new ItemStack(var11, 1, this.damageDropped(par5)));
}
}
}
}
}
I tried that, but isn't that for making the same item have a chance to drop another? Cause I have already figured out away to make 0-2 of the same item drop. I wanted to know how to make a block drop different items when broken.
I tried that, but isn't that for making the same item have a chance to drop another? Cause I have already figured out away to make 0-2 of the same item drop. I wanted to know how to make a block drop different items when broken.
I found a workaround to this problem, add these three voids to your BlockName.java:
public int idDropped(int par1, Random par2Random, int par3){
return mod_fun.funBlock.blockID;
}
public int idDropped2(int par1, Random par2Random, int par3){
return mod_fun.mineralBlock.blockID;
}
public void dropBlockAsItemWithChance(World par1World, int par2, int par3, int par4, int par5, float par6, int par7){
if (!par1World.isRemote){
int var8 = this.quantityDroppedWithBonus(par7, par1World.rand);
for (int var9 = 0; var9 < var8; ++var9)
{
if (par1World.rand.nextFloat() <= par6)
{
int var10 = this.idDropped2(par5, par1World.rand, par7);
int var11 = this.idDropped(par5, par1World.rand, par7);
if (var10 > 0)
{
this.dropBlockAsItem_do(par1World, par2, par3, par4, new ItemStack(var10, 1, this.damageDropped(par5)));
this.dropBlockAsItem_do(par1World, par2, par3, par4, new ItemStack(var11, 1, this.damageDropped(par5)));
}
}
}
}
}
Just keep on adding
public int idDropped3(int par1, Random par2Random, int par3){
return mod_fun.mineralBlock.blockID;
}
int var12 = this.idDropped3(par5, par1World.rand, par7);
this.dropBlockAsItem_do(par1World, par2, par3, par4, new ItemStack(var12, 1, this.damageDropped(par5)));
for each item, just change var12 and idDropped3 to var13 & idDropped4 and so on
You have been so helpful
Your tutorials are great.
I have another question if you don't mind. Right now, I have a way to make it a chance to drop items. My code goes like this:
public int quantityDropped(Random par1Random){
return par1Random.nextInt(2) == 0 ? 1 : 0;
}
Right now, it either drops all items, or no items. Is it possible to give each item a chance to drop or not?
Thx anyway
You have been so helpful
Your tutorials are great.
I have another question if you don't mind. Right now, I have a way to make it a chance to drop items. My code goes like this:
public int quantityDropped(Random par1Random){
return par1Random.nextInt(2) == 0 ? 1 : 0;
}
Right now, it either drops all items, or no items. Is it possible to give each item a chance to drop or not?
Thx anyway
Here is the code, you need to add a quantityDropped2, quantityDroppedWithBonus2 and a for statement for each item:
public int quantityDropped(Random par1Random){
return par1Random.nextInt(2) == 0 ? 1 : 0;
}
public int quantityDropped2(Random par1Random){
return par1Random.nextInt(3) == 0 ? 1 : 0;
}
public int idDropped(int par1, Random par2Random, int par3){
return mod_fun.funBlock.blockID;
}
public int idDropped2(int par1, Random par2Random, int par3){
return mod_fun.mineralBlock.blockID;
}
public void dropBlockAsItemWithChance(World par1World, int par2, int par3, int par4, int par5, float par6, int par7){
if (!par1World.isRemote){
int var8 = this.quantityDroppedWithBonus(par7, par1World.rand);
int var20 = this.quantityDroppedWithBonus2(par7, par1World.rand);
for (int var9 = 0; var9 < var8; ++var9){
if (par1World.rand.nextFloat() <= par6){
int var10 = this.idDropped(par5, par1World.rand, par7);
if (var10 > 0){
this.dropBlockAsItem_do(par1World, par2, par3, par4, new ItemStack(var10, 1, this.damageDropped(par5)));
}
}
}
for (int var30 = 0; var30 < var20; ++var30){
if (par1World.rand.nextFloat() <= par6){
int var11 = this.idDropped2(par5, par1World.rand, par7);
if (var11 > 0){
this.dropBlockAsItem_do(par1World, par2, par3, par4, new ItemStack(var11, 1, this.damageDropped(par5)));
}
}
}
}
}
public int quantityDroppedWithBonus(int par1, Random par2Random)
{
return this.quantityDropped(par2Random);
}
public int quantityDroppedWithBonus2(int par1, Random par2Random)
{
return this.quantityDropped2(par2Random);
}
This is my code, when you mine the block you might get nothing, both blocks, or one of the two blocks
Ok first they have Icon methods in the block codes to register deferent sides of the block. Look at Blocktnt scroll down and find the icon method, and use your own codes without doing all of it in you mod_file.
I have a problem when I try to use the .setPotionEffect. Eclipse marks it as an error and it says "The method setPotionEffect(String) in the type Item is not applicable for the arguments (int, int, int, float)" Here's my code for the item:
public static final Item baconGolden = new ItemFood(9002, 10, 1.5F, true).setCreativeTab(CreativeTabs.tabFood).setPotionEffect(Potion.waterBreathing.id, 180, 0, 1.0F).setUnlocalizedName("goldenbacon");
I have a problem when I try to use the .setPotionEffect. Eclipse marks it as an error and it says "The method setPotionEffect(String) in the type Item is not applicable for the arguments (int, int, int, float)" Here's my code for the item:
public static final Item baconGolden = new ItemFood(9002, 10, 1.5F, true).setCreativeTab(CreativeTabs.tabFood).setPotionEffect(Potion.waterBreathing.id, 180, 0, 1.0F).setUnlocalizedName("goldenbacon");
Help please?
It's a general minecraft error, I'll add it to the tutorial:
The .setPotionEffect must be straight after the ItemFood(), like so:
public static final Item baconGolden = new ItemFood(9002, 10, 1.5F, true).setPotionEffect(Potion.waterBreathing.id, 180, 0, 1.0F).setCreativeTab(CreativeTabs.tabFood).setUnlocalizedName("goldenbacon");
Instead of
public static final Item baconGolden = new ItemFood(9002, 10, 1.5F, true).setCreativeTab(CreativeTabs.tabFood).setPotionEffect(Potion.waterBreathing.id, 180, 0, 1.0F).setUnlocalizedName("goldenbacon");
Did you finish the the gun code? And when I shot the gun the bullets don't render in the game and the gun clips have damage. O and you can take my Nether ore generation code.
Did you finish the the gun code? And when I shot the gun the bullets don't render in the game and the gun clips have damage. O and you can take my Nether ore generation code.
I can't find a solution, I have tried even making a new class for damaging the clips and the bullets move to fast to render.
im not sure if it will work or not but try rendering it like this
This is part of the crash code
By the way, I really like your tutorials, keep it up
Risugami helped me out here, and you missed a line of code in your tutorial. I didn't register the block.
Not true, I had written in my Block code:
"Now all that's left is registering the block, insert this line in your mod_YourModNameHere class in the public void load section
"
Make sure its in the /textures/blocks folder inside the minecraft.jar and you wrote getIndirectPowerOutput("name") instead of ("name.png")
idDropped is an int, so it can only handle one block, you would need to change it into an array so it can handle different blocks.
I found a workaround to this problem, add these three voids to your BlockName.java:
I tried that, but isn't that for making the same item have a chance to drop another? Cause I have already figured out away to make 0-2 of the same item drop. I wanted to know how to make a block drop different items when broken.
In your BlockName.java change
to
or if it's a minecraft block:
An item would end in .itemID instead of blockID:
Yeah, that's what I already have. I wanted to know how to make a block drop 6 different things when mined. Is that possible?
That's what I had done in this post:
Just keep on adding
for each item, just change var12 and idDropped3 to var13 & idDropped4 and so on
Your tutorials are great.
I have another question if you don't mind. Right now, I have a way to make it a chance to drop items. My code goes like this:
Right now, it either drops all items, or no items. Is it possible to give each item a chance to drop or not?
Thx anyway
Here is the code, you need to add a quantityDropped2, quantityDroppedWithBonus2 and a for statement for each item:
This is my code, when you mine the block you might get nothing, both blocks, or one of the two blocks
If this helped vote this post up.
import java.awt.Color;
at the top of the mod_file
I have a problem when I try to use the .setPotionEffect. Eclipse marks it as an error and it says "The method setPotionEffect(String) in the type Item is not applicable for the arguments (int, int, int, float)" Here's my code for the item:
Help please?
It's a general minecraft error, I'll add it to the tutorial:
The .setPotionEffect must be straight after the ItemFood(), like so:
Instead of
I can't find a solution, I have tried even making a new class for damaging the clips and the bullets move to fast to render.