Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement Linear Forging Furnace #69

Open
wants to merge 21 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package gregicality.multiblocks.api.capability.impl;

import org.jetbrains.annotations.NotNull;

import gregtech.api.capability.IHeatingCoil;
import gregtech.api.metatileentity.multiblock.RecipeMapMultiblockController;
import gregtech.api.recipes.logic.OverclockingLogic;
import gregtech.api.recipes.recipeproperties.IRecipePropertyStorage;
import gregtech.api.recipes.recipeproperties.TemperatureProperty;

public class GCYMHeatingCoilRecipeLogic extends GCYMMultiblockRecipeLogic {

public GCYMHeatingCoilRecipeLogic(RecipeMapMultiblockController metaTileEntity) {
super(metaTileEntity);
if (!(metaTileEntity instanceof IHeatingCoil)) {
throw new IllegalArgumentException("MetaTileEntity must be instanceof IHeatingCoil");
}
}

protected void modifyOverclockPre(@NotNull int[] values, @NotNull IRecipePropertyStorage storage) {
super.modifyOverclockPre(values, storage);
values[0] = OverclockingLogic.applyCoilEUtDiscount(values[0],
((IHeatingCoil) this.metaTileEntity).getCurrentTemperature(),
(Integer) storage.getRecipePropertyValue(TemperatureProperty.getInstance(), 0));
}

protected @NotNull int[] runOverclockingLogic(@NotNull IRecipePropertyStorage propertyStorage, int recipeEUt,
long maxVoltage, int duration, int amountOC) {
return OverclockingLogic.heatingCoilOverclockingLogic(Math.abs(recipeEUt), maxVoltage, duration, amountOC,
((IHeatingCoil) this.metaTileEntity).getCurrentTemperature(),
(Integer) propertyStorage.getRecipePropertyValue(TemperatureProperty.getInstance(), 0));
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
package gregicality.multiblocks.api.metatileentity;

import net.minecraft.util.ResourceLocation;

import org.jetbrains.annotations.NotNull;

import gregtech.api.metatileentity.interfaces.IGregTechTileEntity;
import gregtech.api.pattern.BlockPattern;
import gregtech.api.recipes.RecipeMap;

public abstract class GCYMMultiShapeMultiblockController extends GCYMRecipeMapMultiblockController {

public GCYMMultiShapeMultiblockController(ResourceLocation metaTileEntityId, RecipeMap<?>[] recipeMaps) {
super(metaTileEntityId, recipeMaps);
}

@Override
protected @NotNull BlockPattern createStructurePattern() {
if (this.getWorld() != null && this.getPos() != null) {
if (this.getWorld().getTileEntity(this.getPos()) instanceof IGregTechTileEntity gtte) {
if (gtte.getMetaTileEntity() instanceof GCYMMultiShapeMultiblockController controller) {
return getStructurePattern(controller.getRecipeMapIndex());
}
}
}
return getStructurePattern(0);
}

protected abstract @NotNull BlockPattern getStructurePattern(int index);

@Override
public void checkStructurePattern() {
if (!this.isStructureFormed()) {
this.reinitializeStructurePattern();
}
super.checkStructurePattern();
}

@Override
public void setRecipeMapIndex(int index) {
super.setRecipeMapIndex(index);
this.reinitializeStructurePattern();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package gregicality.multiblocks.api.recipeproperties;

import net.minecraft.client.Minecraft;

import gregtech.api.recipes.recipeproperties.RecipeProperty;

import gregicality.multiblocks.api.recipes.LinearForgingFurnaceRecipeType;

public class LFFRecipeTypeProperty extends RecipeProperty<LinearForgingFurnaceRecipeType> {

public static final String KEY = "lff_recipe_type";

private static LFFRecipeTypeProperty INSTANCE;

protected LFFRecipeTypeProperty() {
super(KEY, LinearForgingFurnaceRecipeType.class);
}

public static LFFRecipeTypeProperty getInstance() {
if (INSTANCE == null) {
INSTANCE = new LFFRecipeTypeProperty();
}
return INSTANCE;
}

@Override
public void drawInfo(Minecraft minecraft, int x, int y, int color, Object value) {}

@Override
public int getInfoHeight(Object value) {
return 0;
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
package gregicality.multiblocks.api.recipes;

import java.util.List;

import com.google.common.collect.Lists;

import gregtech.api.gui.GuiTextures;
import gregtech.api.recipes.RecipeMap;
import gregtech.api.recipes.RecipeMaps;
import gregtech.api.recipes.builders.BlastRecipeBuilder;
import gregtech.core.sound.GTSoundEvents;

Expand All @@ -17,5 +22,42 @@ public final class GCYMRecipeMaps {
.setSlotOverlay(true, true, true, GuiTextures.FURNACE_OVERLAY_2)
.setSound(GTSoundEvents.FURNACE);

public static final RecipeMap<?>[] LINEAR_FORGING_RECIPES = new RecipeMap[] {
RecipeMaps.BLAST_RECIPES,
ALLOY_BLAST_RECIPES,
new RecipeMap<>("lff_dual", 9, 3, 3, 1, new BlastRecipeBuilder(), false)
.setSlotOverlay(false, false, false, GuiTextures.FURNACE_OVERLAY_1)
.setSlotOverlay(false, true, false, GuiTextures.FURNACE_OVERLAY_2)
.setSlotOverlay(true, true, false, GuiTextures.FURNACE_OVERLAY_2)
.setSound(GTSoundEvents.FURNACE),
RecipeMaps.VACUUM_RECIPES,
new RecipeMap<>("lff_blast_cooled", 6, 3, 3, 2, new BlastRecipeBuilder(), false),
new RecipeMap<>("lff_alloy_cooled", 12, 1, 4, 2, new BlastRecipeBuilder(), false)
.setSlotOverlay(false, false, false, GuiTextures.FURNACE_OVERLAY_1)
.setSlotOverlay(false, false, true, GuiTextures.FURNACE_OVERLAY_1)
.setSlotOverlay(false, true, false, GuiTextures.FURNACE_OVERLAY_2)
.setSlotOverlay(true, true, false, GuiTextures.FURNACE_OVERLAY_2)
.setSound(GTSoundEvents.FURNACE),
new RecipeMap<>("lff_dual_cooled", 12, 3, 4, 2, new BlastRecipeBuilder(), false)
.setSlotOverlay(false, false, false, GuiTextures.FURNACE_OVERLAY_1)
.setSlotOverlay(false, true, false, GuiTextures.FURNACE_OVERLAY_2)
.setSlotOverlay(true, true, false, GuiTextures.FURNACE_OVERLAY_2)
.setSound(GTSoundEvents.FURNACE),
new RecipeMap<>("lff_blast_forging_cooled", 6, 3, 3, 2, new BlastRecipeBuilder(), false),
new RecipeMap<>("lff_alloy_forging_cooled", 12, 1, 4, 2, new BlastRecipeBuilder(), false)
.setSlotOverlay(false, false, false, GuiTextures.FURNACE_OVERLAY_1)
.setSlotOverlay(false, false, true, GuiTextures.FURNACE_OVERLAY_1)
.setSlotOverlay(false, true, false, GuiTextures.FURNACE_OVERLAY_2)
.setSlotOverlay(true, true, false, GuiTextures.FURNACE_OVERLAY_2)
.setSound(GTSoundEvents.FURNACE),
new RecipeMap<>("lff_dual_forging_cooled", 12, 3, 4, 2, new BlastRecipeBuilder(), false)
.setSlotOverlay(false, false, false, GuiTextures.FURNACE_OVERLAY_1)
.setSlotOverlay(false, true, false, GuiTextures.FURNACE_OVERLAY_2)
.setSlotOverlay(true, true, false, GuiTextures.FURNACE_OVERLAY_2)
.setSound(GTSoundEvents.FURNACE)
};

static final List<RecipeMap<?>> LFF_RECIPES_AS_LIST = Lists.newArrayList(GCYMRecipeMaps.LINEAR_FORGING_RECIPES);

private GCYMRecipeMaps() {}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package gregicality.multiblocks.api.recipes;

public enum LinearForgingFurnaceRecipeType {

NONE,
BLAST,
ALLOY,
BLAST_COOLED,
ALLOY_COOLED,
BLAST_FORGING_COOLED,
ALLOY_FORGING_COOLED;
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ public final class GCYMTextures {
public static OrientedOverlayRenderer MEGA_BLAST_FURNACE_OVERLAY;
public static OrientedOverlayRenderer MEGA_VACUUM_FREEZER_OVERLAY;
public static OrientedOverlayRenderer STEAM_ENGINE_OVERLAY;
public static OrientedOverlayRenderer LINEAR_FORGING_FURNACE_OVERLAY;

// Hatches
public static OrientedOverlayRenderer PARALLEL_HATCH_MK1_OVERLAY;
Expand All @@ -63,6 +64,7 @@ public final class GCYMTextures {
public static SimpleOverlayRenderer ENGRAVER_CASING;
public static SimpleOverlayRenderer ATOMIC_CASING;
public static SimpleOverlayRenderer STEAM_CASING;
public static SimpleOverlayRenderer FORGING_CASING;

private GCYMTextures() {}

Expand Down Expand Up @@ -97,6 +99,7 @@ public static void preInit() {
MEGA_BLAST_FURNACE_OVERLAY = new OrientedOverlayRenderer("multiblock/mega_blast_furnace");
MEGA_VACUUM_FREEZER_OVERLAY = new OrientedOverlayRenderer("multiblock/mega_vacuum_freezer");
STEAM_ENGINE_OVERLAY = new OrientedOverlayRenderer("multiblock/steam_engine");
LINEAR_FORGING_FURNACE_OVERLAY = new OrientedOverlayRenderer("multiblock/linear_forging_furnace");

// Hatches
PARALLEL_HATCH_MK1_OVERLAY = new OrientedOverlayRenderer("hatches/parallel_hatch_mk1");
Expand All @@ -119,5 +122,6 @@ public static void preInit() {
ENGRAVER_CASING = new SimpleOverlayRenderer("casings/large_multiblock_casing/engraver_casing");
ATOMIC_CASING = new SimpleOverlayRenderer("casings/large_multiblock_casing/atomic_casing");
STEAM_CASING = new SimpleOverlayRenderer("casings/large_multiblock_casing/steam_casing");
FORGING_CASING = new SimpleOverlayRenderer("casings/large_multiblock_casing/forging_casing");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -94,5 +94,13 @@ public static void init() {
.components(Molybdenum, 1, Silicon, 2)
.blastTemp(2300, BlastProperty.GasTier.MID, GTValues.VA[GTValues.EV], 800)
.build();

CobaltAlloy = new Material.Builder(3010, gcymId("cobalt_alloy"))
.ingot().fluid()
.color(0x6594B2).iconSet(MaterialIconSet.METALLIC)
.flags(GENERATE_PLATE, GENERATE_GEAR)
.components(Cobalt, 3, Iridium, 3, Aluminium, 1, Tungsten, 1)
.blastTemp(5388, BlastProperty.GasTier.HIGH, GTValues.VA[GTValues.IV], 1000)
.build();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,17 @@ public final class GCYMMaterialFlags {
.requireFlags(NO_ALLOY_BLAST_RECIPES)
.build();

/**
* Use to disable forging recipes from generating where this material is an input. Not compatible with ore entries.
*/
public static final MaterialFlag NO_FORGING_RECIPES_IN = new MaterialFlag.Builder("no_forging_recipes_in")
.build();

/**
* Use to disable forging recipes from forging this material as an output.
*/
public static final MaterialFlag NO_FORGING_OUT = new MaterialFlag.Builder("no_forging_out")
.build();

private GCYMMaterialFlags() {}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ public final class GCYMMaterials {
public static Material TitaniumCarbide;
public static Material TantalumCarbide;
public static Material MolybdenumDisilicide;
public static Material CobaltAlloy;

/*
* Second Degree Materials 3020-3039
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import net.minecraftforge.event.RegistryEvent;
import net.minecraftforge.fml.client.event.ConfigChangedEvent;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.eventhandler.EventPriority;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.registries.IForgeRegistry;

Expand All @@ -21,6 +22,7 @@
import gregicality.multiblocks.api.utils.GCYMLog;
import gregicality.multiblocks.common.block.GCYMMetaBlocks;
import gregicality.multiblocks.loaders.recipe.GCYMRecipeLoader;
import gregicality.multiblocks.loaders.recipe.LinearForgingFurnaceLoader;

@Mod.EventBusSubscriber(modid = GregicalityMultiblocks.MODID)
public class CommonProxy {
Expand Down Expand Up @@ -67,4 +69,9 @@ public static void registerRecipes(RegistryEvent.Register<IRecipe> event) {
// anything here is safe to call removals in
GCYMRecipeLoader.init();
}

@SubscribeEvent(priority = EventPriority.LOWEST)
public static void recipesLate(RegistryEvent.Register<IRecipe> event) {
LinearForgingFurnaceLoader.registerLate();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,49 @@ public class GCYMConfigHolder {
@Config.Name("Global Multiblock Options")
public static GlobalMultiblocks globalMultiblocks = new GlobalMultiblocks();

@Config.Comment("Config settings applying to the Linear Forging Furnace")
@Config.Name("Linear Forging Furnace Settings")
public static LinearForgingFurnaceSettings linearForgingFurnaceSettings = new LinearForgingFurnaceSettings();

public static class GlobalMultiblocks {

@Config.Comment({ "Makes nearly every GCYM Multiblock require blocks which set their maximum voltages.",
"Default: false" })
public boolean enableTieredCasings = false;
}

public static class LinearForgingFurnaceSettings {

@Config.Comment({ "Sets the multiplier to duration applied for cooling recipes.",
"Default: 1" })
@Config.RequiresMcRestart
@Config.RangeDouble(
min = 0.1,
max = 2.0)
public double coolingDurationModifier = 1.0;

@Config.Comment({ "Sets the flat temperature penalty applied for cooling recipes.",
"Default: 0" })
@Config.RequiresMcRestart
@Config.RangeInt(
min = 0,
max = 2000)
public int coolingTemperaturePenalty = 0;

@Config.Comment({ "Sets the multiplier to duration applied for forging recipes.",
"Default: 1.05" })
@Config.RequiresMcRestart
@Config.RangeDouble(
min = 0.1,
max = 2.0)
public double forgingDurationModifier = 1.05;

@Config.Comment({ "Sets the flat temperature penalty applied for forging recipes.",
"Default: 200" })
@Config.RequiresMcRestart
@Config.RangeInt(
min = 0,
max = 2000)
public int forgingTemperaturePenalty = 200;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ public enum CasingType implements IStringSerializable {
MIXER_CASING("mixer_casing"),
ENGRAVER_CASING("engraver_casing"),
ATOMIC_CASING("atomic_casing"),
STEAM_CASING("steam_casing");
STEAM_CASING("steam_casing"),
FORGING_CASING("forging_casing");

private final String name;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import gregtech.api.GTValues;
import gregtech.api.GregTechAPI;

import gregicality.multiblocks.common.metatileentities.multiblock.advanced.MetaTileEntityLinearForgingFurnace;
import gregicality.multiblocks.common.metatileentities.multiblock.generator.MetaTileEntitySteamEngine;
import gregicality.multiblocks.common.metatileentities.multiblock.standard.*;
import gregicality.multiblocks.common.metatileentities.multiblockpart.MetaTileEntityParallelHatch;
Expand Down Expand Up @@ -41,6 +42,7 @@ public final class GCYMMetaTileEntities {
public static MetaTileEntityMegaVacuumFreezer MEGA_VACUUM_FREEZER;
public static MetaTileEntitySteamEngine STEAM_ENGINE;
public static MetaTileEntityLargeCircuitAssembler LARGE_CIRCUIT_ASSEMBLER;
public static MetaTileEntityLinearForgingFurnace LINEAR_FORGING_FURNACE;

public static MetaTileEntityParallelHatch[] PARALLEL_HATCH = new MetaTileEntityParallelHatch[4];
public static MetaTileEntityTieredHatch[] TIERED_HATCH = new MetaTileEntityTieredHatch[GTValues.V.length];
Expand Down Expand Up @@ -88,6 +90,8 @@ public static void init() {
STEAM_ENGINE = registerMetaTileEntity(2027, new MetaTileEntitySteamEngine(gcymId("steam_engine")));
LARGE_CIRCUIT_ASSEMBLER = registerMetaTileEntity(2028,
new MetaTileEntityLargeCircuitAssembler(gcymId("large_circuit_assembler")));
LINEAR_FORGING_FURNACE = registerMetaTileEntity(2029,
new MetaTileEntityLinearForgingFurnace(gcymId("linear_forging_furnace")));

// Hatches
for (int i = 0; i < PARALLEL_HATCH.length; i++) {
Expand Down
Loading