Skip to content

Commit

Permalink
started work on renaming fluid extractor and adding smelter
Browse files Browse the repository at this point in the history
  • Loading branch information
Trinsdar committed Apr 26, 2024
1 parent f83e245 commit 84dd145
Show file tree
Hide file tree
Showing 11 changed files with 126 additions and 101 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,21 @@
import trinsdar.gt4r.data.RecipeMaps;
import trinsdar.gt4r.blockentity.multi.BlockEntityIndustrialBlastFurnace;

public class BlockEntityFluidExtractor extends BlockEntityMachine<BlockEntityFluidExtractor> {
public BlockEntityFluidExtractor(Machine<?> type, BlockPos pos, BlockState state) {
public class BlockEntitySmelter extends BlockEntityMachine<BlockEntitySmelter> {
public BlockEntitySmelter(Machine<?> type, BlockPos pos, BlockState state) {
super(type, pos, state);
this.recipeHandler.set(() -> new MachineRecipeHandler<BlockEntityFluidExtractor>(this){
this.recipeHandler.set(() -> new MachineRecipeHandler<>(this) {
int heat = 0, maxHeat = 750;

@Override
public void onMachineEvent(IMachineEvent event, Object... data) {
super.onMachineEvent(event, data);
if (event instanceof BlockEntityIndustrialBlastFurnace.BFEvent){
if (event instanceof BlockEntityIndustrialBlastFurnace.BFEvent) {
maxHeat = 750;
ItemStack stack = (ItemStack) data[0];
if (!stack.isEmpty()){
IRecipe coilRecipe = RecipeMaps.FLUID_EXTRACTOR_COILS.find(new ItemStack[]{stack}, new FluidHolder[]{}, tile.tier, r -> r.getSpecialValue() > 0);
if (coilRecipe != null){
if (!stack.isEmpty()) {
IRecipe coilRecipe = RecipeMaps.SMELTER_COILS.find(new ItemStack[]{stack}, new FluidHolder[]{}, tile.tier, r -> r.getSpecialValue() > 0);
if (coilRecipe != null) {
maxHeat += (coilRecipe.getSpecialValue() * stack.getCount());
}
}
Expand Down
7 changes: 4 additions & 3 deletions common/src/main/java/trinsdar/gt4r/data/Guis.java
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public static void init(Side side) {

AntimatterAPI.registerJEICategory(RecipeMaps.ORE_BYPRODUCTS, Guis.ORE_BYPRODUCTS);
AntimatterAPI.registerJEICategory(RecipeMaps.INT_CIRCUITS, Guis.ORE_BYPRODUCTS_OLD);
AntimatterAPI.registerJEICategory(RecipeMaps.FLUID_EXTRACTOR_COILS, Guis.ORE_BYPRODUCTS_OLD);
AntimatterAPI.registerJEICategory(RecipeMaps.SMELTER_COILS, Guis.ORE_BYPRODUCTS_OLD);

//TODO changing slots of a machine in world, will crash from GTItemHandler.validateSlot()

Expand Down Expand Up @@ -133,7 +133,8 @@ public static void slots(){
MASS_FABRICATOR.add(COMPRESSOR).add(FL_IN, 53, 63).add(FL_OUT, 107, 63);
REPLICATOR.add(FLUID_CANNER);
FERMENTER.add(FLUID_CANNER);
FLUID_EXTRACTOR.add(COMPRESSOR).add(FL_OUT, 107, 63);
FLUID_PRESS.add(COMPRESSOR).add(FL_OUT, 107, 63);
SMELTER.add(FLUID_PRESS);
FLUID_SOLIDIFIER.add(COMPRESSOR).add(FL_IN, 53, 63);
DISTILLERY.add(FLUID_CANNER);
BATH.add(THERMAL_CENTRIFUGE).add(FL_IN, 53, 63);
Expand Down Expand Up @@ -288,7 +289,7 @@ public static void machineData(){
CHEMICAL_REACTOR.getGui().getMachineData().setProgressLocation("chemical_reactor");
FLUID_CANNER.getGui().getMachineData().setProgressLocation("canner");
FERMENTER.getGui().getMachineData().setProgressLocation("chemical_reactor");
FLUID_EXTRACTOR.getGui().getMachineData().setProgressLocation("extractor");
FLUID_PRESS.getGui().getMachineData().setProgressLocation("extractor");
DISTILLERY.getGui().getMachineData().setProgressLocation("chemical_reactor");
BATH.getGui().getMachineData().setProgressLocation("ore_washer");
SIFTER.getGui().getMachineData().setProgressLocation("sifter");
Expand Down
3 changes: 2 additions & 1 deletion common/src/main/java/trinsdar/gt4r/data/Machines.java
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,11 @@ public class Machines {
public static BasicMachine FORGE_HAMMER = new UpgradeableMachine(GT4RRef.ID, "forge_hammer").setMap(HAMMERING).setTiers(LV).addFlags(GUI, ITEM).setTile(BlockEntityForgeHammer::new);
public static BasicMachine ORE_WASHER = new UpgradeableMachine(GT4RRef.ID, "ore_washer").setMap(ORE_WASHING).setTiers(LV).addFlags(GUI, ITEM, FLUID);
public static BasicMachine THERMAL_CENTRIFUGE = new UpgradeableMachine(GT4RRef.ID, "thermal_centrifuge").setTiers(MV).setMap(THERMAL_CENTRIFUGING).addFlags(GUI, ITEM, FLUID);
public static BasicMachine FLUID_EXTRACTOR = new UpgradeableMachine(GT4RRef.ID, "fluid_extractor").setMap(FLUID_EXTRACTING).setTiers(LV).addFlags(GUI, ITEM, FLUID);
public static BasicMachine FLUID_PRESS = new UpgradeableMachine(GT4RRef.ID, "fluid_press").setMap(RecipeMaps.FLUID_PRESS).setTiers(LV).addFlags(GUI, ITEM, FLUID);
public static BasicMachine FLUID_SOLIDIFIER = new UpgradeableMachine(GT4RRef.ID, "fluid_solidifier").setMap(FLUID_SOLIDIFYING).setTiers(LV).addFlags(GUI, ITEM, FLUID);
public static BasicMachine PUMP = new BasicMachine(GT4RRef.ID, "pump").addFlags(GUI, ITEM, FLUID).setTiers(LV).setTile(BlockEntityPump::new);
public static BasicMachine SIFTER = new UpgradeableMachine(GT4RRef.ID, "sifter").setMap(SIFTING).setTiers(LV).addFlags(GUI, ITEM);
public static BasicMachine SMELTER = new UpgradeableMachine(GT4RRef.ID, "smelter").setMap(RecipeMaps.SMELTER).addFlags(GUI, ITEM, FLUID);
public static BasicMachine BATH = new UpgradeableMachine(GT4RRef.ID, "bath").setMap(BATHING).setTiers(LV).addFlags(GUI, ITEM);
public static BasicMachine DISTILLERY = new UpgradeableMachine(GT4RRef.ID, "distillery").setMap(BASIC_DISTILLING).setTiers(LV).addFlags(GUI, ITEM, FLUID);
public static BasicMachine FERMENTER = new UpgradeableMachine(GT4RRef.ID, "fermenter").setMap(FERMENTING).setTiers(LV).addFlags(GUI, ITEM, FLUID);
Expand Down
5 changes: 3 additions & 2 deletions common/src/main/java/trinsdar/gt4r/data/RecipeMaps.java
Original file line number Diff line number Diff line change
Expand Up @@ -63,14 +63,15 @@ public class RecipeMaps {
public static RecipeMap<?> DISASSEMBLING = AntimatterAPI.register(RecipeMap.class, new RecipeMap<>(GT4RRef.ID, "disassembler", new RecipeBuilder()));
public static RecipeMap<?> MASS_FABRICATING = AntimatterAPI.register(RecipeMap.class, new RecipeMap<>(GT4RRef.ID, "mass_fabricator", new RecipeBuilder()));
public static RecipeMap<?> REPLICATING = AntimatterAPI.register(RecipeMap.class, new RecipeMap<>(GT4RRef.ID, "replicator", new RecipeBuilder()));
public static RecipeMap<?> FLUID_EXTRACTING = AntimatterAPI.register(RecipeMap.class, new RecipeMap<>(GT4RRef.ID, "fluid_extractor", new RecipeBuilder()));
public static RecipeMap<?> FLUID_PRESS = AntimatterAPI.register(RecipeMap.class, new RecipeMap<>(GT4RRef.ID, "fluid_press", new RecipeBuilder()));
public static RecipeMap<?> FLUID_SOLIDIFYING = AntimatterAPI.register(RecipeMap.class, new RecipeMap<>(GT4RRef.ID, "fluid_solidifier", new RecipeBuilder()));
public static RecipeMap<?> HAMMERING = AntimatterAPI.register(RecipeMap.class, new RecipeMap<>(GT4RRef.ID, "forge_hammer", new SteamBuilder(STEAM_FORGE_HAMMER)));
public static RecipeMap<?> SIFTING = AntimatterAPI.register(RecipeMap.class, new RecipeMap<>(GT4RRef.ID, "sifter", new SteamBuilder(STEAM_SIFTER)));
public static RecipeMap<?> SMELTER = AntimatterAPI.register(RecipeMap.class, new RecipeMap<>(GT4RRef.ID, "smelter", new RecipeBuilder()));
public static RecipeMap<?> BASIC_DISTILLING = AntimatterAPI.register(RecipeMap.class, new RecipeMap<>(GT4RRef.ID, "distillery", new RecipeBuilder()));
public static RecipeMap<?> DUSTBIN = AntimatterAPI.register(RecipeMap.class, new RecipeMap<>(GT4RRef.ID, "dustbin", new RecipeBuilder()));
public static RecipeMap<?> FERMENTING = AntimatterAPI.register(RecipeMap.class, new RecipeMap<>(GT4RRef.ID, "fermenter", new RecipeBuilder()));
public static RecipeMap<?> FLUID_EXTRACTOR_COILS = AntimatterAPI.register(RecipeMap.class, new RecipeMap<>(GT4RRef.ID, "fluid_extractor_coils", new RecipeBuilder())).setIcon(() -> GT4RData.CupronickelHeatingCoil);
public static RecipeMap<?> SMELTER_COILS = AntimatterAPI.register(RecipeMap.class, new RecipeMap<>(GT4RRef.ID, "smelter_coils", new RecipeBuilder())).setIcon(() -> GT4RData.CupronickelHeatingCoil);

public static RecipeMap<?> COKING = AntimatterAPI.register(RecipeMap.class, new RecipeMap<>(GT4RRef.ID, "coke_oven", new RecipeBuilder()));
public static RecipeMap<?> PYROLYSING = AntimatterAPI.register(RecipeMap.class, new RecipeMap<>(GT4RRef.ID, "pyrolysis_oven", new RecipeBuilder()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public void render(PoseStack stack, IRecipe recipe, Font fontRenderer, int guiOf
public static void clientMaps() {
RecipeMaps.ORE_BYPRODUCTS.setInfoRenderer(InfoRenderers.EMPTY_RENDERER);
RecipeMaps.INT_CIRCUITS.setInfoRenderer(INT_CIRCUIT_RENDERER);
RecipeMaps.FLUID_EXTRACTOR_COILS.setInfoRenderer(FLUID_EXTRACTOR_COILS_RENDERER);
RecipeMaps.SMELTER_COILS.setInfoRenderer(FLUID_EXTRACTOR_COILS_RENDERER);
RecipeMaps.THERMAL_BOILER_FUELS.setInfoRenderer(InfoRenderers.EMPTY_RENDERER);
RecipeMaps.STEAM_FUELS.setInfoRenderer(FUEL_RENDERER);
RecipeMaps.GAS_FUELS.setInfoRenderer(FUEL_RENDERER);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
import trinsdar.gt4r.loader.machines.ExtruderLoader;
import trinsdar.gt4r.loader.machines.FermentingLoader;
import trinsdar.gt4r.loader.machines.FluidCanningLoader;
import trinsdar.gt4r.loader.machines.FluidExtractorLoader;
import trinsdar.gt4r.loader.machines.FluidPressLoader;
import trinsdar.gt4r.loader.machines.FluidSolidifierLoader;
import trinsdar.gt4r.loader.machines.ForgeHammerLoader;
import trinsdar.gt4r.loader.machines.FurnaceLoader;
Expand All @@ -50,6 +50,7 @@
import trinsdar.gt4r.loader.machines.MassFabLoader;
import trinsdar.gt4r.loader.machines.OreByproducts;
import trinsdar.gt4r.loader.machines.SiftingLoader;
import trinsdar.gt4r.loader.machines.SmelterLoader;
import trinsdar.gt4r.loader.machines.ThermalCentrifuge;
import trinsdar.gt4r.loader.machines.WasherLoader;
import trinsdar.gt4r.loader.machines.WiremillLoader;
Expand Down Expand Up @@ -85,10 +86,11 @@ public static void registerRecipeLoaders(IAntimatterRegistrar registrar, IRecipe
loader.accept("chemical_reactor", ChemicalReactorLoader::init);
loader.accept("fuels", FuelBurnHandler::init);
loader.accept("heat_exchanger", HeatExchangerLoader::init);
loader.accept("fluid_extractor", FluidExtractorLoader::init);
loader.accept("fluid_extractor", FluidPressLoader::init);
loader.accept("fluid_solidifier", FluidSolidifierLoader::init);
loader.accept("bathing", BathingLoader::init);
loader.accept("solid_fuel_boiler", SolidFuelBoilerHandler::init);
loader.accept("smelter", SmelterLoader::init);
loader.accept("distilling", DistillingLoader::init);
loader.accept("fermenting", FermentingLoader::init);
loader.accept("industrial_sawmilling", IndustrialSawmill::init);
Expand Down
10 changes: 5 additions & 5 deletions common/src/main/java/trinsdar/gt4r/gui/slots/SlotCoil.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import trinsdar.gt4r.data.Machines;
import trinsdar.gt4r.data.RecipeMaps;
import trinsdar.gt4r.blockentity.multi.BlockEntityIndustrialBlastFurnace;
import trinsdar.gt4r.blockentity.single.BlockEntityFluidExtractor;
import trinsdar.gt4r.blockentity.single.BlockEntitySmelter;

import javax.annotation.Nonnull;

Expand All @@ -23,8 +23,8 @@ public SlotCoil(SlotType<SlotCoil> type, IGuiHandler tile, ExtendedItemContainer

@Override
public boolean mayPlace(@Nonnull ItemStack stack) {
if (holder instanceof BlockEntityFluidExtractor){
return RecipeMaps.FLUID_EXTRACTOR_COILS.acceptsItem(stack);
if (holder instanceof BlockEntitySmelter){
return RecipeMaps.SMELTER_COILS.acceptsItem(stack);
}
BlockEntityMachine<?> m = (BlockEntityMachine<?>) holder;
return stack.getItem() == GT4RData.KanthalHeatingCoil || stack.getItem() == GT4RData.NichromeHeatingCoil || (m.getMachineType() == Machines.PYROLYSIS_OVEN && stack.getItem() == GT4RData.CupronickelHeatingCoil);
Expand All @@ -37,15 +37,15 @@ public boolean mayPickup(Player playerIn) {

@Override
public int getMaxStackSize() {
if (holder instanceof BlockEntityFluidExtractor){
if (holder instanceof BlockEntitySmelter){
return 6;
}
return 4;
}

@Override
public int getMaxStackSize(@Nonnull ItemStack stack) {
if (holder instanceof BlockEntityFluidExtractor){
if (holder instanceof BlockEntitySmelter){
return 6;
}
return 4;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import net.minecraft.world.item.Items;
import trinsdar.gt4r.GT4RRef;
import muramasa.antimatter.data.ForgeCTags;
import trinsdar.gt4r.data.GT4RData;
import trinsdar.gt4r.data.GT4RMaterialTags;
import trinsdar.gt4r.data.TierMaps;

Expand Down Expand Up @@ -252,7 +251,7 @@ private static void loadUtilityBlockRecipes(Consumer<FinishedRecipe> output, Ant
}

private static void loadHatchRecipes(Consumer<FinishedRecipe> output, AntimatterRecipeProvider provider){
provider.addItemRecipe(output, GT4RRef.ID, "fluid_extractor", "machines", FLUID_EXTRACTOR.getItem(LV), of('C', CIRCUITS_BASIC, 'G', ForgeCTags.GLASS, 'M', MACHINE_HULLS_BASIC, 'P', PISTONS, 'p', PumpModule), " C ", "pMP", "GCG");
provider.addItemRecipe(output, GT4RRef.ID, "fluid_press", "machines", FLUID_PRESS.getItem(LV), of('C', CIRCUITS_BASIC, 'G', ForgeCTags.GLASS, 'M', MACHINE_HULLS_BASIC, 'P', PISTONS, 'p', PumpModule), " C ", "pMP", "GCG");
provider.addItemRecipe(output, GT4RRef.ID, "fluid_solidifier", "machines", FLUID_SOLIDIFIER.getItem(LV), of('C', CIRCUITS_BASIC, 'G', ForgeCTags.GLASS, 'M', MACHINE_HULLS_BASIC, 'P', PumpModule, 'c', ForgeCTags.CHESTS_WOODEN), " G ", "PMP", "CcC");
provider.addItemRecipe(output, GT4RRef.ID, "item_input_hatch", "hatches", HATCH_ITEM_I.getItem(LV), of('P', AntimatterMaterialTypes.PLATE.getMaterialTag(StainlessSteel), 'G', GEARS_STEELS, 'M', MACHINE_HULLS_BASIC, 'C', ForgeCTags.CHESTS_WOODEN), "PCP", "GMG", "PPP");
provider.addItemRecipe(output, GT4RRef.ID, "item_output_hatch", "hatches", HATCH_ITEM_O.getItem(LV), of('P', AntimatterMaterialTypes.PLATE.getMaterialTag(StainlessSteel), 'G', GEARS_STEELS, 'M', MACHINE_HULLS_BASIC, 'C', ForgeCTags.CHESTS_WOODEN), "PPP", "GMG", "PCP");
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package trinsdar.gt4r.loader.machines;

import muramasa.antimatter.material.Material;
import muramasa.antimatter.material.MaterialTags;
import muramasa.antimatter.material.MaterialTypeItem;
import muramasa.antimatter.recipe.ingredient.RecipeIngredient;
import muramasa.antimatter.util.AntimatterPlatformUtils;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Items;
import net.minecraft.tags.ItemTags;
import muramasa.antimatter.data.ForgeCTags;

import static muramasa.antimatter.data.AntimatterMaterialTypes.*;
import static trinsdar.gt4r.data.Materials.FishOil;
import static trinsdar.gt4r.data.Materials.Honey;
import static trinsdar.gt4r.data.Materials.SeedOil;
import static trinsdar.gt4r.data.RecipeMaps.FLUID_PRESS;

public class FluidPressLoader {
public static void init() {
FLUID_PRESS.RB()
.ii(RecipeIngredient.of(ForgeCTags.SEEDS,1))
.fo(SeedOil.getLiquid(10))
.add("seed_oil",32, 2);
FLUID_PRESS.RB()
.ii(RecipeIngredient.of(ItemTags.FISHES,1))
.fo(FishOil.getLiquid(10))
.add("fish_oil",32, 2);
FLUID_PRESS.RB()
.ii(RecipeIngredient.of(Items.HONEY_BOTTLE,1))
.fo(Honey.getLiquid(250))
.io(new ItemStack(Items.GLASS_BOTTLE))
.add("honey",32, 2);
}
}
Loading

0 comments on commit 84dd145

Please sign in to comment.