Fixed apple trees only producing rotten apples

This commit is contained in:
Sollace 2019-02-23 15:22:53 +02:00
parent cfd7cf23da
commit ff7c400885
3 changed files with 2 additions and 14 deletions

View file

@ -66,7 +66,7 @@ public class UBlocks {
public static final Block apple_leaves = new BlockFruitLeaves(Unicopia.MODID, "apple_leaves", apple_tree)
.setBaseGrowthChance(1200)
.setTint(0xFFEE81)
.setHarvestFruit(w -> ItemApple.getRandomItemStack(null))
.setHarvestFruit(ItemApple::getRandomItemStack)
.setUnharvestFruit(w -> new ItemStack(UItems.rotten_apple));
static void init(IForgeRegistry<Block> registry) {

View file

@ -57,14 +57,6 @@ public class ItemApple extends ItemFood implements IEdible {
.orElse(ItemStack.EMPTY);
}
public ItemStack getRandomApple() {
return getRandomApple(null);
}
public ItemStack getRandomApple(Object variant) {
return getRandomItemStack(variant);
}
public ItemApple(String domain, String name) {
super(4, 3, false);

View file

@ -31,7 +31,7 @@ public class Pool<K, V> extends HashMap<K, V> {
@Override
public V get(Object key) {
if (!containsKey(key)) {
if (key == null || !containsKey(key)) {
key = defaultKey;
}
@ -39,10 +39,6 @@ public class Pool<K, V> extends HashMap<K, V> {
}
public Optional<V> getOptional(K key) {
if (!containsKey(key)) {
return Optional.empty();
}
return Optional.ofNullable(get(key));
}
}