Proper Datagen

- Also: better flamethrower fuel registry
- Also: Blast Stove multiblock & my multiblock system.
This commit is contained in:
pouffy
2024-07-22 17:00:46 +01:00
parent 303be9dae4
commit a32804c1cb
291 changed files with 8792 additions and 2664 deletions

View File

@@ -1,5 +1,10 @@
package com.drmangotea.createindustry;
import com.drmangotea.createindustry.base.TFMGRegistrate;
import com.drmangotea.createindustry.base.datagen.TFMGDataGen;
import com.drmangotea.createindustry.items.weapons.flamethrover.BuiltinFlamethrowerFuelTypes;
import com.drmangotea.createindustry.items.weapons.flamethrover.FlamethrowerFuelType;
import com.drmangotea.createindustry.items.weapons.flamethrover.FlamethrowerFuelTypeManager;
import com.drmangotea.createindustry.registry.TFMGContraptions;
import com.drmangotea.createindustry.base.TFMGLangPartials;
import com.drmangotea.createindustry.config.TFMGConfigs;
@@ -9,9 +14,7 @@ import com.drmangotea.createindustry.worldgen.TFMGConfiguredFeatures;
import com.drmangotea.createindustry.worldgen.TFMGFeatures;
import com.drmangotea.createindustry.worldgen.TFMGOreConfigEntries;
import com.mojang.logging.LogUtils;
import com.simibubi.create.AllParticleTypes;
import com.simibubi.create.content.processing.burner.BlazeBurnerBlock;
import com.simibubi.create.foundation.data.CreateRegistrate;
import com.simibubi.create.foundation.data.LangMerger;
import com.simibubi.create.foundation.item.ItemDescription;
import com.simibubi.create.foundation.item.KineticStats;
@@ -47,7 +50,7 @@ public class CreateTFMG
public static final String MOD_ID = "createindustry";
public static final String NAME = "Create: The Factory Must Grow";
public static final CreateRegistrate REGISTRATE = CreateRegistrate.create(MOD_ID);
public static final TFMGRegistrate REGISTRATE = TFMGRegistrate.create();
public static final Logger LOGGER = LogUtils.getLogger();
static {
@@ -95,7 +98,7 @@ public class CreateTFMG
//
modEventBus.addListener(CreateTFMG::init);
MinecraftForge.EVENT_BUS.register(this);
modEventBus.addListener(EventPriority.LOWEST, CreateTFMG::gatherData);
modEventBus.addListener(EventPriority.LOWEST, TFMGDataGen::gatherData);
modEventBus.addListener(TFMGSoundEvents::register);
DistExecutor.safeRunWhenOn(Dist.CLIENT, () -> CreateTFMGClient::new);
modEventBus.addListener(this::clientSetup);
@@ -106,7 +109,7 @@ public class CreateTFMG
TFMGFluids.registerFluidInteractions();
event.enqueueWork(() -> {
BuiltinFlamethrowerFuelTypes.register();
registerHeater(TFMGBlocks.FIREBOX.get(), (level, pos, state) -> {
BlazeBurnerBlock.HeatLevel value = state.getValue(BlazeBurnerBlock.HEAT_LEVEL);
if (value == BlazeBurnerBlock.HeatLevel.NONE) {
@@ -124,11 +127,6 @@ public class CreateTFMG
});
}
@SuppressWarnings("removal")
public static void gatherData(GatherDataEvent event) {
DataGenerator gen = event.getGenerator();
gen.addProvider(true, new LangMerger(gen, MOD_ID, NAME, TFMGLangPartials.values()));
}
@SuppressWarnings("removal")
private void clientSetup(final FMLClientSetupEvent event) {
ItemBlockRenderTypes.setRenderLayer(TFMGColoredFires.GREEN_FIRE.get(), RenderType.cutout());
ItemBlockRenderTypes.setRenderLayer(TFMGColoredFires.BLUE_FIRE.get(), RenderType.cutout());
@@ -139,11 +137,18 @@ public class CreateTFMG
final Holder<PlacedFeature> initializeSimulatedOil = TFMGConfiguredFeatures.OIL_DEPOSIT_PLACED;
});
TFMGMobEffects.init();
}
@SubscribeEvent
public void onServerStarting(ServerStartingEvent event)
{
LOGGER.info("YEEEHAAW");
for (FlamethrowerFuelType type : FlamethrowerFuelTypeManager.BUILTIN_TYPE_MAP.values()) {
LOGGER.info("Registered Builtin Flamethrower Fuel type: {}", FlamethrowerFuelTypeManager.getIdForType(type));
}
for (FlamethrowerFuelType type : FlamethrowerFuelTypeManager.CUSTOM_TYPE_MAP.values()) {
LOGGER.info("Registered Custom Flamethrower Fuel type: {}", FlamethrowerFuelTypeManager.getIdForType(type));
}
}
public static ResourceLocation asResource(String path) {

View File

@@ -0,0 +1,105 @@
package com.drmangotea.createindustry.base;
import com.drmangotea.createindustry.blocks.TFMGHorizontalDirectionalBlock;
import com.drmangotea.createindustry.registry.TFMGCreativeModeTabs;
import com.tterrag.registrate.util.entry.BlockEntry;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.SlabBlock;
import net.minecraft.world.level.block.StairBlock;
import net.minecraft.world.level.block.WallBlock;
import static com.drmangotea.createindustry.CreateTFMG.REGISTRATE;
public class TFMGColoredBlocks {
static {
REGISTRATE.creativeModeTab(() -> TFMGCreativeModeTabs.TFMG_BUILDING_BLOCKS);
}
public static final BlockEntry<Block> BLACK_CONCRETE = REGISTRATE.coloredConcrete("black");
public static final BlockEntry<Block> WHITE_CONCRETE = REGISTRATE.coloredConcrete("white");
public static final BlockEntry<Block> BLUE_CONCRETE = REGISTRATE.coloredConcrete("blue");
public static final BlockEntry<Block> LIGHT_BLUE_CONCRETE = REGISTRATE.coloredConcrete("light_blue");
public static final BlockEntry<Block> RED_CONCRETE = REGISTRATE.coloredConcrete("red");
public static final BlockEntry<Block> GREEN_CONCRETE = REGISTRATE.coloredConcrete("green");
public static final BlockEntry<Block> LIME_CONCRETE = REGISTRATE.coloredConcrete("lime");
public static final BlockEntry<Block> PINK_CONCRETE = REGISTRATE.coloredConcrete("pink");
public static final BlockEntry<Block> MAGENTA_CONCRETE = REGISTRATE.coloredConcrete("magenta");
public static final BlockEntry<Block> YELLOW_CONCRETE = REGISTRATE.coloredConcrete("yellow");
public static final BlockEntry<Block> GRAY_CONCRETE = REGISTRATE.coloredConcrete("gray");
public static final BlockEntry<Block> LIGHT_GRAY_CONCRETE = REGISTRATE.coloredConcrete("light_gray");
public static final BlockEntry<Block> BROWN_CONCRETE = REGISTRATE.coloredConcrete("brown");
public static final BlockEntry<Block> CYAN_CONCRETE = REGISTRATE.coloredConcrete("cyan");
public static final BlockEntry<Block> PURPLE_CONCRETE = REGISTRATE.coloredConcrete("purple");
public static final BlockEntry<Block> ORANGE_CONCRETE = REGISTRATE.coloredConcrete("orange");
public static final BlockEntry<StairBlock> BLACK_CONCRETE_STAIRS = REGISTRATE.coloredConcreteStair("black");
public static final BlockEntry<StairBlock> WHITE_CONCRETE_STAIRS = REGISTRATE.coloredConcreteStair("white");
public static final BlockEntry<StairBlock> BLUE_CONCRETE_STAIRS = REGISTRATE.coloredConcreteStair("blue");
public static final BlockEntry<StairBlock> LIGHT_BLUE_CONCRETE_STAIRS = REGISTRATE.coloredConcreteStair("light_blue");
public static final BlockEntry<StairBlock> RED_CONCRETE_STAIRS = REGISTRATE.coloredConcreteStair("red");
public static final BlockEntry<StairBlock> GREEN_CONCRETE_STAIRS = REGISTRATE.coloredConcreteStair("green");
public static final BlockEntry<StairBlock> LIME_CONCRETE_STAIRS = REGISTRATE.coloredConcreteStair("lime");
public static final BlockEntry<StairBlock> PINK_CONCRETE_STAIRS = REGISTRATE.coloredConcreteStair("pink");
public static final BlockEntry<StairBlock> MAGENTA_CONCRETE_STAIRS = REGISTRATE.coloredConcreteStair("magenta");
public static final BlockEntry<StairBlock> YELLOW_CONCRETE_STAIRS = REGISTRATE.coloredConcreteStair("yellow");
public static final BlockEntry<StairBlock> GRAY_CONCRETE_STAIRS = REGISTRATE.coloredConcreteStair("gray");
public static final BlockEntry<StairBlock> LIGHT_GRAY_CONCRETE_STAIRS = REGISTRATE.coloredConcreteStair("light_gray");
public static final BlockEntry<StairBlock> BROWN_CONCRETE_STAIRS = REGISTRATE.coloredConcreteStair("brown");
public static final BlockEntry<StairBlock> CYAN_CONCRETE_STAIRS = REGISTRATE.coloredConcreteStair("cyan");
public static final BlockEntry<StairBlock> PURPLE_CONCRETE_STAIRS = REGISTRATE.coloredConcreteStair("purple");
public static final BlockEntry<StairBlock> ORANGE_CONCRETE_STAIRS = REGISTRATE.coloredConcreteStair("orange");
public static final BlockEntry<SlabBlock> BLACK_CONCRETE_SLAB = REGISTRATE.coloredConcreteSlab("black");
public static final BlockEntry<SlabBlock> WHITE_CONCRETE_SLAB = REGISTRATE.coloredConcreteSlab("white");
public static final BlockEntry<SlabBlock> BLUE_CONCRETE_SLAB = REGISTRATE.coloredConcreteSlab("blue");
public static final BlockEntry<SlabBlock> LIGHT_BLUE_CONCRETE_SLAB = REGISTRATE.coloredConcreteSlab("light_blue");
public static final BlockEntry<SlabBlock> RED_CONCRETE_SLAB = REGISTRATE.coloredConcreteSlab("red");
public static final BlockEntry<SlabBlock> GREEN_CONCRETE_SLAB = REGISTRATE.coloredConcreteSlab("green");
public static final BlockEntry<SlabBlock> LIME_CONCRETE_SLAB = REGISTRATE.coloredConcreteSlab("lime");
public static final BlockEntry<SlabBlock> PINK_CONCRETE_SLAB = REGISTRATE.coloredConcreteSlab("pink");
public static final BlockEntry<SlabBlock> MAGENTA_CONCRETE_SLAB = REGISTRATE.coloredConcreteSlab("magenta");
public static final BlockEntry<SlabBlock> YELLOW_CONCRETE_SLAB = REGISTRATE.coloredConcreteSlab("yellow");
public static final BlockEntry<SlabBlock> GRAY_CONCRETE_SLAB = REGISTRATE.coloredConcreteSlab("gray");
public static final BlockEntry<SlabBlock> LIGHT_GRAY_CONCRETE_SLAB = REGISTRATE.coloredConcreteSlab("light_gray");
public static final BlockEntry<SlabBlock> BROWN_CONCRETE_SLAB = REGISTRATE.coloredConcreteSlab("brown");
public static final BlockEntry<SlabBlock> CYAN_CONCRETE_SLAB = REGISTRATE.coloredConcreteSlab("cyan");
public static final BlockEntry<SlabBlock> PURPLE_CONCRETE_SLAB = REGISTRATE.coloredConcreteSlab("purple");
public static final BlockEntry<SlabBlock> ORANGE_CONCRETE_SLAB = REGISTRATE.coloredConcreteSlab("orange");
public static final BlockEntry<WallBlock> BLACK_CONCRETE_WALL = REGISTRATE.coloredConcreteWall("black");
public static final BlockEntry<WallBlock> WHITE_CONCRETE_WALL = REGISTRATE.coloredConcreteWall("white");
public static final BlockEntry<WallBlock> BLUE_CONCRETE_WALL = REGISTRATE.coloredConcreteWall("blue");
public static final BlockEntry<WallBlock> LIGHT_BLUE_CONCRETE_WALL = REGISTRATE.coloredConcreteWall("light_blue");
public static final BlockEntry<WallBlock> RED_CONCRETE_WALL = REGISTRATE.coloredConcreteWall("red");
public static final BlockEntry<WallBlock> GREEN_CONCRETE_WALL = REGISTRATE.coloredConcreteWall("green");
public static final BlockEntry<WallBlock> LIME_CONCRETE_WALL = REGISTRATE.coloredConcreteWall("lime");
public static final BlockEntry<WallBlock> PINK_CONCRETE_WALL = REGISTRATE.coloredConcreteWall("pink");
public static final BlockEntry<WallBlock> MAGENTA_CONCRETE_WALL = REGISTRATE.coloredConcreteWall("magenta");
public static final BlockEntry<WallBlock> YELLOW_CONCRETE_WALL = REGISTRATE.coloredConcreteWall("yellow");
public static final BlockEntry<WallBlock> GRAY_CONCRETE_WALL = REGISTRATE.coloredConcreteWall("gray");
public static final BlockEntry<WallBlock> LIGHT_GRAY_CONCRETE_WALL = REGISTRATE.coloredConcreteWall("light_gray");
public static final BlockEntry<WallBlock> BROWN_CONCRETE_WALL = REGISTRATE.coloredConcreteWall("brown");
public static final BlockEntry<WallBlock> CYAN_CONCRETE_WALL = REGISTRATE.coloredConcreteWall("cyan");
public static final BlockEntry<WallBlock> PURPLE_CONCRETE_WALL = REGISTRATE.coloredConcreteWall("purple");
public static final BlockEntry<WallBlock> ORANGE_CONCRETE_WALL = REGISTRATE.coloredConcreteWall("orange");
public static final BlockEntry<TFMGHorizontalDirectionalBlock> WHITE_CAUTION_BLOCK = REGISTRATE.coloredCautionBlock("white");
public static final BlockEntry<TFMGHorizontalDirectionalBlock> BLUE_CAUTION_BLOCK = REGISTRATE.coloredCautionBlock("blue");
public static final BlockEntry<TFMGHorizontalDirectionalBlock> LIGHT_BLUE_CAUTION_BLOCK = REGISTRATE.coloredCautionBlock("light_blue");
public static final BlockEntry<TFMGHorizontalDirectionalBlock> RED_CAUTION_BLOCK = REGISTRATE.coloredCautionBlock("red");
public static final BlockEntry<TFMGHorizontalDirectionalBlock> GREEN_CAUTION_BLOCK = REGISTRATE.coloredCautionBlock("green");
public static final BlockEntry<TFMGHorizontalDirectionalBlock> LIME_CAUTION_BLOCK = REGISTRATE.coloredCautionBlock("lime");
public static final BlockEntry<TFMGHorizontalDirectionalBlock> PINK_CAUTION_BLOCK = REGISTRATE.coloredCautionBlock("pink");
public static final BlockEntry<TFMGHorizontalDirectionalBlock> MAGENTA_CAUTION_BLOCK = REGISTRATE.coloredCautionBlock("magenta");
public static final BlockEntry<TFMGHorizontalDirectionalBlock> YELLOW_CAUTION_BLOCK = REGISTRATE.coloredCautionBlock("yellow");
public static final BlockEntry<TFMGHorizontalDirectionalBlock> GRAY_CAUTION_BLOCK = REGISTRATE.coloredCautionBlock("gray");
public static final BlockEntry<TFMGHorizontalDirectionalBlock> LIGHT_GRAY_CAUTION_BLOCK = REGISTRATE.coloredCautionBlock("light_gray");
public static final BlockEntry<TFMGHorizontalDirectionalBlock> BROWN_CAUTION_BLOCK = REGISTRATE.coloredCautionBlock("brown");
public static final BlockEntry<TFMGHorizontalDirectionalBlock> CYAN_CAUTION_BLOCK = REGISTRATE.coloredCautionBlock("cyan");
public static final BlockEntry<TFMGHorizontalDirectionalBlock> PURPLE_CAUTION_BLOCK = REGISTRATE.coloredCautionBlock("purple");
public static final BlockEntry<TFMGHorizontalDirectionalBlock> ORANGE_CAUTION_BLOCK = REGISTRATE.coloredCautionBlock("orange");
public static void register() {
// NO-OP
}
}

View File

@@ -0,0 +1,137 @@
package com.drmangotea.createindustry.base;
import com.drmangotea.createindustry.CreateTFMG;
import com.drmangotea.createindustry.blocks.TFMGHorizontalDirectionalBlock;
import com.drmangotea.createindustry.registry.TFMGBlocks;
import com.simibubi.create.foundation.data.CreateRegistrate;
import com.tterrag.registrate.util.DataIngredient;
import com.tterrag.registrate.util.entry.BlockEntry;
import net.minecraft.tags.BlockTags;
import net.minecraft.world.item.Item;
import net.minecraft.world.level.block.*;
import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraft.world.level.material.MaterialColor;
import net.minecraftforge.registries.ForgeRegistries;
import static com.simibubi.create.foundation.data.BlockStateGen.simpleCubeAll;
import static com.simibubi.create.foundation.data.ModelGen.customItemModel;
import static com.simibubi.create.foundation.data.TagGen.pickaxeOnly;
public class TFMGRegistrate extends CreateRegistrate {
public static String autoLang(String id) {
StringBuilder builder = new StringBuilder();
boolean b = true;
for (char c: id.toCharArray()) {
if(c == '_') {
builder.append(' ');
b = true;
} else {
builder.append(b ? String.valueOf(c).toUpperCase() : c);
b = false;
}
}
return builder.toString();
}
protected TFMGRegistrate() {
super(CreateTFMG.MOD_ID);
}
public static TFMGRegistrate create() {
return new TFMGRegistrate();
}
public static Block getBlock(String name) {
return CreateTFMG.REGISTRATE.get(name, ForgeRegistries.BLOCKS.getRegistryKey()).get();
}
public static Item getItem(String name) {
return CreateTFMG.REGISTRATE.get(name, ForgeRegistries.ITEMS.getRegistryKey()).get();
}
public static Item getBucket(String name) {
return CreateTFMG.REGISTRATE.get(name+"_bucket", ForgeRegistries.ITEMS.getRegistryKey()).get();
}
public BlockEntry<Block> coloredConcrete(String pColor) {
return this.block(pColor + "_concrete", Block::new)
.initialProperties(() -> Blocks.STONE)
.properties(p -> p.color(MaterialColor.COLOR_LIGHT_GRAY))
.properties(BlockBehaviour.Properties::requiresCorrectToolForDrops)
.transform(pickaxeOnly())
.blockstate(simpleCubeAll(pColor + "_concrete"))
.tag(BlockTags.NEEDS_STONE_TOOL)
.item()
.build()
.lang(autoLang(pColor + "_concrete"))
.register();
}
public BlockEntry<StairBlock> coloredConcreteStair(String pColor) {
return this.block(pColor + "_concrete_stairs", p -> new StairBlock(() -> TFMGBlocks.CONCRETE.get().defaultBlockState(), p))
.initialProperties(() -> Blocks.STONE)
.properties(p -> p.color(MaterialColor.COLOR_LIGHT_GRAY))
.properties(BlockBehaviour.Properties::requiresCorrectToolForDrops)
.transform(pickaxeOnly())
.blockstate((c, p) -> TFMGVanillaBlockStates.generateStairBlockState(c, p, pColor + "_concrete"))
.tag(BlockTags.NEEDS_STONE_TOOL)
.tag(BlockTags.STAIRS)
.recipe((c, p) -> p.stonecutting(DataIngredient.items(getBlock(pColor + "_concrete")), c::get, 1))
.item()
.transform(b -> TFMGVanillaBlockStates.transformStairItem(b, pColor + "_concrete"))
.build()
.lang(autoLang(pColor + "_concrete_stairs"))
.register();
}
public BlockEntry<SlabBlock> coloredConcreteSlab(String pColor) {
return this.block(pColor + "_concrete_slab", SlabBlock::new)
.initialProperties(() -> Blocks.STONE)
.properties(p -> p.color(MaterialColor.COLOR_LIGHT_GRAY))
.properties(BlockBehaviour.Properties::requiresCorrectToolForDrops)
.transform(pickaxeOnly())
.blockstate((c, p) -> TFMGVanillaBlockStates.generateSlabBlockState(c, p, pColor + "_concrete"))
.tag(BlockTags.NEEDS_STONE_TOOL)
.tag(BlockTags.SLABS)
.recipe((c, p) -> p.stonecutting(DataIngredient.items(getBlock(pColor + "_concrete")), c::get, 2))
.item()
.transform(customItemModel(pColor + "_concrete_bottom"))
.lang(autoLang(pColor + "_concrete_slab"))
.register();
}
public BlockEntry<WallBlock> coloredConcreteWall(String pColor) {
return this.block(pColor + "_concrete_wall", WallBlock::new)
.initialProperties(() -> Blocks.STONE)
.properties(p -> p.color(MaterialColor.COLOR_LIGHT_GRAY))
.properties(BlockBehaviour.Properties::requiresCorrectToolForDrops)
.transform(pickaxeOnly())
.blockstate((c, p) -> TFMGVanillaBlockStates.generateWallBlockState(c, p, pColor + "_concrete"))
.tag(BlockTags.NEEDS_STONE_TOOL)
.tag(BlockTags.WALLS)
.recipe((c, p) -> p.stonecutting(DataIngredient.items(getBlock(pColor + "_concrete")), c::get, 1))
.item()
.transform(b -> TFMGVanillaBlockStates.transformWallItem(b, pColor + "_concrete"))
.build()
.lang(autoLang(pColor + "_concrete_wall"))
.register();
}
public BlockEntry<TFMGHorizontalDirectionalBlock> coloredCautionBlock(String pColor) {
return this.block(pColor + "_caution_block", TFMGHorizontalDirectionalBlock::new)
.initialProperties(() -> Blocks.COPPER_BLOCK)
.properties(p -> p.color(MaterialColor.COLOR_LIGHT_GRAY))
.properties(BlockBehaviour.Properties::requiresCorrectToolForDrops)
.properties(p -> p.sound(SoundType.NETHERITE_BLOCK))
.transform(pickaxeOnly())
.blockstate((c, p) -> p.horizontalBlock(c.get(), p.models()
.withExistingParent(c.getName(), p.modLoc("block/caution_block"))
.texture("0", p.modLoc("block/caution_block/" + pColor))
.texture("particle", p.modLoc("block/caution_block/" + pColor))
))
.tag(BlockTags.NEEDS_STONE_TOOL)
.item()
.build()
.lang(autoLang(pColor + "_caution_block"))
.register();
}
}

View File

@@ -1,7 +1,7 @@
package com.drmangotea.createindustry.base.creative_mode_tabs;
import com.drmangotea.createindustry.registry.TFMGBlocks;
import com.drmangotea.createindustry.base.TFMGColoredBlocks;
import net.minecraft.core.NonNullList;
import net.minecraft.world.item.ItemStack;
@@ -16,6 +16,6 @@ public class BuldingCreativeModeTab extends TFMGCreativeModeTab {
@Override
public ItemStack makeIcon() {
return TFMGBlocks.CONCRETE.asStack();
return TFMGColoredBlocks.MAGENTA_CONCRETE.asStack();
}
}

View File

@@ -0,0 +1,64 @@
package com.drmangotea.createindustry.base.datagen;
import com.drmangotea.createindustry.CreateTFMG;
import com.drmangotea.createindustry.base.datagen.recipe.TFMGProcessingRecipeGen;
import com.drmangotea.createindustry.base.datagen.recipe.create.MechanicalCraftingGen;
import com.drmangotea.createindustry.base.datagen.recipe.create.SequencedAssemblyGen;
import com.drmangotea.createindustry.base.datagen.recipe.vanilla.TFMGStandardRecipeGen;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.simibubi.create.foundation.utility.FilesHelper;
import com.tterrag.registrate.providers.ProviderType;
import net.minecraft.data.DataGenerator;
import net.minecraftforge.common.data.ExistingFileHelper;
import net.minecraftforge.data.event.GatherDataEvent;
import java.util.Map;
import java.util.function.BiConsumer;
public class TFMGDataGen {
public static void gatherData(GatherDataEvent event) {
addExtraRegistrateData();
DataGenerator generator = event.getGenerator();
ExistingFileHelper existingFileHelper = event.getExistingFileHelper();
boolean client = event.includeClient();
boolean server = event.includeServer();
if (server) {
//generator.addProvider(true, new MStandardRecipeGen(generator));
TFMGProcessingRecipeGen.registerAll(generator);
generator.addProvider(true, new SequencedAssemblyGen(generator));
generator.addProvider(true, new MechanicalCraftingGen(generator));
generator.addProvider(true, new TFMGStandardRecipeGen(generator));
}
}
private static void addExtraRegistrateData() {
TFMGRegistrateTags.addGenerators();
CreateTFMG.REGISTRATE.addDataGenerator(ProviderType.LANG, provider -> {
BiConsumer<String, String> langConsumer = provider::add;
provideDefaultLang("interface", langConsumer);
provideDefaultLang("ponders", langConsumer);
provideDefaultLang("tooltips", langConsumer);
});
}
private static void provideDefaultLang(String fileName, BiConsumer<String, String> consumer) {
String path = "assets/createindustry/lang/default/" + fileName + ".json";
JsonElement jsonElement = FilesHelper.loadJsonResource(path);
if (jsonElement == null) {
throw new IllegalStateException(String.format("Could not find default lang file: %s", path));
}
JsonObject jsonObject = jsonElement.getAsJsonObject();
for (Map.Entry<String, JsonElement> entry : jsonObject.entrySet()) {
String key = entry.getKey();
String value = entry.getValue().getAsString();
consumer.accept(key, value);
}
}
}

View File

@@ -0,0 +1,37 @@
package com.drmangotea.createindustry.base.datagen;
import com.drmangotea.createindustry.CreateTFMG;
import com.drmangotea.createindustry.registry.TFMGTags;
import com.simibubi.create.AllTags;
import com.tterrag.registrate.providers.ProviderType;
import com.tterrag.registrate.providers.RegistrateTagsProvider;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.item.Item;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.material.Fluid;
public class TFMGRegistrateTags {
public static void addGenerators() {
CreateTFMG.REGISTRATE.addDataGenerator(ProviderType.BLOCK_TAGS, TFMGRegistrateTags::genBlockTags);
CreateTFMG.REGISTRATE.addDataGenerator(ProviderType.ITEM_TAGS, TFMGRegistrateTags::genItemTags);
CreateTFMG.REGISTRATE.addDataGenerator(ProviderType.FLUID_TAGS, TFMGRegistrateTags::genFluidTags);
CreateTFMG.REGISTRATE.addDataGenerator(ProviderType.ENTITY_TAGS, TFMGRegistrateTags::genEntityTags);
}
private static void genBlockTags(RegistrateTagsProvider<Block> prov) {
prov.tag(TFMGTags.TFMGBlockTags.AIR_INTAKE_TRANSPARENT.tag).addTag(AllTags.AllBlockTags.FAN_TRANSPARENT.tag).add(Blocks.MAGMA_BLOCK);
}
private static void genItemTags(RegistrateTagsProvider<Item> prov) {
}
private static void genFluidTags(RegistrateTagsProvider<Fluid> prov) {
}
private static void genEntityTags(RegistrateTagsProvider<EntityType<?>> prov) {
}
}

View File

@@ -0,0 +1,146 @@
package com.drmangotea.createindustry.base.datagen.recipe;
import com.drmangotea.createindustry.CreateTFMG;
import com.drmangotea.createindustry.base.datagen.recipe.create.*;
import com.drmangotea.createindustry.base.datagen.recipe.tfmg.*;
import com.simibubi.create.content.processing.recipe.ProcessingRecipe;
import com.simibubi.create.content.processing.recipe.ProcessingRecipeBuilder;
import com.simibubi.create.content.processing.recipe.ProcessingRecipeSerializer;
import com.simibubi.create.foundation.recipe.IRecipeTypeInfo;
import com.simibubi.create.foundation.utility.RegisteredObjects;
import net.minecraft.data.CachedOutput;
import net.minecraft.data.DataGenerator;
import net.minecraft.data.DataProvider;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.item.crafting.Ingredient;
import net.minecraft.world.level.ItemLike;
import net.minecraftforge.fluids.FluidType;
import org.jetbrains.annotations.NotNull;
import java.util.ArrayList;
import java.util.List;
import java.util.function.Supplier;
import java.util.function.UnaryOperator;
public abstract class TFMGProcessingRecipeGen extends TFMGRecipeProvider {
protected static final List<TFMGProcessingRecipeGen> GENERATORS = new ArrayList<>();
protected static final int BUCKET = FluidType.BUCKET_VOLUME;
protected static final int BOTTLE = 250;
public TFMGProcessingRecipeGen(DataGenerator generator) {
super(generator);
}
public static void registerAll(DataGenerator gen) {
//TFMG
GENERATORS.add(new CastingGen(gen));
GENERATORS.add(new CokingGen(gen));
GENERATORS.add(new DistillationGen(gen));
GENERATORS.add(new IndustrialBlastingGen(gen));
GENERATORS.add(new GasBlastingGen(gen));
//Create
GENERATORS.add(new CompactingGen(gen));
GENERATORS.add(new CrushingGen(gen));
GENERATORS.add(new FillingGen(gen));
GENERATORS.add(new ItemApplicationGen(gen));
GENERATORS.add(new MillingGen(gen));
GENERATORS.add(new MixingGen(gen));
GENERATORS.add(new PressingGen(gen));
gen.addProvider(true, new DataProvider() {
@Override
public String getName() {
return "TFMG's Processing Recipes";
}
@Override
public void run(@NotNull CachedOutput dc) {
GENERATORS.forEach(g -> {
try {
g.run(dc);
} catch (Exception e) {
e.printStackTrace();
}
});
}
});
}
/**
* Create a processing recipe with a single itemstack ingredient, using its id
* as the name of the recipe
*/
protected <T extends ProcessingRecipe<?>> GeneratedRecipe create(String namespace,
Supplier<ItemLike> singleIngredient, UnaryOperator<ProcessingRecipeBuilder<T>> transform) {
ProcessingRecipeSerializer<T> serializer = getSerializer();
GeneratedRecipe generatedRecipe = c -> {
ItemLike itemLike = singleIngredient.get();
transform
.apply(new ProcessingRecipeBuilder<>(serializer.getFactory(),
new ResourceLocation(namespace, RegisteredObjects.getKeyOrThrow(itemLike.asItem())
.getPath())).withItemIngredients(Ingredient.of(itemLike)))
.build(c);
};
all.add(generatedRecipe);
return generatedRecipe;
}
/**
* Create a processing recipe with a single itemstack ingredient, using its id
* as the name of the recipe
*/
<T extends ProcessingRecipe<?>> GeneratedRecipe create(Supplier<ItemLike> singleIngredient,
UnaryOperator<ProcessingRecipeBuilder<T>> transform) {
return create(CreateTFMG.MOD_ID, singleIngredient, transform);
}
protected <T extends ProcessingRecipe<?>> GeneratedRecipe createWithDeferredId(Supplier<ResourceLocation> name,
UnaryOperator<ProcessingRecipeBuilder<T>> transform) {
ProcessingRecipeSerializer<T> serializer = getSerializer();
GeneratedRecipe generatedRecipe =
c -> transform.apply(new ProcessingRecipeBuilder<>(serializer.getFactory(), name.get()))
.build(c);
all.add(generatedRecipe);
return generatedRecipe;
}
/**
* Create a new processing recipe, with recipe definitions provided by the
* function
*/
protected <T extends ProcessingRecipe<?>> GeneratedRecipe create(ResourceLocation name,
UnaryOperator<ProcessingRecipeBuilder<T>> transform) {
return createWithDeferredId(() -> name, transform);
}
/**
* Create a new processing recipe, with recipe definitions provided by the
* function
*/
<T extends ProcessingRecipe<?>> GeneratedRecipe create(String name,
UnaryOperator<ProcessingRecipeBuilder<T>> transform) {
return create(CreateTFMG.asResource(name), transform);
}
protected abstract IRecipeTypeInfo getRecipeType();
protected <T extends ProcessingRecipe<?>> ProcessingRecipeSerializer<T> getSerializer() {
return getRecipeType().getSerializer();
}
protected Supplier<ResourceLocation> idWithSuffix(Supplier<ItemLike> item, String suffix) {
return () -> {
ResourceLocation registryName = RegisteredObjects.getKeyOrThrow(item.get()
.asItem());
return CreateTFMG.asResource(registryName.getPath() + suffix);
};
}
@Override
public String getName() {
return "TFMG's Processing Recipes: " + getRecipeType().getId()
.getPath();
}
}

View File

@@ -0,0 +1,480 @@
package com.drmangotea.createindustry.base.datagen.recipe;
import com.drmangotea.createindustry.CreateTFMG;
import com.drmangotea.createindustry.base.TFMGRegistrate;
import com.drmangotea.createindustry.registry.TFMGBlocks;
import com.drmangotea.createindustry.registry.TFMGFluids;
import com.drmangotea.createindustry.registry.TFMGItems;
import com.drmangotea.createindustry.registry.TFMGPaletteStoneTypes;
import com.simibubi.create.AllFluids;
import com.simibubi.create.AllItems;
import com.simibubi.create.content.decoration.palettes.AllPaletteStoneTypes;
import com.tterrag.registrate.providers.ProviderType;
import com.tterrag.registrate.util.DataIngredient;
import net.minecraft.data.DataGenerator;
import net.minecraft.data.recipes.FinishedRecipe;
import net.minecraft.data.recipes.RecipeProvider;
import net.minecraft.data.recipes.SingleItemRecipeBuilder;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.tags.TagKey;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.Items;
import net.minecraft.world.level.ItemLike;
import net.minecraft.world.level.material.Fluid;
import net.minecraft.world.level.material.Fluids;
import net.minecraftforge.registries.ForgeRegistries;
import javax.annotation.ParametersAreNonnullByDefault;
import java.util.ArrayList;
import java.util.List;
import java.util.function.Consumer;
import java.util.function.Supplier;
@ParametersAreNonnullByDefault
public class TFMGRecipeProvider extends RecipeProvider {
protected final List<GeneratedRecipe> all = new ArrayList<>();
public TFMGRecipeProvider(DataGenerator generator) {
super(generator);
}
@Override
protected void buildCraftingRecipes(Consumer<FinishedRecipe> consumer) {
all.forEach(c -> c.register(consumer));
CreateTFMG.LOGGER.info("{} registered {} recipe{}", getName(), all.size(), all.size() == 1 ? "" : "s");
}
protected GeneratedRecipe register(GeneratedRecipe recipe) {
all.add(recipe);
return recipe;
}
@FunctionalInterface
public interface GeneratedRecipe {
void register(Consumer<FinishedRecipe> consumer);
}
public static class Marker {
}
public static class IT {
public static TagKey<Item> aluminumIngot() {
return TagKey.create(ForgeRegistries.ITEMS.getRegistryKey(), new ResourceLocation("forge", "ingots/aluminum"));
}
public static TagKey<Item> steelIngot() {
return TagKey.create(ForgeRegistries.ITEMS.getRegistryKey(), new ResourceLocation("forge", "ingots/steel"));
}
public static TagKey<Item> copperIngot() {
return TagKey.create(ForgeRegistries.ITEMS.getRegistryKey(), new ResourceLocation("forge", "ingots/copper"));
}
public static TagKey<Item> zincIngot() {
return TagKey.create(ForgeRegistries.ITEMS.getRegistryKey(), new ResourceLocation("forge", "ingots/zinc"));
}
public static TagKey<Item> bauxiteStoneType() {
return TFMGPaletteStoneTypes.BAUXITE.materialTag;
}
public static TagKey<Item> galenaStoneType() {
return TFMGPaletteStoneTypes.GALENA.materialTag;
}
public static TagKey<Item> planks() {
return TagKey.create(ForgeRegistries.ITEMS.getRegistryKey(), new ResourceLocation("minecraft", "planks"));
}
public static TagKey<Item> string() {
return TagKey.create(ForgeRegistries.ITEMS.getRegistryKey(), new ResourceLocation("forge", "string"));
}
public static TagKey<Item> copperWire() {
return TagKey.create(ForgeRegistries.ITEMS.getRegistryKey(), new ResourceLocation("forge", "wires/copper"));
}
public static TagKey<Item> copperPlate() {
return TagKey.create(ForgeRegistries.ITEMS.getRegistryKey(), new ResourceLocation("forge", "plates/copper"));
}
public static TagKey<Item> leadIngot() {
return TagKey.create(ForgeRegistries.ITEMS.getRegistryKey(), new ResourceLocation("forge", "ingots/lead"));
}
public static TagKey<Item> nickelIngot() {
return TagKey.create(ForgeRegistries.ITEMS.getRegistryKey(), new ResourceLocation("forge", "ingots/nickel"));
}
public static TagKey<Item> brassIngot() {
return TagKey.create(ForgeRegistries.ITEMS.getRegistryKey(), new ResourceLocation("forge", "ingots/brass"));
}
}
public static class I {
public static ItemLike coal() {
return Items.COAL;
}
public static ItemLike charcoal() {
return Items.CHARCOAL;
}
public static ItemLike coalCoke() {
return TFMGItems.COAL_COKE.get();
}
public static ItemLike coalCokeDust() {
return TFMGItems.COAL_COKE_DUST.get();
}
public static ItemLike steelIngot() {
return TFMGItems.STEEL_INGOT.get();
}
public static ItemLike steelBlock() {
return TFMGBlocks.STEEL_BLOCK.get();
}
public static ItemLike blastingMixture() {
return TFMGItems.BLASTING_MIXTURE.get();
}
public static ItemLike bitumen() {
return TFMGItems.BITUMEN.get();
}
public static ItemLike cinderFlour() {
return AllItems.CINDER_FLOUR.get();
}
public static ItemLike cinderflourBlock() {
return TFMGBlocks.CINDERFLOUR_BLOCK.get();
}
public static ItemLike plasticSheet() {
return TFMGItems.PLASTIC_SHEET.get();
}
public static ItemLike crimsite() {
return AllPaletteStoneTypes.CRIMSITE.getBaseBlock().get();
}
public static ItemLike thermitePowder() {
return TFMGItems.THERMITE_POWDER.get();
}
public static ItemLike crushedRawAluminum() {
return AllItems.CRUSHED_BAUXITE.get();
}
public static ItemLike experienceNugget() {
return AllItems.EXP_NUGGET.get();
}
public static ItemLike copperSulfate() {
return TFMGItems.COPPER_SULFATE.get();
}
public static ItemLike boneMeal() {
return Items.BONE_MEAL;
}
public static ItemLike blueDye() {
return Items.BLUE_DYE;
}
public static ItemLike cyanDye() {
return Items.CYAN_DYE;
}
public static ItemLike crushedRawLead() {
return AllItems.CRUSHED_LEAD.get();
}
public static ItemLike lignite() {
return TFMGBlocks.LIGNITE.get();
}
public static ItemLike limestone() {
return AllPaletteStoneTypes.LIMESTONE.getBaseBlock().get();
}
public static ItemLike limesand() {
return TFMGItems.LIMESAND.get();
}
public static ItemLike dirt() {
return Items.DIRT;
}
public static ItemLike nitrateDust() {
return TFMGItems.NITRATE_DUST.get();
}
public static ItemLike sulfur() {
return TFMGBlocks.SULFUR.get();
}
public static ItemLike sulfurDust() {
return TFMGItems.SULFUR_DUST.get();
}
public static ItemLike bucket() {
return Items.BUCKET;
}
public static ItemLike bottle() {
return Items.GLASS_BOTTLE;
}
public static ItemLike bottleOfBatteryAcid() {
return TFMGItems.BOTTLE_OF_BATTERY_ACID.get();
}
public static ItemLike bottleOfConcrete() {
return TFMGItems.BOTTLE_OF_CONCRETE.get();
}
public static ItemLike hardenedPlanks() {
return TFMGBlocks.HARDENED_PLANKS.get();
}
public static ItemLike potato() {
return Items.POTATO;
}
public static ItemLike napalmPotato() {
return TFMGItems.NAPALM_POTATO.get();
}
public static ItemLike heavyMachineryCasing() {
return TFMGBlocks.HEAVY_MACHINERY_CASING.get();
}
public static ItemLike steelCasing() {
return TFMGBlocks.STEEL_CASING.get();
}
public static ItemLike heavyPlate() {
return TFMGItems.HEAVY_PLATE.get();
}
//public static ItemLike charcoalDust() {
// return TFMGItems.CHARCOAL_DUST.get();
//}
public static ItemLike crushedRawIron() {
return AllItems.CRUSHED_IRON.get();
}
public static ItemLike ironIngot() {
return Items.IRON_INGOT;
}
public static ItemLike castIronIngot() {
return TFMGItems.CAST_IRON_INGOT.get();
}
public static ItemLike clayBall() {
return Items.CLAY_BALL;
}
public static ItemLike cement() {
return TFMGBlocks.CEMENT.get();
}
public static ItemLike sand() {
return Items.SAND;
}
public static ItemLike gravel() {
return Items.GRAVEL;
}
public static ItemLike concreteMixture() {
return TFMGItems.CONCRETE_MIXTURE.get();
}
public static ItemLike slag() {
return TFMGItems.SLAG.get();
}
public static ItemLike gunpowder() {
return Items.GUNPOWDER;
}
public static ItemLike zincSulfate() {
return TFMGItems.ZINC_SULFATE.get();
}
public static ItemLike syntheticLeather() {
return TFMGItems.SYNTHETIC_LEATHER.get();
}
public static ItemLike engineBase() {
return TFMGItems.ENGINE_BASE.get();
}
public static ItemLike unfinishedGasolineEngine() {
return TFMGItems.UNFINISHED_GASOLINE_ENGINE.get();
}
public static ItemLike gasolineEngine() {
return TFMGBlocks.GASOLINE_ENGINE.get();
}
public static ItemLike unfinishedLpgEngine() {
return TFMGItems.UNFINISHED_LPG_ENGINE.get();
}
public static ItemLike lpgEngine() {
return TFMGBlocks.LPG_ENGINE.get();
}
public static ItemLike engineChamber() {
return TFMGItems.ENGINE_CHAMBER.get();
}
public static ItemLike screw() {
return TFMGItems.SCREW.get();
}
public static ItemLike screwdriver() {
return TFMGItems.SCREWDRIVER.get();
}
public static ItemLike unprocessedHeavyPlate() {
return TFMGItems.UNPROCESSED_HEAVY_PLATE.get();
}
public static ItemLike steelMechanism() {
return TFMGItems.STEEL_MECHANISM.get();
}
public static ItemLike unfinishedSteelMechanism() {
return TFMGItems.UNFINISHED_STEEL_MECHANISM.get();
}
public static ItemLike aluminumIngot() {
return TFMGItems.ALUMINUM_INGOT.get();
}
public static ItemLike industrialPipe() {
return TFMGBlocks.INDUSTRIAL_PIPE.get();
}
public static ItemLike turbineBlade() {
return TFMGItems.TURBINE_BLADE.get();
}
public static ItemLike turbineEngine() {
return TFMGBlocks.TURBINE_ENGINE.get();
}
public static ItemLike unfinishedTurbineEngine() {
return TFMGItems.UNFINISHED_TURBINE_ENGINE.get();
}
}
public static class F {
//GASSES
public static Fluid air() {
return TFMGFluids.AIR.get();
}
public static Fluid heatedAir() {
return TFMGFluids.HEATED_AIR.get();
}
public static Fluid carbonDioxide() {
return TFMGFluids.CARBON_DIOXIDE.get();
}
public static Fluid ethylene() {
return TFMGFluids.ETHYLENE.get();
}
public static Fluid propylene() {
return TFMGFluids.PROPYLENE.get();
}
public static Fluid propane() {
return TFMGFluids.PROPANE.get();
}
public static Fluid butane() {
return TFMGFluids.BUTANE.get();
}
public static Fluid lpg() {
return TFMGFluids.LPG.get();
}
public static Fluid neon() {
return TFMGFluids.NEON.get();
}
public static Fluid blastFurnaceGas() {
return TFMGFluids.BLAST_FURNACE_GAS.get();
}
//LIQUIDS
public static Fluid crudeOil() {
return TFMGFluids.CRUDE_OIL.get();
}
public static Fluid heavyOil() {
return TFMGFluids.HEAVY_OIL.get();
}
public static Fluid lubricationOil() {
return TFMGFluids.LUBRICATION_OIL.get();
}
public static Fluid napalm() {
return TFMGFluids.NAPALM.get();
}
public static Fluid naphtha() {
return TFMGFluids.NAPHTHA.get();
}
public static Fluid kerosene() {
return TFMGFluids.KEROSENE.get();
}
public static Fluid gasoline() {
return TFMGFluids.GASOLINE.get();
}
public static Fluid diesel() {
return TFMGFluids.DIESEL.get();
}
public static Fluid creosote() {
return TFMGFluids.CREOSOTE.get();
}
public static Fluid water() {
return Fluids.WATER;
}
//MISC
public static Fluid coolingFluid() {
return TFMGFluids.COOLING_FLUID.get();
}
public static Fluid sulfuricAcid() {
return TFMGFluids.SULFURIC_ACID.get();
}
public static Fluid liquidConcrete() {
return TFMGFluids.LIQUID_CONCRETE.get();
}
public static Fluid liquidAsphalt() {
return TFMGFluids.LIQUID_ASPHALT.get();
}
public static Fluid liquidPlastic() {
return TFMGFluids.LIQUID_PLASTIC.get();
}
public static Fluid moltenSteel() {
return TFMGFluids.MOLTEN_STEEL.get();
}
public static Fluid moltenSlag() {
return TFMGFluids.MOLTEN_SLAG.get();
}
public static Fluid potion() {
return AllFluids.POTION.get();
}
//BUCKETS
public static ItemLike airTank() {
return TFMGRegistrate.getBucket("air");
}
public static ItemLike heatedAirTank() {
return TFMGRegistrate.getBucket("heated_air");
}
public static ItemLike carbonDioxideTank() {
return TFMGRegistrate.getBucket("carbon_dioxide");
}
public static ItemLike ethyleneTank() {
return TFMGRegistrate.getBucket("ethylene");
}
public static ItemLike propyleneTank() {
return TFMGRegistrate.getBucket("propylene");
}
public static ItemLike propaneTank() {
return TFMGRegistrate.getBucket("propane");
}
public static ItemLike butaneTank() {
return TFMGRegistrate.getBucket("butane");
}
public static ItemLike lpgTank() {
return TFMGRegistrate.getBucket("lpg");
}
public static ItemLike neonTank() {
return TFMGRegistrate.getBucket("neon");
}
public static ItemLike blastFurnaceGasTank() {
return TFMGRegistrate.getBucket("blast_furnace_gas");
}
public static ItemLike crudeOilBucket() {
return TFMGRegistrate.getBucket("crude_oil");
}
public static ItemLike heavyOilBucket() {
return TFMGRegistrate.getBucket("heavy_oil");
}
public static ItemLike lubricationOilBucket() {
return TFMGRegistrate.getBucket("lubrication_oil");
}
public static ItemLike napalmBucket() {
return TFMGRegistrate.getBucket("napalm");
}
public static ItemLike naphthaBucket() {
return TFMGRegistrate.getBucket("naphtha");
}
public static ItemLike keroseneBucket() {
return TFMGRegistrate.getBucket("kerosene");
}
public static ItemLike gasolineBucket() {
return TFMGRegistrate.getBucket("gasoline");
}
public static ItemLike dieselBucket() {
return TFMGRegistrate.getBucket("diesel");
}
public static ItemLike creosoteBucket() {
return TFMGRegistrate.getBucket("creosote");
}
public static ItemLike coolingFluidBucket() {
return TFMGRegistrate.getBucket("cooling_fluid");
}
public static ItemLike sulfuricAcidBucket() {
return TFMGRegistrate.getBucket("sulfuric_acid");
}
public static ItemLike liquidConcreteBucket() {
return TFMGRegistrate.getBucket("liquid_concrete");
}
public static ItemLike liquidAsphaltBucket() {
return TFMGRegistrate.getBucket("liquid_asphalt");
}
public static ItemLike liquidPlasticBucket() {
return TFMGRegistrate.getBucket("liquid_plastic");
}
public static ItemLike moltenSteelBucket() {
return TFMGRegistrate.getBucket("molten_steel");
}
public static ItemLike moltenSlagBucket() {
return TFMGRegistrate.getBucket("molten_slag");
}
public static ItemLike waterBucket() {
return Fluids.WATER.getBucket();
}
}
}

View File

@@ -0,0 +1,52 @@
package com.drmangotea.createindustry.base.datagen.recipe.create;
import com.drmangotea.createindustry.CreateTFMG;
import com.drmangotea.createindustry.base.datagen.recipe.TFMGProcessingRecipeGen;
import com.simibubi.create.AllRecipeTypes;
import com.simibubi.create.foundation.recipe.IRecipeTypeInfo;
import net.minecraft.data.DataGenerator;
public class CompactingGen extends TFMGProcessingRecipeGen {
GeneratedRecipe
bitumen = create(CreateTFMG.asResource("bitumen"), b -> b
.require(F.heavyOil(), 10)
.output(I.bitumen(), 1)),
cinderflourblock = create(CreateTFMG.asResource("cinderflourblock"), b -> b
.require(I.cinderFlour())
.require(I.cinderFlour())
.output(I.cinderflourBlock(), 1)),
plasticMolding = create(CreateTFMG.asResource("plastic_molding"), b -> b
.require(F.liquidPlastic(), 200)
.output(I.plasticSheet(), 1)),
steelBlock = create(CreateTFMG.asResource("steel_block"), b -> b
.require(I.steelIngot())
.require(I.steelIngot())
.require(I.steelIngot())
.require(I.steelIngot())
.require(I.steelIngot())
.require(I.steelIngot())
.require(I.steelIngot())
.require(I.steelIngot())
.require(I.steelIngot())
.output(I.steelBlock(), 1)),
thermitePowder = create(CreateTFMG.asResource("thermite_powder"), b -> b
.require(IT.aluminumIngot())
.require(I.crimsite())
.output(I.thermitePowder(), 1))
;
public CompactingGen(DataGenerator generator) {
super(generator);
}
@Override
protected IRecipeTypeInfo getRecipeType() {
return AllRecipeTypes.COMPACTING;
}
}

View File

@@ -0,0 +1,70 @@
package com.drmangotea.createindustry.base.datagen.recipe.create;
import com.drmangotea.createindustry.CreateTFMG;
import com.drmangotea.createindustry.base.datagen.recipe.TFMGProcessingRecipeGen;
import com.simibubi.create.AllRecipeTypes;
import com.simibubi.create.foundation.recipe.IRecipeTypeInfo;
import net.minecraft.data.DataGenerator;
public class CrushingGen extends TFMGProcessingRecipeGen {
GeneratedRecipe
bauxiteRecycling = create(CreateTFMG.asResource("bauxite_recycling"), b -> b
.require(IT.bauxiteStoneType())
.output(I.crushedRawAluminum(), 1)
.output(0.25f, I.crushedRawAluminum(), 1)
.output(0.15f, I.experienceNugget(), 1)
.duration(250)),
coalCokeDust = create(CreateTFMG.asResource("coal_coke_dust"), b -> b
.require(I.coalCoke())
.output(I.coalCokeDust(), 1)
.duration(250)),
copperSulfate = create(CreateTFMG.asResource("copper_sulfate"), b -> b
.require(I.copperSulfate())
.output(I.boneMeal(), 4)
.output(0.5f, I.boneMeal(), 3)
.output(0.5f, I.blueDye(), 1)
.output(0.3f, I.cyanDye(), 1)
.duration(100)),
galenaRecycling = create(CreateTFMG.asResource("galena_recycling"), b -> b
.require(IT.galenaStoneType())
.output(I.crushedRawLead(), 1)
.output(0.15f, I.experienceNugget(), 1)
.duration(250)),
lignite = create(CreateTFMG.asResource("lignite"), b -> b
.require(I.lignite())
.output(I.coal(), 1)
.duration(250)),
limesand = create(CreateTFMG.asResource("limesand"), b -> b
.require(I.limestone())
.output(I.limesand(), 1)
.duration(100)),
saltpeter = create(CreateTFMG.asResource("saltpeter"), b -> b
.require(I.dirt())
.output(0.2f, I.nitrateDust(), 1)
.duration(350)),
sulfur = create(CreateTFMG.asResource("sulfur"), b -> b
.require(I.sulfur())
.output(I.sulfurDust(), 1)
.output(0.1f, I.sulfurDust(), 1)
.duration(250))
;
public CrushingGen(DataGenerator generator) {
super(generator);
}
@Override
protected IRecipeTypeInfo getRecipeType() {
return AllRecipeTypes.CRUSHING;
}
}

View File

@@ -0,0 +1,83 @@
package com.drmangotea.createindustry.base.datagen.recipe.create;
import com.drmangotea.createindustry.CreateTFMG;
import com.drmangotea.createindustry.base.datagen.recipe.TFMGProcessingRecipeGen;
import com.simibubi.create.AllRecipeTypes;
import com.simibubi.create.foundation.recipe.IRecipeTypeInfo;
import net.minecraft.data.DataGenerator;
public class FillingGen extends TFMGProcessingRecipeGen {
GeneratedRecipe
airTank = create(CreateTFMG.asResource("air_tank"), b -> b
.require(I.bucket())
.require(F.air(), 1000)
.output(F.airTank(), 1)),
bottleOfBatteryAcid = create(CreateTFMG.asResource("bottle_of_battery_acid"), b -> b
.require(I.bottle())
.require(F.sulfuricAcid(), 250)
.output(I.bottleOfBatteryAcid(), 1)),
bottleOfConcrete = create(CreateTFMG.asResource("bottle_of_concrete"), b -> b
.require(I.bottle())
.require(F.liquidConcrete(), 250)
.output(I.bottleOfConcrete(), 1)),
butaneTank = create(CreateTFMG.asResource("butane_tank"), b -> b
.require(I.bucket())
.require(F.butane(), 1000)
.output(F.butaneTank(), 1)),
carbonDioxideTank = create(CreateTFMG.asResource("carbon_dioxide_tank"), b -> b
.require(I.bucket())
.require(F.carbonDioxide(), 1000)
.output(F.carbonDioxideTank(), 1)),
ethyleneTank = create(CreateTFMG.asResource("ethylene_tank"), b -> b
.require(I.bucket())
.require(F.ethylene(), 1000)
.output(F.ethyleneTank(), 1)),
hardenedWoodCreosote = create(CreateTFMG.asResource("hardened_wood_creosote"), b -> b
.require(IT.planks())
.require(F.creosote(), 200)
.output(I.hardenedPlanks(), 1)),
lpgTank = create(CreateTFMG.asResource("lpg_tank"), b -> b
.require(I.bucket())
.require(F.lpg(), 1000)
.output(F.lpgTank(), 1)),
napalmPotato = create(CreateTFMG.asResource("napalm_potato"), b -> b
.require(I.potato())
.require(F.napalm(), 250)
.output(I.napalmPotato(), 1)),
neonTank = create(CreateTFMG.asResource("neon_tank"), b -> b
.require(I.bucket())
.require(F.neon(), 1000)
.output(F.neonTank(), 1)),
propaneTank = create(CreateTFMG.asResource("propane_tank"), b -> b
.require(I.bucket())
.require(F.propane(), 1000)
.output(F.propaneTank(), 1)),
propyleneTank = create(CreateTFMG.asResource("propylene_tank"), b -> b
.require(I.bucket())
.require(F.propylene(), 1000)
.output(F.propyleneTank(), 1))
;
public FillingGen(DataGenerator generator) {
super(generator);
}
@Override
protected IRecipeTypeInfo getRecipeType() {
return AllRecipeTypes.FILLING;
}
}

View File

@@ -0,0 +1,35 @@
package com.drmangotea.createindustry.base.datagen.recipe.create;
import com.drmangotea.createindustry.CreateTFMG;
import com.drmangotea.createindustry.base.datagen.recipe.TFMGProcessingRecipeGen;
import com.simibubi.create.AllRecipeTypes;
import com.simibubi.create.foundation.recipe.IRecipeTypeInfo;
import net.minecraft.data.DataGenerator;
public class ItemApplicationGen extends TFMGProcessingRecipeGen {
GeneratedRecipe
heavyMachineryCasing = create(CreateTFMG.asResource("heavy_machinery_casing"), b -> b
.require(I.steelCasing())
.require(I.heavyPlate())
.output(I.heavyMachineryCasing(), 1)),
steelCasing = create(CreateTFMG.asResource("steel_casing"), b -> b
.require(I.hardenedPlanks())
.require(IT.steelIngot())
.output(I.steelCasing(), 1))
;
public ItemApplicationGen(DataGenerator generator) {
super(generator);
}
@Override
protected IRecipeTypeInfo getRecipeType() {
return AllRecipeTypes.ITEM_APPLICATION;
}
}

View File

@@ -0,0 +1,152 @@
package com.drmangotea.createindustry.base.datagen.recipe.create;
import com.drmangotea.createindustry.CreateTFMG;
import com.drmangotea.createindustry.base.TFMGPipes;
import com.drmangotea.createindustry.base.datagen.recipe.TFMGRecipeProvider;
import com.drmangotea.createindustry.registry.TFMGBlocks;
import com.drmangotea.createindustry.registry.TFMGItems;
import com.google.common.base.Supplier;
import com.simibubi.create.AllBlocks;
import com.simibubi.create.AllItems;
import com.simibubi.create.foundation.data.recipe.MechanicalCraftingRecipeBuilder;
import com.simibubi.create.foundation.utility.RegisteredObjects;
import net.minecraft.data.DataGenerator;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.item.Items;
import net.minecraft.world.level.ItemLike;
import java.util.function.UnaryOperator;
public class MechanicalCraftingGen extends TFMGRecipeProvider {
GeneratedRecipe advancedPotatoCannon = create(TFMGItems.ADVANCED_POTATO_CANNON::get).recipe((b) -> {
return b.key('I', TFMGPipes.STEEL_PIPE.get()).key('P', I.steelMechanism()).key('H', I.heavyPlate()).key('A', I.plasticSheet()).patternLine("IIPPH").patternLine(" AH H");
});
GeneratedRecipe dieselEngine = create(TFMGBlocks.DIESEL_ENGINE::get).recipe((b) -> {
return b.key('A', IT.aluminumIngot()).key('H', I.heavyPlate()).key('S', I.steelMechanism()).key('C', I.heavyMachineryCasing()).key('O', IT.steelIngot()).key('T', TFMGBlocks.STEEL_FLUID_TANK.get())
.patternLine(" O ").patternLine(" A ").patternLine("AOA").patternLine("SCS").patternLine("STS").patternLine("HHH");
});
GeneratedRecipe engineBase = create(TFMGItems.ENGINE_BASE::get).recipe((b) -> {
return b.key('A', AllBlocks.SHAFT.get()).key('H', I.heavyPlate()).key('C', I.heavyMachineryCasing())
.patternLine("HAH").patternLine("HCH");
});
GeneratedRecipe engineChamber = create(TFMGItems.ENGINE_CHAMBER::get).recipe((b) -> {
return b.key('A', IT.aluminumIngot()).key('S', TFMGItems.SPARK_PLUG.get()).key('P', I.steelMechanism())
.patternLine("S").patternLine("A").patternLine("P");
});
GeneratedRecipe flamethrower = create(TFMGItems.FLAMETHROWER::get).recipe((b) -> {
return b.key('P', I.steelMechanism()).key('A', IT.aluminumIngot()).key('I', TFMGPipes.STEEL_PIPE.get()).key('H', I.heavyPlate()).key('T', TFMGBlocks.STEEL_FLUID_TANK.get())
.patternLine("IIPPH").patternLine(" ATAH");
});
GeneratedRecipe generator = create(TFMGBlocks.GENERATOR::get).recipe((b) -> {
return b.key('M', TFMGItems.MAGNETIC_INGOT.get()).key('C', TFMGBlocks.ELECTRIC_CASING.get()).key('E', I.steelMechanism()).key('K', TFMGItems.COPPER_CABLE.get())
.patternLine("EME").patternLine("MCM").patternLine("KMK");
});
GeneratedRecipe largeRadialEngine = create(TFMGBlocks.LARGE_RADIAL_ENGINE::get).recipe((b) -> {
return b.key('L', F.lubricationOilBucket()).key('C', I.heavyMachineryCasing()).key('M', I.engineChamber()).key('S', AllBlocks.SHAFT.get()).key('P', TFMGPipes.STEEL_PIPE.get()).key('E', TFMGBlocks.EXHAUST.get()).key('H', I.heavyPlate()).key('N', I.steelMechanism())
.patternLine(" MHM ").patternLine("MNLNM").patternLine("EPCPE").patternLine("MHSHM").patternLine(" MHM ");
});
GeneratedRecipe lithiumBlade = create(TFMGItems.LITHIUM_BLADE::get).recipe((b) -> {
return b.key('T', TFMGBlocks.LITHIUM_TORCH.get()).key('M', I.steelMechanism()).key('S', TFMGItems.STEEL_SWORD.get()).key('K', TFMGItems.CAPACITOR.get()).key('R', TFMGItems.RESISTOR.get()).key('P', I.plasticSheet()).key('L', TFMGItems.SYNTHETIC_LEATHER.get()).key('C', IT.copperWire())
.patternLine(" T ").patternLine("CSC").patternLine("CMK").patternLine("PLR");
});
GeneratedRecipe pumpjackBase = create(TFMGBlocks.PUMPJACK_BASE::get).recipe((b) -> {
return b.key('A', IT.string()).key('H', I.heavyPlate()).key('S', I.steelMechanism()).key('C', I.heavyMachineryCasing()).key('I', I.industrialPipe())
.patternLine("HAH").patternLine("SCS").patternLine("HIH");
});
GeneratedRecipe pumpjackCrank = create(TFMGBlocks.PUMPJACK_CRANK::get).recipe((b) -> {
return b.key('A', IT.string()).key('H', I.heavyPlate()).key('S', TFMGItems.REBAR.get()).key('C', I.heavyMachineryCasing())
.patternLine("HAH").patternLine("SCS");
});
GeneratedRecipe quadPotatoCannon = create(TFMGItems.QUAD_POTATO_CANNON::get).recipe((b) -> {
return b.key('P', I.steelMechanism()).key('A', TFMGItems.REBAR.get()).key('S', I.industrialPipe()).key('I', TFMGPipes.STEEL_PIPE.get()).key('H', I.heavyPlate())
.patternLine("HIIIS").patternLine("HPPIS").patternLine(" A ");
});
GeneratedRecipe radialEngine = create(TFMGBlocks.RADIAL_ENGINE::get).recipe((b) -> {
return b.key('L', F.lubricationOilBucket()).key('C', I.heavyMachineryCasing()).key('M', I.engineChamber()).key('S', AllBlocks.SHAFT.get()).key('P', TFMGPipes.STEEL_PIPE.get()).key('E', TFMGBlocks.EXHAUST.get())
.patternLine(" M ").patternLine(" MLM ").patternLine("MECPM").patternLine(" MSM ").patternLine(" M ");
});
GeneratedRecipe rotor = create(TFMGBlocks.ROTOR::get).recipe((b) -> {
return b.key('A', IT.aluminumIngot()).key('C', TFMGBlocks.COPPER_COIL.get()).key('S', AllBlocks.SHAFT.get()).key('R', TFMGItems.REBAR.get())
.patternLine(" CCC ").patternLine("CRARC").patternLine("CASAC").patternLine("CRARC").patternLine(" CCC ");
});
GeneratedRecipe sparkPlug = create(TFMGItems.SPARK_PLUG::get).recipe((b) -> {
return b.key('F', Items.FLINT).key('A', IT.aluminumIngot())
.patternLine("F").patternLine("A");
});
GeneratedRecipe stator = create(TFMGBlocks.STATOR::get).recipe((b) -> {
return b.key('C', TFMGItems.COPPER_CABLE.get()).key('M', TFMGItems.MAGNETIC_INGOT.get()).key('P', I.steelMechanism()).key('R', IT.steelIngot()).key('A', TFMGBlocks.ELECTRIC_CASING.get())
.patternLine("MMM").patternLine("CPC").patternLine("RAR");
});
GeneratedRecipe steelDistillationController = create(TFMGBlocks.STEEL_DISTILLATION_CONTROLLER::get).recipe((b) -> {
return b.key('P', I.steelMechanism()).key('I', I.industrialPipe()).key('H', I.heavyPlate()).key('C', I.heavyMachineryCasing()).key('D', AllBlocks.DISPLAY_BOARD.get()).key('E', AllItems.ELECTRON_TUBE.get())
.patternLine("HIH").patternLine("PDP").patternLine("ECE");
});
GeneratedRecipe steelDistillationOutput = create(TFMGBlocks.STEEL_DISTILLATION_OUTPUT::get).recipe((b) -> {
return b.key('T', TFMGBlocks.STEEL_FLUID_TANK.get()).key('H', I.heavyPlate()).key('P', TFMGPipes.STEEL_PIPE.get())
.patternLine("HPH").patternLine("PTP").patternLine("HPH");
});
GeneratedRecipe surfaceScanner = create(TFMGBlocks.SURFACE_SCANNER::get).recipe((b) -> {
return b.key('I', I.heavyPlate()).key('C', I.heavyMachineryCasing()).key('H', Items.COMPASS).key('S', AllBlocks.SHAFT.get()).key('E', I.steelMechanism()).key('K', IT.copperPlate())
.patternLine("IHI").patternLine("SCK").patternLine("EEK");
});
public MechanicalCraftingGen(DataGenerator generator) {
super(generator);
}
GeneratedRecipeBuilder create(Supplier<ItemLike> result) {
return new GeneratedRecipeBuilder(result);
}
public String getName() {
return "TFMG's Mechanical Crafting Recipes";
}
class GeneratedRecipeBuilder {
private String suffix = "";
private Supplier<ItemLike> result;
private int amount;
public GeneratedRecipeBuilder(Supplier<ItemLike> result) {
this.result = result;
this.amount = 1;
}
GeneratedRecipeBuilder returns(int amount) {
this.amount = amount;
return this;
}
GeneratedRecipeBuilder withSuffix(String suffix) {
this.suffix = suffix;
return this;
}
GeneratedRecipe recipe(UnaryOperator<MechanicalCraftingRecipeBuilder> builder) {
return MechanicalCraftingGen.this.register((consumer) -> {
MechanicalCraftingRecipeBuilder b = builder.apply(MechanicalCraftingRecipeBuilder.shapedRecipe(this.result.get(), this.amount));
String var10000 = RegisteredObjects.getKeyOrThrow(this.result.get().asItem()).getPath();
ResourceLocation location = CreateTFMG.asResource("mechanical_crafting/" + var10000 + this.suffix);
b.build(consumer, location);
});
}
}
}

View File

@@ -0,0 +1,32 @@
package com.drmangotea.createindustry.base.datagen.recipe.create;
import com.drmangotea.createindustry.CreateTFMG;
import com.drmangotea.createindustry.base.datagen.recipe.TFMGProcessingRecipeGen;
import com.simibubi.create.AllRecipeTypes;
import com.simibubi.create.foundation.recipe.IRecipeTypeInfo;
import net.minecraft.data.DataGenerator;
public class MillingGen extends TFMGProcessingRecipeGen {
GeneratedRecipe
//charcoalDust = create(CreateTFMG.asResource("charcoal_dust"), b -> b
// .require(I.charcoal())
// .output(I.charcoalDust(), 1)
// .duration(130)),
limesand = create(CreateTFMG.asResource("limesand"), b -> b
.require(I.limestone())
.output(I.limesand(), 1)
.duration(130))
;
public MillingGen(DataGenerator generator) {
super(generator);
}
@Override
protected IRecipeTypeInfo getRecipeType() {
return AllRecipeTypes.MILLING;
}
}

View File

@@ -0,0 +1,119 @@
package com.drmangotea.createindustry.base.datagen.recipe.create;
import com.drmangotea.createindustry.CreateTFMG;
import com.drmangotea.createindustry.base.datagen.recipe.TFMGProcessingRecipeGen;
import com.simibubi.create.AllRecipeTypes;
import com.simibubi.create.content.processing.recipe.HeatCondition;
import com.simibubi.create.foundation.fluid.FluidIngredient;
import com.simibubi.create.foundation.recipe.IRecipeTypeInfo;
import net.minecraft.data.DataGenerator;
public class MixingGen extends TFMGProcessingRecipeGen {
GeneratedRecipe
blastingMixture = create(CreateTFMG.asResource("blasting_mixture"), b -> b
.require(I.limesand())
.require(I.crushedRawIron())
.require(I.crushedRawIron())
.require(I.crushedRawIron())
.output(I.blastingMixture(), 3)),
castIronIngot = create(CreateTFMG.asResource("cast_iron_ingot"), b -> b
.require(I.ironIngot())
.require(I.coal())
.output(I.castIronIngot(), 1)
.requiresHeat(HeatCondition.HEATED)
.duration(100)),
cement = create(CreateTFMG.asResource("cement"), b -> b
.require(I.limesand())
.require(I.clayBall())
.output(I.cement(), 4)),
concreteMixture = create(CreateTFMG.asResource("concrete_mixture"), b -> b
.require(I.sand())
.require(I.gravel())
.require(I.cement())
.output(I.concreteMixture(), 16)),
concreteMixtureFromSlag = create(CreateTFMG.asResource("concrete_mixture_from_slag"), b -> b
.require(I.slag())
.require(I.gravel())
.require(I.cement())
.output(I.concreteMixture(), 32)),
coolingFluid = create(CreateTFMG.asResource("cooling_fluid"), b -> b
.require(F.ethylene(), 250)
.require(F.water(), 250)
.output(F.coolingFluid(), 500)),
copperSulfate = create(CreateTFMG.asResource("copper_sulfate"), b -> b
.require(F.sulfuricAcid(), 500)
.require(IT.copperIngot())
.output(I.copperSulfate(), 1)),
gunPowder = create(CreateTFMG.asResource("gun_powder"), b -> b
.require(I.nitrateDust())
.require(I.nitrateDust())
.require(I.nitrateDust())
.require(I.charcoal())
.require(I.charcoal())
.require(I.sulfurDust())
.output(I.gunpowder(), 6)),
liquidAsphalt = create(CreateTFMG.asResource("liquid_asphalt"), b -> b
.require(I.bitumen())
.require(I.sand())
.require(I.gravel())
.require(F.water(), 500)
.output(F.liquidAsphalt(), 1200)),
liquidConcrete = create(CreateTFMG.asResource("liquid_concrete"), b -> b
.require(I.concreteMixture())
.require(F.water(), 250)
.output(F.liquidConcrete(), 1000)),
liquidPlasticFromEthylene = create(CreateTFMG.asResource("liquid_plastic_from_ethylene"), b -> b
.require(F.ethylene(), 500)
.output(F.liquidPlastic(), 500)),
liquidPlasticFromPropylene = create(CreateTFMG.asResource("liquid_plastic_from_propylene"), b -> b
.require(F.propylene(), 500)
.output(F.liquidPlastic(), 500)),
napalm = create(CreateTFMG.asResource("napalm"), b -> b
.require(IT.aluminumIngot())
.require(F.gasoline(), 1000)
.output(F.napalm(), 1000)
.duration(1000)),
neon = create(CreateTFMG.asResource("neon"), b -> b
.require(F.air(), 250)
.output(F.neon(), 1)),
slag = create(CreateTFMG.asResource("slag"), b -> b
.require(F.moltenSlag(), 1000)
.output(I.slag(), 9)),
sulfuricAcid = create(CreateTFMG.asResource("sulfuric_acid"), b -> b
.require(I.sulfurDust())
.require(I.nitrateDust())
.require(F.water(), 500)
.output(F.sulfuricAcid(), 500)),
zincSulfate = create(CreateTFMG.asResource("zinc_sulfate"), b -> b
.require(F.sulfuricAcid(), 500)
.require(IT.zincIngot())
.output(I.zincSulfate(), 1))
;
public MixingGen(DataGenerator generator) {
super(generator);
}
@Override
protected IRecipeTypeInfo getRecipeType() {
return AllRecipeTypes.MIXING;
}
}

View File

@@ -0,0 +1,29 @@
package com.drmangotea.createindustry.base.datagen.recipe.create;
import com.drmangotea.createindustry.CreateTFMG;
import com.drmangotea.createindustry.base.datagen.recipe.TFMGProcessingRecipeGen;
import com.drmangotea.createindustry.base.datagen.recipe.TFMGRecipeProvider;
import com.simibubi.create.AllRecipeTypes;
import com.simibubi.create.foundation.recipe.IRecipeTypeInfo;
import net.minecraft.data.DataGenerator;
public class PressingGen extends TFMGProcessingRecipeGen {
GeneratedRecipe
syntheticLeather = create(CreateTFMG.asResource("synthetic_leather"), b -> b
.require(I.plasticSheet())
.output(I.syntheticLeather(), 1))
;
public PressingGen(DataGenerator generator) {
super(generator);
}
@Override
protected IRecipeTypeInfo getRecipeType() {
return AllRecipeTypes.PRESSING;
}
}

View File

@@ -0,0 +1,92 @@
package com.drmangotea.createindustry.base.datagen.recipe.create;
import com.drmangotea.createindustry.CreateTFMG;
import com.drmangotea.createindustry.base.datagen.recipe.TFMGRecipeProvider;
import com.simibubi.create.content.fluids.transfer.FillingRecipe;
import com.simibubi.create.content.kinetics.deployer.DeployerApplicationRecipe;
import com.simibubi.create.content.kinetics.press.PressingRecipe;
import com.simibubi.create.content.processing.sequenced.SequencedAssemblyRecipeBuilder;
import net.minecraft.data.DataGenerator;
import net.minecraft.world.item.ItemStack;
import java.util.function.UnaryOperator;
public class SequencedAssemblyGen extends TFMGRecipeProvider {
GeneratedRecipe gasolineEngine = create("gasoline_engine", (b) -> {
return b.require(I.engineBase()).transitionTo(I.unfinishedGasolineEngine()).addOutput(new ItemStack(I.gasolineEngine().asItem(), 2), 120.0F).loops(8).addStep(FillingRecipe::new, (rb) -> {
return rb.require(F.lubricationOil(), 1000);
}).addStep(DeployerApplicationRecipe::new, (rb) -> {
return rb.require(I.engineChamber());
}).addStep(DeployerApplicationRecipe::new, (rb) -> {
return rb.require(I.screw());
}).addStep(DeployerApplicationRecipe::new, (rb) -> {
return rb.require(I.screwdriver());
});
});
GeneratedRecipe heavyPlate = create("heavy_plate", (b) -> {
return b.require(IT.steelIngot()).transitionTo(I.unprocessedHeavyPlate()).addOutput(I.heavyPlate(), 120.0F).loops(1).addStep(PressingRecipe::new, (rb) -> {
return rb;
}).addStep(PressingRecipe::new, (rb) -> {
return rb;
}).addStep(PressingRecipe::new, (rb) -> {
return rb;
});
});
GeneratedRecipe lpgEngine = create("lpg_engine", (b) -> {
return b.require(I.engineBase()).transitionTo(I.unfinishedLpgEngine()).addOutput(new ItemStack(I.lpgEngine().asItem(), 2), 120.0F).loops(8).addStep(DeployerApplicationRecipe::new, (rb) -> {
return rb.require(I.engineChamber());
}).addStep(DeployerApplicationRecipe::new, (rb) -> {
return rb.require(I.screw());
}).addStep(DeployerApplicationRecipe::new, (rb) -> {
return rb.require(I.screwdriver());
}).addStep(FillingRecipe::new, (rb) -> {
return rb.require(F.lubricationOil(), 1000);
});
});
GeneratedRecipe steelMechanism = create("steel_mechanism", (b) -> {
return b.require(IT.steelIngot()).transitionTo(I.unfinishedSteelMechanism()).addOutput(I.steelMechanism(), 120.0F).addOutput(I.heavyPlate(), 0.8F).addOutput(I.steelIngot(), 0.8F).addOutput(I.aluminumIngot(), 0.5F).addOutput(I.industrialPipe(), 0.3F).loops(1)
.addStep(DeployerApplicationRecipe::new, (rb) -> {
return rb.require(IT.steelIngot());
}).addStep(DeployerApplicationRecipe::new, (rb) -> {
return rb.require(IT.aluminumIngot());
}).addStep(DeployerApplicationRecipe::new, (rb) -> {
return rb.require(I.screw());
}).addStep(DeployerApplicationRecipe::new, (rb) -> {
return rb.require(I.screwdriver());
});
});
GeneratedRecipe turbineEngine = create("turbine_engine", (b) -> {
return b.require(I.engineBase()).transitionTo(I.unfinishedTurbineEngine()).addOutput(new ItemStack(I.turbineEngine().asItem(), 2), 120.0F).loops(6).addStep(DeployerApplicationRecipe::new, (rb) -> {
return rb.require(I.turbineBlade());
}).addStep(DeployerApplicationRecipe::new, (rb) -> {
return rb.require(I.screw());
}).addStep(DeployerApplicationRecipe::new, (rb) -> {
return rb.require(I.screwdriver());
}).addStep(FillingRecipe::new, (rb) -> {
return rb.require(F.lubricationOil(), 1000);
}).addStep(DeployerApplicationRecipe::new, (rb) -> {
return rb.require(I.steelMechanism());
});
});
public SequencedAssemblyGen(DataGenerator generator) {
super(generator);
}
protected GeneratedRecipe create(String name, UnaryOperator<SequencedAssemblyRecipeBuilder> transform) {
GeneratedRecipe generatedRecipe = (c) -> {
transform.apply(new SequencedAssemblyRecipeBuilder(CreateTFMG.asResource(name))).build(c);
};
this.all.add(generatedRecipe);
return generatedRecipe;
}
public String getName() {
return "TFMG's Sequenced Assembly Recipes";
}
}

View File

@@ -0,0 +1,29 @@
package com.drmangotea.createindustry.base.datagen.recipe.tfmg;
import com.drmangotea.createindustry.CreateTFMG;
import com.drmangotea.createindustry.base.datagen.recipe.TFMGProcessingRecipeGen;
import com.drmangotea.createindustry.registry.TFMGRecipeTypes;
import com.simibubi.create.foundation.recipe.IRecipeTypeInfo;
import net.minecraft.data.DataGenerator;
public class CastingGen extends TFMGProcessingRecipeGen {
GeneratedRecipe
steel = create(CreateTFMG.asResource("steel"), b -> b
.require(F.moltenSteel(), 1)
.output(I.steelIngot(), 1)
.output(I.steelBlock(), 1)
.duration(300))
;
public CastingGen(DataGenerator generator) {
super(generator);
}
@Override
protected IRecipeTypeInfo getRecipeType() {
return TFMGRecipeTypes.CASTING;
}
}

View File

@@ -0,0 +1,35 @@
package com.drmangotea.createindustry.base.datagen.recipe.tfmg;
import com.drmangotea.createindustry.CreateTFMG;
import com.drmangotea.createindustry.base.datagen.recipe.TFMGProcessingRecipeGen;
import com.drmangotea.createindustry.registry.TFMGRecipeTypes;
import com.simibubi.create.foundation.recipe.IRecipeTypeInfo;
import net.minecraft.data.DataGenerator;
public class CokingGen extends TFMGProcessingRecipeGen {
GeneratedRecipe
charcoal = create(CreateTFMG.asResource("charcoal"), b -> b
.require(I.coal())
.output(I.charcoal(), 1)
.output(F.creosote(), 1)
.duration(400)),
coalCoke = create(CreateTFMG.asResource("coal_coke"), b -> b
.require(I.coal())
.output(I.coalCoke(), 1)
.output(F.creosote(), 1)
.duration(1000))
;
public CokingGen(DataGenerator generator) {
super(generator);
}
@Override
protected IRecipeTypeInfo getRecipeType() {
return TFMGRecipeTypes.COKING;
}
}

View File

@@ -0,0 +1,49 @@
package com.drmangotea.createindustry.base.datagen.recipe.tfmg;
import com.drmangotea.createindustry.CreateTFMG;
import com.drmangotea.createindustry.base.datagen.recipe.TFMGProcessingRecipeGen;
import com.drmangotea.createindustry.registry.TFMGRecipeTypes;
import com.simibubi.create.foundation.recipe.IRecipeTypeInfo;
import net.minecraft.data.DataGenerator;
public class DistillationGen extends TFMGProcessingRecipeGen {
GeneratedRecipe
crudeOil = create(CreateTFMG.asResource("crude_oil"), b -> b
.require(F.crudeOil(), 360)
.output(F.heavyOil(), 80)
.output(F.diesel(), 60)
.output(F.kerosene(), 40)
.output(F.naphtha(), 40)
.output(F.gasoline(), 80)
.output(F.lpg(), 60)),
crudeOilNoNaphtha = create(CreateTFMG.asResource("crude_oil_no_naphtha"), b -> b
.require(F.crudeOil(), 340)
.output(F.heavyOil(), 80)
.output(F.diesel(), 60)
.output(F.kerosene(), 40)
.output(F.gasoline(), 80)
.output(F.lpg(), 60)),
heavyOil = create(CreateTFMG.asResource("heavy_oil"), b -> b
.require(F.heavyOil(), 150)
.output(F.diesel(), 100)
.output(F.lubricationOil(), 50)),
naphtha = create(CreateTFMG.asResource("naphtha"), b -> b
.require(F.naphtha(), 100)
.output(F.ethylene(), 50)
.output(F.propylene(), 50))
;
public DistillationGen(DataGenerator generator) {
super(generator);
}
@Override
protected IRecipeTypeInfo getRecipeType() {
return TFMGRecipeTypes.DISTILLATION;
}
}

View File

@@ -0,0 +1,31 @@
package com.drmangotea.createindustry.base.datagen.recipe.tfmg;
import com.drmangotea.createindustry.CreateTFMG;
import com.drmangotea.createindustry.base.datagen.recipe.TFMGProcessingRecipeGen;
import com.drmangotea.createindustry.registry.TFMGRecipeTypes;
import com.simibubi.create.foundation.recipe.IRecipeTypeInfo;
import net.minecraft.data.DataGenerator;
public class GasBlastingGen extends TFMGProcessingRecipeGen {
GeneratedRecipe
heatedAir = create(CreateTFMG.asResource("heated_air"), b -> b
.require(F.air(), 1000)
.require(F.blastFurnaceGas(), 250)
.output(F.heatedAir(), 1000)
.output(F.carbonDioxide(), 750)
.duration(400))
;
public GasBlastingGen(DataGenerator generator) {
super(generator);
}
@Override
protected IRecipeTypeInfo getRecipeType() {
return TFMGRecipeTypes.GAS_BLASTING;
}
}

View File

@@ -0,0 +1,30 @@
package com.drmangotea.createindustry.base.datagen.recipe.tfmg;
import com.drmangotea.createindustry.CreateTFMG;
import com.drmangotea.createindustry.base.datagen.recipe.TFMGProcessingRecipeGen;
import com.drmangotea.createindustry.registry.TFMGRecipeTypes;
import com.simibubi.create.foundation.recipe.IRecipeTypeInfo;
import net.minecraft.data.DataGenerator;
public class IndustrialBlastingGen extends TFMGProcessingRecipeGen {
GeneratedRecipe
steel = create(CreateTFMG.asResource("steel"), b -> b
.require(I.blastingMixture())
.output(F.moltenSteel(), 111)
.output(F.moltenSlag(), 75)
.duration(200))
;
public IndustrialBlastingGen(DataGenerator generator) {
super(generator);
}
@Override
protected IRecipeTypeInfo getRecipeType() {
return TFMGRecipeTypes.INDUSTRIAL_BLASTING;
}
}

View File

@@ -0,0 +1,317 @@
package com.drmangotea.createindustry.base.datagen.recipe.vanilla;
import com.drmangotea.createindustry.CreateTFMG;
import com.drmangotea.createindustry.base.datagen.recipe.TFMGRecipeProvider;
import com.google.common.base.Supplier;
import com.google.gson.JsonArray;
import com.google.gson.JsonObject;
import com.simibubi.create.foundation.utility.RegisteredObjects;
import com.tterrag.registrate.util.entry.ItemProviderEntry;
import net.minecraft.advancements.critereon.ItemPredicate;
import net.minecraft.data.DataGenerator;
import net.minecraft.data.recipes.*;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.tags.TagKey;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.Items;
import net.minecraft.world.item.crafting.Ingredient;
import net.minecraft.world.item.crafting.RecipeSerializer;
import net.minecraft.world.item.crafting.SimpleCookingSerializer;
import net.minecraft.world.level.ItemLike;
import net.minecraftforge.common.crafting.CraftingHelper;
import net.minecraftforge.common.crafting.conditions.ICondition;
import net.minecraftforge.common.crafting.conditions.ModLoadedCondition;
import net.minecraftforge.common.crafting.conditions.NotCondition;
import java.util.ArrayList;
import java.util.List;
import java.util.function.UnaryOperator;
public class TFMGStandardRecipeGen extends TFMGRecipeProvider {
String currentFolder = "";
Marker enterFolder(String folder) {
currentFolder = folder;
return new Marker();
}
public GeneratedRecipeBuilder create(String path, Supplier<ItemLike> result) {
return new GeneratedRecipeBuilder(path, result);
}
public GeneratedRecipeBuilder create(String path, ResourceLocation result) {
return new GeneratedRecipeBuilder(path, result);
}
public GeneratedRecipeBuilder create(String path, ItemProviderEntry<? extends ItemLike> result) {
return create(path, result::get);
}
public GeneratedRecipeBuilder create(Supplier<ItemLike> result) {
return new GeneratedRecipeBuilder(currentFolder, result);
}
public GeneratedRecipeBuilder create(ResourceLocation result) {
return new GeneratedRecipeBuilder(currentFolder, result);
}
public GeneratedRecipeBuilder create(ItemProviderEntry<? extends ItemLike> result) {
return create(result::get);
}
public class GeneratedRecipeBuilder {
private String path;
private String suffix;
private Supplier<? extends ItemLike> result;
private ResourceLocation compatDatagenOutput;
List<ICondition> recipeConditions;
private Supplier<ItemPredicate> unlockedBy;
private int amount;
private GeneratedRecipeBuilder(String path) {
this.path = path;
this.recipeConditions = new ArrayList<>();
this.suffix = "";
this.amount = 1;
}
public GeneratedRecipeBuilder(String path, Supplier<? extends ItemLike> result) {
this(path);
this.result = result;
}
public GeneratedRecipeBuilder(String path, ResourceLocation result) {
this(path);
this.compatDatagenOutput = result;
}
GeneratedRecipeBuilder returns(int amount) {
this.amount = amount;
return this;
}
GeneratedRecipeBuilder unlockedBy(Supplier<? extends ItemLike> item) {
this.unlockedBy = () -> ItemPredicate.Builder.item()
.of(item.get())
.build();
return this;
}
GeneratedRecipeBuilder unlockedByTag(Supplier<TagKey<Item>> tag) {
this.unlockedBy = () -> ItemPredicate.Builder.item()
.of(tag.get())
.build();
return this;
}
GeneratedRecipeBuilder whenModLoaded(String modid) {
return withCondition(new ModLoadedCondition(modid));
}
GeneratedRecipeBuilder whenModMissing(String modid) {
return withCondition(new NotCondition(new ModLoadedCondition(modid)));
}
GeneratedRecipeBuilder withCondition(ICondition condition) {
recipeConditions.add(condition);
return this;
}
GeneratedRecipeBuilder withSuffix(String suffix) {
this.suffix = suffix;
return this;
}
GeneratedRecipe viaShaped(UnaryOperator<ShapedRecipeBuilder> builder) {
return register(consumer -> {
ShapedRecipeBuilder b = builder.apply(ShapedRecipeBuilder.shaped(result.get(), amount));
if (unlockedBy != null)
b.unlockedBy("has_item", inventoryTrigger(unlockedBy.get()));
b.save(consumer, createLocation("crafting"));
});
}
GeneratedRecipe viaShapeless(UnaryOperator<ShapelessRecipeBuilder> builder) {
return register(consumer -> {
ShapelessRecipeBuilder b = builder.apply(ShapelessRecipeBuilder.shapeless(result.get(), amount));
if (unlockedBy != null)
b.unlockedBy("has_item", inventoryTrigger(unlockedBy.get()));
b.save(consumer, createLocation("crafting"));
});
}
GeneratedRecipe viaSmithing(Supplier<? extends Item> base, Supplier<Ingredient> upgradeMaterial) {
return register(consumer -> {
UpgradeRecipeBuilder b =
UpgradeRecipeBuilder.smithing(Ingredient.of(base.get()), upgradeMaterial.get(), result.get()
.asItem());
b.unlocks("has_item", inventoryTrigger(ItemPredicate.Builder.item()
.of(base.get())
.build()));
b.save(consumer, createLocation("crafting"));
});
}
private ResourceLocation createSimpleLocation(String recipeType) {
return CreateTFMG.asResource(recipeType + "/" + getRegistryName().getPath() + suffix);
}
private ResourceLocation createLocation(String recipeType) {
return CreateTFMG.asResource(recipeType + "/" + path + "/" + getRegistryName().getPath() + suffix);
}
private ResourceLocation getRegistryName() {
return compatDatagenOutput == null ? RegisteredObjects.getKeyOrThrow(result.get()
.asItem()) : compatDatagenOutput;
}
GeneratedRecipeBuilder.GeneratedCookingRecipeBuilder viaCooking(Supplier<? extends ItemLike> item) {
return unlockedBy(item).viaCookingIngredient(() -> Ingredient.of(item.get()));
}
GeneratedRecipeBuilder.GeneratedCookingRecipeBuilder viaCookingTag(Supplier<TagKey<Item>> tag) {
return unlockedByTag(tag).viaCookingIngredient(() -> Ingredient.of(tag.get()));
}
GeneratedRecipeBuilder.GeneratedCookingRecipeBuilder viaCookingIngredient(Supplier<Ingredient> ingredient) {
return new GeneratedRecipeBuilder.GeneratedCookingRecipeBuilder(ingredient);
}
class GeneratedCookingRecipeBuilder {
private Supplier<Ingredient> ingredient;
private float exp;
private int cookingTime;
private final SimpleCookingSerializer<?> FURNACE = RecipeSerializer.SMELTING_RECIPE,
SMOKER = RecipeSerializer.SMOKING_RECIPE, BLAST = RecipeSerializer.BLASTING_RECIPE,
CAMPFIRE = RecipeSerializer.CAMPFIRE_COOKING_RECIPE;
GeneratedCookingRecipeBuilder(Supplier<Ingredient> ingredient) {
this.ingredient = ingredient;
cookingTime = 200;
exp = 0;
}
GeneratedRecipeBuilder.GeneratedCookingRecipeBuilder forDuration(int duration) {
cookingTime = duration;
return this;
}
GeneratedRecipeBuilder.GeneratedCookingRecipeBuilder rewardXP(float xp) {
exp = xp;
return this;
}
GeneratedRecipe inFurnace() {
return inFurnace(b -> b);
}
GeneratedRecipe inFurnace(UnaryOperator<SimpleCookingRecipeBuilder> builder) {
return create(FURNACE, builder, 1);
}
GeneratedRecipe inSmoker() {
return inSmoker(b -> b);
}
GeneratedRecipe inSmoker(UnaryOperator<SimpleCookingRecipeBuilder> builder) {
create(FURNACE, builder, 1);
create(CAMPFIRE, builder, 3);
return create(SMOKER, builder, .5f);
}
GeneratedRecipe inSmokerOnly() {
return inSmokerOnly(b -> b);
}
GeneratedRecipe inSmokerOnly(UnaryOperator<SimpleCookingRecipeBuilder> builder) {
create(CAMPFIRE, builder, 3);
return create(SMOKER, builder, 1f);
}
GeneratedRecipe inBlastFurnace() {
return inBlastFurnace(b -> b);
}
GeneratedRecipe inBlastFurnace(UnaryOperator<SimpleCookingRecipeBuilder> builder) {
create(FURNACE, builder, 1);
return create(BLAST, builder, .5f);
}
GeneratedRecipe inBlastFurnaceOnly() {
return inBlastFurnaceOnly(b -> b);
}
GeneratedRecipe inBlastFurnaceOnly(UnaryOperator<SimpleCookingRecipeBuilder> builder) {
return create(BLAST, builder, 1f);
}
private GeneratedRecipe create(SimpleCookingSerializer<?> serializer,
UnaryOperator<SimpleCookingRecipeBuilder> builder, float cookingTimeModifier) {
return register(consumer -> {
boolean isOtherMod = compatDatagenOutput != null;
SimpleCookingRecipeBuilder b = builder.apply(
SimpleCookingRecipeBuilder.cooking(ingredient.get(), isOtherMod ? Items.DIRT : result.get(),
exp, (int) (cookingTime * cookingTimeModifier), serializer));
if (unlockedBy != null)
b.unlockedBy("has_item", inventoryTrigger(unlockedBy.get()));
b.save(result -> {
consumer.accept(
isOtherMod ? new ModdedCookingRecipeResult(result, compatDatagenOutput, recipeConditions)
: result);
}, createSimpleLocation(RegisteredObjects.getKeyOrThrow(serializer)
.getPath()));
});
}
}
}
private static class ModdedCookingRecipeResult implements FinishedRecipe {
private FinishedRecipe wrapped;
private ResourceLocation outputOverride;
private List<ICondition> conditions;
public ModdedCookingRecipeResult(FinishedRecipe wrapped, ResourceLocation outputOverride,
List<ICondition> conditions) {
this.wrapped = wrapped;
this.outputOverride = outputOverride;
this.conditions = conditions;
}
@Override
public ResourceLocation getId() {
return wrapped.getId();
}
@Override
public RecipeSerializer<?> getType() {
return wrapped.getType();
}
@Override
public JsonObject serializeAdvancement() {
return wrapped.serializeAdvancement();
}
@Override
public ResourceLocation getAdvancementId() {
return wrapped.getAdvancementId();
}
@Override
public void serializeRecipeData(JsonObject object) {
wrapped.serializeRecipeData(object);
object.addProperty("result", outputOverride.toString());
JsonArray conds = new JsonArray();
conditions.forEach(c -> conds.add(CraftingHelper.serialize(c)));
object.add("conditions", conds);
}
}
@Override
public String getName() {
return "TFMG's Standard Recipes";
}
public TFMGStandardRecipeGen(DataGenerator generator) {
super(generator);
}
}

View File

@@ -0,0 +1,25 @@
package com.drmangotea.createindustry.base.effects;
import net.minecraft.world.effect.MobEffect;
import net.minecraft.world.effect.MobEffectCategory;
import net.minecraft.world.entity.LivingEntity;
public class FrostyEffect extends MobEffect {
public FrostyEffect(MobEffectCategory pCategory, int pColor) {
super(pCategory, pColor);
}
@Override
public void applyEffectTick(LivingEntity pLivingEntity, int pAmplifier) {
if (pLivingEntity.getTicksFrozen() > 1) {
pLivingEntity.setTicksFrozen(pLivingEntity.getTicksFrozen() + 5);
} else {
pLivingEntity.setTicksFrozen(5);
}
}
@Override
public boolean isDurationEffectTick(int pDuration, int pAmplifier) {
return true;
}
}

View File

@@ -0,0 +1,22 @@
package com.drmangotea.createindustry.base.multiblock;
import com.drmangotea.createindustry.registry.TFMGBlockEntities;
import com.simibubi.create.foundation.block.IBE;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.entity.BlockEntityType;
public class FluidOutputBlock extends Block implements IBE<FluidOutputBlockEntity> {
public FluidOutputBlock(Properties pProperties) {
super(pProperties);
}
@Override
public Class<FluidOutputBlockEntity> getBlockEntityClass() {
return FluidOutputBlockEntity.class;
}
@Override
public BlockEntityType<? extends FluidOutputBlockEntity> getBlockEntityType() {
return TFMGBlockEntities.FLUID_OUTPUT.get();
}
}

View File

@@ -0,0 +1,135 @@
package com.drmangotea.createindustry.base.multiblock;
import com.simibubi.create.content.equipment.goggles.IHaveGoggleInformation;
import com.simibubi.create.foundation.blockEntity.SmartBlockEntity;
import com.simibubi.create.foundation.blockEntity.behaviour.BlockEntityBehaviour;
import com.simibubi.create.foundation.fluid.SmartFluidTank;
import com.simibubi.create.foundation.utility.Lang;
import com.simibubi.create.foundation.utility.LangBuilder;
import net.minecraft.ChatFormatting;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.chat.Component;
import net.minecraft.world.level.block.entity.BlockEntityType;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraftforge.common.capabilities.Capability;
import net.minecraftforge.common.capabilities.ForgeCapabilities;
import net.minecraftforge.common.util.LazyOptional;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.IFluidTank;
import net.minecraftforge.fluids.capability.IFluidHandler;
import net.minecraftforge.fluids.capability.templates.FluidTank;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.util.List;
import java.util.Optional;
public class FluidOutputBlockEntity extends SmartBlockEntity implements IHaveGoggleInformation {
protected LazyOptional<IFluidHandler> fluidCapability = LazyOptional.of(() -> {
return this.tankInventory;
});
public FluidTank tankInventory = this.createInventory();
public FluidOutputBlockEntity(BlockEntityType<?> type, BlockPos pos, BlockState state) {
super(type, pos, state);
this.refreshCapability();
}
protected SmartFluidTank createInventory() {
return new SmartFluidTank(1000, this::onFluidStackChanged);
}
protected void onFluidStackChanged(FluidStack newFluidStack) {
this.sendData();
}
@Override
public void addBehaviours(List<BlockEntityBehaviour> behaviours) {
}
public void invalidate() {
super.invalidate();
this.fluidCapability.invalidate();
}
@Nonnull
public <T> LazyOptional<T> getCapability(@Nonnull Capability<T> cap, @Nullable Direction side) {
if (!this.fluidCapability.isPresent()) {
this.refreshCapability();
}
return cap == ForgeCapabilities.FLUID_HANDLER ? this.fluidCapability.cast() : super.getCapability(cap, side);
}
private void refreshCapability() {
LazyOptional<IFluidHandler> oldCap = this.fluidCapability;
this.fluidCapability = LazyOptional.of(() -> {
return this.handlerForCapability();
});
oldCap.invalidate();
}
private IFluidHandler handlerForCapability() {
return this.tankInventory;
}
public IFluidTank getTankInventory() {
return this.tankInventory;
}
public void notifyUpdate() {
super.notifyUpdate();
}
protected void read(CompoundTag compound, boolean clientPacket) {
super.read(compound, clientPacket);
this.tankInventory.setCapacity(0);
this.tankInventory.readFromNBT(compound.getCompound("TankContent"));
}
public void write(CompoundTag compound, boolean clientPacket) {
compound.put("TankContent", this.tankInventory.writeToNBT(new CompoundTag()));
super.write(compound, clientPacket);
}
public boolean addToGoggleTooltip(List<Component> tooltip, boolean isPlayerSneaking) {
LazyOptional<IFluidHandler> handler = this.getCapability(ForgeCapabilities.FLUID_HANDLER);
Optional<IFluidHandler> resolve = handler.resolve();
if (!resolve.isPresent()) {
return false;
} else {
IFluidHandler tank = (IFluidHandler)resolve.get();
if (tank.getTanks() == 0) {
return false;
} else {
LangBuilder mb = Lang.translate("generic.unit.millibuckets", new Object[0]);
boolean isEmpty = true;
for(int i = 0; i < tank.getTanks(); ++i) {
FluidStack fluidStack = tank.getFluidInTank(i);
if (!fluidStack.isEmpty()) {
Lang.fluidName(fluidStack).style(ChatFormatting.GRAY).forGoggles(tooltip, 1);
Lang.builder().add(Lang.number((double)fluidStack.getAmount()).add(mb).style(ChatFormatting.DARK_GREEN)).text(ChatFormatting.GRAY, " / ").add(Lang.number((double)tank.getTankCapacity(i)).add(mb).style(ChatFormatting.DARK_GRAY)).forGoggles(tooltip, 1);
isEmpty = false;
}
}
if (tank.getTanks() > 1) {
if (isEmpty) {
tooltip.remove(tooltip.size() - 1);
}
return true;
} else if (!isEmpty) {
return true;
} else {
Lang.translate("gui.goggles.fluid_container.capacity", new Object[0]).add(Lang.number((double)tank.getTankCapacity(0)).add(mb).style(ChatFormatting.DARK_GREEN)).style(ChatFormatting.DARK_GRAY).forGoggles(tooltip, 1);
return true;
}
}
}
}
}

View File

@@ -0,0 +1,172 @@
package com.drmangotea.createindustry.base.multiblock;
import com.drmangotea.createindustry.blocks.machines.metal_processing.blast_stove.BlastStoveBlock;
import com.simibubi.create.content.equipment.goggles.IHaveGoggleInformation;
import com.simibubi.create.foundation.blockEntity.SmartBlockEntity;
import com.simibubi.create.foundation.blockEntity.behaviour.BlockEntityBehaviour;
import com.simibubi.create.foundation.fluid.SmartFluidTank;
import com.simibubi.create.foundation.utility.Lang;
import com.simibubi.create.foundation.utility.LangBuilder;
import net.minecraft.ChatFormatting;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.chat.Component;
import net.minecraft.world.level.block.entity.BlockEntityType;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.properties.BlockStateProperties;
import net.minecraftforge.common.capabilities.Capability;
import net.minecraftforge.common.capabilities.ForgeCapabilities;
import net.minecraftforge.common.util.LazyOptional;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.IFluidTank;
import net.minecraftforge.fluids.capability.IFluidHandler;
import net.minecraftforge.fluids.capability.templates.FluidTank;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.util.List;
import java.util.Optional;
public class MultiblockMasterBlockEntity extends SmartBlockEntity implements IHaveGoggleInformation {
protected LazyOptional<IFluidHandler> fluidCapability = LazyOptional.of(() -> {
return this.tankInventory;
});
public FluidTank tankInventory = this.createInventory();
public boolean isValid = false;
public int timer;
public final String multiblockIdentifier;
public final int masterTankCapacity;
public MultiblockStructure multiblockStructure;
public Direction getMasterDirection() {
return this.getBlockState().getValue(BlockStateProperties.HORIZONTAL_FACING);
}
public MultiblockMasterBlockEntity(BlockEntityType<?> type, BlockPos pos, BlockState state, int masterTankCapacity, String multiblockIdentifier) {
super(type, pos, state);
this.timer = -1;
this.masterTankCapacity = masterTankCapacity;
this.multiblockIdentifier = multiblockIdentifier;
}
public String getMultiblockIdentifier() {
return this.multiblockIdentifier;
}
protected SmartFluidTank createInventory() {
return new SmartFluidTank(1000, this::onFluidStackChanged);
}
protected void onFluidStackChanged(FluidStack newFluidStack) {
this.sendData();
}
public void tick() {
super.tick();
if (this.level == null) {
return;
}
if (multiblockStructure != null) {
multiblockStructure.renderGhostBlocks();
multiblockStructure.setFluidOutputCapacities();
isValid = multiblockStructure.isStructureCorrect();
}
}
public void invalidate() {
super.invalidate();
this.fluidCapability.invalidate();
}
@Nonnull
public <T> LazyOptional<T> getCapability(@Nonnull Capability<T> cap, @Nullable Direction side) {
if (!this.fluidCapability.isPresent()) {
this.refreshCapability();
}
return cap == ForgeCapabilities.FLUID_HANDLER ? this.fluidCapability.cast() : super.getCapability(cap, side);
}
private IFluidHandler handlerForCapability() {
return this.tankInventory;
}
public IFluidTank getTankInventory() {
return this.tankInventory;
}
private void refreshCapability() {
LazyOptional<IFluidHandler> oldCap = this.fluidCapability;
this.fluidCapability = LazyOptional.of(this::handlerForCapability);
oldCap.invalidate();
}
protected void read(CompoundTag compound, boolean clientPacket) {
super.read(compound, clientPacket);
this.tankInventory.readFromNBT(compound.getCompound("TankContent"));
}
public void write(CompoundTag compound, boolean clientPacket) {
super.write(compound, clientPacket);
compound.put("TankContent", this.tankInventory.writeToNBT(new CompoundTag()));
}
@Override
public void addBehaviours(List<BlockEntityBehaviour> list) {
}
public boolean addToGoggleTooltip(List<Component> tooltip, boolean isPlayerSneaking) {
if (!isValid) {
Lang.translate("goggles.reverbaratory.invalid").style(ChatFormatting.RED).forGoggles(tooltip, 1);
} else {
if (!isPlayerSneaking) {
Lang.translate("goggles.reverbaratory.stats").style(ChatFormatting.GRAY).forGoggles(tooltip, 1);
if (this.timer > 0) {
Lang.translate("goggles.blast_furnace.status.running").style(ChatFormatting.YELLOW).forGoggles(tooltip, 1);
} else {
Lang.translate("goggles.blast_furnace.status.off").style(ChatFormatting.YELLOW).forGoggles(tooltip, 1);
}
}
}
LazyOptional<IFluidHandler> handler = this.getCapability(ForgeCapabilities.FLUID_HANDLER);
Optional<IFluidHandler> resolve = handler.resolve();
if (!resolve.isPresent()) {
return false;
} else {
if (isPlayerSneaking) {
multiblockStructure.addToGoggleTooltip(tooltip);
return false;
}
IFluidHandler tank = resolve.get();
if (tank.getTanks() == 0) {
return false;
} else {
LangBuilder mb = Lang.translate("generic.unit.millibuckets");
boolean isEmpty = true;
for(int i = 0; i < tank.getTanks(); ++i) {
FluidStack fluidStack = tank.getFluidInTank(i);
if (!fluidStack.isEmpty()) {
Lang.fluidName(fluidStack).style(ChatFormatting.GRAY).forGoggles(tooltip, 1);
Lang.builder().add(Lang.number((double)fluidStack.getAmount()).add(mb).style(ChatFormatting.GOLD)).text(ChatFormatting.GRAY, " / ").add(Lang.number((double)tank.getTankCapacity(i)).add(mb).style(ChatFormatting.DARK_GRAY)).forGoggles(tooltip, 1);
isEmpty = false;
}
}
if (tank.getTanks() > 1) {
if (isEmpty) {
tooltip.remove(tooltip.size() - 1);
}
return true;
} else if (!isEmpty) {
return true;
} else {
Lang.translate("gui.goggles.fluid_container.capacity", new Object[0]).add(Lang.number(tank.getTankCapacity(0)).add(mb).style(ChatFormatting.DARK_GREEN)).style(ChatFormatting.DARK_GRAY).forGoggles(tooltip, 1);
return true;
}
}
}
}
}

View File

@@ -0,0 +1,369 @@
package com.drmangotea.createindustry.base.multiblock;
import com.drmangotea.createindustry.CreateTFMG;
import com.drmangotea.createindustry.base.util.Triple;
import com.drmangotea.createindustry.registry.TFMGBlocks;
import com.simibubi.create.CreateClient;
import com.simibubi.create.foundation.blockEntity.behaviour.scrollValue.ScrollValueBehaviour;
import com.simibubi.create.foundation.utility.Lang;
import com.simibubi.create.foundation.utility.LangBuilder;
import com.simibubi.create.foundation.utility.ghost.GhostBlockParams;
import com.simibubi.create.foundation.utility.ghost.GhostBlockRenderer;
import net.minecraft.ChatFormatting;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.network.chat.Component;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.properties.BlockStateProperties;
import net.minecraftforge.common.capabilities.ForgeCapabilities;
import net.minecraftforge.common.util.LazyOptional;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.capability.IFluidHandler;
import java.util.*;
import java.util.stream.Collectors;
public class MultiblockStructure {
private final MultiblockMasterBlockEntity master;
private final ArrayList<Map<BlockPos, BlockState>> structure;
private final ArrayList<Map<BlockPos, String>> fluidOutputs = new ArrayList<>();
private final ArrayList<Map<String, Integer>> fluidCapacities = new ArrayList<>();
private final ArrayList<Map<BlockPos, String>> segments = new ArrayList<>();
public MultiblockStructure(MultiblockMasterBlockEntity master, ArrayList<Map<BlockPos, BlockState>> structure) {
this.master = master;
this.structure = structure;
}
public MultiblockStructure addSegment(BlockPos pos, String identifier) {
segments.add(Map.of(pos, identifier));
return this;
}
public MultiblockStructure addFluidOutput(BlockPos pos, String identifier) {
fluidOutputs.add(Map.of(pos, identifier));
return this;
}
public MultiblockStructure addFluidOutputs(List<Map<BlockPos, String>> fluidOutputs, List<Map<String, Integer>> fluidCapacities) {
this.fluidOutputs.addAll(fluidOutputs);
this.fluidCapacities.addAll(fluidCapacities);
return this;
}
public static CuboidBuilder cuboidBuilder(MultiblockMasterBlockEntity master) {
return new CuboidBuilder(master);
}
public static class CuboidBuilder {
private final MultiblockMasterBlockEntity master;
private Direction direction = null;
private boolean isDirectional = false;
private final ArrayList<Map<BlockPos, BlockState>> structure = new ArrayList<>();
private final ArrayList<Map<BlockPos, String>> fluidOutputs = new ArrayList<>();
private final ArrayList<Map<String, Integer>> fluidCapacities = new ArrayList<>();
private final ArrayList<Map<BlockPos, String>> segments = new ArrayList<>();
private int width = 0;
private int height = 0;
private int depth = 0;
public CuboidBuilder(MultiblockMasterBlockEntity master) {
this.master = master;
}
public MultiblockMasterBlockEntity getMaster() {
return master;
}
public BlockPos getMasterPosition() {
return getMaster().getBlockPos();
}
public CuboidBuilder cube(int size) {
return withSize(size, size, size);
}
public CuboidBuilder withSize(int width, int height) {
return withSize(width, height, width);
}
public CuboidBuilder withSize(int width, int height, int depth) {
this.width = width;
this.height = height;
this.depth = depth;
return this;
}
public CuboidBuilder directional(Direction direction) {
this.direction = direction;
this.isDirectional = true;
return this;
}
public Triple<Integer, Integer, Integer> getSize() {
return Triple.of(width, height, depth);
}
public int getWidth() {
return getSize().getFirst();
}
public int getHeight() {
return getSize().getSecond();
}
public int getDepth() {
return getSize().getThird();
}
public CuboidBuilder withFluidOutputAt(int x, int y, int z, String identifier, int capacity) {
BlockPos pos = translateToMaster(x, y, z);
fluidOutputs.add(Map.of(pos, identifier));
fluidCapacities.add(Map.of(identifier, capacity));
return withBlockAt(x, y, z, TFMGBlocks.FLUID_OUTPUT.get().defaultBlockState());
}
public CuboidBuilder withBlockAt(int x, int z, ScrollValueBehaviour y, BlockState block) {
return withBlockAt(x, y.getValue(), z, block);
}
public CuboidBuilder withBlockAt(int x, int y, int z, BlockState block) {
BlockPos pos = translateToMaster(x, y, z);
structure.add(Map.of(pos, block));
return this;
}
public CuboidBuilder withBlockAt(PositionUtil.PositionRange range, BlockState block) {
for (Triple<Integer, Integer, Integer> pos : range.getPositions()) {
structure.add(Map.of(translateToMaster(pos.getFirst(), pos.getSecond(), pos.getThird()), block));
}
return this;
}
public CuboidBuilder withSegmentAt(int x, int y, int z, StackableMultiblockSegment segment) {
for (Map<BlockPos, BlockState> map : segment.segmentStructure.getStructure()) {
for (BlockPos pos : map.keySet()) {
segments.add(Map.of(translateToMaster(x + pos.getX(), y + pos.getY(), z + pos.getZ()), segment.getSegmentIdentifier(pos, master.getMultiblockIdentifier())));
withBlockAt(x + pos.getX(), y + pos.getY(), z + pos.getZ(), map.get(pos));
}
}
return this;
}
private BlockPos translateToMaster(int x, int y, int z) {
BlockPos masterPos = getMasterPosition();
if (isDirectional) {
return masterPos.relative(direction, x).above(y).relative(direction.getClockWise(), z);
}
return masterPos.offset(x, y, z);
}
public MultiblockStructure build() {
return new MultiblockStructure(getMaster(), structure).addFluidOutputs(fluidOutputs, fluidCapacities);
}
}
private Triple<Integer, Integer, Integer> translateToRelative(BlockPos pos, Direction direction) {
BlockPos masterPos = getMasterPosition();
int x = pos.getX() - masterPos.getX();
int y = pos.getY() - masterPos.getY();
int z = pos.getZ() - masterPos.getZ();
if (direction == null) {
return Triple.of(x, y, z);
}
return Triple.of(direction.getAxis() == Direction.Axis.X ? x : direction.getAxis() == Direction.Axis.Y ? y : z, y, direction.getAxis() == Direction.Axis.Z ? x : direction.getAxis() == Direction.Axis.Y ? z : y);
}
public ArrayList<Map<BlockPos, BlockState>> getStructure() {
return structure;
}
public BlockEntity getMaster() {
return master;
}
public ArrayList<Map<BlockPos, String>> getFluidOutputs() {
return fluidOutputs;
}
public ArrayList<FluidOutputBlockEntity> getFluidOutputBlockEntities() {
ArrayList<FluidOutputBlockEntity> fluidOutputBlockEntities = new ArrayList<>();
for (Map<BlockPos, String> map : fluidOutputs) {
for (BlockPos pos : map.keySet()) {
BlockEntity blockEntity = master.getLevel().getBlockEntity(pos);
if (blockEntity instanceof FluidOutputBlockEntity) {
fluidOutputBlockEntities.add((FluidOutputBlockEntity) blockEntity);
}
}
}
return fluidOutputBlockEntities;
}
public BlockPos getFluidOutputPosition(String identifier) {
for (Map<BlockPos, String> map : fluidOutputs) {
for (BlockPos pos : map.keySet()) {
if (map.get(pos).equals(identifier)) {
return pos;
}
}
}
return null;
}
public BlockPos getMasterPosition() {
return getMaster().getBlockPos();
}
public BlockState getMasterBlockState() {
return getMaster().getLevel().getBlockState(getMasterPosition());
}
public Direction getMasterDirection() {
return getMasterBlockState().getValue(BlockStateProperties.FACING);
}
public boolean isBlockCorrect(BlockPos pos) {
if (master.getLevel() == null) return false;
for (Map<BlockPos, BlockState> map : getStructure()) {
if (map.containsKey(pos)) {
return master.getLevel().getBlockState(pos).is(map.get(pos).getBlock());
}
}
return false;
}
public void renderGhostBlocksByYLevel() {
if (master.getLevel() == null) {
CreateTFMG.LOGGER.error("Level is null, cannot render ghost blocks");
return;
}
// Group blocks by their y-levels
Map<Integer, List<BlockPos>> yLevelMap = new HashMap<>();
for (Map<BlockPos, BlockState> map : getStructure()) {
for (BlockPos pos : map.keySet()) {
yLevelMap.computeIfAbsent(pos.getY(), k -> new ArrayList<>()).add(pos);
}
}
// Check each y-level for completeness and render ghost blocks for the first incomplete y-level
for (Integer yLevel : yLevelMap.keySet().stream().sorted().toList()) {
boolean isComplete = true;
for (BlockPos pos : yLevelMap.get(yLevel)) {
if (!isBlockCorrect(pos)) {
isComplete = false;
break;
}
}
if (!isComplete) {
for (BlockPos pos : yLevelMap.get(yLevel)) {
for (Map<BlockPos, BlockState> map : getStructure()) {
if (!isBlockCorrect(pos)) {
BlockState blockState = map.get(pos);
if (blockState != null)
CreateClient.GHOST_BLOCKS.showGhost(pos, GhostBlockRenderer.standard(), GhostBlockParams.of(blockState).at(pos).breathingAlpha(), 1);
}
}
}
break; // Stop after rendering the first incomplete y-level
}
}
}
public void renderGhostBlocks() {
if (master.getLevel() == null) {
CreateTFMG.LOGGER.error("Level is null, cannot render ghost blocks");
return;
}
for (Map<BlockPos, BlockState> map : getStructure()) {
for (BlockPos pos : map.keySet()) {
if (!isBlockCorrect(pos)) {
CreateClient.GHOST_BLOCKS.showGhost(pos, GhostBlockRenderer.standard(), GhostBlockParams.of(map.get(pos)).at(pos).breathingAlpha(), 1);
}
}
}
}
public boolean isStructureCorrect() {
for (Map<BlockPos, BlockState> map : getStructure()) {
for (BlockPos pos : map.keySet()) {
if (!isBlockCorrect(pos)) {
return false;
}
}
}
return true;
}
public void setFluidOutputCapacities() {
if (master.getLevel() == null) return;
for (Map<String, Integer> map : fluidCapacities) {
for (String identifier : map.keySet()) {
FluidOutputBlockEntity fluidOutput = master.getLevel().getBlockEntity(getFluidOutputPosition(identifier)) instanceof FluidOutputBlockEntity ? (FluidOutputBlockEntity) master.getLevel().getBlockEntity(getFluidOutputPosition(identifier)) : null;
setFluidOutputCapacity(fluidOutput, isStructureCorrect() ? map.get(identifier) : 0);
}
}
}
public void setFluidOutputCapacity(FluidOutputBlockEntity fluidOutput, int value) {
if (fluidOutput == null) return;
if (fluidOutput.tankInventory.getCapacity() == value) return;
fluidOutput.tankInventory.setCapacity(value);
}
public void addFluidTooltip(List<Component> tooltip, Optional<IFluidHandler> resolve, BlockPos fluidOutput) {
if (!resolve.isPresent()) {
return;
} else {
IFluidHandler tank = resolve.get();
if (tank.getTanks() == 0) {
return;
} else {
LangBuilder tankName = null;
for (Map<BlockPos, String> map : getFluidOutputs()) {
for (BlockPos pos : map.keySet()) {
if (pos.equals(fluidOutput)) {
tankName = Lang.translate(map.get(pos));
}
}
}
LangBuilder mb = Lang.translate("generic.unit.millibuckets");
boolean isEmpty = true;
if (tankName != null) {
tankName.style(ChatFormatting.WHITE).forGoggles(tooltip, 1);
}
for(int i = 0; i < tank.getTanks(); ++i) {
FluidStack fluidStack = tank.getFluidInTank(i);
if (!fluidStack.isEmpty()) {
Lang.fluidName(fluidStack).style(ChatFormatting.GRAY).forGoggles(tooltip, 1);
Lang.builder().add(Lang.number(fluidStack.getAmount()).add(mb).style(ChatFormatting.GOLD)).text(ChatFormatting.GRAY, " / ").add(Lang.number((double)tank.getTankCapacity(i)).add(mb).style(ChatFormatting.DARK_GRAY)).forGoggles(tooltip, 1);
isEmpty = false;
}
}
if (tank.getTanks() > 1) {
if (isEmpty) {
tooltip.remove(tooltip.size() - 1);
}
return;
} else if (!isEmpty) {
return;
} else {
Lang.translate("gui.goggles.fluid_container.capacity", new Object[0]).add(Lang.number(tank.getTankCapacity(0)).add(mb).style(ChatFormatting.DARK_GREEN)).style(ChatFormatting.DARK_GRAY).forGoggles(tooltip, 1);
return;
}
}
}
}
public void addToGoggleTooltip(List<Component> tooltip) {
for (FluidOutputBlockEntity fluidOutput : getFluidOutputBlockEntities()) {
LazyOptional<IFluidHandler> handler = fluidOutput.getCapability(ForgeCapabilities.FLUID_HANDLER);
Optional<IFluidHandler> resolve = handler.resolve();
addFluidTooltip(tooltip, resolve, fluidOutput.getBlockPos());
}
}
}

View File

@@ -0,0 +1,88 @@
package com.drmangotea.createindustry.base.multiblock;
import com.drmangotea.createindustry.base.util.Triple;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import java.util.ArrayList;
import java.util.List;
public class PositionUtil {
public static BlockPos getLeftSidePos(BlockPos pos, Direction direction) {
return pos.relative(direction.getCounterClockWise());
}
public static BlockPos getLeftSidePos(BlockPos pos, int distance, Direction direction) {
return pos.relative(direction.getCounterClockWise(), distance);
}
public static BlockPos getRightSidePos(BlockPos pos, Direction direction) {
return pos.relative(direction.getClockWise());
}
public static BlockPos getRightSidePos(BlockPos pos, int distance, Direction direction) {
return pos.relative(direction.getClockWise(), distance);
}
public static List<Integer> zero() {
return List.of(0);
}
public static List<Integer> pos(int pos) {
return List.of(pos);
}
public static List<Integer> generateSequence(int start, int end, int step) {
List<Integer> sequence = new ArrayList<>();
for (int i = start; i <= end; i += step) {
sequence.add(i);
}
return sequence;
}
public static class PositionRange {
private final List<Integer> xRange;
private final List<Integer> yRange;
private final List<Integer> zRange;
private final List<Triple<Integer, Integer, Integer>> toIgnore = new ArrayList<>();
public PositionRange(List<Integer> xRange, List<Integer> yRange, List<Integer> zRange) {
this.xRange = xRange;
this.yRange = yRange;
this.zRange = zRange;
}
public PositionRange ignorePosition(int x, int y, int z) {
toIgnore.add(Triple.of(x, y, z));
return this;
}
public List<Integer> getXRange() {
return xRange;
}
public List<Integer> getYRange() {
return yRange;
}
public List<Integer> getZRange() {
return zRange;
}
public List<Triple<Integer, Integer, Integer>> getPositions() {
List<Triple<Integer, Integer, Integer>> positions = new ArrayList<>();
for (int x : xRange) {
for (int y : yRange) {
for (int z : zRange) {
if (toIgnore.contains(Triple.of(x, y, z))) {
continue;
}
if (x == 0 && y == 0 && z == 0) {
continue;
}
positions.add(Triple.of(x, y, z));
}
}
}
return positions;
}
}
}

View File

@@ -0,0 +1,40 @@
package com.drmangotea.createindustry.base.multiblock;
import net.minecraft.core.BlockPos;
public class StackableMultiblockSegment {
private final int maxSegmentHeight = 1;
public MultiblockStructure segmentStructure;
private int maxStackHeight = 4;
public StackableMultiblockSegment(MultiblockStructure segmentStructure) {
this.segmentStructure = segmentStructure;
}
public StackableMultiblockSegment maxStackHeight(int pMaxStackHeight) {
maxStackHeight = pMaxStackHeight;
return this;
}
public int getMaxStackHeight() {
return maxStackHeight;
}
public int getMaxSegmentHeight() {
return maxSegmentHeight;
}
public boolean isSegmentValid() {
return segmentStructure.isStructureCorrect();
}
private String createSegmentIdentifier(BlockPos pos, String multiblockIdentifier) {
return "(multiblockSegment:" + multiblockIdentifier + ":" + pos.getX() + "," + pos.getY() + "," + pos.getZ() + ")";
}
public String getSegmentIdentifier(BlockPos pos, String multiblockIdentifier) {
return createSegmentIdentifier(pos, multiblockIdentifier);
}
}

View File

@@ -0,0 +1,39 @@
package com.drmangotea.createindustry.base.util;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.crafting.Ingredient;
import net.minecraftforge.common.brewing.BrewingRecipe;
import javax.annotation.Nonnull;
public class ProperBrewingRecipe extends BrewingRecipe {
private final Ingredient input;
private final Ingredient ingredient;
private final ItemStack output;
public ProperBrewingRecipe(Ingredient input, Ingredient ingredient, ItemStack output) {
super(input, ingredient, output);
this.input = input;
this.ingredient = ingredient;
this.output = output;
}
@Override
public boolean isInput(@Nonnull ItemStack stack) {
ItemStack[] matchingStacks = input.getItems();
if (matchingStacks.length == 0) {
return stack.isEmpty();
} else {
for (ItemStack itemstack : matchingStacks) {
if (itemstack.sameItem(stack) && ItemStack.tagMatches(itemstack, stack)) {
return true;
}
}
return false;
}
}
}

View File

@@ -0,0 +1,72 @@
package com.drmangotea.createindustry.base.util;
import java.io.Serializable;
import java.util.Objects;
public class Triple<A, B, C> implements Serializable {
private static final long serialVersionUID = -7076291895521537427L;
protected A first;
protected B second;
protected C third;
public Triple(A a, B b, C c) {
this.first = a;
this.second = b;
this.third = c;
}
public A getFirst() {
return this.first;
}
public B getSecond() {
return this.second;
}
public C getThird() {
return this.third;
}
public void setFirst(A a) {
this.first = a;
}
public void setSecond(B b) {
this.second = b;
}
public void setThird(C c) {
this.third = c;
}
public <E> boolean hasElement(E e) {
if (e == null) {
return this.first == null || this.second == null || this.third == null;
} else {
return e.equals(this.first) || e.equals(this.second) || e.equals(this.third);
}
}
public String toString() {
return "(" + this.first + "," + this.second + "," + this.third + ")";
}
public boolean equals(Object o) {
if (this == o) {
return true;
} else if (!(o instanceof Triple)) {
return false;
} else {
Triple<A, B, C> other = (Triple)o;
return Objects.equals(this.first, other.first) && Objects.equals(this.second, other.second) && Objects.equals(this.third, other.third);
}
}
public int hashCode() {
return Objects.hash(new Object[]{this.first, this.second, this.third});
}
public static <A, B, C> Triple<A, B, C> of(A a, B b, C c) {
return new Triple(a, b, c);
}
}

View File

@@ -0,0 +1,155 @@
package com.drmangotea.createindustry.base.util.spark;
import com.drmangotea.createindustry.items.weapons.explosives.thermite_grenades.fire.BlueFireBlock;
import com.drmangotea.createindustry.items.weapons.explosives.thermite_grenades.fire.GreenFireBlock;
import com.drmangotea.createindustry.registry.TFMGEntityTypes;
import com.drmangotea.createindustry.registry.TFMGItems;
import com.drmangotea.createindustry.registry.TFMGMobEffects;
import com.simibubi.create.content.fluids.OpenEndedPipe;
import com.simibubi.create.content.trains.CubeParticleData;
import net.minecraft.core.BlockPos;
import net.minecraft.core.particles.ParticleOptions;
import net.minecraft.core.particles.ParticleTypes;
import net.minecraft.tags.BlockTags;
import net.minecraft.world.effect.MobEffectInstance;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.Mob;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.entity.projectile.ThrowableProjectile;
import net.minecraft.world.item.Item;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.AbstractCandleBlock;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.CampfireBlock;
import net.minecraft.world.level.block.SnowLayerBlock;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.properties.BlockStateProperties;
import net.minecraft.world.phys.BlockHitResult;
import net.minecraft.world.phys.EntityHitResult;
import net.minecraft.world.phys.HitResult;
public class CoolSpark extends ThrowableProjectile {
public CoolSpark(EntityType<? extends CoolSpark> p_37391_, Level p_37392_) {
super(p_37391_, p_37392_);
}
public CoolSpark(Level p_37399_, LivingEntity p_37400_) {
super(TFMGEntityTypes.COOL_SPARK.get(), p_37400_, p_37399_);
}
public CoolSpark(Level p_37394_, double p_37395_, double p_37396_, double p_37397_) {
super(TFMGEntityTypes.COOL_SPARK.get(), p_37395_, p_37396_, p_37397_, p_37394_);
}
@Override
protected float getGravity(){
return 0.02f;
}
@Override
protected void defineSynchedData() {
}
public void tick(){
super.tick();
if (this.isInWaterOrRain()) {
this.discard();
}
if(this.level.isClientSide) {
CubeParticleData data = new CubeParticleData(191, 82, 91, 0.1f, 10, true);
level.addParticle(data, this.getX(), this.getY(), this.getZ(), this.random.nextGaussian() * 0.05D, -this.getDeltaMovement().y * 0.5D, this.random.nextGaussian() * 0.05D);
}
}
private ParticleOptions getParticle() {
return ParticleTypes.SNOWFLAKE;
}
public void handleEntityEvent(byte p_37402_) {
if (p_37402_ == 3) {
ParticleOptions particleoptions = this.getParticle();
for(int i = 0; i < 8; ++i) {
this.level.addParticle(particleoptions, this.getX(), this.getY(), this.getZ(), 0.0D, 0.0D, 0.0D);
}
}
}
protected void onHitBlock(BlockHitResult hitResult) {
super.onHitBlock(hitResult);
if (!this.level.isClientSide) {
Entity entity = this.getOwner();
if (!(entity instanceof Mob) || net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.level, this)) {
BlockPos blockpos = hitResult.getBlockPos().relative(hitResult.getDirection());
if (this.level.getBlockState(blockpos).getBlock() == Blocks.SNOW) {
// Stack snow layers
final int layers = this.level.getBlockState(blockpos).getValue(BlockStateProperties.LAYERS);
if (layers < 5) {
level.setBlockAndUpdate(blockpos, this.level.getBlockState(blockpos).setValue(BlockStateProperties.LAYERS, 1 + layers));
}
} else if (this.level.isEmptyBlock(blockpos) && this.level.getBlockState(blockpos.below()).getBlock() != Blocks.SNOW) {
this.level.setBlockAndUpdate(blockpos, Blocks.SNOW.defaultBlockState());
}
dowseFire(this.level, blockpos);
}
}
}
private static void dowseFire(Level level, BlockPos pos) {
BlockState state = level.getBlockState(pos);
if (state.is(BlockTags.FIRE)) {
level.removeBlock(pos, false);
} else if (AbstractCandleBlock.isLit(state)) {
AbstractCandleBlock.extinguish((Player)null, state, level, pos);
} else if (CampfireBlock.isLitCampfire(state)) {
level.levelEvent((Player)null, 1009, pos, 0);
CampfireBlock.dowse((Entity)null, level, pos, state);
level.setBlockAndUpdate(pos, (BlockState)state.setValue(CampfireBlock.LIT, false));
}
}
protected void onHitEntity(EntityHitResult p_37386_) {
super.onHitEntity(p_37386_);
if (!this.level.isClientSide) {
Entity entity = p_37386_.getEntity();
Entity entity1 = this.getOwner();
if(entity instanceof LivingEntity){
((LivingEntity)entity).addEffect(new MobEffectInstance(TFMGMobEffects.FROSTY.get(),400));
}
}
}
protected void onHit(HitResult p_37406_) {
super.onHit(p_37406_);
if (!this.level.isClientSide) {
this.level.broadcastEntityEvent(this, (byte)3);
//this.level.explode(this, this.getX(), this.getY(0.0625D), this.getZ(), 2.0F, Explosion.BlockInteraction.NONE);
this.discard();
}
}
@SuppressWarnings("unchecked")
public static EntityType.Builder<?> build(EntityType.Builder<?> builder) {
EntityType.Builder<CoolSpark> entityBuilder = (EntityType.Builder<CoolSpark>) builder;
return entityBuilder.sized(.25f, .25f);
}
}

View File

@@ -0,0 +1,55 @@
package com.drmangotea.createindustry.base.util.spark;
import com.drmangotea.createindustry.CreateTFMG;
import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.blaze3d.vertex.VertexConsumer;
import com.mojang.math.Matrix3f;
import com.mojang.math.Matrix4f;
import com.mojang.math.Vector3f;
import net.minecraft.client.renderer.MultiBufferSource;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.client.renderer.entity.EntityRenderer;
import net.minecraft.client.renderer.entity.EntityRendererProvider;
import net.minecraft.client.renderer.texture.OverlayTexture;
import net.minecraft.core.BlockPos;
import net.minecraft.resources.ResourceLocation;
public class CoolSparkRenderer extends EntityRenderer<CoolSpark> {
private static final ResourceLocation TEXTURE_LOCATION = CreateTFMG.asResource("textures/entity/blue_spark.png");
private static final RenderType RENDER_TYPE = RenderType.entityCutoutNoCull(TEXTURE_LOCATION);
public CoolSparkRenderer(EntityRendererProvider.Context p_173962_) {
super(p_173962_);
}
protected int getBlockLightLevel(CoolSpark p_114087_, BlockPos p_114088_) {
return 15;
}
public void render(CoolSpark p_114080_, float p_114081_, float p_114082_, PoseStack p_114083_, MultiBufferSource p_114084_, int p_114085_) {
p_114083_.pushPose();
p_114083_.scale(0.5F, 0.5F, 0.5F);
p_114083_.mulPose(this.entityRenderDispatcher.cameraOrientation());
p_114083_.mulPose(Vector3f.YP.rotationDegrees(180.0F));
PoseStack.Pose posestack$pose = p_114083_.last();
Matrix4f matrix4f = posestack$pose.pose();
Matrix3f matrix3f = posestack$pose.normal();
VertexConsumer vertexconsumer = p_114084_.getBuffer(RENDER_TYPE);
vertex(vertexconsumer, matrix4f, matrix3f, p_114085_, 0.0F, 0, 0, 1);
vertex(vertexconsumer, matrix4f, matrix3f, p_114085_, 1.0F, 0, 1, 1);
vertex(vertexconsumer, matrix4f, matrix3f, p_114085_, 1.0F, 1, 1, 0);
vertex(vertexconsumer, matrix4f, matrix3f, p_114085_, 0.0F, 1, 0, 0);
p_114083_.popPose();
super.render(p_114080_, p_114081_, p_114082_, p_114083_, p_114084_, p_114085_);
}
private static void vertex(VertexConsumer p_114090_, Matrix4f p_114091_, Matrix3f p_114092_, int p_114093_, float p_114094_, int p_114095_, int p_114096_, int p_114097_) {
p_114090_.vertex(p_114091_, p_114094_ - 0.5F, (float)p_114095_ - 0.25F, 0.0F).color(255, 255, 255, 255).uv((float)p_114096_, (float)p_114097_).overlayCoords(OverlayTexture.NO_OVERLAY).uv2(p_114093_).normal(p_114092_, 0.0F, 1.0F, 0.0F).endVertex();
}
public ResourceLocation getTextureLocation(CoolSpark p_114078_) {
return TEXTURE_LOCATION;
}
}

View File

@@ -1,10 +1,9 @@
package com.drmangotea.createindustry.blocks.engines.intake;
import com.drmangotea.createindustry.registry.TFMGBlocks;
import com.drmangotea.createindustry.registry.TFMGFluids;
import com.drmangotea.createindustry.registry.TFMGTags;
import com.simibubi.create.content.equipment.wrench.IWrenchable;
import com.simibubi.create.content.kinetics.base.KineticBlockEntity;
import com.simibubi.create.foundation.fluid.CombinedTankWrapper;
import com.simibubi.create.foundation.fluid.SmartFluidTank;
import com.simibubi.create.foundation.utility.Lang;
import com.simibubi.create.foundation.utility.LangBuilder;
@@ -31,7 +30,6 @@ import javax.annotation.Nonnull;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import java.util.stream.Stream;
import static com.drmangotea.createindustry.blocks.engines.intake.AirIntakeBlock.INVISIBLE;
import static com.simibubi.create.content.kinetics.base.DirectionalKineticBlock.FACING;
@@ -47,7 +45,10 @@ public class AirIntakeBlockEntity extends KineticBlockEntity implements IWrencha
boolean isUsedByController = false;
int efficiency = 1;
boolean allObstructed = false;
boolean isObstructed = false;
public BlockPos controller;
public List<AirIntakeBlockEntity> blockEntities = new ArrayList<>();
@@ -77,14 +78,12 @@ public class AirIntakeBlockEntity extends KineticBlockEntity implements IWrencha
//if(!level.isClientSide) {
int production = ((int) maxShaftSpeed * ((diameter * diameter))) / 10;
if (tankInventory.getFluidAmount() + production <= tankInventory.getCapacity()) {
//tankInventory.fill(new FluidStack(TFMGFluids.AIR.getSource(), production), IFluidHandler.FluidAction.EXECUTE);
if (tankInventory.getFluidAmount() + production <= tankInventory.getCapacity() && !allObstructed) {
tankInventory.setFluid(new FluidStack(TFMGFluids.AIR.getSource(), production + tankInventory.getFluidAmount()));
// if(controller!=null) {
// ((AirIntakeBlockEntity) level.getBlockEntity(controller)).setChanged();
// ((AirIntakeBlockEntity) level.getBlockEntity(controller)).sendData();
// }
}
isObstructed = hasBlockInFront(this.getBlockPos());
// }
////////////////
@@ -93,7 +92,8 @@ public class AirIntakeBlockEntity extends KineticBlockEntity implements IWrencha
sendData();
setChanged();
}
efficiency = getEfficiency();
if(diameter == 3){
visual_angle.chase(angle, 0.1f, LerpedFloat.Chaser.EXP);
@@ -108,8 +108,8 @@ public class AirIntakeBlockEntity extends KineticBlockEntity implements IWrencha
if(isUsedByController)
blockEntities.clear();
allObstructed = efficiency == 0;
if(!this.getBlockState().getValue(INVISIBLE)){
if(isController||isUsedByController){
@@ -127,7 +127,7 @@ public class AirIntakeBlockEntity extends KineticBlockEntity implements IWrencha
diameter =getPossibleDiameter();
if(controller == this.getBlockPos()) {
isUsedByController = false;
} else {
isUsedByController = true;
@@ -215,6 +215,30 @@ public class AirIntakeBlockEntity extends KineticBlockEntity implements IWrencha
}
public int getEfficiency(){
int result;
if (diameter == 1) {
result = 1;
if (isObstructed) {
result = 0;
}
} else {
int fans = blockEntities.toArray().length;
for (AirIntakeBlockEntity be : blockEntities) {
if (be.isObstructed) {
fans--;
}
}
result = fans;
}
return result;
}
public boolean hasBlockInFront(BlockPos pos){
return !level.getBlockState(pos.relative(this.getBlockState().getValue(FACING))).is(TFMGTags.TFMGBlockTags.AIR_INTAKE_TRANSPARENT.tag) && !level.getBlockState(pos.relative(this.getBlockState().getValue(FACING))).isAir();
}
@Override
public void invalidate() {
super.invalidate();
@@ -292,8 +316,6 @@ public class AirIntakeBlockEntity extends KineticBlockEntity implements IWrencha
BlockPos checkedPos = this.getBlockPos();
Direction direction = this.getBlockState().getValue(FACING);
List<BlockPos> checkedPosses = new ArrayList<>();
checkedPos = this.getBlockPos();
@@ -510,7 +532,16 @@ public class AirIntakeBlockEntity extends KineticBlockEntity implements IWrencha
.style(ChatFormatting.DARK_GREEN))
.style(ChatFormatting.DARK_GRAY)
.forGoggles(tooltip, 1);
if (isObstructed) {
Lang.translate("gui.goggles.fluid_container.obstructed")
.style(ChatFormatting.RED)
.forGoggles(tooltip, 1);
}
Lang.number(getEfficiency())
.style(ChatFormatting.DARK_GREEN)
.forGoggles(tooltip, 1);
return true;
@@ -548,7 +579,8 @@ public class AirIntakeBlockEntity extends KineticBlockEntity implements IWrencha
isUsedByController = compound.getBoolean("IsUsed");
hasShaft = compound.getBoolean("HasShaft");
tankInventory.readFromNBT(compound.getCompound("TankContent"));
efficiency = compound.getInt("Efficiency");
isObstructed = compound.getBoolean("IsObstructed");
}
@Override
@@ -561,6 +593,8 @@ public class AirIntakeBlockEntity extends KineticBlockEntity implements IWrencha
compound.putBoolean("IsUsed", isUsedByController);
compound.putBoolean("HasShaft", hasShaft);
compound.put("TankContent", tankInventory.writeToNBT(new CompoundTag()));
compound.putInt("Efficiency", efficiency);
compound.putBoolean("IsObstructed", isObstructed);
}
}

View File

@@ -23,7 +23,7 @@ public class FireboxGenerator extends SpecialBlockStateGen {
protected int getYRotation(BlockState state) {
short value;
switch ((Direction)state.getValue(HorizontalDirectionalBlock.FACING)) {
switch (state.getValue(HorizontalDirectionalBlock.FACING)) {
case NORTH:
value = 0;
break;
@@ -45,6 +45,6 @@ public class FireboxGenerator extends SpecialBlockStateGen {
}
public <T extends Block> ModelFile getModel(DataGenContext<Block, T> ctx, RegistrateBlockstateProvider prov, BlockState state) {
return (Boolean)(state.getValue(FireboxBlock.HEAT_LEVEL)!= BlazeBurnerBlock.HeatLevel.SMOULDERING) ? AssetLookup.partialBaseModel(ctx, prov, new String[]{"lit"}) : AssetLookup.partialBaseModel(ctx, prov, new String[0]);
return (Boolean)(state.getValue(FireboxBlock.HEAT_LEVEL)!= BlazeBurnerBlock.HeatLevel.SMOULDERING) ? AssetLookup.partialBaseModel(ctx, prov, "lit") : AssetLookup.partialBaseModel(ctx, prov);
}
}

View File

@@ -0,0 +1,39 @@
package com.drmangotea.createindustry.blocks.machines.metal_processing.blast_stove;
import com.drmangotea.createindustry.registry.TFMGBlockEntities;
import com.simibubi.create.foundation.block.IBE;
import net.minecraft.core.BlockPos;
import net.minecraft.world.item.context.BlockPlaceContext;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.HorizontalDirectionalBlock;
import net.minecraft.world.level.block.entity.BlockEntityType;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.StateDefinition;
import net.minecraft.world.level.block.state.properties.BooleanProperty;
public class BlastStoveBlock extends HorizontalDirectionalBlock implements IBE<BlastStoveBlockEntity> {
public static final BooleanProperty RUNNING = BooleanProperty.create("running");
public BlastStoveBlock(Properties p_54120_) {
super(p_54120_);
registerDefaultState(defaultBlockState().setValue(RUNNING, false));
}
public BlockState getStateForPlacement(BlockPlaceContext p_48781_) {
return this.defaultBlockState().setValue(FACING, p_48781_.getHorizontalDirection().getOpposite()).setValue(RUNNING, false);
}
@Override
public Class<BlastStoveBlockEntity> getBlockEntityClass() {
return BlastStoveBlockEntity.class;
}
public void onRemove(BlockState state, Level worldIn, BlockPos pos, BlockState newState, boolean isMoving) {
IBE.onRemove(state, worldIn, pos, newState);
}
@Override
public BlockEntityType<? extends BlastStoveBlockEntity> getBlockEntityType() {
return TFMGBlockEntities.BLAST_STOVE.get();
}
@Override
protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockState> pBuilder) {
super.createBlockStateDefinition(pBuilder.add(FACING, RUNNING));
}
}

View File

@@ -0,0 +1,263 @@
package com.drmangotea.createindustry.blocks.machines.metal_processing.blast_stove;
import com.drmangotea.createindustry.base.multiblock.FluidOutputBlockEntity;
import com.drmangotea.createindustry.base.multiblock.MultiblockMasterBlockEntity;
import com.drmangotea.createindustry.base.multiblock.MultiblockStructure;
import com.drmangotea.createindustry.base.multiblock.PositionUtil;
import com.drmangotea.createindustry.blocks.machines.firebox.FireboxBlock;
import com.drmangotea.createindustry.recipes.gas_blasting.GasBlastingRecipe;
import com.drmangotea.createindustry.registry.TFMGBlocks;
import com.simibubi.create.content.equipment.goggles.IHaveGoggleInformation;
import com.simibubi.create.foundation.blockEntity.behaviour.BlockEntityBehaviour;
import com.simibubi.create.foundation.blockEntity.behaviour.ValueBoxTransform;
import com.simibubi.create.foundation.blockEntity.behaviour.scrollValue.ScrollValueBehaviour;
import com.simibubi.create.foundation.fluid.CombinedTankWrapper;
import com.simibubi.create.foundation.recipe.RecipeFinder;
import com.simibubi.create.foundation.utility.Lang;
import com.simibubi.create.foundation.utility.VecHelper;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.MutableComponent;
import net.minecraft.world.Container;
import net.minecraft.world.item.crafting.Recipe;
import net.minecraft.world.level.block.entity.BlockEntityType;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.phys.Vec3;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.capability.IFluidHandler;
import net.minecraftforge.fluids.capability.templates.FluidTank;
import java.util.List;
import static com.drmangotea.createindustry.base.multiblock.PositionUtil.*;
import static com.drmangotea.createindustry.base.multiblock.PositionUtil.generateSequence;
public class BlastStoveBlockEntity extends MultiblockMasterBlockEntity implements IHaveGoggleInformation {
private static final Object GasBlastingRecipesKey = new Object();
public static final int maxSegments = 12;
public static final int defaultSegments = 2;
protected ScrollValueBehaviour segments;
public GasBlastingRecipe recipe;
public Direction getMasterDirection() {
return this.getBlockState().getValue(BlastStoveBlock.FACING);
}
public BlockState mainWall = TFMGBlocks.FIREPROOF_BRICKS.get().defaultBlockState();
public BlockState cinderFlourBlock = TFMGBlocks.CINDERFLOUR_BLOCK.get().defaultBlockState();
public BlockState reinforcement = TFMGBlocks.FIREPROOF_BRICK_REINFORCEMENT.get().defaultBlockState();
public BlastStoveBlockEntity(BlockEntityType<?> type, BlockPos pos, BlockState state) {
super(type, pos, state, 8000, "blast_stove");
this.timer = -1;
}
@Override
public void addBehaviours(List<BlockEntityBehaviour> behaviours) {
behaviours.add(this.segments = new ScrollValueBehaviour(Lang.translateDirect("multiblock.blast_stove.segments_height"), this, new SegmentValueBox()));
this.segments.between(2, 8);
this.segments.value = defaultSegments;
}
public void lazyTick() {
super.lazyTick();
}
public void tick() {
super.tick();
if (this.level == null) {
return;
}
this.multiblockStructure = MultiblockStructure.cuboidBuilder(this).directional(getMasterDirection())
.withBlockAt(new PositionUtil.PositionRange(generateSequence(-3, 0, 1), zero(), generateSequence(-1, 1, 1)).ignorePosition(0, 1, 0), mainWall)
.withBlockAt(new PositionUtil.PositionRange(List.of(-4), zero(), generateSequence(-1, 1, 2)), reinforcement)
.withFluidOutputAt(-4, 0, 0, "createindustry.blast_stove.tank1", 4000 * segments.getValue())
.withFluidOutputAt(-4, 1, 0, "createindustry.blast_stove.tank2", 4000 * segments.getValue())
.withFluidOutputAt(0, 1, 0, "createindustry.blast_stove.tank0", 4000 * segments.getValue())
.withBlockAt(new PositionUtil.PositionRange(List.of(0, -1, -3), List.of(1), generateSequence(-1, 1, 2)), mainWall)
.withBlockAt(new PositionUtil.PositionRange(List.of(-2, -4), List.of(1), generateSequence(-1, 1, 2)), reinforcement)
.withBlockAt(-2, 1, 0, mainWall)
//.withBlockAt(new PositionUtil.PositionRange(List.of(-1, -2), zero(), generateSequence(-2, 2, 1)), mainWall)
//.withBlockAt(new PositionUtil.PositionRange(pos(-3), generateSequence(0, 4, 1), generateSequence(-1, 1, 1)), mainWall)
//.withBlockAt(new PositionUtil.PositionRange(pos(-3), generateSequence(0, 3, 1), generateSequence(-2, 2, 4)), reinforcement)
.withBlockAt(new PositionUtil.PositionRange(List.of(-1), generateSequence(2, 1 + segments.getValue(), 1), zero()), cinderFlourBlock)
.withBlockAt(new PositionUtil.PositionRange(List.of(-1, -3), generateSequence(2, 1 + segments.getValue(), 1), generateSequence(-1, 1, 2)), mainWall)
.withBlockAt(new PositionUtil.PositionRange(zero(), generateSequence(2, 1 + segments.getValue(), 1), generateSequence(-1, 1, 1)), mainWall)
.withBlockAt(new PositionUtil.PositionRange(List.of(-2, -4), generateSequence(2, 1 + segments.getValue(), 1), generateSequence(-1, 1, 2)), reinforcement)
.withBlockAt(new PositionUtil.PositionRange(List.of(-2, -4), generateSequence(2, 1 + segments.getValue(), 1), zero()), mainWall)
.withBlockAt(new PositionUtil.PositionRange(List.of(-3), List.of(2 + segments.getValue()), generateSequence(-1, 1, 2)), mainWall)
.withBlockAt(new PositionUtil.PositionRange(List.of(-1, -2), List.of(2 + segments.getValue()), generateSequence(-1, 1, 2)), reinforcement)
.withBlockAt(-4, 2 + segments.getValue(), 0, mainWall)
.withBlockAt(0, 2 + segments.getValue(), 0, reinforcement)
.withBlockAt(new PositionUtil.PositionRange(zero(), List.of(2 + segments.getValue()), generateSequence(-1, 1, 2)), mainWall)
.withBlockAt(new PositionUtil.PositionRange(List.of(0, -1, -2, -3), List.of(3 + segments.getValue()), zero()), mainWall)
.withBlockAt(new PositionUtil.PositionRange(List.of(-1, -2), List.of(3 + segments.getValue()), generateSequence(-1, 1, 2)), mainWall)
.build();
if(!isValid)
return;
if (tankInventory.getCapacity() != masterTankCapacity * segments.getValue()) {
this.tankInventory.setCapacity(masterTankCapacity * segments.getValue());
}
if(recipe !=null) {
if (timer == -1 &&
(getMainFluidOutput().tankInventory.getFluidAmount() + recipe.getFluidResults().get(0).getAmount()) <= getMainFluidOutput().tankInventory.getCapacity() && (getSecondaryFluidOutput().tankInventory.getFluidAmount() + recipe.getFluidResults().get(1).getAmount()) <= getSecondaryFluidOutput().tankInventory.getCapacity()&&
canContinue()
) {
timer = recipe.getProcessingDuration();
tankInventory.drain(recipe.getFluidIngredients().get(0).getRequiredAmount(), IFluidHandler.FluidAction.EXECUTE);
getSecondaryFluidInput().tankInventory.drain(recipe.getFluidIngredients().get(1).getRequiredAmount(), IFluidHandler.FluidAction.EXECUTE);
}
}
findRecipe();
setRunning(timer > 0);
if (timer > 0 &&
(getMainFluidOutput().tankInventory.getFluidAmount() + recipe.getFluidResults().get(0).getAmount()) <= getMainFluidOutput().tankInventory.getCapacity() && (getSecondaryFluidOutput().tankInventory.getFluidAmount() + recipe.getFluidResults().get(1).getAmount()) <= getSecondaryFluidOutput().tankInventory.getCapacity()&&canContinue()
) {
timer--;
}
if (timer == 0) {
process(getMainFluidOutput().tankInventory, getSecondaryFluidOutput().tankInventory);
timer = -1;
}
}
public boolean canContinue() {
if (recipe == null)
return false;
return recipe.matches(tankInventory, getSecondaryFluidInput().tankInventory);
}
public void findRecipe(){
CombinedTankWrapper tankIn = new CombinedTankWrapper(tankInventory,getSecondaryFluidInput().tankInventory);
if (recipe == null || !recipe.matches(tankIn, level)) {
GasBlastingRecipe recipe = getMatchingRecipes();
if (recipe!=null) {
this.recipe = recipe;
sendData();
}
}
}
public void process(FluidTank mainOutput, FluidTank secondaryOutput) {
if (level == null)
return;
if (level.isClientSide)
return;
mainOutput.setFluid(new FluidStack(recipe.getFluidResults().get(0).getFluid(), mainOutput.getFluidAmount()+recipe.getFluidResults().get(0).getAmount()));
secondaryOutput.setFluid(new FluidStack(recipe.getFluidResults().get(1).getFluid(), secondaryOutput.getFluidAmount()+recipe.getFluidResults().get(1).getAmount()));
}
protected void setRunning(boolean running) {
if (level == null)
return;
level.setBlockAndUpdate(worldPosition, getBlockState().setValue(BlastStoveBlock.RUNNING, running));
notifyUpdate();
}
public void invalidate() {
super.invalidate();
}
protected void read(CompoundTag compound, boolean clientPacket) {
super.read(compound, clientPacket);
}
public void write(CompoundTag compound, boolean clientPacket) {
super.write(compound, clientPacket);
}
public boolean addToGoggleTooltip(List<Component> tooltip, boolean isPlayerSneaking) {
super.addToGoggleTooltip(tooltip, isPlayerSneaking);
if (recipe == null) {
tooltip.add(Component.nullToEmpty("No recipe"));
return true;
} else {
tooltip.add(Component.nullToEmpty("Recipe: " + recipe.getId()));
tooltip.add(percent());
}
return true;
}
class GhostBlockDisplay extends ValueBoxTransform.Sided {
protected Vec3 getSouthLocation() {
return VecHelper.voxelSpace(12.0, 8.0, 15.5);
}
@Override
protected boolean isSideActive(BlockState state, Direction direction) {
return !isValid && state.getValue(BlastStoveBlock.FACING) == direction;
}
}
class SegmentValueBox extends ValueBoxTransform.Sided {
protected Vec3 getSouthLocation() {
return VecHelper.voxelSpace(4.0, 8.0, 15.5);
}
@Override
protected boolean isSideActive(BlockState state, Direction direction) {
return !isValid && state.getValue(BlastStoveBlock.FACING) == direction;
}
}
protected FluidOutputBlockEntity getMainFluidOutput() {
if (level == null || multiblockStructure == null) {
return null;
}
return (FluidOutputBlockEntity) level.getBlockEntity(multiblockStructure.getFluidOutputPosition("createindustry.blast_stove.tank2"));
}
protected FluidOutputBlockEntity getSecondaryFluidOutput() {
if (level == null || multiblockStructure == null) {
return null;
}
return (FluidOutputBlockEntity) level.getBlockEntity(multiblockStructure.getFluidOutputPosition("createindustry.blast_stove.tank0"));
}
protected FluidOutputBlockEntity getSecondaryFluidInput() {
if (level == null || multiblockStructure == null) {
return null;
}
return (FluidOutputBlockEntity) level.getBlockEntity(multiblockStructure.getFluidOutputPosition("createindustry.blast_stove.tank1"));
}
protected GasBlastingRecipe getMatchingRecipes() {
List<Recipe<?>> list = RecipeFinder.get(getRecipeCacheKey(), level, this::matchStaticFilters);
for(int i = 0; i < list.toArray().length;i++){
GasBlastingRecipe recipe = (GasBlastingRecipe) list.get(i);
for(int y = 0; y < recipe.getFluidIngredients().get(0).getMatchingFluidStacks().toArray().length;y++)
if(tankInventory.getFluid().getFluid()==recipe.getFluidIngredients().get(0).getMatchingFluidStacks().get(y).getFluid())
if(tankInventory.getFluidAmount()>=recipe.getFluidIngredients().get(0).getRequiredAmount())
return recipe;
}
return null;
}
protected <C extends Container> boolean matchStaticFilters(Recipe<C> r) {
return r instanceof GasBlastingRecipe;
}
protected Object getRecipeCacheKey() {
return GasBlastingRecipesKey;
}
private MutableComponent percent() {
float percent = Math.round((float) timer / recipe.getProcessingDuration() * 100);
return Lang.builder().text(" ")
.text(percent + "%")
.component();
}
}

View File

@@ -0,0 +1,48 @@
package com.drmangotea.createindustry.blocks.machines.metal_processing.blast_stove;
import com.simibubi.create.foundation.data.AssetLookup;
import com.simibubi.create.foundation.data.SpecialBlockStateGen;
import com.tterrag.registrate.providers.DataGenContext;
import com.tterrag.registrate.providers.RegistrateBlockstateProvider;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.HorizontalDirectionalBlock;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraftforge.client.model.generators.ModelFile;
public class BlastStoveGenerator extends SpecialBlockStateGen {
public BlastStoveGenerator() {
}
@Override
protected int getXRotation(BlockState state) {
return 0;
}
protected int getYRotation(BlockState state) {
short value;
switch (state.getValue(HorizontalDirectionalBlock.FACING)) {
case NORTH:
value = 0;
break;
case SOUTH:
value = 180;
break;
case WEST:
value = 270;
break;
case EAST:
value = 90;
break;
default:
throw new IncompatibleClassChangeError();
}
return value;
}
public <T extends Block> ModelFile getModel(DataGenContext<Block, T> ctx, RegistrateBlockstateProvider prov, BlockState state) {
return state.getValue(BlastStoveBlock.RUNNING) ? AssetLookup.partialBaseModel(ctx, prov, "running") : AssetLookup.partialBaseModel(ctx, prov);
}
}

View File

@@ -0,0 +1,14 @@
package com.drmangotea.createindustry.events;
import com.drmangotea.createindustry.items.weapons.flamethrover.FlamethrowerFuelTypeManager;
import net.minecraftforge.event.AddReloadListenerEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod;
@Mod.EventBusSubscriber
public class CommonEvents {
@SubscribeEvent
public static void addReloadListeners(AddReloadListenerEvent event) {
event.addListener(FlamethrowerFuelTypeManager.ReloadListener.INSTANCE);
}
}

View File

@@ -0,0 +1,84 @@
package com.drmangotea.createindustry.items.weapons.flamethrover;
import com.drmangotea.createindustry.CreateTFMG;
import com.drmangotea.createindustry.registry.TFMGFluids;
public class BuiltinFlamethrowerFuelTypes {
public static final FlamethrowerFuelType
FALLBACK = create("fallback")
.spread(0)
.speed(0)
.amount(0)
.color(0x000000)
.register(),
GASOLINE = create("gasoline")
.spread(15)
.speed(1)
.amount(3)
.color(0xC4AA76)
.registerAndAssign(TFMGFluids.GASOLINE::get),
DIESEL = create("diesel")
.spread(7)
.speed(2)
.amount(3)
.color(0xBA9177)
.registerAndAssign(TFMGFluids.DIESEL::get),
KEROSENE = create("kerosene")
.spread(10)
.speed(1.3f)
.amount(4)
.color(0x7876D5)
.registerAndAssign(TFMGFluids.KEROSENE::get),
NAPHTHA = create("naphtha")
.spread(20)
.speed(0.8f)
.amount(1)
.color(0x5E1B0A)
.registerAndAssign(TFMGFluids.NAPHTHA::get),
LPG = create("lpg")
.spread(35)
.speed(0.6f)
.amount(15)
.color(0xE0BB48)
.registerAndAssign(TFMGFluids.LPG::get),
NAPALM = create("napalm")
.spread(20)
.speed(1.8f)
.amount(15)
.color(0xA3C649)
.registerAndAssign(TFMGFluids.NAPALM::get),
MOLTEN_SLAG = create("molten_slag")
.spread(15)
.speed(0.3f)
.amount(15)
.color(0xFF9621)
.registerAndAssign(TFMGFluids.MOLTEN_SLAG::get),
COOLING_FLUID = create("cooling_fluid")
.spread(12)
.speed(0.8f)
.amount(15)
.cold()
.color(0x4edbdb)
.registerAndAssign(TFMGFluids.COOLING_FLUID::get)
;
private static FlamethrowerFuelType.Builder create(String name) {
return new FlamethrowerFuelType.Builder(CreateTFMG.asResource(name));
}
public static void register() {}
}

View File

@@ -0,0 +1,198 @@
package com.drmangotea.createindustry.items.weapons.flamethrover;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.JsonPrimitive;
import com.simibubi.create.foundation.utility.RegisteredObjects;
import net.minecraft.ResourceLocationException;
import net.minecraft.core.Holder;
import net.minecraft.network.FriendlyByteBuf;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.level.material.Fluid;
import net.minecraftforge.registries.ForgeRegistries;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import java.util.function.Consumer;
import java.util.function.Predicate;
import java.util.function.Supplier;
public class FlamethrowerFuelType {
private List<Supplier<Fluid>> fluids = new ArrayList<>();
private int spread = 15;
private float speed = 1;
private int amount = 4;
private boolean isCold = false;
private boolean hellfire = false;
private int color = 0xC4AA76;
public FlamethrowerFuelType() {
}
public List<Supplier<Fluid>> getFluids() {
return fluids;
}
public int getSpread() {
return spread;
}
public float getSpeed() {
return speed;
}
public int getAmount() {
return amount;
}
public int getColor() {
return color;
}
public boolean isCold() {
return isCold;
}
public boolean isHellfire() {
return hellfire;
}
public static FlamethrowerFuelType fromJson(JsonObject object) {
FlamethrowerFuelType type = new FlamethrowerFuelType();
try {
JsonElement itemsElement = object.get("fluids");
if (itemsElement != null && itemsElement.isJsonArray()) {
for (JsonElement element : itemsElement.getAsJsonArray()) {
if (element.isJsonPrimitive()) {
JsonPrimitive primitive = element.getAsJsonPrimitive();
if (primitive.isString()) {
try {
Optional<Holder.Reference<Fluid>> reference = ForgeRegistries.FLUIDS.getDelegate(new ResourceLocation(primitive.getAsString()));
if (reference.isPresent()) {
type.fluids.add(reference.get());
}
} catch (ResourceLocationException e) {
//
}
}
}
}
}
parseJsonPrimitive(object, "spread", JsonPrimitive::isNumber, primitive -> type.spread = primitive.getAsInt());
parseJsonPrimitive(object, "speed", JsonPrimitive::isNumber, primitive -> type.speed = primitive.getAsFloat());
parseJsonPrimitive(object, "amount", JsonPrimitive::isNumber, primitive -> type.amount = primitive.getAsInt());
parseJsonPrimitive(object, "cold", JsonPrimitive::isBoolean, primitive -> type.isCold = primitive.getAsBoolean());
parseJsonPrimitive(object, "hellfire", JsonPrimitive::isBoolean, primitive -> type.hellfire = primitive.getAsBoolean());
parseJsonPrimitive(object, "color", JsonPrimitive::isString, primitive -> type.color = Integer.parseInt(primitive.getAsString()));
} catch (Exception e) {
//
}
return type;
}
private static void parseJsonPrimitive(JsonObject object, String key, Predicate<JsonPrimitive> predicate, Consumer<JsonPrimitive> consumer) {
JsonElement element = object.get(key);
if (element != null && element.isJsonPrimitive()) {
JsonPrimitive primitive = element.getAsJsonPrimitive();
if (predicate.test(primitive)) {
consumer.accept(primitive);
}
}
}
public static void toBuffer(FlamethrowerFuelType type, FriendlyByteBuf buffer) {
buffer.writeVarInt(type.fluids.size());
for (Supplier<Fluid> delegate : type.fluids) {
buffer.writeResourceLocation(RegisteredObjects.getKeyOrThrow(delegate.get()));
}
buffer.writeInt(type.spread);
buffer.writeFloat(type.speed);
buffer.writeInt(type.amount);
buffer.writeBoolean(type.isCold);
buffer.writeBoolean(type.hellfire);
buffer.writeInt(type.color);
}
public static FlamethrowerFuelType fromBuffer(FriendlyByteBuf buffer) {
FlamethrowerFuelType type = new FlamethrowerFuelType();
int size = buffer.readVarInt();
for (int i = 0; i < size; i++) {
Optional<Holder.Reference<Fluid>> reference = ForgeRegistries.FLUIDS.getDelegate(buffer.readResourceLocation());
if (reference.isPresent()) {
type.fluids.add(reference.get());
}
}
type.spread = buffer.readInt();
type.speed = buffer.readFloat();
type.amount = buffer.readInt();
type.isCold = buffer.readBoolean();
type.hellfire = buffer.readBoolean();
type.color = buffer.readInt();
return type;
}
public static class Builder {
protected ResourceLocation id;
protected FlamethrowerFuelType result;
public Builder(ResourceLocation id) {
this.id = id;
this.result = new FlamethrowerFuelType();
}
public Builder spread(int spread) {
result.spread = spread;
return this;
}
public Builder speed(float speed) {
result.speed = speed;
return this;
}
public Builder amount(int amount) {
result.amount = amount;
return this;
}
public Builder cold() {
result.isCold = true;
result.hellfire = false;
return this;
}
public Builder hellfire() {
result.hellfire = true;
result.isCold = false;
return this;
}
public Builder color(int color) {
result.color = color;
return this;
}
@SafeVarargs
public final Builder addFluids(Supplier<Fluid>... fluids) {
for (Supplier<Fluid> fluid : fluids)
result.fluids.add(ForgeRegistries.FLUIDS.getDelegateOrThrow(fluid.get()));
return this;
}
public FlamethrowerFuelType register() {
FlamethrowerFuelTypeManager.registerBuiltinType(id, result);
return result;
}
@SafeVarargs
public final FlamethrowerFuelType registerAndAssign(Supplier<Fluid>... fluids) {
addFluids(fluids);
register();
return result;
}
}
}

View File

@@ -0,0 +1,191 @@
package com.drmangotea.createindustry.items.weapons.flamethrover;
import com.drmangotea.createindustry.CreateTFMG;
import com.drmangotea.createindustry.registry.TFMGPackets;
import com.google.gson.Gson;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.simibubi.create.AllPackets;
import com.simibubi.create.foundation.networking.SimplePacketBase;
import net.minecraft.network.FriendlyByteBuf;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.server.packs.resources.ResourceManager;
import net.minecraft.server.packs.resources.SimpleJsonResourceReloadListener;
import net.minecraft.util.profiling.ProfilerFiller;
import net.minecraft.world.level.material.Fluid;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.network.NetworkEvent;
import net.minecraftforge.network.PacketDistributor;
import net.minecraftforge.registries.ForgeRegistries;
import java.util.HashMap;
import java.util.IdentityHashMap;
import java.util.Map;
import java.util.Optional;
import java.util.function.Supplier;
public class FlamethrowerFuelTypeManager {
public static final Map<ResourceLocation, FlamethrowerFuelType> BUILTIN_TYPE_MAP = new HashMap<>();
public static final Map<ResourceLocation, FlamethrowerFuelType> CUSTOM_TYPE_MAP = new HashMap<>();
public static final Map<ResourceLocation, FlamethrowerFuelType> GLOBAL_TYPE_MAP = new HashMap<>();
private static final Map<Fluid, FlamethrowerFuelType> FLUID_TO_TYPE_MAP = new IdentityHashMap<>();
public static void registerBuiltinType(ResourceLocation id, FlamethrowerFuelType type) {
synchronized (BUILTIN_TYPE_MAP) {
BUILTIN_TYPE_MAP.put(id, type);
}
synchronized (GLOBAL_TYPE_MAP) {
GLOBAL_TYPE_MAP.put(id, type);
}
}
public static FlamethrowerFuelType getBuiltinType(ResourceLocation id) {
return BUILTIN_TYPE_MAP.get(id);
}
public static FlamethrowerFuelType getCustomType(ResourceLocation id) {
return CUSTOM_TYPE_MAP.get(id);
}
public static FlamethrowerFuelType getGlobalType(ResourceLocation id) {
return GLOBAL_TYPE_MAP.get(id);
}
public static FlamethrowerFuelType getTypeForFluid(Fluid fluid) {
return FLUID_TO_TYPE_MAP.get(fluid);
}
public static FlamethrowerFuelType getTypeForFluid(ResourceLocation fluidId) {
return getTypeForFluid(ForgeRegistries.FLUIDS.getValue(fluidId));
}
public static Optional<FlamethrowerFuelType> getTypeForStack(FluidStack fluidStack) {
if (fluidStack.isEmpty())
return Optional.empty();
return Optional.ofNullable(getTypeForFluid(fluidStack.getFluid()));
}
public static ResourceLocation getIdForType(FlamethrowerFuelType type) {
for (Map.Entry<ResourceLocation, FlamethrowerFuelType> entry : GLOBAL_TYPE_MAP.entrySet()) {
if (entry.getValue() == type)
return entry.getKey();
}
return null;
}
public static FlamethrowerFuelType getTypeForId(ResourceLocation id) {
for (Map.Entry<ResourceLocation, FlamethrowerFuelType> entry : GLOBAL_TYPE_MAP.entrySet()) {
if (entry.getKey().equals(id))
return entry.getValue();
}
return null;
}
public static void clear() {
GLOBAL_TYPE_MAP.clear();
CUSTOM_TYPE_MAP.clear();
FLUID_TO_TYPE_MAP.clear();
}
public static void fillFluidMap() {
for (Map.Entry<ResourceLocation, FlamethrowerFuelType> entry : BUILTIN_TYPE_MAP.entrySet()) {
FlamethrowerFuelType type = entry.getValue();
for (Supplier<Fluid> delegate : type.getFluids()) {
FLUID_TO_TYPE_MAP.put(delegate.get(), type);
}
}
for (Map.Entry<ResourceLocation, FlamethrowerFuelType> entry : CUSTOM_TYPE_MAP.entrySet()) {
FlamethrowerFuelType type = entry.getValue();
for (Supplier<Fluid> delegate : type.getFluids()) {
FLUID_TO_TYPE_MAP.put(delegate.get(), type);
}
}
}
public static void fillGlobalMap() {
GLOBAL_TYPE_MAP.putAll(BUILTIN_TYPE_MAP);
GLOBAL_TYPE_MAP.putAll(CUSTOM_TYPE_MAP);
CreateTFMG.LOGGER.info("Populated global flamethrower fuel type map with {} entries", GLOBAL_TYPE_MAP.size());
}
public static void toBuffer(FriendlyByteBuf buffer) {
buffer.writeVarInt(CUSTOM_TYPE_MAP.size());
for (Map.Entry<ResourceLocation, FlamethrowerFuelType> entry : CUSTOM_TYPE_MAP.entrySet()) {
buffer.writeResourceLocation(entry.getKey());
FlamethrowerFuelType.toBuffer(entry.getValue(), buffer);
}
}
public static void fromBuffer(FriendlyByteBuf buffer) {
clear();
int size = buffer.readVarInt();
for (int i = 0; i < size; i++) {
CUSTOM_TYPE_MAP.put(buffer.readResourceLocation(), FlamethrowerFuelType.fromBuffer(buffer));
}
fillFluidMap();
fillGlobalMap();
}
public static void syncTo(ServerPlayer player) {
TFMGPackets.getChannel().send(PacketDistributor.PLAYER.with(() -> player), new SyncPacket());
}
public static void syncToAll() {
TFMGPackets.getChannel().send(PacketDistributor.ALL.noArg(), new SyncPacket());
}
public static class ReloadListener extends SimpleJsonResourceReloadListener {
private static final Gson GSON = new Gson();
public static final ReloadListener INSTANCE = new ReloadListener();
protected ReloadListener() {
super(GSON, "flamethrower_fuel_types");
}
@Override
protected void apply(Map<ResourceLocation, JsonElement> map, ResourceManager resourceManager, ProfilerFiller profiler) {
clear();
for (Map.Entry<ResourceLocation, JsonElement> entry : map.entrySet()) {
JsonElement element = entry.getValue();
if (element.isJsonObject()) {
ResourceLocation id = entry.getKey();
JsonObject object = element.getAsJsonObject();
FlamethrowerFuelType type = FlamethrowerFuelType.fromJson(object);
CUSTOM_TYPE_MAP.put(id, type);
}
}
fillFluidMap();
fillGlobalMap();
}
}
public static class SyncPacket extends SimplePacketBase {
private FriendlyByteBuf buffer;
public SyncPacket() {
}
public SyncPacket(FriendlyByteBuf buffer) {
this.buffer = buffer;
}
@Override
public void write(FriendlyByteBuf buffer) {
toBuffer(buffer);
}
@Override
public boolean handle(NetworkEvent.Context context) {
context.enqueueWork(() -> {
fromBuffer(buffer);
});
return true;
}
}
}

View File

@@ -1,7 +1,9 @@
package com.drmangotea.createindustry.items.weapons.flamethrover;
import com.drmangotea.createindustry.CreateTFMGClient;
import com.drmangotea.createindustry.base.util.spark.CoolSpark;
import com.drmangotea.createindustry.base.util.spark.Spark;
import com.drmangotea.createindustry.items.weapons.lithium_blade.LithiumSpark;
import com.drmangotea.createindustry.registry.TFMGCreativeModeTabs;
import com.drmangotea.createindustry.registry.TFMGEntityTypes;
import com.drmangotea.createindustry.registry.TFMGItems;
@@ -12,6 +14,8 @@ import net.minecraft.client.player.AbstractClientPlayer;
import net.minecraft.core.BlockPos;
import net.minecraft.core.NonNullList;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.sounds.SoundEvent;
import net.minecraft.sounds.SoundEvents;
import net.minecraft.sounds.SoundSource;
import net.minecraft.world.InteractionHand;
@@ -25,9 +29,12 @@ import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.UseAnim;
import net.minecraft.world.item.context.UseOnContext;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.material.Fluid;
import net.minecraftforge.fluids.capability.IFluidHandler;
import org.jetbrains.annotations.Nullable;
import java.util.function.Supplier;
public class FlamethrowerItem extends Item implements CustomArmPoseItem {
@@ -40,11 +47,14 @@ public class FlamethrowerItem extends Item implements CustomArmPoseItem {
public void onUseTick(Level level, LivingEntity entity, ItemStack stack, int time) {
CoolSpark coolSpark = TFMGEntityTypes.COOL_SPARK.create(level);
coolSpark.setPos(entity.getX(),entity.getY()+1.2f,entity.getZ());
Spark spark = TFMGEntityTypes.SPARK.create(level);
spark.setPos(entity.getX(),entity.getY()+1.2f,entity.getZ());
LithiumSpark lithiumSpark = TFMGEntityTypes.LITHIUM_SPARK.create(level);
lithiumSpark.setPos(entity.getX(),entity.getY()+1.2f,entity.getZ());
CompoundTag nbt = stack.getOrCreateTag();
@@ -55,23 +65,35 @@ public class FlamethrowerItem extends Item implements CustomArmPoseItem {
//if(true)
// return;
level.playSound((Player)null, entity.getX(), entity.getY(), entity.getZ(), SoundEvents.FIRE_EXTINGUISH, SoundSource.NEUTRAL, 0.1F, 0.04F);
FlamethrowerFuelType fuel = FlamethrowerFuelTypeManager.getTypeForId(new ResourceLocation(nbt.getString("fuel")));
if (fuel == null) {
return;
}
SoundEvent sound = fuel.isCold() ? SoundEvents.SNOW_BREAK : SoundEvents.FIRE_EXTINGUISH;
level.playSound((Player)null, entity.getX(), entity.getY(), entity.getZ(), sound, SoundSource.NEUTRAL, 0.1F, 0.04F);
FlamethrowerFuel fuel = Enum.valueOf(FlamethrowerFuel.class,nbt.getString("fuel").toUpperCase());
for(int i =0;i<fuel.amount;i++) {
for(int i =0;i<fuel.getAmount();i++) {
if(nbt.getInt("amount")==0) {
nbt.putString("fuel","");
return;
}
nbt.putInt("amount",nbt.getInt("amount")-1);
spark.shoot(entity.getLookAngle().x,entity.getLookAngle().y,entity.getLookAngle().z,fuel.speed,fuel.spread);
level.addFreshEntity(spark);
//Snuck this in here, sorry Mango :3
if (fuel.isCold()) {
coolSpark.shoot(entity.getLookAngle().x,entity.getLookAngle().y,entity.getLookAngle().z,fuel.getSpeed(),fuel.getSpread());
level.addFreshEntity(coolSpark);
} else {
spark.shoot(entity.getLookAngle().x, entity.getLookAngle().y, entity.getLookAngle().z, fuel.getSpeed(), fuel.getSpread());
level.addFreshEntity(spark);
}
if (fuel.isHellfire()) {
lithiumSpark.shoot(entity.getLookAngle().x,entity.getLookAngle().y,entity.getLookAngle().z,fuel.getSpeed(),fuel.getSpread());
level.addFreshEntity(lithiumSpark);
}
}
}
@@ -85,7 +107,7 @@ public class FlamethrowerItem extends Item implements CustomArmPoseItem {
return;
ItemStack stack = TFMGItems.FLAMETHROWER.asStack();
stack.getOrCreateTag().putString("fuel","napalm");
stack.getOrCreateTag().putString("fuel","createindustry:napalm");
stack.getOrCreateTag().putInt("amount",FUEL_CAPACITY);
list.add(stack);
super.fillItemCategory(group, list);
@@ -102,9 +124,7 @@ public class FlamethrowerItem extends Item implements CustomArmPoseItem {
@Override
public int getBarColor(ItemStack stack) {
return stack.getOrCreateTag().getString("fuel").isEmpty() ? 0xffffff :
Enum.valueOf(FlamethrowerFuel.class,stack.getOrCreateTag().getString("fuel").toUpperCase()).color;
return stack.getOrCreateTag().getString("fuel").isEmpty() ? 0xffffff : FlamethrowerFuelTypeManager.getGlobalType(new ResourceLocation(stack.getOrCreateTag().getString("fuel"))).getColor();
}
@Override
@@ -139,33 +159,26 @@ return Math.round( 13* ((float)((float)stack.getOrCreateTag().getInt("amount")/(
if(level.getBlockEntity(pos)!=null)
if(level.getBlockEntity(pos) instanceof FluidTankBlockEntity fluidTankBe){
FluidTankBlockEntity be = fluidTankBe.isController() ? fluidTankBe : fluidTankBe.getControllerBE();
for(FlamethrowerFuel fuel : FlamethrowerFuel.values()) {
String fluid = be.getFluid(0).getFluid().getFluidType().toString().replaceFirst("createindustry:","");
if (fluid.equals(fuel.name().toLowerCase())) {
if(nbt.getString("fuel").equals(fluid)||nbt.getInt("amount")==0) {
//String fluid = be.getFluid(0).getFluid().getFluidType().toString();
//FlamethrowerFuelType fuelType = FlamethrowerFuelTypeManager.getTypeForStack(be.getFluid(0)).orElse(BuiltinFlamethrowerFuelTypes.FALLBACK);
//int toDrain = Math.min(FUEL_CAPACITY - nbt.getInt("amount"), be.getFluid(0).getAmount());
//nbt.putString("fuel", FlamethrowerFuelTypeManager.getIdForType(fuelType).toString());
//be.getTankInventory().drain(toDrain, IFluidHandler.FluidAction.EXECUTE);
//nbt.putInt("amount", nbt.getInt("amount") + toDrain);
//context.getPlayer().getCooldowns().addCooldown(stack.getItem(), 20);
for (FlamethrowerFuelType fuelBuiltin : FlamethrowerFuelTypeManager.GLOBAL_TYPE_MAP.values()) {
if (fuelBuiltin.getFluids().stream().anyMatch(supplier -> supplier.get().isSame(be.getFluid(0).getFluid()))) {
int toDrain = Math.min(FUEL_CAPACITY - nbt.getInt("amount"), be.getFluid(0).getAmount());
nbt.putString("fuel", fluid);
nbt.putString("fuel", FlamethrowerFuelTypeManager.getIdForType(fuelBuiltin).toString());
be.getTankInventory().drain(toDrain, IFluidHandler.FluidAction.EXECUTE);
nbt.putInt("amount", nbt.getInt("amount") + toDrain);
context.getPlayer().getCooldowns().addCooldown(stack.getItem(), 20);
return InteractionResult.SUCCESS;
}
}
}
}
@@ -200,8 +213,10 @@ return Math.round( 13* ((float)((float)stack.getOrCreateTag().getInt("amount")/(
NAPALM(20,1.8f,15,0xA3C649),
MOLTEN_SLAG(15,0.3f,15,0xFF9621)
MOLTEN_SLAG(15,0.3f,15,0xFF9621),
//Sorry Mango, I had to do it :3
COOLING_FLUID(12,0.8f,15,0x4edbdb)
;

View File

@@ -0,0 +1,63 @@
package com.drmangotea.createindustry.mixins;
import com.drmangotea.createindustry.registry.TFMGPotions;
import net.minecraft.core.particles.ParticleTypes;
import net.minecraft.util.Mth;
import net.minecraft.world.effect.MobEffectInstance;
import net.minecraft.world.entity.AreaEffectCloud;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.item.alchemy.Potion;
import net.minecraft.world.level.Level;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import java.util.Set;
@Mixin(AreaEffectCloud.class)
public abstract class AreaEffectCloudMixin extends Entity {
public AreaEffectCloudMixin(EntityType<?> pEntityType, Level pLevel) {
super(pEntityType, pLevel);
}
@Shadow private Potion potion;
@Shadow public abstract float getRadius();
@Shadow public abstract boolean isWaiting();
@Inject(at = @At("TAIL"),method = "tick",remap = false)
public void tick(CallbackInfo ci) {
int $$5 = isWaiting() ? 2 : Mth.ceil(3.1415927F * getRadius() * getRadius());
float $$6 = isWaiting() ? 0.2F : getRadius();
for(int $$7 = 0; $$7 < $$5; ++$$7) {
float $$8 = this.random.nextFloat() * 6.2831855F;
float $$9 = Mth.sqrt(this.random.nextFloat()) * $$6;
double $$10 = this.getX() + (double)(Mth.cos($$8) * $$9);
double $$11 = this.getY();
double $$12 = this.getZ() + (double)(Mth.sin($$8) * $$9);
double $$17;
double $$18;
double $$22;
if (isWaiting()) {
$$17 = 0.0;
$$18 = 0.0;
$$22 = 0.0;
} else {
$$17 = (0.5 - this.random.nextDouble()) * 0.15;
$$18 = 0.009999999776482582;
$$22 = (0.5 - this.random.nextDouble()) * 0.15;
}
if(potion == TFMGPotions.HELLFIRE_POTION.get())
this.level.addAlwaysVisibleParticle(ParticleTypes.FLAME, $$10, $$11, $$12, $$17, $$18, $$22);
if(potion == TFMGPotions.FROSTY_POTION.get())
this.level.addAlwaysVisibleParticle(ParticleTypes.SNOWFLAKE, $$10, $$11, $$12, $$17, $$18, $$22);
}
}
}

View File

@@ -2,6 +2,7 @@ package com.drmangotea.createindustry.mixins;
import com.drmangotea.createindustry.registry.TFMGPotions;
import net.minecraft.core.particles.ParticleTypes;
import net.minecraft.world.effect.MobEffectInstance;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.projectile.AbstractArrow;
@@ -12,6 +13,7 @@ import net.minecraft.world.item.alchemy.Potion;
import net.minecraft.world.item.alchemy.PotionUtils;
import net.minecraft.world.item.alchemy.Potions;
import net.minecraft.world.level.Level;
import net.minecraft.world.phys.Vec3;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
@@ -37,8 +39,22 @@ public abstract class ArrowMixin extends AbstractArrow {
@Inject(at = @At("HEAD"),method = "tick",remap = false)
public void tick(CallbackInfo ci) {
if(potion == TFMGPotions.HELLFIRE_POTION.get())
Vec3 vec3;
vec3 = this.getDeltaMovement();
double d5 = vec3.x;
double d6 = vec3.y;
double d1 = vec3.z;
if(potion == TFMGPotions.HELLFIRE_POTION.get()) {
this.setSecondsOnFire(20);
for(int i = 0; i < 4; ++i) {
this.level.addAlwaysVisibleParticle(ParticleTypes.FLAME, this.getX() + d5 * (double)i / 4.0, this.getY() + d6 * (double)i / 4.0, this.getZ() + d1 * (double)i / 4.0, -d5, -d6 + 0.2, -d1);
}
}
if(potion == TFMGPotions.FROSTY_POTION.get()) {
for (int i = 0; i < 4; ++i) {
this.level.addAlwaysVisibleParticle(ParticleTypes.SNOWFLAKE, this.getX() + d5 * (double)i / 4.0, this.getY() + d6 * (double)i / 4.0, this.getZ() + d1 * (double)i / 4.0, -d5, -d6 + 0.2, -d1);
}
}
}
@Shadow

View File

@@ -0,0 +1,77 @@
package com.drmangotea.createindustry.recipes.gas_blasting;
import com.drmangotea.createindustry.registry.TFMGRecipeTypes;
import com.simibubi.create.content.processing.recipe.ProcessingRecipe;
import com.simibubi.create.content.processing.recipe.ProcessingRecipeBuilder;
import com.simibubi.create.foundation.fluid.CombinedTankWrapper;
import com.simibubi.create.foundation.fluid.FluidIngredient;
import com.simibubi.create.foundation.item.SmartInventory;
import net.minecraft.core.NonNullList;
import net.minecraft.world.level.Level;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.capability.templates.FluidTank;
public class GasBlastingRecipe extends ProcessingRecipe<SmartInventory> {
public GasBlastingRecipe(ProcessingRecipeBuilder.ProcessingRecipeParams params) {
super(TFMGRecipeTypes.GAS_BLASTING, params);
}
public FluidIngredient getInputFluid(){
return getFluidIngredients().get(0);
}
public FluidIngredient getSecondInputFluid(){
return getFluidIngredients().get(1);
}
public FluidStack getFirstFluidResult(){
return fluidResults.get(0);
}
public FluidStack getSecondFluidResult(){
return fluidResults.get(1);
}
public int getOutputCount(GasBlastingRecipe recipe){
return recipe.fluidResults.toArray().length;
}
public NonNullList<FluidStack> getResults(){
return fluidResults;
}
@Override
protected int getMaxFluidOutputCount() {
return 2;
}
@Override
protected int getMaxInputCount() {
return 0;
}
@Override
protected int getMaxFluidInputCount() {
return 2;
}
@Override
protected int getMaxOutputCount() {
return 0;
}
public boolean matches(FluidTank mainInv, FluidTank secondaryInv) {
if (mainInv.isEmpty() || secondaryInv.isEmpty())
return false;
return fluidIngredients.get(0).test(mainInv.getFluid()) && fluidIngredients.get(1).test(secondaryInv.getFluid());
}
public boolean matches(CombinedTankWrapper inv, Level worldIn) {
if (inv.getFluidInTank(0).getAmount()==0)
return false;
return fluidIngredients.get(0).test(inv.getFluidInTank(0));
}
@Override
public boolean matches(SmartInventory pContainer, Level pLevel) {
return false;
}
}

View File

@@ -0,0 +1,51 @@
package com.drmangotea.createindustry.recipes.jei;
import com.drmangotea.createindustry.recipes.gas_blasting.GasBlastingRecipe;
import com.mojang.blaze3d.vertex.PoseStack;
import com.simibubi.create.compat.jei.category.CreateRecipeCategory;
import com.simibubi.create.foundation.gui.AllGuiTextures;
import mezz.jei.api.forge.ForgeTypes;
import mezz.jei.api.gui.builder.IRecipeLayoutBuilder;
import mezz.jei.api.gui.ingredient.IRecipeSlotsView;
import mezz.jei.api.recipe.IFocusGroup;
import mezz.jei.api.recipe.RecipeIngredientRole;
public class GasBlastingCategory extends CreateRecipeCategory<GasBlastingRecipe> {
public GasBlastingCategory(Info<GasBlastingRecipe> info) {
super(info);
}
@Override
public void setRecipe(IRecipeLayoutBuilder builder, GasBlastingRecipe recipe, IFocusGroup focuses) {
builder
.addSlot(RecipeIngredientRole.INPUT, 25, 13)
.setBackground(getRenderedSlot(), -1, -1)
.addIngredient(ForgeTypes.FLUID_STACK, withImprovedVisibility(recipe.getInputFluid().getMatchingFluidStacks().get(0)))
.addTooltipCallback(addFluidTooltip(recipe.getInputFluid().getRequiredAmount()));
builder
.addSlot(RecipeIngredientRole.INPUT, 5, 13)
.setBackground(getRenderedSlot(), -1, -1)
.addIngredient(ForgeTypes.FLUID_STACK, withImprovedVisibility(recipe.getSecondInputFluid().getMatchingFluidStacks().get(0)))
.addTooltipCallback(addFluidTooltip(recipe.getSecondInputFluid().getRequiredAmount()));
builder
.addSlot(RecipeIngredientRole.OUTPUT,140, 117)
.setBackground(getRenderedSlot(), -1, -1)
.addIngredient(ForgeTypes.FLUID_STACK, withImprovedVisibility(recipe.getFluidResults().get(0)))
.addTooltipCallback(addFluidTooltip(recipe.getFluidResults().get(0).getAmount()));
builder
.addSlot(RecipeIngredientRole.OUTPUT,160, 117)
.setBackground(getRenderedSlot(), -1, -1)
.addIngredient(ForgeTypes.FLUID_STACK, withImprovedVisibility(recipe.getFluidResults().get(1)))
.addTooltipCallback(addFluidTooltip(recipe.getFluidResults().get(1).getAmount()));
}
@Override
public void draw(GasBlastingRecipe recipe, IRecipeSlotsView iRecipeSlotsView, PoseStack matrixStack, double mouseX, double mouseY) {
AllGuiTextures.JEI_ARROW.render(matrixStack, 96, 121);
AllGuiTextures.JEI_DOWN_ARROW.render(matrixStack, 45, 15);
}
}

View File

@@ -4,6 +4,7 @@ package com.drmangotea.createindustry.recipes.jei;
import com.drmangotea.createindustry.recipes.casting.CastingRecipe;
import com.drmangotea.createindustry.recipes.coking.CokingRecipe;
import com.drmangotea.createindustry.recipes.distillation.DistillationRecipe;
import com.drmangotea.createindustry.recipes.gas_blasting.GasBlastingRecipe;
import com.drmangotea.createindustry.recipes.industrial_blasting.IndustrialBlastingRecipe;
import com.drmangotea.createindustry.registry.TFMGBlocks;
import com.drmangotea.createindustry.registry.TFMGFluids;
@@ -89,8 +90,15 @@ public class TFMGJei implements IModPlugin {
.catalyst(TFMGBlocks.CASTING_BASIN::get)
.itemIcon(TFMGBlocks.STEEL_BLOCK.get())
.emptyBackground(177, 140)
.build("casting", CastingCategory::new)
.build("casting", CastingCategory::new),
gas_blasting = builder(GasBlastingRecipe.class)
.addTypedRecipes(TFMGRecipeTypes.GAS_BLASTING)
.catalyst(TFMGBlocks.BLAST_STOVE::get)
.doubleItemIcon(TFMGBlocks.BLAST_STOVE.get(), TFMGFluids.AIR.getBucket().get())
.emptyBackground(177, 150)
.build("gas_blasting", GasBlastingCategory::new)
;

View File

@@ -2,6 +2,7 @@ package com.drmangotea.createindustry.registry;
import com.drmangotea.createindustry.base.TFMGEncasedBlocks;
import com.drmangotea.createindustry.base.TFMGPipes;
import com.drmangotea.createindustry.base.multiblock.FluidOutputBlockEntity;
import com.drmangotea.createindustry.blocks.HalfShaftRenderer;
import com.drmangotea.createindustry.blocks.cogwheeels.*;
import com.drmangotea.createindustry.blocks.concrete.formwork.FormWorkBlockEntity;
@@ -71,6 +72,7 @@ import com.drmangotea.createindustry.blocks.machines.flarestack.FlarestackBlockE
import com.drmangotea.createindustry.blocks.machines.metal_processing.blast_furnace.BlastFurnaceOutputBlockEntity;
import com.drmangotea.createindustry.blocks.machines.metal_processing.blast_furnace.BlastFurnaceRenderer;
import com.drmangotea.createindustry.blocks.machines.metal_processing.blast_furnace.MoltenMetalBlockEntity;
import com.drmangotea.createindustry.blocks.machines.metal_processing.blast_stove.BlastStoveBlockEntity;
import com.drmangotea.createindustry.blocks.machines.metal_processing.casting_basin.CastingBasinBlockEntity;
import com.drmangotea.createindustry.blocks.machines.metal_processing.casting_basin.CastingBasinRenderer;
import com.drmangotea.createindustry.blocks.machines.metal_processing.casting_spout.CastingSpoutBlockEntity;
@@ -117,6 +119,11 @@ import static com.drmangotea.createindustry.CreateTFMG.REGISTRATE;
public class TFMGBlockEntities {
public static final BlockEntityEntry<FluidOutputBlockEntity> FLUID_OUTPUT = REGISTRATE
.blockEntity("fluid_output", FluidOutputBlockEntity::new)
.validBlocks(TFMGBlocks.FLUID_OUTPUT)
.register();
public static final BlockEntityEntry<WeldingMachineBlockEntity> WELDING_MACHINE = REGISTRATE
.blockEntity("welding_machine", WeldingMachineBlockEntity::new)
@@ -314,7 +321,11 @@ public class TFMGBlockEntities {
.validBlocks(TFMGBlocks.MACHINE_INPUT)
.renderer(() -> MachineInputRenderer::new)
.register();
public static final BlockEntityEntry<BlastStoveBlockEntity> BLAST_STOVE = REGISTRATE
.blockEntity("blast_stove", BlastStoveBlockEntity::new)
.validBlocks(TFMGBlocks.BLAST_STOVE)
.register();
public static final BlockEntityEntry<BlastFurnaceOutputBlockEntity> BLAST_FURNACE_OUTPUT = REGISTRATE
.blockEntity("blast_furnace_output", BlastFurnaceOutputBlockEntity::new)

View File

@@ -1,6 +1,7 @@
package com.drmangotea.createindustry.registry;
import com.drmangotea.createindustry.base.*;
import com.drmangotea.createindustry.base.multiblock.FluidOutputBlock;
import com.drmangotea.createindustry.blocks.TFMGHorizontalDirectionalBlock;
import com.drmangotea.createindustry.blocks.cogwheeels.TFMGCogWheelBlock;
import com.drmangotea.createindustry.blocks.cogwheeels.TFMGCogwheelBlockItem;
@@ -68,6 +69,8 @@ import com.drmangotea.createindustry.blocks.machines.firebox.FireboxBlock;
import com.drmangotea.createindustry.blocks.machines.firebox.FireboxGenerator;
import com.drmangotea.createindustry.blocks.machines.flarestack.FlarestackBlock;
import com.drmangotea.createindustry.blocks.machines.flarestack.FlarestackGenerator;
import com.drmangotea.createindustry.blocks.machines.metal_processing.blast_stove.BlastStoveBlock;
import com.drmangotea.createindustry.blocks.machines.metal_processing.blast_stove.BlastStoveGenerator;
import com.drmangotea.createindustry.blocks.machines.metal_processing.coke_oven.CokeOvenCTBehavior;
import com.drmangotea.createindustry.blocks.machines.oil_processing.distillation.IndustrialPipeBlock;
import com.drmangotea.createindustry.blocks.machines.oil_processing.distillation.controller.DistillationControllerBlock;
@@ -527,7 +530,18 @@ public class TFMGBlocks {
.register();
//-----------------------MACHINES---------------------------//
public static final BlockEntry<FluidOutputBlock> FLUID_OUTPUT = REGISTRATE.block("fluid_output", FluidOutputBlock::new)
.initialProperties(SharedProperties::copperMetal)
.transform(TagGen.pickaxeOnly())
.blockstate(simpleCubeAll("fluid_output"))
.properties(BlockBehaviour.Properties::noOcclusion)
.addLayer(() -> RenderType::cutoutMipped)
.item()
.build()
.register();
public static final BlockEntry<LightBulbBlock> LIGHT_BULB =
REGISTRATE.block("light_bulb", LightBulbBlock::new)
.initialProperties(() -> Blocks.IRON_BLOCK)
@@ -1112,6 +1126,17 @@ public class TFMGBlocks {
///////////
//Blast Furnace
public static final BlockEntry<BlastStoveBlock> BLAST_STOVE = REGISTRATE.block("blast_stove", BlastStoveBlock::new)
.initialProperties(() -> Blocks.BRICKS)
.properties(p -> p.color(MaterialColor.COLOR_RED))
.properties(p -> p.requiresCorrectToolForDrops())
.blockstate(new BlastStoveGenerator()::generate)
.transform(pickaxeOnly())
.item()
.transform(customItemModel())
.lang("Blast Stove")
.register();
public static final BlockEntry<Block> FIREPROOF_BRICKS = REGISTRATE.block("fireproof_bricks", Block::new)
.initialProperties(() -> Blocks.BRICKS)
@@ -1901,11 +1926,47 @@ public class TFMGBlocks {
// .register();
public static final BlockEntry<Block> CONCRETE = generateConcrete();
static {
generateCautionBlocks();
}
public static final BlockEntry<Block> CONCRETE = REGISTRATE.block("concrete", Block::new)
.initialProperties(() -> Blocks.STONE)
.properties(p -> p.color(MaterialColor.COLOR_LIGHT_GRAY))
.properties(p -> p.requiresCorrectToolForDrops())
.transform(pickaxeOnly())
.blockstate(simpleCubeAll("concrete"))
.tag(BlockTags.NEEDS_STONE_TOOL)
.transform(tagBlockAndItem("concrete"))
.build()
.lang("Concrete")
.register();
public static final BlockEntry<WallBlock> CONCRETE_WALL = REGISTRATE.block("concrete_wall", WallBlock::new)
.initialProperties(() -> Blocks.STONE)
.properties(p -> p.color(MaterialColor.COLOR_LIGHT_GRAY))
.properties(p -> p.requiresCorrectToolForDrops())
.transform(pickaxeOnly())
.blockstate((c, p) -> TFMGVanillaBlockStates.generateWallBlockState(c, p, "concrete"))
.tag(BlockTags.NEEDS_STONE_TOOL)
.tag(BlockTags.WALLS)
.recipe((c, p) -> p.stonecutting(DataIngredient.items(TFMGBlocks.CONCRETE.get()), c::get, 1))
.item()
.transform(b -> TFMGVanillaBlockStates.transformWallItem(b, "concrete"))
.build()
.lang("Concrete Wall")
.register();
public static final BlockEntry<StairBlock> CONCRETE_STAIRS = REGISTRATE.block("concrete_stairs", p -> new StairBlock(() -> TFMGBlocks.CONCRETE.get().defaultBlockState(), p))
.initialProperties(() -> Blocks.STONE)
.properties(p -> p.color(MaterialColor.COLOR_LIGHT_GRAY))
.properties(p -> p.requiresCorrectToolForDrops())
.transform(pickaxeOnly())
.blockstate((c, p) -> TFMGVanillaBlockStates.generateStairBlockState(c, p, "concrete"))
.tag(BlockTags.NEEDS_STONE_TOOL)
.tag(BlockTags.STAIRS)
.recipe((c, p) -> p.stonecutting(DataIngredient.items(TFMGBlocks.CONCRETE.get()), c::get, 1))
.item()
.transform(b -> TFMGVanillaBlockStates.transformStairItem(b, "concrete"))
.build()
.lang("Concrete Stairs")
.register();
public static final BlockEntry<SlabBlock> CONCRETE_SLAB = REGISTRATE.block("concrete_slab", SlabBlock::new)
@@ -1915,7 +1976,7 @@ public class TFMGBlocks {
.transform(pickaxeOnly())
.blockstate((c, p) -> TFMGVanillaBlockStates.generateSlabBlockState(c, p, "concrete"))
.tag(BlockTags.NEEDS_STONE_TOOL)
.tag(BlockTags.WALLS)
.tag(BlockTags.SLABS)
.recipe((c, p) -> p.stonecutting(DataIngredient.items(TFMGBlocks.CONCRETE.get()), c::get, 2))
.item()
.transform(customItemModel("concrete_bottom"))
@@ -1923,8 +1984,49 @@ public class TFMGBlocks {
.register();
public static final BlockEntry<Block> REBAR_CONCRETE = withVariants("rebar_concrete", Blocks.STONE,
MaterialColor.COLOR_GRAY, BlockTags.NEEDS_DIAMOND_TOOL, SoundType.STONE, 40, true);
public static final BlockEntry<Block> REBAR_CONCRETE = REGISTRATE.block("rebar_concrete", Block::new)
.initialProperties(() -> Blocks.STONE)
.properties(p -> p.color(MaterialColor.COLOR_GRAY))
.properties(p -> p.sound(SoundType.STONE))
.properties(p -> p.strength(40, 40))
.properties(p -> p.requiresCorrectToolForDrops())
.transform(pickaxeOnly())
.blockstate(simpleCubeAll("rebar_concrete"))
.tag(BlockTags.NEEDS_DIAMOND_TOOL)
.transform(tagBlockAndItem("rebar_concrete"))
.build()
//.lang(displayName)
.register();
public static final BlockEntry<WallBlock> REBAR_CONCRETE_WALL = REGISTRATE.block("rebar_concrete_wall", WallBlock::new)
.initialProperties(() -> Blocks.STONE)
.properties(p -> p.color(MaterialColor.COLOR_GRAY))
.properties(p -> p.sound(SoundType.STONE))
.properties(p -> p.strength(40, 40))
.properties(p -> p.requiresCorrectToolForDrops())
.transform(pickaxeOnly())
.blockstate((c, p) -> TFMGVanillaBlockStates.generateWallBlockState(c, p, "rebar_concrete"))
.tag(BlockTags.NEEDS_DIAMOND_TOOL)
.tag(BlockTags.WALLS)
.item()
.transform(b -> TFMGVanillaBlockStates.transformWallItem(b, "rebar_concrete"))
.build()
.register();
public static final BlockEntry<StairBlock> REBAR_CONCRETE_STAIRS = REGISTRATE.block("rebar_concrete_stairs", p -> new StairBlock(() -> TFMGBlocks.CONCRETE.get().defaultBlockState(), p))
.initialProperties(() -> Blocks.STONE)
.properties(p -> p.color(MaterialColor.COLOR_GRAY))
.properties(p -> p.sound(SoundType.STONE))
.properties(p -> p.strength(40, 40))
.properties(p -> p.requiresCorrectToolForDrops())
.transform(pickaxeOnly())
.blockstate((c, p) -> TFMGVanillaBlockStates.generateStairBlockState(c, p, "rebar_concrete"))
.tag(BlockTags.NEEDS_DIAMOND_TOOL)
.tag(BlockTags.STAIRS)
.item()
.transform(b -> TFMGVanillaBlockStates.transformStairItem(b, "rebar_concrete"))
.build()
.register();
public static final BlockEntry<SlabBlock> REBAR_CONCRETE_SLAB = REGISTRATE.block("rebar_concrete_slab", SlabBlock::new)
.initialProperties(() -> Blocks.STONE)
@@ -1935,220 +2037,13 @@ public class TFMGBlocks {
.blockstate((c, p) -> TFMGVanillaBlockStates.generateSlabBlockState(c, p, "rebar_concrete"))
.tag(BlockTags.NEEDS_STONE_TOOL)
.recipe((c, p) -> p.stonecutting(DataIngredient.items(TFMGBlocks.REBAR_CONCRETE.get()), c::get, 2))
.tag(BlockTags.WALLS)
.tag(BlockTags.SLABS)
.item()
.transform(customItemModel("rebar_concrete_bottom"))
.lang("Rebar Concrete Slab")
.register();
public static BlockEntry<Block> generateConcrete() {
generateColoredConcrete();
REGISTRATE.block("concrete_wall", WallBlock::new)
.initialProperties(() -> Blocks.STONE)
.properties(p -> p.color(MaterialColor.COLOR_LIGHT_GRAY))
.properties(p -> p.requiresCorrectToolForDrops())
.transform(pickaxeOnly())
.blockstate((c, p) -> TFMGVanillaBlockStates.generateWallBlockState(c, p, "concrete"))
.tag(BlockTags.NEEDS_STONE_TOOL)
.tag(BlockTags.WALLS)
.recipe((c, p) -> p.stonecutting(DataIngredient.items(TFMGBlocks.CONCRETE.get()), c::get, 1))
.item()
.transform(b -> TFMGVanillaBlockStates.transformWallItem(b, "concrete"))
.build()
.lang("Concrete Wall")
.register();
REGISTRATE.block("concrete_stairs", p -> new StairBlock(() -> TFMGBlocks.CONCRETE.get().defaultBlockState(), p))
.initialProperties(() -> Blocks.STONE)
.properties(p -> p.color(MaterialColor.COLOR_LIGHT_GRAY))
.properties(p -> p.requiresCorrectToolForDrops())
.transform(pickaxeOnly())
.blockstate((c, p) -> TFMGVanillaBlockStates.generateStairBlockState(c, p, "concrete"))
.tag(BlockTags.NEEDS_STONE_TOOL)
.tag(BlockTags.STAIRS)
.recipe((c, p) -> p.stonecutting(DataIngredient.items(TFMGBlocks.CONCRETE.get()), c::get, 1))
.item()
.transform(b -> TFMGVanillaBlockStates.transformStairItem(b, "concrete"))
.build()
.lang("Concrete Stairs")
.register();
return REGISTRATE.block("concrete", Block::new)
.initialProperties(() -> Blocks.STONE)
.properties(p -> p.color(MaterialColor.COLOR_LIGHT_GRAY))
.properties(p -> p.requiresCorrectToolForDrops())
.transform(pickaxeOnly())
.blockstate(simpleCubeAll("concrete"))
.tag(BlockTags.NEEDS_STONE_TOOL)
.transform(tagBlockAndItem("concrete"))
.build()
.lang("Concrete")
.register();
}
//this saved so much time
public static void generateColoredConcrete() {
String[] colours = {"black", "white", "blue", "light_blue", "red", "green", "lime", "pink", "magenta", "yellow", "gray", "light_gray", "brown", "cyan", "purple", "orange"};
for (String color : colours) {
String firstLetter = color.substring(0, 1).toUpperCase();
String colorWithoutC = color.substring(1);
String upperCaseColor = firstLetter + colorWithoutC;
String light = "Light";
if (upperCaseColor.contains(light)) {
String nameWithoutLight = upperCaseColor.substring(6);
String firstLetter2 = nameWithoutLight.substring(0, 1).toUpperCase();
String colorWithoutC2 = nameWithoutLight.substring(1);
upperCaseColor = light + " " + firstLetter2 + colorWithoutC2;
}
REGISTRATE.block(color + "_concrete", Block::new)
.initialProperties(() -> Blocks.STONE)
.properties(p -> p.color(MaterialColor.COLOR_LIGHT_GRAY))
.properties(p -> p.requiresCorrectToolForDrops())
.transform(pickaxeOnly())
.blockstate(simpleCubeAll(color + "_concrete"))
.tag(BlockTags.NEEDS_STONE_TOOL)
.item()
.build()
.lang(upperCaseColor + " Concrete")
.register();
REGISTRATE.block(color + "_concrete_wall", WallBlock::new)
.initialProperties(() -> Blocks.STONE)
.properties(p -> p.color(MaterialColor.COLOR_LIGHT_GRAY))
.properties(p -> p.requiresCorrectToolForDrops())
.transform(pickaxeOnly())
.blockstate((c, p) -> TFMGVanillaBlockStates.generateWallBlockState(c, p, color + "_concrete"))
.tag(BlockTags.NEEDS_STONE_TOOL)
.tag(BlockTags.WALLS)
.item()
.transform(b -> TFMGVanillaBlockStates.transformWallItem(b, color + "_concrete"))
.build()
.lang(upperCaseColor + " Concrete Wall")
.register();
REGISTRATE.block(color + "_concrete_stairs", p -> new StairBlock(() -> TFMGBlocks.CONCRETE.get().defaultBlockState(), p))
.initialProperties(() -> Blocks.STONE)
.properties(p -> p.color(MaterialColor.COLOR_LIGHT_GRAY))
.properties(p -> p.requiresCorrectToolForDrops())
.transform(pickaxeOnly())
.blockstate((c, p) -> TFMGVanillaBlockStates.generateStairBlockState(c, p, color + "_concrete"))
.tag(BlockTags.NEEDS_STONE_TOOL)
.tag(BlockTags.STAIRS)
.item()
.transform(b -> TFMGVanillaBlockStates.transformStairItem(b, color + "_concrete"))
.build()
.lang(upperCaseColor + " Concrete Stairs")
.register();
REGISTRATE.block(color + "_concrete_slab", SlabBlock::new)
.initialProperties(() -> Blocks.STONE)
.properties(p -> p.color(MaterialColor.COLOR_LIGHT_GRAY))
.properties(p -> p.requiresCorrectToolForDrops())
.transform(pickaxeOnly())
.blockstate((c, p) -> TFMGVanillaBlockStates.generateSlabBlockState(c, p, color + "_concrete"))
.tag(BlockTags.NEEDS_STONE_TOOL)
.tag(BlockTags.WALLS)
.item()
.transform(customItemModel(color + "_concrete_bottom"))
.lang(upperCaseColor + " Concrete Slab")
.register();
}
}
public static void generateCautionBlocks() {
String[] colours = {"white", "blue", "light_blue", "red", "green", "lime", "pink", "magenta", "yellow", "gray", "light_gray", "brown", "cyan", "purple", "orange"};
for (String color : colours) {
String firstLetter = color.substring(0, 1).toUpperCase();
String colorWithoutC = color.substring(1);
String upperCaseColor = firstLetter + colorWithoutC;
String light = "Light";
if (upperCaseColor.contains(light)) {
String nameWithoutLight = upperCaseColor.substring(6);
String firstLetter2 = nameWithoutLight.substring(0, 1).toUpperCase();
String colorWithoutC2 = nameWithoutLight.substring(1);
upperCaseColor = light + " " + firstLetter2 + colorWithoutC2;
}
REGISTRATE.block(color + "_caution_block", TFMGHorizontalDirectionalBlock::new)
.initialProperties(() -> Blocks.COPPER_BLOCK)
.properties(p -> p.color(MaterialColor.COLOR_LIGHT_GRAY))
.properties(p -> p.requiresCorrectToolForDrops())
.properties(p -> p.sound(SoundType.NETHERITE_BLOCK))
.transform(pickaxeOnly())
.blockstate((c, p) -> p.horizontalBlock(c.get(), p.models()
.withExistingParent(c.getName(), p.modLoc("block/caution_block"))
.texture("0", p.modLoc("block/caution_block/" + color))
.texture("particle", p.modLoc("block/caution_block/" + color))
))
.tag(BlockTags.NEEDS_STONE_TOOL)
.item()
.build()
.lang(upperCaseColor + " Caution Block")
.register();
//REGISTRATE.block(color + "_caution_block_stairs", p -> new StairBlock(()-> TFMGBlocks.CONCRETE.get().defaultBlockState(),p))
// .initialProperties(() -> Blocks.COPPER_BLOCK)
// .properties(p -> p.color(MaterialColor.COLOR_LIGHT_GRAY))
// .properties(p -> p.requiresCorrectToolForDrops())
// .properties(p -> p.sound(SoundType.NETHERITE_BLOCK))
// .transform(pickaxeOnly())
// .blockstate((c, p) -> TFMGVanillaBlockStates.generateStairBlockState(c, p, color + "_caution_block"))
// .tag(BlockTags.NEEDS_STONE_TOOL)
// .tag(BlockTags.STAIRS)
// .item()
// .transform(b -> TFMGVanillaBlockStates.transformStairItem(b, color + "_caution_block"))
// .build()
// .lang(upperCaseColor + " Caution Block Stairs")
// .register();
//
//
//
//REGISTRATE.block(color + "_caution_block_slab", SlabBlock::new)
// .initialProperties(() -> Blocks.COPPER_BLOCK)
// .properties(p -> p.color(MaterialColor.COLOR_LIGHT_GRAY))
// .properties(p -> p.sound(SoundType.NETHERITE_BLOCK))
// .properties(p -> p.requiresCorrectToolForDrops())
// .transform(pickaxeOnly())
// .blockstate((c, p) -> TFMGVanillaBlockStates.generateSlabBlockState(c, p, color + "_caution_block"))
// .tag(BlockTags.NEEDS_STONE_TOOL)
// .tag(BlockTags.WALLS)
// .item()
// .transform(customItemModel(color+"_caution_block_bottom"))
// .lang(upperCaseColor + " Caution Block Slab")
// .register();
}
}
public static BlockEntry<Block> withVariants(String name, Block properties, MaterialColor color, TagKey<Block> toolRequired, SoundType sound, int strenght, boolean wall) {
@@ -2211,5 +2106,6 @@ public class TFMGBlocks {
public static void register() {
TFMGEncasedBlocks.register();
TFMGPipes.register();
TFMGColoredBlocks.register();
}
}

View File

@@ -20,6 +20,7 @@ import com.tterrag.registrate.util.nullness.NonNullFunction;
import com.tterrag.registrate.util.nullness.NonNullSupplier;
import net.minecraft.client.renderer.entity.EntityRenderer;
import net.minecraft.client.renderer.entity.EntityRendererProvider;
import net.minecraft.world.entity.AreaEffectCloud;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.MobCategory;
@@ -57,13 +58,16 @@ public class TFMGEntityTypes {
public static final EntityEntry<BlueSpark> BLUE_SPARK =
register("blue_spark", BlueSpark::new, () -> BlueSparkRenderer::new,
MobCategory.MISC, 4, 20, true, true, BlueSpark::build).register();
public static final EntityEntry<CoolSpark> COOL_SPARK =
register("cool_spark", CoolSpark::new, () -> CoolSparkRenderer::new,
MobCategory.MISC, 4, 20, true, true, CoolSpark::build).register();
public static final EntityEntry<LithiumSpark> LITHIUM_SPARK =
register("lithium_spark", LithiumSpark::new, () -> LithiumSparkRenderer::new,
MobCategory.MISC, 4, 20, true, true, LithiumSpark::build).register();
//
private static <T extends Entity> CreateEntityBuilder<T, ?> register(String name, EntityType.EntityFactory<T> factory,
NonNullSupplier<NonNullFunction<EntityRendererProvider.Context, EntityRenderer<? super T>>> renderer,

View File

@@ -54,6 +54,7 @@ public class TFMGFluids {
public static final FluidEntry<VirtualFluid>
AIR = gas("air"),
HEATED_AIR = gas("heated_air"),
CARBON_DIOXIDE = gas("carbon_dioxide"),
ETHYLENE = gas("ethylene"),
@@ -61,7 +62,8 @@ public class TFMGFluids {
PROPANE = gas("propane",TFMGTags.TFMGFluidTags.FLAMMABLE.tag),
BUTANE = gas("butane",TFMGTags.TFMGFluidTags.FLAMMABLE.tag),
LPG = gas("lpg",TFMGTags.TFMGFluidTags.LPG.tag,TFMGTags.TFMGFluidTags.FLAMMABLE.tag),
NEON = gas("neon")
NEON = gas("neon"),
BLAST_FURNACE_GAS = gas("blast_furnace_gas",TFMGTags.TFMGFluidTags.FLAMMABLE.tag)
;
public static final FluidEntry<ForgeFlowingFluid.Flowing>
CRUDE_OIL = flammableFluid("crude_oil",TFMGTags.TFMGFluidTags.CRUDE_OIL.tag),

View File

@@ -2,9 +2,18 @@ package com.drmangotea.createindustry.registry;
import com.drmangotea.createindustry.CreateTFMG;
import com.drmangotea.createindustry.base.effects.FrostyEffect;
import com.drmangotea.createindustry.base.effects.HellFireEffect;
import com.drmangotea.createindustry.base.util.ProperBrewingRecipe;
import net.minecraft.world.effect.MobEffect;
import net.minecraft.world.effect.MobEffectCategory;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Items;
import net.minecraft.world.item.alchemy.Potion;
import net.minecraft.world.item.alchemy.PotionUtils;
import net.minecraft.world.item.alchemy.Potions;
import net.minecraft.world.item.crafting.Ingredient;
import net.minecraftforge.common.brewing.BrewingRecipeRegistry;
import net.minecraftforge.eventbus.api.IEventBus;
import net.minecraftforge.registries.DeferredRegister;
import net.minecraftforge.registries.ForgeRegistries;
@@ -16,9 +25,25 @@ public class TFMGMobEffects {
public static final DeferredRegister<MobEffect> MOB_EFFECTS = DeferredRegister.create(ForgeRegistries.MOB_EFFECTS, CreateTFMG.MOD_ID);
public static final RegistryObject<MobEffect> HELLFIRE = MOB_EFFECTS.register("hellfire", () -> new HellFireEffect(MobEffectCategory.HARMFUL, new Color(150, 0, 0, 200).getRGB()));
public static final RegistryObject<MobEffect> FROSTY = MOB_EFFECTS.register("frostbite", () -> new FrostyEffect(MobEffectCategory.HARMFUL, new Color(153, 233, 238, 200).getRGB()));
public static void register(IEventBus modEventBus){
MOB_EFFECTS.register(modEventBus);
}
public static ItemStack createPotion(RegistryObject<Potion> potion){
return PotionUtils.setPotion(new ItemStack(Items.POTION), potion.get());
}
public static ItemStack createPotion(Potion potion){
return PotionUtils.setPotion(new ItemStack(Items.POTION), potion);
}
public static void init(){
BrewingRecipeRegistry.addRecipe(new ProperBrewingRecipe(Ingredient.of(createPotion(Potions.AWKWARD)), Ingredient.of(TFMGItems.LITHIUM_INGOT.get()), createPotion(TFMGPotions.HELLFIRE_POTION)));
BrewingRecipeRegistry.addRecipe(new ProperBrewingRecipe(Ingredient.of(createPotion(Potions.AWKWARD)), Ingredient.of(Items.BLUE_ICE), createPotion(TFMGPotions.FROSTY_POTION)));
BrewingRecipeRegistry.addRecipe(new ProperBrewingRecipe(Ingredient.of(createPotion(TFMGPotions.HELLFIRE_POTION)), Ingredient.of(Items.REDSTONE), createPotion(TFMGPotions.LONG_HELLFIRE_POTION)));
BrewingRecipeRegistry.addRecipe(new ProperBrewingRecipe(Ingredient.of(createPotion(TFMGPotions.FROSTY_POTION)), Ingredient.of(Items.REDSTONE), createPotion(TFMGPotions.LONG_FROSTY_POTION)));
}
}

View File

@@ -2,8 +2,10 @@ package com.drmangotea.createindustry.registry;
import com.drmangotea.createindustry.CreateTFMG;
import com.drmangotea.createindustry.items.weapons.advanced_potato_cannon.AdvancedPotatoCannonPacket;
import com.drmangotea.createindustry.items.weapons.flamethrover.FlamethrowerFuelTypeManager;
import com.drmangotea.createindustry.items.weapons.quad_potato_cannon.QuadPotatoCannonPacket;
import com.simibubi.create.content.equipment.potatoCannon.PotatoProjectileTypeManager;
import com.simibubi.create.foundation.networking.SimplePacketBase;
import net.minecraft.core.BlockPos;
import net.minecraft.network.FriendlyByteBuf;
@@ -24,7 +26,8 @@ import static net.minecraftforge.network.NetworkDirection.PLAY_TO_CLIENT;
public enum TFMGPackets {
ADVANCED_POTATO_CANNON(AdvancedPotatoCannonPacket.class, AdvancedPotatoCannonPacket::new, PLAY_TO_CLIENT),
QUAD_POTATO_CANNON(QuadPotatoCannonPacket.class, QuadPotatoCannonPacket::new, PLAY_TO_CLIENT)
QUAD_POTATO_CANNON(QuadPotatoCannonPacket.class, QuadPotatoCannonPacket::new, PLAY_TO_CLIENT),
SYNC_FLAMETHROWER_FUEL_TYPES(FlamethrowerFuelTypeManager.SyncPacket.class, FlamethrowerFuelTypeManager.SyncPacket::new, NetworkDirection.PLAY_TO_CLIENT),
;
public static final ResourceLocation CHANNEL_NAME = CreateTFMG.asResource("main");

View File

@@ -14,6 +14,15 @@ public class TFMGPotions {
public static final RegistryObject<Potion> HELLFIRE_POTION = POTIONS.register("hellfire_potion",
() -> new Potion(new MobEffectInstance(TFMGMobEffects.HELLFIRE.get(), 600, 0)));
public static final RegistryObject<Potion> LONG_HELLFIRE_POTION = POTIONS.register("long_hellfire_potion",
() -> new Potion(new MobEffectInstance(TFMGMobEffects.HELLFIRE.get(), 1800, 0)));
public static final RegistryObject<Potion> FROSTY_POTION = POTIONS.register("frostbite_potion",
() -> new Potion(new MobEffectInstance(TFMGMobEffects.FROSTY.get(), 600, 0)));
public static final RegistryObject<Potion> LONG_FROSTY_POTION = POTIONS.register("long_frostbite_potion",
() -> new Potion(new MobEffectInstance(TFMGMobEffects.FROSTY.get(), 1800, 0)));

View File

@@ -6,6 +6,7 @@ import com.drmangotea.createindustry.blocks.machines.simple.welding_machine.Weld
import com.drmangotea.createindustry.recipes.casting.CastingRecipe;
import com.drmangotea.createindustry.recipes.coking.CokingRecipe;
import com.drmangotea.createindustry.recipes.distillation.DistillationRecipe;
import com.drmangotea.createindustry.recipes.gas_blasting.GasBlastingRecipe;
import com.drmangotea.createindustry.recipes.industrial_blasting.IndustrialBlastingRecipe;
import com.google.common.collect.ImmutableSet;
import com.simibubi.create.AllTags;
@@ -37,7 +38,8 @@ CASTING(CastingRecipe::new),
INDUSTRIAL_BLASTING(IndustrialBlastingRecipe::new),
COKING(CokingRecipe::new),
DISTILLATION(DistillationRecipe::new),
WELDING(WeldingRecipe::new)
WELDING(WeldingRecipe::new),
GAS_BLASTING(GasBlastingRecipe::new)
;
private final ResourceLocation id;

View File

@@ -230,9 +230,50 @@ public class TFMGTags {
private static void init() {}
}
public enum TFMGBlockTags {
AIR_INTAKE_TRANSPARENT,
;
public final TagKey<Block> tag;
public final boolean alwaysDatagen;
TFMGBlockTags() {
this(MOD);
}
TFMGBlockTags(TFMGTags.NameSpace namespace) {
this(namespace, namespace.optionalDefault, namespace.alwaysDatagenDefault);
}
TFMGBlockTags(TFMGTags.NameSpace namespace, String path) {
this(namespace, path, namespace.optionalDefault, namespace.alwaysDatagenDefault);
}
TFMGBlockTags(TFMGTags.NameSpace namespace, boolean optional, boolean alwaysDatagen) {
this(namespace, null, optional, alwaysDatagen);
}
TFMGBlockTags(TFMGTags.NameSpace namespace, String path, boolean optional, boolean alwaysDatagen) {
ResourceLocation id = new ResourceLocation(namespace.id, path == null ? Lang.asId(name()) : path);
if (optional) {
tag = optionalTag(ForgeRegistries.BLOCKS, id);
} else {
tag = BlockTags.create(id);
}
this.alwaysDatagen = alwaysDatagen;
}
public boolean matches(BlockState state) {
return state.is(tag);
}
private static void init() {}
}
public static void init() {
// TFMGBlockTags.init();
TFMGBlockTags.init();
// TFMGItemTags.init();
TFMGFluidTags.init();
TFMGEntityTags.init();

View File

@@ -102,7 +102,13 @@
"item.minecraft.lingering_potion.effect.hellfire_potion": "Lingering Potion of Hellfire",
"item.minecraft.tipped_arrow.effect.hellfire_potion": "Arrow of Hellfire",
"item.minecraft.potion.effect.frostbite_potion": "Potion of Frostbite",
"item.minecraft.splash_potion.effect.frostbite_potion": "Splash Potion of Frostbite",
"item.minecraft.lingering_potion.effect.frostbite_potion": "Lingering Potion of Frostbite",
"item.minecraft.tipped_arrow.effect.frostbite_potion": "Arrow of Frostbite",
"effect.createindustry.hellfire": "Hellfire",
"effect.createindustry.frostbite": "Frostbite",
"create.wires.removed_data": "Data Removed",

View File

@@ -0,0 +1,23 @@
{
"credit": "Made with Blockbench",
"parent": "block/block",
"textures": {
"0": "createindustry:block/blast_stove",
"1": "createindustry:block/fireproof_bricks",
"particle": "createindustry:block/blast_stove"
},
"elements": [
{
"from": [0, 0, 0],
"to": [16, 16, 16],
"faces": {
"north": {"uv": [0, 0, 16, 16], "texture": "#0"},
"east": {"uv": [0, 0, 16, 16], "texture": "#1"},
"south": {"uv": [0, 0, 16, 16], "texture": "#1"},
"west": {"uv": [0, 0, 16, 16], "texture": "#1"},
"up": {"uv": [0, 0, 16, 16], "texture": "#1"},
"down": {"uv": [0, 0, 16, 16], "texture": "#1"}
}
}
]
}

View File

@@ -0,0 +1,23 @@
{
"credit": "Made with Blockbench",
"parent": "block/block",
"textures": {
"0": "createindustry:block/blast_stove_running",
"1": "createindustry:block/fireproof_bricks",
"particle": "createindustry:block/blast_stove_running"
},
"elements": [
{
"from": [0, 0, 0],
"to": [16, 16, 16],
"faces": {
"north": {"uv": [0, 0, 16, 16], "texture": "#0"},
"east": {"uv": [0, 0, 16, 16], "texture": "#1"},
"south": {"uv": [0, 0, 16, 16], "texture": "#1"},
"west": {"uv": [0, 0, 16, 16], "texture": "#1"},
"up": {"uv": [0, 0, 16, 16], "texture": "#1"},
"down": {"uv": [0, 0, 16, 16], "texture": "#1"}
}
}
]
}

View File

@@ -0,0 +1,23 @@
{
"credit": "Made with Blockbench",
"parent": "block/block",
"textures": {
"0": "createindustry:block/blast_stove",
"1": "createindustry:block/fireproof_bricks",
"particle": "createindustry:block/blast_stove"
},
"elements": [
{
"from": [0, 0, 0],
"to": [16, 16, 16],
"faces": {
"north": {"uv": [0, 0, 16, 16], "texture": "#0"},
"east": {"uv": [0, 0, 16, 16], "texture": "#1"},
"south": {"uv": [0, 0, 16, 16], "texture": "#1"},
"west": {"uv": [0, 0, 16, 16], "texture": "#1"},
"up": {"uv": [0, 0, 16, 16], "texture": "#1"},
"down": {"uv": [0, 0, 16, 16], "texture": "#1"}
}
}
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 278 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 272 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 316 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.3 KiB

View File

@@ -0,0 +1,5 @@
{
"animation": {
"frametime": 2
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

View File

@@ -0,0 +1,5 @@
{
"animation": {
"frametime": 2
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 967 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 220 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 224 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 250 B

View File

@@ -7,15 +7,13 @@
"refmap": "createindustry.refmap.json",
"mixins": [
"AllOreFeatureConfigEntriesMixin",
"FluidPropagatorMixin",
"FluidPipeBlockMixin",
"PipeAttachmentModelMixin",
"AreaEffectCloudMixin",
"ArrowMixin",
"BucketItemMixin",
// "ArrowMixin"
//,
// "ScreenEffectRendererMixin"
"FluidPipeBlockMixin",
"FluidPropagatorMixin",
"PipeAttachmentModelMixin"
],
"injectors": {
"defaultRequire": 1
}

View File

@@ -0,0 +1,10 @@
{
"fluids": [
"mekanism:lithium"
],
"spread": 18,
"speed": 1.2,
"amount": 23,
"hellfire": true,
"color": "0xea4a15"
}

View File

@@ -1,22 +0,0 @@
{
"type": "createindustry:casting",
"ingredients": [
{
"fluid": "createindustry:molten_steel",
"amount": 1
}
],
"processingTime": 300,
"results": [
{
"count": 1,
"item": "createindustry:steel_ingot"
}
,
{
"count": 1,
"item": "createindustry:steel_block"
}
]
}

View File

@@ -1,22 +0,0 @@
{
"type": "createindustry:coking",
"ingredients": [
{
"count": 1,
"item": "minecraft:coal"
}
],
"processingTime": 400,
"results": [
{
"count": 1,
"item": "minecraft:charcoal"
}
,
{
"fluid": "createindustry:creosote",
"amount": 1
}
]
}

View File

@@ -1,22 +0,0 @@
{
"type": "createindustry:coking",
"ingredients": [
{
"count": 1,
"item": "minecraft:coal"
}
],
"processingTime": 1000,
"results": [
{
"count": 1,
"item": "createindustry:coal_coke"
}
,
{
"fluid": "createindustry:creosote",
"amount": 1
}
]
}

View File

@@ -1,9 +0,0 @@
{
"type": "minecraft:stonecutting",
"ingredient": {
"item": "createindustry:black_concrete"
},
"result": "createindustry:black_concrete_slab",
"count": 2
}

View File

@@ -1,9 +0,0 @@
{
"type": "minecraft:stonecutting",
"ingredient": {
"item": "createindustry:black_concrete"
},
"result": "createindustry:black_concrete_stairs",
"count": 1
}

View File

@@ -1,9 +0,0 @@
{
"type": "minecraft:stonecutting",
"ingredient": {
"item": "createindustry:black_concrete"
},
"result": "createindustry:black_concrete_wall",
"count": 1
}

View File

@@ -1,9 +0,0 @@
{
"type": "minecraft:stonecutting",
"ingredient": {
"item": "createindustry:blue_concrete"
},
"result": "createindustry:blue_concrete_slab",
"count": 2
}

View File

@@ -1,9 +0,0 @@
{
"type": "minecraft:stonecutting",
"ingredient": {
"item": "createindustry:blue_concrete"
},
"result": "createindustry:blue_concrete_stairs",
"count": 1
}

View File

@@ -1,9 +0,0 @@
{
"type": "minecraft:stonecutting",
"ingredient": {
"item": "createindustry:blue_concrete"
},
"result": "createindustry:blue_concrete_wall",
"count": 1
}

View File

@@ -1,9 +0,0 @@
{
"type": "minecraft:stonecutting",
"ingredient": {
"item": "createindustry:brown_concrete"
},
"result": "createindustry:brown_concrete_slab",
"count": 2
}

View File

@@ -1,9 +0,0 @@
{
"type": "minecraft:stonecutting",
"ingredient": {
"item": "createindustry:brown_concrete"
},
"result": "createindustry:brown_concrete_stairs",
"count": 1
}

View File

@@ -1,9 +0,0 @@
{
"type": "minecraft:stonecutting",
"ingredient": {
"item": "createindustry:brown_concrete"
},
"result": "createindustry:brown_concrete_wall",
"count": 1
}

View File

@@ -1,9 +0,0 @@
{
"type": "minecraft:stonecutting",
"ingredient": {
"item": "createindustry:cyan_concrete"
},
"result": "createindustry:cyan_concrete_slab",
"count": 2
}

View File

@@ -1,9 +0,0 @@
{
"type": "minecraft:stonecutting",
"ingredient": {
"item": "createindustry:cyan_concrete"
},
"result": "createindustry:cyan_concrete_stairs",
"count": 1
}

View File

@@ -1,9 +0,0 @@
{
"type": "minecraft:stonecutting",
"ingredient": {
"item": "createindustry:cyan_concrete"
},
"result": "createindustry:cyan_concrete_wall",
"count": 1
}

View File

@@ -1,9 +0,0 @@
{
"type": "minecraft:stonecutting",
"ingredient": {
"item": "createindustry:gray_concrete"
},
"result": "createindustry:gray_concrete_slab",
"count": 2
}

View File

@@ -1,9 +0,0 @@
{
"type": "minecraft:stonecutting",
"ingredient": {
"item": "createindustry:gray_concrete"
},
"result": "createindustry:gray_concrete_stairs",
"count": 1
}

View File

@@ -1,9 +0,0 @@
{
"type": "minecraft:stonecutting",
"ingredient": {
"item": "createindustry:gray_concrete"
},
"result": "createindustry:gray_concrete_wall",
"count": 1
}

View File

@@ -1,9 +0,0 @@
{
"type": "minecraft:stonecutting",
"ingredient": {
"item": "createindustry:green_concrete"
},
"result": "createindustry:green_concrete_slab",
"count": 2
}

View File

@@ -1,9 +0,0 @@
{
"type": "minecraft:stonecutting",
"ingredient": {
"item": "createindustry:green_concrete"
},
"result": "createindustry:green_concrete_stairs",
"count": 1
}

View File

@@ -1,9 +0,0 @@
{
"type": "minecraft:stonecutting",
"ingredient": {
"item": "createindustry:green_concrete"
},
"result": "createindustry:green_concrete_wall",
"count": 1
}

View File

@@ -1,9 +0,0 @@
{
"type": "minecraft:stonecutting",
"ingredient": {
"item": "createindustry:light_blue_concrete"
},
"result": "createindustry:light_blue_concrete_slab",
"count": 2
}

View File

@@ -1,9 +0,0 @@
{
"type": "minecraft:stonecutting",
"ingredient": {
"item": "createindustry:light_blue_concrete"
},
"result": "createindustry:light_blue_concrete_stairs",
"count": 1
}

View File

@@ -1,9 +0,0 @@
{
"type": "minecraft:stonecutting",
"ingredient": {
"item": "createindustry:light_blue_concrete"
},
"result": "createindustry:light_blue_concrete_wall",
"count": 1
}

View File

@@ -1,9 +0,0 @@
{
"type": "minecraft:stonecutting",
"ingredient": {
"item": "createindustry:light_gray_concrete"
},
"result": "createindustry:light_gray_concrete_slab",
"count": 2
}

Some files were not shown because too many files have changed in this diff Show More