6
6
import galena .oreganized .index .OBlocks ;
7
7
import galena .oreganized .index .OEntityTypes ;
8
8
import galena .oreganized .index .OItems ;
9
+ import net .minecraft .advancements .critereon .ItemPredicate ;
9
10
import net .minecraft .advancements .critereon .StatePropertiesPredicate ;
10
11
import net .minecraft .data .PackOutput ;
11
12
import net .minecraft .data .loot .EntityLootSubProvider ;
14
15
import net .minecraft .world .entity .EntityType ;
15
16
import net .minecraft .world .flag .FeatureFlags ;
16
17
import net .minecraft .world .level .block .Block ;
18
+ import net .minecraft .world .level .block .Blocks ;
17
19
import net .minecraft .world .level .block .DoorBlock ;
18
20
import net .minecraft .world .level .block .state .properties .DoubleBlockHalf ;
19
21
import net .minecraft .world .level .storage .loot .LootPool ;
24
26
import net .minecraft .world .level .storage .loot .functions .SetItemCountFunction ;
25
27
import net .minecraft .world .level .storage .loot .parameters .LootContextParamSets ;
26
28
import net .minecraft .world .level .storage .loot .predicates .LootItemBlockStatePropertyCondition ;
29
+ import net .minecraft .world .level .storage .loot .predicates .MatchTool ;
27
30
import net .minecraft .world .level .storage .loot .providers .number .ConstantValue ;
28
31
29
32
import java .util .List ;
@@ -37,16 +40,16 @@ public class OLootTables extends LootTableProvider {
37
40
38
41
public OLootTables (PackOutput output ) {
39
42
super (output , Set .of (), List .of (
40
- new SubProviderEntry (Blocks ::new , LootContextParamSets .BLOCK ),
41
- new SubProviderEntry (Entities ::new , LootContextParamSets .ENTITY )
43
+ new SubProviderEntry (BlockLoot ::new , LootContextParamSets .BLOCK ),
44
+ new SubProviderEntry (EntityLoot ::new , LootContextParamSets .ENTITY )
42
45
));
43
46
}
44
47
45
48
@ Override
46
49
protected void validate (Map <ResourceLocation , LootTable > map , ValidationContext tracker ) {
47
50
}
48
51
49
- public static class Blocks extends OBlockLootProvider {
52
+ public static class BlockLoot extends OBlockLootProvider {
50
53
51
54
protected void generate () {
52
55
//dropNothing(OBlocks.MOLTEN_LEAD);
@@ -83,9 +86,9 @@ protected void generate() {
83
86
dropSelf (OBlocks .SHRAPNEL_BOMB );
84
87
dropSelf (OBlocks .LEAD_BOLT_CRATE );
85
88
86
- dropAsSilk (OBlocks .GROOVED_ICE );
87
- dropAsSilk (OBlocks .GROOVED_PACKED_ICE );
88
- dropAsSilk (OBlocks .GROOVED_BLUE_ICE );
89
+ grooved (OBlocks .GROOVED_ICE , Blocks . ICE );
90
+ grooved (OBlocks .GROOVED_BLUE_ICE , Blocks . BLUE_ICE );
91
+ grooved (OBlocks .GROOVED_PACKED_ICE , Blocks . PACKED_ICE );
89
92
90
93
add (OBlocks .LEAD_DOOR .get (), LootTable .lootTable ()
91
94
.withPool (applyExplosionCondition (OBlocks .LEAD_DOOR .get (), LootPool .lootPool ()
@@ -125,15 +128,29 @@ protected void generate() {
125
128
}
126
129
}
127
130
131
+ private void grooved (Supplier <Block > block , Block other ) {
132
+ var hasScribe = MatchTool .toolMatches (ItemPredicate .Builder .item ().of (OItems .SCRIBE .get ()));
133
+ add (block .get (), LootTable .lootTable ()
134
+ .withPool (LootPool .lootPool ()
135
+ .setRolls (ConstantValue .exactly (1.0F ))
136
+ .add (AlternativesEntry .alternatives (
137
+ LootItem .lootTableItem (block .get ().asItem ())
138
+ .when (HAS_SILK_TOUCH ),
139
+ LootItem .lootTableItem (other .asItem ())
140
+ .when (hasScribe )
141
+ ))
142
+ ));
143
+ }
144
+
128
145
@ Override
129
146
protected Iterable <Block > getKnownBlocks () {
130
147
return Oreganized .REGISTRY_HELPER .getBlockSubHelper ().getDeferredRegister ().getEntries ().stream ().map (Supplier ::get ).collect (Collectors .toList ());
131
148
}
132
149
}
133
150
134
- public static class Entities extends EntityLootSubProvider {
151
+ public static class EntityLoot extends EntityLootSubProvider {
135
152
136
- public Entities () {
153
+ public EntityLoot () {
137
154
super (FeatureFlags .REGISTRY .allFlags ());
138
155
}
139
156
0 commit comments