Skip to content

Commit

Permalink
made sure macerator can process ores without issue
Browse files Browse the repository at this point in the history
  • Loading branch information
Trinsdar committed Sep 2, 2024
1 parent b5d32da commit 61b2ee1
Show file tree
Hide file tree
Showing 4 changed files with 86 additions and 43 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package trinsdar.gt4r.blockentity.single;

import muramasa.antimatter.blockentity.BlockEntityMachine;
import muramasa.antimatter.capability.machine.MachineRecipeHandler;
import muramasa.antimatter.machine.types.Machine;
import muramasa.antimatter.recipe.map.IRecipeMap;
import net.minecraft.core.BlockPos;
import net.minecraft.world.level.block.state.BlockState;
import trinsdar.gt4r.data.RecipeMaps;
import trinsdar.gt4r.machine.UpgradeableMachine;

import static muramasa.antimatter.machine.Tier.LV;
import static muramasa.antimatter.machine.Tier.MV;

public class BlockEntityMacerator extends BlockEntityUpgradeableMachine<BlockEntityMacerator> {
public BlockEntityMacerator(UpgradeableMachine type, BlockPos pos, BlockState state) {
super(type, pos, state);
recipeHandler.set(() -> new MachineRecipeHandler<>(this){
@Override
protected IRecipeMap getRecipeMap() {
if (tile.getMachineTier() == LV) return RecipeMaps.MACERATING;
return super.getRecipeMap();
}
});
}
}
2 changes: 1 addition & 1 deletion common/src/main/java/trinsdar/gt4r/data/Machines.java
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public class Machines {
public static UpgradeableMachine EXTRACTOR = new UpgradeableMachine(GT4RRef.ID, "extractor").setMap(EXTRACTING).setTiers(LV).addFlags(GUI, ITEM);
public static UpgradeableMachine EXTRUDER = new UpgradeableMachine(GT4RRef.ID, "extruder").setTiers(MV).setMap(EXTRUDING).addFlags(GUI, ITEM).custom();
public static UpgradeableMachine LATHE = new UpgradeableMachine(GT4RRef.ID, "lathe").setMap(LATHING).setTiers(LV).addFlags(GUI, ITEM);
public static UpgradeableMachine MACERATOR = new UpgradeableMachine(GT4RRef.ID, "macerator").setMap(MACERATING).addFlags(GUI, ITEM).setTiers(LV, MV).custom().overlayTexture(Textures.TIER_SPECIFIC_OVERLAY_HANDLER).setTierSpecificLang();
public static UpgradeableMachine MACERATOR = new UpgradeableMachine(GT4RRef.ID, "macerator").setTiers(LV, MV).setMap(UNIVERSAL_MACERATING).addFlags(GUI, ITEM).setTile(BlockEntityMacerator::new).custom().overlayTexture(Textures.TIER_SPECIFIC_OVERLAY_HANDLER).setTierSpecificLang();
public static UpgradeableMachine RECYCLER = new UpgradeableMachine(GT4RRef.ID, "recycler").setMap(RECYCLING).setTiers(LV).addFlags(GUI, ITEM);
public static UpgradeableMachine SCANNER = new UpgradeableMachine(GT4RRef.ID, "scanner").setTiers(HV).setMap(SCANNING).addFlags(GUI, ITEM, FLUID);
public static UpgradeableMachine WIRE_MILL = new UpgradeableMachine(GT4RRef.ID, "wire_mill").setMap(WIRE_MILLING).setTiers(LV).addFlags(GUI, ITEM).custom();
Expand Down
21 changes: 19 additions & 2 deletions common/src/main/java/trinsdar/gt4r/data/RecipeMaps.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import io.github.gregtechintergalactical.gtcore.data.RecipeBuilders.SteamBuilder;
import muramasa.antimatter.AntimatterAPI;
import muramasa.antimatter.recipe.IRecipe;
import muramasa.antimatter.recipe.RecipeProxies;
import muramasa.antimatter.recipe.map.RecipeBuilder;
import muramasa.antimatter.recipe.map.RecipeMap;
Expand Down Expand Up @@ -50,8 +51,8 @@ public class RecipeMaps {
public static RecipeMap<?> EXTRACTING = AntimatterAPI.register(RecipeMap.class, new RecipeMap<>(GT4RRef.ID, "extractor", new SteamBuilder(STEAM_EXTRACTOR)));
public static RecipeMap<?> EXTRUDING = AntimatterAPI.register(RecipeMap.class, new RecipeMap<>(GT4RRef.ID, "extruder", new RecipeBuilder()));
public static RecipeMap<?> LATHING = AntimatterAPI.register(RecipeMap.class, new RecipeMap<>(GT4RRef.ID, "lathe", new RecipeBuilder()));
//public static RecipeMap UNIVERSAL_MACERATING = AntimatterAPI.register(RecipeMap.class, new RecipeMap<>("universal_macerating", new UniversalMaceratingBuilder(), Tier.MV));
public static RecipeMap<?> MACERATING = AntimatterAPI.register(RecipeMap.class, new RecipeMap<>(GT4RRef.ID, "macerator", new SteamBuilder(STEAM_MACERATOR)).setGuiTier(MV));
public static RecipeMap<?> UNIVERSAL_MACERATING = AntimatterAPI.register(RecipeMap.class, new RecipeMap<>(GT4RRef.ID, "universal_macerator", new UniversalMaceratorBuilder()).setGuiTier(MV));
public static RecipeMap<?> MACERATING = AntimatterAPI.register(RecipeMap.class, new RecipeMap<>(GT4RRef.ID, "macerator", new SteamBuilder(STEAM_MACERATOR)));
public static RecipeMap<?> RECYCLING = AntimatterAPI.register(RecipeMap.class, new RecipeMap<>(GT4RRef.ID, "recycler", new RecipeBuilder()));
public static RecipeMap<?> SCANNING = AntimatterAPI.register(RecipeMap.class, new RecipeMap<>(GT4RRef.ID, "scanner", new RecipeBuilder()));
public static RecipeMap<?> WIRE_MILLING = AntimatterAPI.register(RecipeMap.class, new RecipeMap<>(GT4RRef.ID, "wire_mill", new RecipeBuilder()));
Expand Down Expand Up @@ -112,4 +113,20 @@ public static void postInit(){
ORE_BYPRODUCTS.setIcon(() -> Items.IRON_ORE);
INT_CIRCUITS.setIcon(() -> TierMaps.INT_CIRCUITS_ITEMS.get(0));
}

public static class UniversalMaceratorBuilder extends RecipeBuilder{
@Override
public IRecipe add(String domain, String id) {
IRecipe recipe = super.add(domain, id);
var recipeBuilder = MACERATING.RB().hide().ii(recipe.getInputItems());
if (recipe.hasOutputItems() && recipe.getOutputItems().length > 0) {
recipeBuilder.io(recipe.getOutputItems(false)[0]);
}
if (recipe.hasOutputChances() && recipe.getOutputChances().length > 0) {
recipeBuilder.outputChances(recipe.getOutputChances()[0]);
}
recipeBuilder.inputChances(recipe.getInputChances()).add(domain, id, recipe.getDuration(), recipe.getPower(), recipe.getSpecialValue(), recipe.getAmps());
return recipe;
}
}
}
Loading

0 comments on commit 61b2ee1

Please sign in to comment.