82
82
import net .neoforged .fml .common .EventBusSubscriber ;
83
83
import net .neoforged .fml .common .EventBusSubscriber .Bus ;
84
84
import net .neoforged .fml .common .Mod ;
85
- import net .neoforged .neoforge .common .conditions .IConditionBuilder ;
86
- import net .neoforged .neoforge .common .conditions .ModLoadedCondition ;
85
+ import net .neoforged .neoforge .common .conditions .NeoForgeConditions ;
87
86
import net .neoforged .neoforge .common .conditions .WithConditions ;
88
87
import net .neoforged .neoforge .common .crafting .CompoundIngredient ;
89
88
import net .neoforged .neoforge .common .crafting .DifferenceIngredient ;
98
97
import net .neoforged .neoforge .common .data .SoundDefinition ;
99
98
import net .neoforged .neoforge .common .data .SoundDefinitionsProvider ;
100
99
import net .neoforged .neoforge .data .event .GatherDataEvent ;
100
+ import net .neoforged .neoforge .internal .versions .neoforge .NeoForgeVersion ;
101
101
import org .apache .commons .lang3 .tuple .Triple ;
102
102
import org .apache .logging .log4j .LogManager ;
103
103
import org .apache .logging .log4j .Logger ;
@@ -134,8 +134,8 @@ public static void gatherData(GatherDataEvent.Client event) {
134
134
new WithConditions <>(new OverlayMetadataSection .OverlayEntry (new InclusiveRange <>(0 , Integer .MAX_VALUE ), "neoforge_overlays_test" )))))
135
135
.add (GeneratingOverlayMetadataSection .TYPE , new GeneratingOverlayMetadataSection (List .of (
136
136
new WithConditions <>(new OverlayMetadataSection .OverlayEntry (new InclusiveRange <>(0 , Integer .MAX_VALUE ), "pack_overlays_test" )),
137
- new WithConditions <>(new OverlayMetadataSection .OverlayEntry (new InclusiveRange <>(0 , Integer .MAX_VALUE ), "conditional_overlays_enabled" ), new ModLoadedCondition ( "neoforge" )),
138
- new WithConditions <>(new OverlayMetadataSection .OverlayEntry (new InclusiveRange <>(0 , Integer .MAX_VALUE ), "conditional_overlays_enabled" ), new ModLoadedCondition ("does_not_exist" )))))
137
+ new WithConditions <>(new OverlayMetadataSection .OverlayEntry (new InclusiveRange <>(0 , Integer .MAX_VALUE ), "conditional_overlays_enabled" ), NeoForgeConditions . modLoaded ( NeoForgeVersion . MOD_ID )),
138
+ new WithConditions <>(new OverlayMetadataSection .OverlayEntry (new InclusiveRange <>(0 , Integer .MAX_VALUE ), "conditional_overlays_enabled" ), NeoForgeConditions . modLoaded ("does_not_exist" )))))
139
139
.add (PackMetadataSection .TYPE , new PackMetadataSection (
140
140
Component .literal ("NeoForge tests resource pack" ),
141
141
DetectedVersion .BUILT_IN .getPackVersion (PackType .CLIENT_RESOURCES ),
@@ -160,7 +160,7 @@ public static void levelStem(BootstrapContext<LevelStem> context) {
160
160
context .register (TEST_LEVEL_STEM , levelStem );
161
161
}
162
162
163
- public static class Recipes extends RecipeProvider implements IConditionBuilder {
163
+ public static class Recipes extends RecipeProvider {
164
164
public Recipes (HolderLookup .Provider registries , RecipeOutput output ) {
165
165
super (registries , output );
166
166
}
@@ -181,10 +181,10 @@ protected void buildRecipes() {
181
181
.unlockedBy ("has_dirt" , has (Blocks .DIRT ))
182
182
.save (
183
183
output .withConditions (
184
- and (
185
- not (modLoaded ("minecraft" )),
186
- itemExists ("minecraft" , "dirt" ),
187
- FALSE ())),
184
+ NeoForgeConditions . and (
185
+ NeoForgeConditions . not (NeoForgeConditions . modLoaded ("minecraft" )),
186
+ NeoForgeConditions . itemRegistered ("minecraft" , "dirt" ),
187
+ NeoForgeConditions . never ())),
188
188
recipeKey ("conditional" ));
189
189
190
190
this .shaped (RecipeCategory .BUILDING_BLOCKS , Blocks .DIAMOND_BLOCK , 64 )
@@ -196,11 +196,11 @@ protected void buildRecipes() {
196
196
.unlockedBy ("has_dirt" , has (Blocks .DIRT ))
197
197
.save (
198
198
output .withConditions (
199
- not (
200
- and (
201
- not (modLoaded ("minecraft" )),
202
- itemExists ("minecraft" , "dirt" ),
203
- FALSE ()))),
199
+ NeoForgeConditions . not (
200
+ NeoForgeConditions . and (
201
+ NeoForgeConditions . not (NeoForgeConditions . modLoaded ("minecraft" )),
202
+ NeoForgeConditions . itemRegistered ("minecraft" , "dirt" ),
203
+ NeoForgeConditions . never ()))),
204
204
recipeKey ("conditional2" ));
205
205
206
206
this .shaped (RecipeCategory .BUILDING_BLOCKS , Blocks .NETHERITE_BLOCK , 1 )
@@ -211,7 +211,7 @@ protected void buildRecipes() {
211
211
.unlockedBy ("has_diamond_block" , has (Blocks .DIAMOND_BLOCK ))
212
212
.save (
213
213
output .withConditions (
214
- tagEmpty (ItemTags .PLANKS )),
214
+ NeoForgeConditions . tagEmpty (ItemTags .PLANKS )),
215
215
recipeKey ("conditional3" ));
216
216
217
217
this .shaped (RecipeCategory .BUILDING_BLOCKS , Blocks .NETHERITE_BLOCK , 9 )
@@ -222,7 +222,7 @@ protected void buildRecipes() {
222
222
.unlockedBy ("has_diamond_block" , has (Blocks .DIAMOND_BLOCK ))
223
223
.save (
224
224
output .withConditions (
225
- not (tagEmpty (ItemTags .PLANKS ))),
225
+ NeoForgeConditions . not (NeoForgeConditions . tagEmpty (ItemTags .PLANKS ))),
226
226
recipeKey ("conditional4" ));
227
227
228
228
// intersection - should match all non-flammable planks
@@ -486,7 +486,7 @@ protected void addTags(HolderLookup.Provider provider) {
486
486
.addTag (BlockTags .STONE_BRICKS )
487
487
.addTag (net .neoforged .neoforge .common .Tags .Blocks .COBBLESTONES )
488
488
.addOptional (ResourceLocation .fromNamespaceAndPath ("chisel" , "marble/raw" ))
489
- .addOptionalTag (ResourceLocation .fromNamespaceAndPath ("neoforge" , "storage_blocks/ruby" ));
489
+ .addOptionalTag (ResourceLocation .fromNamespaceAndPath (NeoForgeVersion . MOD_ID , "storage_blocks/ruby" ));
490
490
491
491
// Hopefully sorting issues
492
492
tag (BlockTags .create (ResourceLocation .fromNamespaceAndPath (MODID , "thing/one" )))
@@ -581,7 +581,7 @@ public void generate(HolderLookup.Provider registries, Consumer<AdvancementHolde
581
581
false ,
582
582
false )
583
583
.addCriterion ("get_cobbleStone" , InventoryChangeTrigger .TriggerInstance .hasItems (Items .COBBLESTONE ))
584
- .parent (ResourceLocation .fromNamespaceAndPath ("neoforge" , "dummy_parent" ))
584
+ .parent (ResourceLocation .fromNamespaceAndPath (NeoForgeVersion . MOD_ID , "dummy_parent" ))
585
585
.save (saver , ResourceLocation .withDefaultNamespace ("good_parent" ), existingFileHelper );
586
586
}
587
587
}
0 commit comments