Hello I need help with me block how would I make my block drop two different Items random maybe it would drop this time but it would drop the other time kinda deal. Can anyone help?
Hello I need help with me block how would I make my block drop two different Items random maybe it would drop this time but it would drop the other time kinda deal. Can anyone help?
Something like this would work:
package net.minecraft.src;
import java.util.Random;
public class BlockTest extends Block
{
public BlockTest(int i, int j)
{
super(i,j,Material.ground);
}
public int idDropped(int i, Random random)
{
int x = random.NextInt(1);
if (x == 0) { return A.B.C }
if (x == 1) { return A.B.C }
else { return A.B.C }
}
public int quantityDropped(Random random)
{
return 1;
}
private int x;
}
A = Prefix, if drop is a block, A would be Block. If A is an item, it would be Item.
B = Item/Block name of drop.
C = If drop is a block, this would be .blockID. If drop is an item, this would be .shiftedIndex.
Now I'm not a 100% comfortable with java's random function, but to my knowledge it generates between 0 and whatever you put in random.NextInt(x). Also I put else's when using if commands just to be on the safe side, more of a personal preference I suppose.
Something like this would work:
Now I'm not a 100% comfortable with java's random function, but to my knowledge it generates between 0 and whatever you put in random.NextInt(x). Also I put else's when using if commands just to be on the safe side, more of a personal preference I suppose.