-
Notifications
You must be signed in to change notification settings - Fork 81
/
NaturaBlockLootTables.java
35 lines (29 loc) · 1.16 KB
/
NaturaBlockLootTables.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package com.progwml6.natura.common.data;
import com.progwml6.natura.Natura;
import com.progwml6.natura.overworld.NaturaOverworld;
import com.progwml6.natura.overworld.block.TreeType;
import net.minecraft.block.Block;
import net.minecraft.data.loot.BlockLootTables;
import net.minecraftforge.registries.ForgeRegistries;
import javax.annotation.Nonnull;
import java.util.stream.Collectors;
public class NaturaBlockLootTables extends BlockLootTables {
@Nonnull
@Override
protected Iterable<Block> getKnownBlocks() {
return ForgeRegistries.BLOCKS.getValues().stream()
.filter((block) -> Natura.modID.equals(block.getRegistryName().getNamespace()))
.collect(Collectors.toList());
}
@Override
protected void addTables() {
this.addOverworld();
}
private void addOverworld() {
for (TreeType type : TreeType.values()) {
this.registerDropSelfLootTable(NaturaOverworld.logs.get(type));
this.registerLootTable(NaturaOverworld.leaves.get(type), (leaves) -> droppingWithChancesAndSticks(leaves, NaturaOverworld.sapling.get(type), DEFAULT_SAPLING_DROP_RATES));
this.registerDropSelfLootTable(NaturaOverworld.sapling.get(type));
}
}
}