Skip to content

Commit

Permalink
Revamp overall progression, add Sky Steel
Browse files Browse the repository at this point in the history
  • Loading branch information
62832 committed Jul 28, 2023
1 parent d4fffd8 commit fbb98e6
Show file tree
Hide file tree
Showing 17 changed files with 216 additions and 110 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import appeng.core.definitions.AEItems;
import appeng.core.definitions.AEParts;
import appeng.core.definitions.BlockDefinition;
import appeng.decorative.AEDecorativeBlock;

import gripe._90.megacells.block.MEGACraftingBlockItem;
import gripe._90.megacells.block.MEGACraftingUnitType;
Expand All @@ -48,9 +49,11 @@ public static List<BlockDefinition<?>> getBlocks() {
.forceSolidOn();

// spotless:off
public static final BlockDefinition<AEDecorativeBlock> SKY_STEEL_BLOCK = block("Sky Steel Block", "sky_steel_block", () -> new AEDecorativeBlock(BlockBehaviour.Properties.of().strength(5.0f, 12.0f).requiresCorrectToolForDrops().mapColor(MapColor.METAL).sound(SoundType.METAL)));

public static final BlockDefinition<EnergyCellBlock> MEGA_ENERGY_CELL = block("Superdense Energy Cell", "mega_energy_cell", () -> new EnergyCellBlock(12800000, 3200, 12800), EnergyCellBlockItem::new);

public static final BlockDefinition<CraftingUnitBlock> MEGA_CRAFTING_UNIT = block("MEGA Crafting Unit", "mega_crafting_unit", () -> new CraftingUnitBlock(MEGACraftingUnitType.UNIT), null);
public static final BlockDefinition<CraftingUnitBlock> MEGA_CRAFTING_UNIT = block("MEGA Crafting Unit", "mega_crafting_unit", () -> new CraftingUnitBlock(MEGACraftingUnitType.UNIT));
public static final BlockDefinition<CraftingUnitBlock> CRAFTING_ACCELERATOR = craftingBlock("MEGA Crafting Co-Processing Unit", "mega_crafting_accelerator", () -> new CraftingUnitBlock(MEGACraftingUnitType.ACCELERATOR), () -> AEItems.ENGINEERING_PROCESSOR);
public static final BlockDefinition<CraftingUnitBlock> CRAFTING_STORAGE_1M = craftingBlock("1M MEGA Crafting Storage", "1m_crafting_storage", () -> new CraftingUnitBlock(MEGACraftingUnitType.STORAGE_1M), () -> MEGAItems.CELL_COMPONENT_1M);
public static final BlockDefinition<CraftingUnitBlock> CRAFTING_STORAGE_4M = craftingBlock("4M MEGA Crafting Storage", "4m_crafting_storage", () -> new CraftingUnitBlock(MEGACraftingUnitType.STORAGE_4M), () -> MEGAItems.CELL_COMPONENT_4M);
Expand All @@ -69,6 +72,11 @@ private static <T extends Block> BlockDefinition<T> craftingBlock(String english
(block, props) -> new MEGACraftingBlockItem(block, props, disassemblyExtra));
}

private static <T extends Block> BlockDefinition<T> block(String englishName, String id,
Supplier<T> blockSupplier) {
return block(englishName, id, blockSupplier, null);
}

private static <T extends Block> BlockDefinition<T> block(String englishName, String id, Supplier<T> blockSupplier,
BiFunction<Block, Item.Properties, BlockItem> itemFactory) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@ public static List<ItemDefinition<?>> getItems() {
}

// spotless:off
public static final ItemDefinition<MaterialItem> SKY_STEEL_INGOT = item("Sky Steel Ingot", "sky_steel_ingot", p -> new MaterialItem(p.fireResistant()));

public static final ItemDefinition<MaterialItem> ACCUMULATION_PROCESSOR_PRESS = item("Inscriber Accumulation Press", "accumulation_processor_press", MaterialItem::new);
public static final ItemDefinition<MaterialItem> ACCUMULATION_PROCESSOR_PRINT = item("Printed Accumulation Circuit", "printed_accumulation_processor", MaterialItem::new);
public static final ItemDefinition<MaterialItem> ACCUMULATION_PROCESSOR = item("Accumulation Processor", "accumulation_processor", MaterialItem::new);

public static final ItemDefinition<MaterialItem> MEGA_ITEM_CELL_HOUSING = item("MEGA Item Cell Housing", "mega_item_cell_housing", MaterialItem::new);
public static final ItemDefinition<MaterialItem> MEGA_FLUID_CELL_HOUSING = item("MEGA Fluid Cell Housing", "mega_fluid_cell_housing", MaterialItem::new);

Expand Down
19 changes: 19 additions & 0 deletions common/src/main/java/gripe/_90/megacells/definition/MEGATags.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,30 @@
import net.minecraft.resources.ResourceLocation;
import net.minecraft.tags.TagKey;
import net.minecraft.world.item.Item;
import net.minecraft.world.level.block.Block;

import gripe._90.megacells.util.Utils;

public final class MEGATags {
public static final TagKey<Item> SKY_STEEL_INGOT = itemTag(switch (Utils.PLATFORM.getLoader()) {
case FABRIC -> "c:sky_steel_ingots";
case FORGE -> "forge:ingots/sky_steel";
});

private static final String SKY_STEEL_BLOCK_TAG = switch (Utils.PLATFORM.getLoader()) {
case FABRIC -> "c:sky_steel_blocks";
case FORGE -> "forge:storage_blocks/sky_steel";
};
public static final TagKey<Block> SKY_STEEL_BLOCK = blockTag(SKY_STEEL_BLOCK_TAG);
public static final TagKey<Item> SKY_STEEL_BLOCK_ITEM = itemTag(SKY_STEEL_BLOCK_TAG);

public static final TagKey<Item> MEGA_PATTERN_PROVIDER = itemTag("megacells:mega_pattern_provider");

private static TagKey<Item> itemTag(String name) {
return TagKey.create(Registries.ITEM, new ResourceLocation(name));
}

private static TagKey<Block> blockTag(String name) {
return TagKey.create(Registries.BLOCK, new ResourceLocation(name));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,13 @@
import net.minecraft.world.item.CreativeModeTab;

public interface Platform {
Loader getLoader();

CreativeModeTab getCreativeTab(CreativeModeTab.DisplayItemsGenerator display);

boolean isModLoaded(String modId);

enum Loader {
FABRIC, FORGE
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ class ModelProvider extends FabricModelProvider {

@Override
public void generateBlockStateModels(BlockModelGenerators generator) {
generator.createTrivialCube(MEGABlocks.SKY_STEEL_BLOCK.block());

energyCell(generator);

var craftingUnits = List.of(
Expand All @@ -97,6 +99,12 @@ public void generateBlockStateModels(BlockModelGenerators generator) {

@Override
public void generateItemModels(ItemModelGenerators generator) {
generator.generateFlatItem(MEGAItems.SKY_STEEL_INGOT.asItem(), ModelTemplates.FLAT_ITEM);

generator.generateFlatItem(MEGAItems.ACCUMULATION_PROCESSOR_PRESS.asItem(), ModelTemplates.FLAT_ITEM);
generator.generateFlatItem(MEGAItems.ACCUMULATION_PROCESSOR_PRINT.asItem(), ModelTemplates.FLAT_ITEM);
generator.generateFlatItem(MEGAItems.ACCUMULATION_PROCESSOR.asItem(), ModelTemplates.FLAT_ITEM);

generator.generateFlatItem(MEGAItems.MEGA_ITEM_CELL_HOUSING.asItem(), ModelTemplates.FLAT_ITEM);
generator.generateFlatItem(MEGAItems.MEGA_FLUID_CELL_HOUSING.asItem(), ModelTemplates.FLAT_ITEM);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import net.minecraft.data.recipes.RecipeCategory;
import net.minecraft.data.recipes.ShapedRecipeBuilder;
import net.minecraft.data.recipes.ShapelessRecipeBuilder;
import net.minecraft.tags.FluidTags;
import net.minecraft.tags.TagKey;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.Items;
Expand All @@ -27,10 +28,13 @@
import appeng.items.storage.StorageTier;
import appeng.recipes.handlers.InscriberProcessType;
import appeng.recipes.handlers.InscriberRecipeBuilder;
import appeng.recipes.transform.TransformCircumstance;
import appeng.recipes.transform.TransformRecipeBuilder;

import gripe._90.megacells.definition.MEGABlocks;
import gripe._90.megacells.definition.MEGAItems;
import gripe._90.megacells.definition.MEGAParts;
import gripe._90.megacells.definition.MEGATags;
import gripe._90.megacells.integration.appbot.AppBotItems;
import gripe._90.megacells.util.Utils;

Expand All @@ -48,7 +52,7 @@ public void buildRecipes(@NotNull Consumer<FinishedRecipe> consumer) {
component(consumer, MEGAItems.TIER_64M, MEGAItems.TIER_16M, AEItems.MATTER_BALL.asItem());
component(consumer, MEGAItems.TIER_256M, MEGAItems.TIER_64M, AEItems.MATTER_BALL.asItem());

housing(consumer, MEGAItems.MEGA_ITEM_CELL_HOUSING, ConventionTags.IRON_INGOT);
housing(consumer, MEGAItems.MEGA_ITEM_CELL_HOUSING, MEGATags.SKY_STEEL_INGOT);
housing(consumer, MEGAItems.MEGA_FLUID_CELL_HOUSING, ConventionTags.COPPER_INGOT);

cell(consumer, MEGAItems.ITEM_CELL_1M, MEGAItems.CELL_COMPONENT_1M, MEGAItems.MEGA_ITEM_CELL_HOUSING, ConventionTags.IRON_INGOT);
Expand All @@ -72,10 +76,57 @@ public void buildRecipes(@NotNull Consumer<FinishedRecipe> consumer) {
portable(consumer, MEGAItems.PORTABLE_FLUID_CELL_16M, MEGAItems.CELL_COMPONENT_16M, MEGAItems.MEGA_FLUID_CELL_HOUSING);
portable(consumer, MEGAItems.PORTABLE_FLUID_CELL_64M, MEGAItems.CELL_COMPONENT_64M, MEGAItems.MEGA_FLUID_CELL_HOUSING);
portable(consumer, MEGAItems.PORTABLE_FLUID_CELL_256M, MEGAItems.CELL_COMPONENT_256M, MEGAItems.MEGA_FLUID_CELL_HOUSING);

specialisedComponent(consumer, MEGAItems.CELL_COMPONENT_16M, AEItems.SPATIAL_16_CELL_COMPONENT, MEGAItems.BULK_CELL_COMPONENT);
// spotless:on

ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, MEGABlocks.SKY_STEEL_BLOCK)
.pattern("###")
.pattern("###")
.pattern("###")
.define('#', MEGATags.SKY_STEEL_INGOT)
.unlockedBy("has_sky_steel_ingot", has(MEGATags.SKY_STEEL_INGOT))
.save(consumer, Utils.makeId("crafting/sky_steel_block"));
ShapelessRecipeBuilder.shapeless(RecipeCategory.MISC, MEGAItems.SKY_STEEL_INGOT, 9)
.requires(MEGATags.SKY_STEEL_BLOCK_ITEM)
.unlockedBy("has_sky_steel_ingot", has(MEGATags.SKY_STEEL_INGOT))
.save(consumer, Utils.makeId("crafting/sky_steel_ingot_from_sky_steel_block"));

TransformRecipeBuilder.transform(consumer, Utils.makeId("transform/sky_steel_ingot"), MEGAItems.SKY_STEEL_INGOT,
2, TransformCircumstance.fluid(FluidTags.WATER), Ingredient.of(ConventionTags.IRON_INGOT),
Ingredient.of(AEItems.CERTUS_QUARTZ_CRYSTAL_CHARGED), Ingredient.of(AEBlocks.SKY_STONE_BLOCK));

InscriberRecipeBuilder.inscribe(AEItems.SINGULARITY, MEGAItems.ACCUMULATION_PROCESSOR_PRESS, 1)
.setTop(Ingredient.of(AEItems.CALCULATION_PROCESSOR_PRESS))
.setBottom(Ingredient.of(AEItems.ENGINEERING_PROCESSOR_PRESS))
.setMode(InscriberProcessType.PRESS)
.save(consumer, Utils.makeId("inscriber/accumulation_processor_press"));
InscriberRecipeBuilder.inscribe(Items.IRON_BLOCK, MEGAItems.ACCUMULATION_PROCESSOR_PRESS, 1)
.setTop(Ingredient.of(MEGAItems.ACCUMULATION_PROCESSOR_PRESS))
.setMode(InscriberProcessType.INSCRIBE)
.save(consumer, Utils.makeId("inscriber/accumulation_processor_press_extra"));

InscriberRecipeBuilder.inscribe(MEGATags.SKY_STEEL_INGOT, MEGAItems.ACCUMULATION_PROCESSOR_PRINT, 1)
.setTop(Ingredient.of(MEGAItems.ACCUMULATION_PROCESSOR_PRESS))
.setMode(InscriberProcessType.INSCRIBE)
.save(consumer, Utils.makeId("inscriber/accumulation_processor_print"));
InscriberRecipeBuilder.inscribe(ConventionTags.FLUIX_DUST, MEGAItems.ACCUMULATION_PROCESSOR, 1)
.setTop(Ingredient.of(MEGAItems.ACCUMULATION_PROCESSOR_PRINT))
.setBottom(Ingredient.of(AEItems.SILICON_PRINT))
.setMode(InscriberProcessType.PRESS)
.save(consumer, Utils.makeId("inscriber/accumulation_processor"));

ShapedRecipeBuilder.shaped(RecipeCategory.MISC, MEGAItems.BULK_CELL_COMPONENT)
.pattern("aba")
.pattern("cdc")
.pattern("aea")
.define('a', AEItems.SKY_DUST)
.define('b', MEGAItems.ACCUMULATION_PROCESSOR)
.define('c', MEGAItems.CELL_COMPONENT_4M)
.define('d', AEBlocks.QUARTZ_VIBRANT_GLASS)
.define('e', AEItems.SPATIAL_2_CELL_COMPONENT)
.unlockedBy("has_cell_component_4m", has(MEGAItems.CELL_COMPONENT_4M))
.unlockedBy("has_2_cubed_spatial_cell_component", has(AEItems.SPATIAL_2_CELL_COMPONENT))
.save(consumer, Utils.makeId("crafting/bulk_cell_component"));

ShapedRecipeBuilder.shaped(RecipeCategory.MISC, MEGAItems.BULK_ITEM_CELL)
.pattern("aba")
.pattern("bcb")
Expand All @@ -92,9 +143,9 @@ public void buildRecipes(@NotNull Consumer<FinishedRecipe> consumer) {
.pattern("aba")
.pattern("aaa")
.define('a', AEBlocks.DENSE_ENERGY_CELL)
.define('b', AEItems.ENGINEERING_PROCESSOR)
.define('b', MEGAItems.ACCUMULATION_PROCESSOR)
.unlockedBy("has_dense_energy_cell", has(AEBlocks.DENSE_ENERGY_CELL))
.unlockedBy("has_engineering_processor", has(AEItems.ENGINEERING_PROCESSOR))
.unlockedBy("has_accumulation_processor", has(MEGAItems.ACCUMULATION_PROCESSOR))
.save(consumer, Utils.makeId("crafting/mega_energy_cell"));

ShapedRecipeBuilder.shaped(RecipeCategory.MISC, MEGABlocks.MEGA_CRAFTING_UNIT)
Expand All @@ -104,8 +155,9 @@ public void buildRecipes(@NotNull Consumer<FinishedRecipe> consumer) {
.define('a', AEBlocks.CRAFTING_UNIT)
.define('b', AEItems.LOGIC_PROCESSOR)
.define('c', AEParts.SMART_CABLE.item(AEColor.TRANSPARENT))
.define('d', AEItems.ENGINEERING_PROCESSOR)
.define('d', MEGAItems.ACCUMULATION_PROCESSOR)
.unlockedBy("has_logic_processor", has(AEItems.LOGIC_PROCESSOR))
.unlockedBy("has_accumulation_processor", has(MEGAItems.ACCUMULATION_PROCESSOR))
.save(consumer, Utils.makeId("crafting/mega_crafting_unit"));
craftingBlock(consumer, MEGABlocks.CRAFTING_ACCELERATOR, AEItems.ENGINEERING_PROCESSOR);
craftingBlock(consumer, MEGABlocks.CRAFTING_STORAGE_1M, MEGAItems.CELL_COMPONENT_1M);
Expand Down Expand Up @@ -135,25 +187,23 @@ public void buildRecipes(@NotNull Consumer<FinishedRecipe> consumer) {
.unlockedBy("has_matter_ball", has(AEItems.MATTER_BALL))
.save(consumer, Utils.makeId("crafting/compression_card"));
ShapedRecipeBuilder.shaped(RecipeCategory.MISC, MEGAParts.DECOMPRESSION_MODULE)
.pattern("ICI")
.pattern("E#E")
.pattern("IAI")
.pattern("C#E")
.pattern("ILI")
.define('I', ConventionTags.IRON_INGOT)
.define('A', MEGAItems.ACCUMULATION_PROCESSOR)
.define('C', AEItems.CALCULATION_PROCESSOR)
.define('E', AEItems.ENGINEERING_PROCESSOR)
.define('L', AEItems.LOGIC_PROCESSOR)
.define('#', MEGAItems.COMPRESSION_CARD)
.unlockedBy("has_accumulation_processor", has(MEGAItems.ACCUMULATION_PROCESSOR))
.unlockedBy("has_compression_card", has(MEGAItems.COMPRESSION_CARD))
.save(consumer, Utils.makeId("crafting/decompression_module"));

ShapedRecipeBuilder.shaped(RecipeCategory.MISC, MEGABlocks.MEGA_PATTERN_PROVIDER)
.pattern("ICI")
.pattern("VPV")
.pattern("ICI")
.define('C', AEItems.CALCULATION_PROCESSOR)
.define('I', ConventionTags.IRON_INGOT)
.define('P', AEBlocks.PATTERN_PROVIDER)
.define('V', AEBlocks.QUARTZ_VIBRANT_GLASS)
ShapelessRecipeBuilder.shapeless(RecipeCategory.MISC, MEGABlocks.MEGA_PATTERN_PROVIDER)
.requires(AEBlocks.PATTERN_PROVIDER)
.requires(MEGAItems.ACCUMULATION_PROCESSOR)
.unlockedBy("has_accumulation_processor", has(MEGAItems.ACCUMULATION_PROCESSOR))
.unlockedBy("has_pattern_provider", has(ConventionTags.PATTERN_PROVIDER))
.save(consumer, Utils.makeId("network/mega_pattern_provider"));

Expand Down Expand Up @@ -183,22 +233,14 @@ private void component(Consumer<FinishedRecipe> consumer, StorageTier tier, Stor
.pattern("cdc")
.pattern("aca")
.define('a', binder)
.define('b', AEItems.CALCULATION_PROCESSOR)
.define('b', MEGAItems.ACCUMULATION_PROCESSOR)
.define('c', precedingComponent)
.define('d', AEBlocks.QUARTZ_VIBRANT_GLASS)
.unlockedBy("has_accumulation_processor", has(MEGAItems.ACCUMULATION_PROCESSOR))
.unlockedBy("has_" + BuiltInRegistries.ITEM.getKey(precedingComponent).getPath(),
has(precedingComponent))
.save(consumer,
Utils.makeId(
"cells/" + BuiltInRegistries.ITEM.getKey(tier.componentSupplier().get()).getPath()));
}

private void specialisedComponent(Consumer<FinishedRecipe> consumer, ItemLike top, ItemLike bottom,
ItemDefinition<?> output) {
InscriberRecipeBuilder.inscribe(AEItems.SINGULARITY, output, 1)
.setMode(InscriberProcessType.PRESS)
.setTop(Ingredient.of(top)).setBottom(Ingredient.of(bottom))
.save(consumer, Utils.makeId("inscriber/" + output.id().getPath()));
.save(consumer, Utils
.makeId("cells/" + BuiltInRegistries.ITEM.getKey(tier.componentSupplier().get()).getPath()));
}

private void cell(Consumer<FinishedRecipe> consumer, ItemDefinition<?> cell, ItemDefinition<?> component,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import appeng.core.definitions.ItemDefinition;

import gripe._90.megacells.definition.MEGABlocks;
import gripe._90.megacells.definition.MEGAItems;
import gripe._90.megacells.definition.MEGAParts;
import gripe._90.megacells.definition.MEGATags;

Expand All @@ -27,6 +28,9 @@ static class Items extends FabricTagProvider.ItemTagProvider {

@Override
protected void addTags(HolderLookup.Provider provider) {
tag(MEGATags.SKY_STEEL_INGOT).add(getKey(MEGAItems.SKY_STEEL_INGOT));
tag(MEGATags.SKY_STEEL_BLOCK_ITEM).add(getKey(MEGABlocks.SKY_STEEL_BLOCK));

tag(P2PTunnelAttunement.getAttunementTag(P2PTunnelAttunement.ENERGY_TUNNEL))
.add(getKey(MEGABlocks.MEGA_ENERGY_CELL));
tag(MEGATags.MEGA_PATTERN_PROVIDER)
Expand All @@ -47,6 +51,7 @@ static class Blocks extends FabricTagProvider.BlockTagProvider {
@Override
protected void addTags(HolderLookup.Provider provider) {
MEGABlocks.getBlocks().forEach(block -> tag(BlockTags.MINEABLE_WITH_PICKAXE).add(getKey(block)));
tag(MEGATags.SKY_STEEL_BLOCK).add(getKey(MEGABlocks.SKY_STEEL_BLOCK));
}

private ResourceKey<Block> getKey(BlockDefinition<?> block) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@
import gripe._90.megacells.util.service.Platform;

public final class FabricPlatform implements Platform {
@Override
public Loader getLoader() {
return Loader.FABRIC;
}

@Override
public CreativeModeTab getCreativeTab(CreativeModeTab.DisplayItemsGenerator display) {
return FabricItemGroup.builder()
Expand Down
Loading

0 comments on commit fbb98e6

Please sign in to comment.