Skip to content

Commit

Permalink
format & update ec4 & prodigytech compat
Browse files Browse the repository at this point in the history
  • Loading branch information
brachy84 committed Jul 6, 2024
1 parent cb3191d commit 2288d65
Show file tree
Hide file tree
Showing 17 changed files with 50 additions and 47 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,15 @@
import com.cleanroommc.groovyscript.helper.Alias;
import com.cleanroommc.groovyscript.helper.SimpleObjectStream;
import com.cleanroommc.groovyscript.registry.VirtualizedRegistry;
import net.minecraft.item.ItemStack;
import essentialcraft.api.DemonTrade;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fml.common.registry.EntityEntry;

@RegistryDescription(
category = RegistryDescription.Category.ENTRIES,
admonition = @Admonition(value = "groovyscript.wiki.essentialcraft.demon_trade.note0", type = Admonition.Type.DANGER))
public class DemonTradeManager extends VirtualizedRegistry<DemonTrade> {

public DemonTradeManager() {
super(Alias.generateOf("DemonTrade"));
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,21 +1,13 @@
package com.cleanroommc.groovyscript.compat.mods.essentialcraft;

import com.cleanroommc.groovyscript.compat.mods.ModPropertyContainer;
import com.cleanroommc.groovyscript.compat.mods.GroovyPropertyContainer;

public class EssentialCraft extends GroovyPropertyContainer {

public class EssentialCraft extends ModPropertyContainer {
public final DemonTradeManager demonTrade = new DemonTradeManager();
public final MagicianTable magicianTable = new MagicianTable();
public final MagmaticSmeltery magmaticSmeltery = new MagmaticSmeltery();
public final MithrilineFurnace mithrilineFurnace = new MithrilineFurnace();
public final RadiatingChamber radiatingChamber = new RadiatingChamber();
public final WindRune windRune = new WindRune();

public EssentialCraft() {
addRegistry(demonTrade);
addRegistry(magicianTable);
addRegistry(magmaticSmeltery);
addRegistry(mithrilineFurnace);
addRegistry(radiatingChamber);
addRegistry(windRune);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ public SimpleObjectStream<MagicianTableRecipe> streamRecipes() {
@Property(property = "input", valid = {@Comp(value = "1", type = Comp.Type.GTE), @Comp(value = "5", type = Comp.Type.LTE)})
@Property(property = "output", valid = @Comp("1"))
public static class RecipeBuilder extends AbstractRecipeBuilder<MagicianTableRecipe> {

@Property(valid = @Comp(type = Comp.Type.GTE, value = "1"))
private int mru;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,11 @@
import essentialcraft.api.OreSmeltingRecipe;
import org.jetbrains.annotations.Nullable;

@RegistryDescription(reloadability = RegistryDescription.Reloadability.DISABLED, admonition={
@Admonition(value = "groovyscript.wiki.essentialcraft.magmatic_smeltery.note0", type = Admonition.Type.WARNING),
@RegistryDescription(reloadability = RegistryDescription.Reloadability.DISABLED, admonition = {
@Admonition(value = "groovyscript.wiki.essentialcraft.magmatic_smeltery.note0", type = Admonition.Type.WARNING),
})
public class MagmaticSmeltery extends VirtualizedRegistry<OreSmeltingRecipe> {

@RecipeBuilderDescription(example = @Example(".input('blockIron').output('ingotGold').factor(3).color(0x0000ff)"))
public MagmaticSmeltery.RecipeBuilder recipeBuilder() {
return new MagmaticSmeltery.RecipeBuilder();
Expand Down Expand Up @@ -54,6 +55,7 @@ public SimpleObjectStream<OreSmeltingRecipe> streamRecipes() {
}

public static class RecipeBuilder implements IRecipeBuilder<OreSmeltingRecipe> {

@Property(valid = @Comp("1"))
private String input;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import com.cleanroommc.groovyscript.registry.VirtualizedRegistry;
import essentialcraft.api.MithrilineFurnaceRecipe;
import essentialcraft.api.MithrilineFurnaceRecipes;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.Ingredient;
import org.jetbrains.annotations.Nullable;

Expand Down Expand Up @@ -68,6 +67,7 @@ public SimpleObjectStream<MithrilineFurnaceRecipe> streamRecipes() {
@Property(property = "input", valid = @Comp("1"))
@Property(property = "output", valid = @Comp("1"))
public static class RecipeBuilder extends AbstractRecipeBuilder<MithrilineFurnaceRecipe> {

@Property(valid = @Comp(type = Comp.Type.GTE, value = "1"))
private int espe;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ public SimpleObjectStream<RadiatingChamberRecipe> streamRecipes() {
@Property(property = "input", valid = {@Comp(value = "1", type = Comp.Type.GTE), @Comp(value = "2", type = Comp.Type.LTE)})
@Property(property = "output", valid = @Comp("1"))
public static class RecipeBuilder extends AbstractRecipeBuilder<RadiatingChamberRecipe> {

@Property(valid = @Comp(type = Comp.Type.GTE, value = "1"))
private int time;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ public SimpleObjectStream<WindImbueRecipe> streamRecipes() {
@Property(property = "input", valid = @Comp("1"))
@Property(property = "output", valid = @Comp("1"))
public static class RecipeBuilder extends AbstractRecipeBuilder<WindImbueRecipe> {

@Property(valid = @Comp(type = Comp.Type.GTE, value = "1"))
private int espe;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,10 @@

@RegistryDescription
public class AtomicReshaper extends VirtualizedRegistry<AtomicReshaperManager.AtomicReshaperRecipe> {

@RecipeBuilderDescription(example = {
@Example(".input(item('minecraft:gold_ingot')).output(item('minecraft:emerald_block')).primordium(10).time(50)"),
@Example(".input(item('minecraft:gold_block')).output(item('minecraft:diamond_block'), 10).output(item('minecraft:carrot'), 3).primordium(7)")
@Example(".input(item('minecraft:gold_ingot')).output(item('minecraft:emerald_block')).primordium(10).time(50)"),
@Example(".input(item('minecraft:gold_block')).output(item('minecraft:diamond_block'), 10).output(item('minecraft:carrot'), 3).primordium(7)")
})
public AtomicReshaper.RecipeBuilder recipeBuilder() {
return new AtomicReshaper.RecipeBuilder();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@

@RegistryDescription
public class ExplosionFurnace extends VirtualizedRegistry<ExplosionFurnaceManager.ExplosionFurnaceRecipe> {

@RecipeBuilderDescription(example = {
@Example(".input(ore('ingotGold'), item('minecraft:diamond')).craftPerReagent(8).power(160).output(item('minecraft:emerald_block'))"),
@Example(".input(item('minecraft:stone')).power(160).output(item('minecraft:glowstone'))")
@Example(".input(ore('ingotGold'), item('minecraft:diamond')).craftPerReagent(8).power(160).output(item('minecraft:emerald_block'))"),
@Example(".input(item('minecraft:stone')).power(160).output(item('minecraft:glowstone'))")
})
public ExplosionFurnace.RecipeBuilder recipeBuilder() {
return new ExplosionFurnace.RecipeBuilder();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

@RegistryDescription(category = RegistryDescription.Category.ENTRIES)
public class ExplosionFurnaceAdditives extends VirtualizedRegistry<ExplosionFurnaceAdditives.EFAdditiveRecipe> {

@Override
public void onReload() {
removeScripted().forEach(EFAdditiveRecipe::unregister);
Expand Down Expand Up @@ -50,7 +51,7 @@ public boolean removeExplosive(IIngredient explosive) {
@MethodDescription(example = @Example(priority = 2000, commented = true))
public void removeAllExplosives() {
ExplosionFurnaceManager.EXPLOSIVES.getAllContent().forEach(r ->
addBackup(new EFAdditiveExplosive(new ItemsIngredient(r.getMatchingStacks()), r.getPower())));
addBackup(new EFAdditiveExplosive(new ItemsIngredient(r.getMatchingStacks()), r.getPower())));
ExplosionFurnaceManager.removeAllExplosives();
}

Expand All @@ -75,17 +76,20 @@ public boolean removeDampener(IIngredient dampener) {
@MethodDescription(example = @Example(priority = 2000, commented = true))
public void removeAllDampeners() {
ExplosionFurnaceManager.DAMPENERS.getAllContent().forEach(r ->
addBackup(new EFAdditiveDampener(new ItemsIngredient(r.getMatchingStacks()), r.getDampening())));
addBackup(new EFAdditiveDampener(new ItemsIngredient(r.getMatchingStacks()), r.getDampening())));
ExplosionFurnaceManager.removeAllDampeners();
}

public interface EFAdditiveRecipe {

void register();

void unregister();
}

@Desugar
public record EFAdditiveExplosive(IIngredient input, int value) implements EFAdditiveRecipe {

@Override
public void register() {
if (this.input instanceof OreDictIngredient) {
Expand All @@ -111,6 +115,7 @@ public void unregister() {

@Desugar
public record EFAdditiveDampener(IIngredient input, int value) implements EFAdditiveRecipe {

@Override
public void register() {
if (this.input instanceof OreDictIngredient) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

@RegistryDescription(category = RegistryDescription.Category.ENTRIES)
public class PrimordialisReactor extends VirtualizedRegistry<IIngredient> {

@Override
public void onReload() {
removeScripted().forEach(this::removeRecipeBase);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
package com.cleanroommc.groovyscript.compat.mods.prodigytech;

import com.cleanroommc.groovyscript.compat.mods.ModPropertyContainer;
import com.cleanroommc.groovyscript.compat.mods.GroovyPropertyContainer;

public class ProdigyTech extends GroovyPropertyContainer {

public class ProdigyTech extends ModPropertyContainer {
public final AtomicReshaper atomicReshaper = new AtomicReshaper();
public final ExplosionFurnace explosionFurnace = new ExplosionFurnace();
public final ExplosionFurnaceAdditives explosionAdditives = new ExplosionFurnaceAdditives();
Expand All @@ -14,17 +15,4 @@ public class ProdigyTech extends ModPropertyContainer {
public final Solderer solderer = new Solderer();
public final ZorraAltar zorraAltar = new ZorraAltar();

public ProdigyTech() {
addRegistry(atomicReshaper);
addRegistry(explosionFurnace);
addRegistry(explosionAdditives);
addRegistry(magneticReassembler);
addRegistry(oreRefinery);
addRegistry(grinder);
addRegistry(primordialisReactor);
addRegistry(sawmill);
addRegistry(solderer);
addRegistry(zorraAltar);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@
import org.jetbrains.annotations.Nullable;

public abstract class SimpleRecipeHandler extends SimpleRecipeHandlerAbstract<SimpleRecipe> {

@RecipeBuilderDescription(example = {
@Example(".input(item('minecraft:gold_ingot')).output(item('minecraft:diamond')).time(50)"),
@Example(".input(item('minecraft:iron_ingot')).output(item('minecraft:coal'))")
@Example(".input(item('minecraft:gold_ingot')).output(item('minecraft:diamond')).time(50)"),
@Example(".input(item('minecraft:iron_ingot')).output(item('minecraft:coal'))")
})
public SimpleRecipeHandler.RecipeBuilder recipeBuilder() {
return new SimpleRecipeHandler.RecipeBuilder();
Expand All @@ -29,6 +30,7 @@ public SimpleRecipeHandler.RecipeBuilder recipeBuilder() {
@Property(property = "input", valid = @Comp("1"))
@Property(property = "output", valid = @Comp("1"))
public class RecipeBuilder extends AbstractRecipeBuilder<SimpleRecipe> {

@Property(valid = @Comp(value = "1", type = Comp.Type.GTE), defaultValue = "(default time for this machine in the mod's config)")
private int time = getDefaultTime();

Expand Down Expand Up @@ -71,6 +73,7 @@ public String getErrorMsg() {

@RegistryDescription
public static class RotaryGrinder extends SimpleRecipeHandler {

RotaryGrinder() {
super("Rotary Grinder", RotaryGrinderManager.INSTANCE);
}
Expand All @@ -89,6 +92,7 @@ public boolean removeByInput(IIngredient input) {

@RegistryDescription
public static class MagneticReassembler extends SimpleRecipeHandler {

MagneticReassembler() {
super("Magnetic Reassembler", MagneticReassemblerManager.INSTANCE);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import net.minecraftforge.oredict.OreDictionary;

public abstract class SimpleRecipeHandlerAbstract<T extends SimpleRecipe> extends VirtualizedRegistry<T> {

private final SimpleRecipeManagerAbstract<T> instance;
protected final String name;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,12 @@
import org.jetbrains.annotations.Nullable;

public abstract class SimpleRecipeHandlerSecondaryOutput extends SimpleRecipeHandlerAbstract<SimpleRecipeSecondaryOutput> {

@RecipeBuilderDescription(example = {
@Example(".input(item('minecraft:gold_ingot')).output(item('minecraft:diamond')).time(50)"),
@Example(".input(item('minecraft:iron_ingot')).output(item('minecraft:coal'))"),
@Example(".input(item('minecraft:iron_block')).output(item('minecraft:emerald'), item('minecraft:clay'))"),
@Example(".input(item('minecraft:gold_block')).output(item('minecraft:emerald'), item('minecraft:nether_star')).secondaryChance(0.25).time(50)")
@Example(".input(item('minecraft:gold_ingot')).output(item('minecraft:diamond')).time(50)"),
@Example(".input(item('minecraft:iron_ingot')).output(item('minecraft:coal'))"),
@Example(".input(item('minecraft:iron_block')).output(item('minecraft:emerald'), item('minecraft:clay'))"),
@Example(".input(item('minecraft:gold_block')).output(item('minecraft:emerald'), item('minecraft:nether_star')).secondaryChance(0.25).time(50)")
})
public SimpleRecipeHandlerSecondaryOutput.RecipeBuilder recipeBuilder() {
return new SimpleRecipeHandlerSecondaryOutput.RecipeBuilder();
Expand All @@ -28,6 +29,7 @@ public SimpleRecipeHandlerSecondaryOutput.RecipeBuilder recipeBuilder() {
@Property(property = "input", valid = @Comp("1"))
@Property(property = "output", valid = {@Comp(value = "1", type = Comp.Type.GTE), @Comp(value = "2", type = Comp.Type.LTE)})
public class RecipeBuilder extends AbstractRecipeBuilder<SimpleRecipe> {

@Property(valid = @Comp(value = "1", type = Comp.Type.GTE))
private int time = getDefaultTime();

Expand Down Expand Up @@ -81,6 +83,7 @@ public String getErrorMsg() {

@RegistryDescription
public static class HeatSawmill extends SimpleRecipeHandlerSecondaryOutput {

HeatSawmill() {
super("Heat Sawmill", HeatSawmillManager.INSTANCE);
}
Expand All @@ -99,6 +102,7 @@ public boolean removeByInput(IIngredient input) {

@RegistryDescription
public static class OreRefinery extends SimpleRecipeHandlerSecondaryOutput {

OreRefinery() {
super("Ore Refinery", OreRefineryManager.INSTANCE);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
public class Solderer extends VirtualizedRegistry<SoldererManager.SoldererRecipe> {

@RecipeBuilderDescription(example = {
@Example(".pattern(item('minecraft:clay')).input(item('minecraft:gold_ingot')).output(item('minecraft:diamond')).gold(5).time(100)"),
@Example(".pattern(item('minecraft:coal_block')).output(item('minecraft:nether_star')).gold(75)"),
@Example(".pattern(item('minecraft:clay')).input(item('minecraft:gold_ingot')).output(item('minecraft:diamond')).gold(5).time(100)"),
@Example(".pattern(item('minecraft:coal_block')).output(item('minecraft:nether_star')).gold(75)"),
})
public Solderer.RecipeBuilder recipeBuilder() {
return new Solderer.RecipeBuilder();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import com.cleanroommc.groovyscript.registry.VirtualizedRegistry;
import com.github.bsideup.jabel.Desugar;
import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap;

import lykrast.prodigytech.common.recipe.ZorraAltarManager;
import lykrast.prodigytech.common.util.Config;
import net.minecraft.enchantment.Enchantment;
Expand All @@ -17,6 +16,7 @@

@RegistryDescription
public class ZorraAltar extends VirtualizedRegistry<ZorraAltar.ZorraRecipeData> {

@GroovyBlacklist
private static final Map<String, ZorraAltarManager> managers = new Object2ObjectOpenHashMap<>();

Expand Down Expand Up @@ -52,8 +52,8 @@ private void removeEnchantment(ZorraRecipeData recipe) {
}

@MethodDescription(example = {
@Example("'sword', enchantment('minecraft:power'), 10"),
@Example("'stick', enchantment('minecraft:knockback'), 20")
@Example("'sword', enchantment('minecraft:power'), 10"),
@Example("'stick', enchantment('minecraft:knockback'), 20")
})
public void addEnchantment(String registry, Enchantment enchantment, int maxLevel) {
if (!managers.containsKey(registry)) return;
Expand Down

0 comments on commit 2288d65

Please sign in to comment.