chore: update anvillib

This commit is contained in:
LordMZTE 2023-11-01 18:12:39 +01:00
parent f498742076
commit 79bc8ecee6
Signed by: LordMZTE
GPG key ID: B64802DC33A64FF6
7 changed files with 58 additions and 35 deletions

View file

@ -35,7 +35,7 @@ dependencies {
forge "net.minecraftforge:forge:${project.forge_version}"
modImplementation "software.bernie.geckolib:geckolib-forge-1.18:3.0.57"
modImplementation "net.anvilcraft:anvillib-18:0.1.1"
modImplementation "net.anvilcraft:anvillib-18-forge:0.2.0"
}
processResources {

View file

@ -4,7 +4,12 @@ import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import net.anvilcraft.anvillib.cosmetics.CosmeticsManager;
import net.anvilcraft.anvillib.event.Bus;
import net.anvilcraft.ntx4core.cosmetics.StaticCosmeticProvider;
import net.anvilcraft.ntx4core.recipes.InputReplacements;
import net.anvilcraft.ntx4core.recipes.RecipeRemovals;
import net.anvilcraft.ntx4core.recipes.RecipeReplacements;
import net.anvilcraft.ntx4core.recipes.ShapedRecipes;
import net.anvilcraft.ntx4core.worldgen.Ntx4CoreFeatures;
import net.anvilcraft.ntx4core.worldgen.Ntx4CoreStructures;
import net.minecraft.util.Identifier;
@ -26,6 +31,11 @@ public class Ntx4Core {
Ntx4CoreFeatures.STRUCTURE_FEATURES.register(bus);
Ntx4CoreStructures.CONFIGURED_STRUCTURE_FEATURES.register(bus);
Bus.MAIN.register(new InputReplacements());
Bus.MAIN.register(new RecipeRemovals());
Bus.MAIN.register(new RecipeReplacements());
Bus.MAIN.register(new ShapedRecipes());
MinecraftForge.EVENT_BUS.register(Ntx4CoreShaders.class);
CosmeticsManager.registerProvider(new StaticCosmeticProvider());
}

View file

@ -1,22 +1,15 @@
package net.anvilcraft.ntx4core.recipes;
import net.anvilcraft.anvillib.Util;
import net.anvilcraft.anvillib.event.Bus;
import net.anvilcraft.anvillib.event.IEventBusRegisterable;
import net.anvilcraft.anvillib.recipe.InputReplaceRecipeMapper;
import net.anvilcraft.anvillib.recipe.RecipesEvent;
import net.anvilcraft.ntx4core.Ntx4Core;
import net.minecraft.util.Identifier;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod.EventBusSubscriber;
import net.minecraftforge.fml.common.Mod.EventBusSubscriber.Bus;
import net.minecraftforge.fml.loading.FMLEnvironment;
@EventBusSubscriber(modid = Ntx4Core.MODID, bus = Bus.MOD)
public class InputReplacements {
@SubscribeEvent
public static void onRecipeRegister(RecipesEvent ev) {
if (!FMLEnvironment.production)
return;
public class InputReplacements implements IEventBusRegisterable {
public void replaceInputs(RecipesEvent ev) {
var darkMatter = Util.ingredientFromString("projecte:dark_matter");
ev.mapRecipeID(
@ -51,4 +44,12 @@ public class InputReplacements {
"deepresonance:machine_frame", "rftoolsbase:machine_frame"
));
}
@Override
public void registerEventHandlers(Bus bus) {
if (!FMLEnvironment.production)
return;
bus.register(RecipesEvent.class, this::replaceInputs);
}
}

View file

@ -1,19 +1,15 @@
package net.anvilcraft.ntx4core.recipes;
import net.anvilcraft.anvillib.Util;
import net.anvilcraft.anvillib.event.Bus;
import net.anvilcraft.anvillib.event.IEventBusRegisterable;
import net.anvilcraft.anvillib.recipe.RecipeContainsPredicate;
import net.anvilcraft.anvillib.recipe.RecipesEvent;
import net.anvilcraft.ntx4core.Ntx4Core;
import net.minecraft.util.Identifier;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod.EventBusSubscriber;
import net.minecraftforge.fml.common.Mod.EventBusSubscriber.Bus;
import net.minecraftforge.fml.loading.FMLEnvironment;
@EventBusSubscriber(modid = Ntx4Core.MODID, bus = Bus.MOD)
public class RecipeRemovals {
@SubscribeEvent
public static void onRecipeRegister(RecipesEvent ev) {
public class RecipeRemovals implements IEventBusRegisterable {
public void removeRecipes(RecipesEvent ev) {
if (!FMLEnvironment.production)
return;
@ -24,4 +20,9 @@ public class RecipeRemovals {
Util.stackFromRegistry(new Identifier("projecte", "transmutation_table"))
));
}
@Override
public void registerEventHandlers(Bus bus) {
bus.register(RecipesEvent.class, this::removeRecipes);
}
}

View file

@ -1,18 +1,15 @@
package net.anvilcraft.ntx4core.recipes;
import net.anvilcraft.anvillib.event.Bus;
import net.anvilcraft.anvillib.event.IEventBusRegisterable;
import net.anvilcraft.anvillib.recipe.RecipesEvent;
import net.anvilcraft.anvillib.recipe.ShapedRecipeBuilder;
import net.anvilcraft.ntx4core.Ntx4Core;
import net.minecraft.util.Identifier;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod.EventBusSubscriber;
import net.minecraftforge.fml.common.Mod.EventBusSubscriber.Bus;
import net.minecraftforge.fml.loading.FMLEnvironment;
@EventBusSubscriber(modid = Ntx4Core.MODID, bus = Bus.MOD)
public class RecipeReplacements {
@SubscribeEvent
public static void onRecipeRegister(RecipesEvent ev) {
public class RecipeReplacements implements IEventBusRegisterable {
public void replaceRecipes(RecipesEvent ev) {
if (!FMLEnvironment.production)
return;
@ -127,4 +124,9 @@ public class RecipeReplacements {
.build()
);
}
@Override
public void registerEventHandlers(Bus bus) {
bus.register(RecipesEvent.class, this::replaceRecipes);
}
}

View file

@ -1,20 +1,17 @@
package net.anvilcraft.ntx4core.recipes;
import net.anvilcraft.anvillib.event.Bus;
import net.anvilcraft.anvillib.event.IEventBusRegisterable;
import net.anvilcraft.anvillib.recipe.RecipesEvent;
import net.anvilcraft.anvillib.recipe.ShapedRecipeBuilder;
import net.anvilcraft.ntx4core.Ntx4Core;
import net.minecraft.item.ItemStack;
import net.minecraft.util.Identifier;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod.EventBusSubscriber;
import net.minecraftforge.fml.common.Mod.EventBusSubscriber.Bus;
import net.minecraftforge.fml.loading.FMLEnvironment;
import net.minecraftforge.registries.ForgeRegistries;
@EventBusSubscriber(modid = Ntx4Core.MODID, bus = Bus.MOD)
public class ShapedRecipes {
@SubscribeEvent
public static void onRecipeRegister(RecipesEvent ev) {
public class ShapedRecipes implements IEventBusRegisterable {
public void registerRecipes(RecipesEvent ev) {
if (!FMLEnvironment.production)
return;
@ -32,4 +29,9 @@ public class ShapedRecipes {
.ingredient('E', "mekanism:energy_tablet")
.build());
}
@Override
public void registerEventHandlers(Bus bus) {
bus.register(RecipesEvent.class, this::registerRecipes);
}
}

View file

@ -38,4 +38,11 @@ modId = "geckolib3"
mandatory = true
versionRange = "[3.0.57,)"
ordering = "NONE"
side = "BOTH"
side = "BOTH"
[[dependencies.ntx4core]]
modId = "anvillib"
mandatory = true
versionRange = "[0.2.0,)"
ordering = "NONE"
side = "BOTH"