Hey, I'm just starting with minecraft modding, using forge for 1.8, and I am having trouble with my block code. It won't drop an item, and for the life of me I cant figure out why.
public class BreadOre extends Block{
public BreadOre(Material materialIn){
super(materialIn);
this.setStepSound(soundTypeStone);
this.setHardness(5f);
this.setResistance(5f);
this.setHarvestLevel("pickaxe", 3);
}
@Override
public Item getItemDropped(IBlockState state, Random rand, int fortune){
return Items.bread;
}
public int quantityDroppedWithBonus(int fortune, Random random){
return this.quantityDropped(random)+random.nextInt(fortune+1);
}
public int quantityDropped(Random random){
return 4+random.nextInt(2);
}
public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune){
super.dropBlockAsItemWithChance(worldIn, pos, state, chance, fortune);
}
@Override
public int getExpDrop(IBlockAccess world, BlockPos pos, int fortune){
if (this.getItemDropped(world.getBlockState(pos), RANDOM, fortune)!=Item.getItemFromBlock(this)){
return 1+RANDOM.nextInt(5);
}
return 0;
}
}
Um, just assume that everything is indented properly. This is a big problem, and even if this joke block doesnt work, It'll effect something if I do make a mod.
Hi
My name in game is dude8513.
I am 13
I want to try out the new snapshot with other people
I have been banned. Once on the brocraft tekkit server just cause they like banning people, once on cubiville because I spammed zzzz
I have a great idea for upcoming features with command blocks.
/place places a block of the specified ID at the specified coordinates. For example /place 46 0 0 0 would place tnt at x:0 y:0 and z:0 unless there is already a block there.
New parameter for /tp. For example /tp[ent 0 0 0] 1 256 1 would transport an entitie at 0 0 0 to 1 256 1. Also /tp[ent 0 0 0 12 0 23] 900 26 900 would transport any entities in a rectangle with those co-ords as corners to 900 26 900.
/spawnmob. Do I really need to explain?
/explosion executes a tnt sized explosion at the specified coordinates.
0
Hey, I'm just starting with minecraft modding, using forge for 1.8, and I am having trouble with my block code. It won't drop an item, and for the life of me I cant figure out why.
Here's the code:
import java.util.Random;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.util.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
public class BreadOre extends Block{
public BreadOre(Material materialIn){
super(materialIn);
this.setStepSound(soundTypeStone);
this.setHardness(5f);
this.setResistance(5f);
this.setHarvestLevel("pickaxe", 3);
}
@Override
public Item getItemDropped(IBlockState state, Random rand, int fortune){
return Items.bread;
}
public int quantityDroppedWithBonus(int fortune, Random random){
return this.quantityDropped(random)+random.nextInt(fortune+1);
}
public int quantityDropped(Random random){
return 4+random.nextInt(2);
}
public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune){
super.dropBlockAsItemWithChance(worldIn, pos, state, chance, fortune);
}
@Override
public int getExpDrop(IBlockAccess world, BlockPos pos, int fortune){
if (this.getItemDropped(world.getBlockState(pos), RANDOM, fortune)!=Item.getItemFromBlock(this)){
return 1+RANDOM.nextInt(5);
}
return 0;
}
}
Um, just assume that everything is indented properly. This is a big problem, and even if this joke block doesnt work, It'll effect something if I do make a mod.
0
My name in game is dude8513.
I am 13
I want to try out the new snapshot with other people
I have been banned. Once on the brocraft tekkit server just cause they like banning people, once on cubiville because I spammed zzzz
0
0
0
0
0
1
/place places a block of the specified ID at the specified coordinates. For example /place 46 0 0 0 would place tnt at x:0 y:0 and z:0 unless there is already a block there.
New parameter for /tp. For example /tp[ent 0 0 0] 1 256 1 would transport an entitie at 0 0 0 to 1 256 1. Also /tp[ent 0 0 0 12 0 23] 900 26 900 would transport any entities in a rectangle with those co-ords as corners to 900 26 900.
/spawnmob. Do I really need to explain?
/explosion executes a tnt sized explosion at the specified coordinates.
Can anyone else think of any more?
: I think you can!
1
0
0
0
0
0
(thats what I type when im mad)
0