GenericWood: change getDrop to getDrops

This commit is contained in:
Matthias Schiffer 2014-05-26 21:55:53 +02:00
parent 4b464a39f9
commit fcc093da13
2 changed files with 11 additions and 7 deletions

View file

@ -1,5 +1,7 @@
package net.universe_factory.minecraft.test; package net.universe_factory.minecraft.test;
import java.util.ArrayList;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.ItemFood; import net.minecraft.item.ItemFood;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
@ -35,7 +37,9 @@ public class Test {
} }
@Override @Override
public ItemStack getDrop(World world, int x, int y, int z, int meta, int fortune) { public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int meta, int fortune) {
ArrayList<ItemStack> ret = new ArrayList<ItemStack>();
int chance = 30; int chance = 30;
if (fortune > 0) { if (fortune > 0) {
@ -46,9 +50,9 @@ public class Test {
} }
if (world.rand.nextInt(chance) == 0) if (world.rand.nextInt(chance) == 0)
return new ItemStack(cherries, 1); ret.add(new ItemStack(cherries, 1));
return null; return ret;
} }
}); });

View file

@ -1,5 +1,6 @@
package net.universe_factory.minecraft.test.generic; package net.universe_factory.minecraft.test.generic;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Random; import java.util.Random;
@ -225,8 +226,7 @@ public class GenericWood {
this.dropBlockAsItem(world, x, y, z, new ItemStack(item, 1, this.damageDropped(meta))); this.dropBlockAsItem(world, x, y, z, new ItemStack(item, 1, this.damageDropped(meta)));
} }
ItemStack drop = info.getDrop(world, x, y, z, meta, fortune); for (ItemStack drop : info.getDrops(world, x, y, z, meta, fortune))
if (drop != null)
this.dropBlockAsItem(world, x, y, z, drop); this.dropBlockAsItem(world, x, y, z, drop);
} }
} }
@ -342,8 +342,8 @@ public class GenericWood {
public abstract int getMinTreeHeight(); public abstract int getMinTreeHeight();
public ItemStack getDrop(World world, int x, int y, int z, int meta, int fortune) { public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int meta, int fortune) {
return null; return new ArrayList<ItemStack>();
} }
} }
} }