Skip to content

Commit 5037ef4

Browse files
Refactor recipe generation classes to extend new API classes
- Updated CNCrushingRecipeGen to extend CrushingRecipeGen and removed redundant methods. - Updated CNEnrichedRecipeGen to extend EnrichedRecipeGen and simplified constructor. - Updated CNItemApplicationRecipeGen to extend ItemApplicationRecipeGen and streamlined constructor. - Updated CNMechanicalCraftingRecipeGen to extend MechanicalCraftingRecipeGen and removed unnecessary methods. - Updated CNMixingRecipeGen to extend MixingRecipeGen and simplified constructor. - Updated CNPressingRecipeGen to extend PressingRecipeGen and streamlined constructor. - Refactored CNProcessingRecipeGen to extend RecipeProvider and removed deprecated methods. - Updated CNShapelessRecipeGen to extend BaseRecipeProvider and removed unused methods. - Updated CNStandardRecipeGen to extend BaseRecipeProvider and simplified constructor. - Updated CNWashingRecipeGen to extend WashingRecipeGen and streamlined constructor. - Added DyedItemsList class for managing dyed item entries.
1 parent d4b82aa commit 5037ef4

19 files changed

+333
-838
lines changed

src/main/java/net/nuclearteam/createnuclear/CNBlocks.java

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,18 @@
66
import com.simibubi.create.foundation.data.AssetLookup;
77
import com.simibubi.create.foundation.data.CreateRegistrate;
88
import com.simibubi.create.foundation.data.SharedProperties;
9+
import com.tterrag.registrate.providers.RegistrateRecipeProvider;
910
import com.tterrag.registrate.providers.loot.RegistrateBlockLootTables;
1011
import com.tterrag.registrate.util.entry.BlockEntry;
1112
import net.minecraft.client.renderer.RenderType;
1213
import net.minecraft.core.Direction;
1314
import net.minecraft.data.loot.BlockLootSubProvider;
15+
import net.minecraft.data.recipes.RecipeCategory;
16+
import net.minecraft.data.recipes.ShapedRecipeBuilder;
1417
import net.minecraft.resources.ResourceLocation;
1518
import net.minecraft.tags.BlockTags;
19+
import net.minecraft.tags.ItemTags;
20+
import net.minecraft.world.item.Items;
1621
import net.minecraft.world.item.enchantment.Enchantments;
1722
import net.minecraft.world.level.block.Block;
1823
import net.minecraft.world.level.block.Blocks;
@@ -28,6 +33,7 @@
2833
import net.minecraftforge.common.Tags;
2934
import net.nuclearteam.createnuclear.content.enriching.campfire.EnrichingCampfireBlock;
3035
import net.nuclearteam.createnuclear.content.enriching.fire.EnrichingFireBlock;
36+
import net.nuclearteam.createnuclear.content.equipment.cloth.ClothItem;
3137
import net.nuclearteam.createnuclear.content.multiblock.casing.ReactorCasing;
3238
import net.nuclearteam.createnuclear.CNTags.CNBlockTags;
3339
import net.nuclearteam.createnuclear.CNTags.CNItemTags;
@@ -174,6 +180,15 @@ public class CNBlocks {
174180
.onRegister(casingConnectivity((block,cc) -> cc.makeCasing(block, CNSpriteShifts.REACTOR_GLASS)))
175181
.loot(RegistrateBlockLootTables::dropWhenSilkTouch)
176182
.tag(CNTags.forgeBlockTag("glass"), BlockTags.IMPERMEABLE)
183+
.recipe((c, p) -> ShapedRecipeBuilder.shaped(RecipeCategory.DECORATIONS, c.get())
184+
.unlockedBy("has_reactor_casing", RegistrateRecipeProvider.has(CNBlocks.REACTOR_CASING.get()))
185+
.define('G', CNTags.forgeItemTag("glass"))
186+
.define('S', CNTags.forgeItemTag("ingots/lead"))
187+
.pattern("SGS")
188+
.pattern("GSG")
189+
.pattern("SGS")
190+
.showNotification(true)
191+
.save(p, CreateNuclear.asResource("crafting/reactor/" + c.getName())))
177192
.blockstate((c, p) -> p.getVariantBuilder(c.getEntry())
178193
.forAllStates(state -> ConfiguredModel.builder().modelFile(p.models()
179194
.withExistingParent("reinforced_glass",new ResourceLocation("block/cube_all"))
@@ -263,6 +278,16 @@ public class CNBlocks {
263278
.addLayer(() -> RenderType::cutoutMipped)
264279
.transform(axeOrPickaxe())
265280
.tag(CNBlockTags.ALL_CAMPFIRES.tag)
281+
.recipe((c, p) -> ShapedRecipeBuilder.shaped(RecipeCategory.MISC, c.get())
282+
.unlockedBy("has_enriched_soul_soil", RegistrateRecipeProvider.has(CNBlocks.ENRICHED_SOUL_SOIL.get()))
283+
.define('E', CNBlocks.ENRICHED_SOUL_SOIL)
284+
.define('L', ItemTags.LOGS)
285+
.define('S', Tags.Items.RODS_WOODEN)
286+
.pattern(" S ")
287+
.pattern("SES")
288+
.pattern("LLL")
289+
.showNotification(true)
290+
.save(p, CreateNuclear.asResource("crafting/" + c.getName())))
266291
.loot((lt, b) -> lt.add(b, RegistrateBlockLootTables.createSilkTouchDispatchTable(b, lt.applyExplosionDecay(b, LootItem.lootTableItem(CNBlocks.ENRICHED_SOUL_SOIL)))))
267292
.blockstate((c, p) ->
268293
p.getVariantBuilder(c.getEntry()).forAllStatesExcept(state -> {
@@ -339,6 +364,13 @@ public class CNBlocks {
339364
.transform(pickaxeOnly())
340365
.tag(BlockTags.NEEDS_DIAMOND_TOOL,
341366
CNTags.forgeBlockTag("storage_blocks/raw_uranium"))
367+
.recipe((c, p) -> ShapedRecipeBuilder.shaped(RecipeCategory.DECORATIONS, c.get())
368+
.unlockedBy("has_raw_materials_uranium", RegistrateRecipeProvider.has(CNTags.forgeItemTag("raw_materials/uranium")))
369+
.define('R', CNTags.forgeItemTag("raw_materials/uranium"))
370+
.pattern("RRR")
371+
.pattern("RRR")
372+
.pattern("RRR")
373+
.save(p, CreateNuclear.asResource("crafting/" + c.getName())))
342374
.item()
343375
.tag(CNTags.forgeItemTag("storage_blocks/raw_uranium"))
344376
.build()
@@ -349,6 +381,13 @@ public class CNBlocks {
349381
.initialProperties(SharedProperties::stone)
350382
.transform(pickaxeOnly())
351383
.tag(CNTags.forgeBlockTag("storage_blocks/raw_lead"))
384+
.recipe((c, p) -> ShapedRecipeBuilder.shaped(RecipeCategory.DECORATIONS, c.get())
385+
.unlockedBy("has_raw_materials_lead", RegistrateRecipeProvider.has(CNTags.forgeItemTag("raw_materials/lead")))
386+
.define('R', CNTags.forgeItemTag("raw_materials/lead"))
387+
.pattern("RRR")
388+
.pattern("RRR")
389+
.pattern("RRR")
390+
.save(p, CreateNuclear.asResource("crafting/" + c.getName())))
352391
.item()
353392
.tag(CNTags.forgeItemTag("storage_blocks/raw_lead"))
354393
.build()
@@ -367,6 +406,17 @@ public class CNBlocks {
367406
public static final BlockEntry<Block> ENRICHED_SOUL_SOIL =
368407
CreateNuclear.REGISTRATE.block("enriched_soul_soil", Block::new)
369408
.initialProperties(() -> Blocks.SOUL_SOIL)
409+
.recipe((c, p) -> ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, c.get())
410+
.unlockedBy("has_nether_star", RegistrateRecipeProvider.has(Items.NETHER_STAR))
411+
.define('S', Blocks.SOUL_SOIL)
412+
.define('O', Blocks.OBSIDIAN)
413+
.define('N', Items.NETHER_STAR)
414+
.pattern("SOS")
415+
.pattern("ONO")
416+
.pattern("SOS")
417+
.showNotification(true)
418+
.save(p, CreateNuclear.asResource("crafting/" + c.getName()))
419+
)
370420
.simpleItem()
371421
.tag(BlockTags.MINEABLE_WITH_SHOVEL)
372422
.tag(CNBlockTags.ENRICHING_FIRE_BASE_BLOCKS.tag, BlockTags.NEEDS_DIAMOND_TOOL)

0 commit comments

Comments
 (0)