public int idDropped(int i, Random random)
{
return Item.slimeball.ShiftedIndex;
return Block.dirt.BlockID;
}
public int quantityDropped(Random random)
{
return 4;
}
}
something like that i guess
it will return a slimeball and a dirt block and four of each
public int idDropped(int i, Random random)
{
return Item.slimeball.ShiftedIndex;
}
public int quantityDropped(Random random)
{
return 4;
}
public int idDropped(int i, Random random)
{
return Block.dirt.BlockID;
}
public int quantityDropped(Random random)
{
return 4;
}
}
public void dropNaturally(World world, int i, int j, int k, int l, float f) {
//Replace the code, obviously, with the real name of the function and the real content
if (!world.isStatic) {
int i1 = this.a(world.random);
for (int j1 = 0; j1 < i1; ++j1) {
if (world.random.nextFloat() <= f) {
int k1 = this.a(l, world.random);
if (k1 > 0) {
this.a(world, i, j, k, new ItemStack(k1, 1, this.a_(l)));
//ADD it here, after a line like this
this.a(world, i, j, k, new ItemStack(46, 1, this.a_(l)));//Drops tnt
}
}
}
}
}
"return" means "give this number back and stop executing everything after this", so returning
different ids won't work.
Edit: easier way: maybe you can just override the drop function so that it returns different items for the first and the second time?
private boolean dropTheFirstItem = false;
public int idDropped(int i, Random random)
{
dropTheFirstItem = !dropTheFirstItem; //Invert the boolean
if (dropTheFirstItem) {
return Item.slimeball.ShiftedIndex;
} else {
return Block.dirt.BlockID;
}
}
public int idDropped(int i, Random random)
{
return Item.slimeball.ShiftedIndex;
return Block.dirt.BlockID;
}
public int quantityDropped(Random random)
{
return 4;
}
}
something like that i guess
it will return a slimeball and a dirt block and four of each
public int idDropped(int i, Random random)
{
return Item.slimeball.ShiftedIndex;
}
public int quantityDropped(Random random)
{
return 4;
}
public int idDropped(int i, Random random)
{
return Block.dirt.BlockID;
}
public int quantityDropped(Random random)
{
return 4;
}
}
I don't think this one will work though
Lol? You can't return twice in the same block of code. lern2javapls
on the second one, you don't call the same method twice. Stop trying to do stupid workaround. Java was designed for people that use their head. :huh.gif:
public void dropNaturally(World world, int i, int j, int k, int l, float f) {
//Replace the code, obviously, with the real name of the function and the real content
if (!world.isStatic) {
int i1 = this.a(world.random);
for (int j1 = 0; j1 < i1; ++j1) {
if (world.random.nextFloat() <= f) {
int k1 = this.a(l, world.random);
if (k1 > 0) {
this.a(world, i, j, k, new ItemStack(k1, 1, this.a_(l)));
//ADD it here, after a line like this
this.a(world, i, j, k, new ItemStack(46, 1, this.a_(l)));//Drops tnt
}
}
}
}
}
"return" means "give this number back and stop executing everything after this", so returning
different ids won't work.
Edit: easier way: maybe you can just override the drop function so that it returns different items for the first and the second time?
private boolean dropTheFirstItem = false;
public int idDropped(int i, Random random)
{
dropTheFirstItem = !dropTheFirstItem; //Invert the boolean
if (dropTheFirstItem) {
return Item.slimeball.ShiftedIndex;
} else {
return Block.dirt.BlockID;
}
}
Your easier way would result in a 1/2 chance of dropping either of those 2. By the way,
It's shiftedIndex, not ShiftedIndex and blockID, not BlockID.
return 4; is how many drops the block drops
so for the block change return 1; to return 2; or something to drop 2 drops
I think...
something like this maybe?
look at the entityskeleton.class
that will tell you how
i looked @ the entityskeleton class and tryed that, it didnt work, thats the 1st thing i tryed
something like that i guess
it will return a slimeball and a dirt block and four of each
I don't think this one will work though
Old stupid solution:
I don't have MCP handy, but the decompiled server code at https://github.com/Bukkit/mc-dev/blob/master/net/minecraft/server/Block.java#L306 states the dropping code. Find in block.class a similar function, then override it. It should be similar to
different ids won't work.
Edit: easier way: maybe you can just override the drop function so that it returns different items for the first and the second time?
Are there any errors? Which method did you use?
I tryed them all, i didnt get errors, but it only dropped the 1 block :/
For mine, you may have to increase the number of blocks dropped.
Lol? You can't return twice in the same block of code. lern2javapls
on the second one, you don't call the same method twice. Stop trying to do stupid workaround. Java was designed for people that use their head. :huh.gif:
Your easier way would result in a 1/2 chance of dropping either of those 2. By the way,
It's shiftedIndex, not ShiftedIndex and blockID, not BlockID.
Oops. For the capitalization errors: I was merely quoting the post above me.