feat: port to architectury
This commit is contained in:
parent
64a9efbd5b
commit
490f4a7896
|
@ -1,5 +1,4 @@
|
|||
# gradle
|
||||
|
||||
.gradle/
|
||||
build/
|
||||
out/
|
||||
|
@ -7,28 +6,26 @@ classes/
|
|||
.factorypath
|
||||
|
||||
# eclipse
|
||||
|
||||
*.launch
|
||||
|
||||
# idea
|
||||
|
||||
.idea/
|
||||
*.iml
|
||||
*.ipr
|
||||
*.iws
|
||||
|
||||
# vscode
|
||||
|
||||
.settings/
|
||||
.vscode/
|
||||
bin/
|
||||
.classpath
|
||||
.project
|
||||
|
||||
# macos
|
||||
|
||||
# kekos
|
||||
*.DS_Store
|
||||
|
||||
# fabric
|
||||
|
||||
run/
|
||||
|
||||
# architectury
|
||||
.architectury-transformer
|
||||
|
|
122
build.gradle
122
build.gradle
|
@ -1,97 +1,59 @@
|
|||
plugins {
|
||||
id "dev.architectury.loom" version "1.1-SNAPSHOT"
|
||||
id "maven-publish"
|
||||
id "architectury-plugin" version "3.4-SNAPSHOT"
|
||||
id "dev.architectury.loom" version "1.3-SNAPSHOT" apply false
|
||||
}
|
||||
|
||||
sourceCompatibility = targetCompatibility = JavaVersion.VERSION_17
|
||||
architectury {
|
||||
minecraft = rootProject.minecraft_version
|
||||
}
|
||||
|
||||
archivesBaseName = project.archives_base_name
|
||||
version = project.mod_version
|
||||
group = project.maven_group
|
||||
subprojects {
|
||||
apply plugin: "dev.architectury.loom"
|
||||
|
||||
loom {
|
||||
forge {
|
||||
mixinConfigs = [
|
||||
"anvillib.mixins.json"
|
||||
]
|
||||
dependencies {
|
||||
minecraft "com.mojang:minecraft:${rootProject.minecraft_version}"
|
||||
// The following line declares the yarn mappings you may select this one as well.
|
||||
mappings "net.fabricmc:yarn:1.18.2+build.4:v2"
|
||||
}
|
||||
}
|
||||
|
||||
repositories {
|
||||
maven {
|
||||
url "https://dl.cloudsmith.io/public/geckolib3/geckolib/maven/"
|
||||
allprojects {
|
||||
apply plugin: "java"
|
||||
apply plugin: "architectury-plugin"
|
||||
apply plugin: "maven-publish"
|
||||
|
||||
base {
|
||||
archivesName = rootProject.archives_base_name
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
// to change the versions see the gradle.properties file
|
||||
minecraft "com.mojang:minecraft:${project.minecraft_version}"
|
||||
mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2"
|
||||
|
||||
forge "net.minecraftforge:forge:${project.forge_version}"
|
||||
|
||||
modImplementation "software.bernie.geckolib:geckolib-forge-1.18:3.0.57"
|
||||
}
|
||||
|
||||
processResources {
|
||||
// this will replace the property "${version}" in your mods.toml
|
||||
// with the version you've defined in your gradle.properties
|
||||
filesMatching("META-INF/mods.toml") {
|
||||
expand "version": project.version
|
||||
}
|
||||
}
|
||||
|
||||
tasks.withType(JavaCompile) {
|
||||
options.encoding = "UTF-8"
|
||||
options.release = 17
|
||||
}
|
||||
|
||||
java {
|
||||
// Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task
|
||||
// if it is present.
|
||||
// If you remove this line, sources will not be generated.
|
||||
withSourcesJar()
|
||||
}
|
||||
|
||||
jar {
|
||||
// add some additional metadata to the jar manifest
|
||||
manifest {
|
||||
attributes([
|
||||
"Specification-Title" : project.mod_id,
|
||||
"Specification-Vendor" : project.mod_author,
|
||||
"Specification-Version" : "1",
|
||||
"Implementation-Title" : project.name,
|
||||
"Implementation-Version" : version,
|
||||
"Implementation-Vendor" : project.mod_author,
|
||||
"Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")
|
||||
])
|
||||
}
|
||||
}
|
||||
|
||||
sourcesJar {
|
||||
archiveClassifier = "sources"
|
||||
}
|
||||
|
||||
// configure the maven publication
|
||||
publishing {
|
||||
publications {
|
||||
mavenJava(MavenPublication) {
|
||||
from components.java
|
||||
|
||||
artifactId = project.archivesBaseName
|
||||
}
|
||||
}
|
||||
version = rootProject.mod_version
|
||||
group = rootProject.maven_group
|
||||
|
||||
repositories {
|
||||
if (project.hasProperty("mvnURL")) {
|
||||
maven {
|
||||
credentials {
|
||||
username findProperty("mvnUsername")
|
||||
password findProperty("mvnPassword")
|
||||
maven { url "https://dl.cloudsmith.io/public/geckolib3/geckolib/maven/" }
|
||||
}
|
||||
|
||||
tasks.withType(JavaCompile) {
|
||||
options.encoding = "UTF-8"
|
||||
options.release = 17
|
||||
}
|
||||
|
||||
java {
|
||||
withSourcesJar()
|
||||
}
|
||||
|
||||
publishing {
|
||||
repositories {
|
||||
if (project.hasProperty("mvnURL")) {
|
||||
maven {
|
||||
credentials {
|
||||
username findProperty("mvnUsername")
|
||||
password findProperty("mvnPassword")
|
||||
}
|
||||
url = findProperty("mvnURL")
|
||||
}
|
||||
url = findProperty("mvnURL")
|
||||
}
|
||||
mavenLocal()
|
||||
}
|
||||
mavenLocal()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
architectury {
|
||||
common(rootProject.enabled_platforms.split(","))
|
||||
}
|
||||
|
||||
loom {
|
||||
accessWidenerPath = file("src/main/resources/anvillib.accesswidener")
|
||||
}
|
||||
|
||||
dependencies {
|
||||
// We depend on fabric loader here to use the fabric @Environment annotations and get the mixin dependencies
|
||||
// Do NOT use other classes from fabric loader
|
||||
modImplementation "net.fabricmc:fabric-loader:${rootProject.fabric_loader_version}"
|
||||
modImplementation "software.bernie.geckolib:geckolib-fabric-1.18:3.0.80"
|
||||
}
|
||||
|
||||
publishing {
|
||||
publications {
|
||||
mavenCommon(MavenPublication) {
|
||||
artifactId = rootProject.archives_base_name
|
||||
from components.java
|
||||
}
|
||||
}
|
||||
}
|
|
@ -3,15 +3,17 @@ package net.anvilcraft.anvillib;
|
|||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.anvilcraft.anvillib.cosmetics.ClientEventHandler;
|
||||
import net.anvilcraft.anvillib.event.Bus;
|
||||
import software.bernie.geckolib3.GeckoLib;
|
||||
|
||||
@Mod(AnvilLib.MODID)
|
||||
public class AnvilLib {
|
||||
public static final String MODID = "anvillib";
|
||||
public static final Logger LOGGER = LogManager.getLogger();
|
||||
|
||||
public AnvilLib() {
|
||||
public static void initialize() {
|
||||
Bus.MAIN.register(new ClientEventHandler());
|
||||
|
||||
GeckoLib.initialize();
|
||||
}
|
||||
}
|
|
@ -5,14 +5,13 @@ import net.minecraft.recipe.Ingredient;
|
|||
import net.minecraft.tag.TagKey;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
|
||||
public class Util {
|
||||
public static ItemStack stackFromRegistry(Identifier id) {
|
||||
if (ForgeRegistries.ITEMS.containsKey(id)) {
|
||||
return new ItemStack(ForgeRegistries.ITEMS.getValue(id));
|
||||
} else if (ForgeRegistries.BLOCKS.containsKey(id)) {
|
||||
return new ItemStack(ForgeRegistries.BLOCKS.getValue(id));
|
||||
if (Registry.ITEM.containsId(id)) {
|
||||
return new ItemStack(Registry.ITEM.get(id));
|
||||
} else if (Registry.BLOCK.containsId(id)) {
|
||||
return new ItemStack(Registry.BLOCK.get(id));
|
||||
} else {
|
||||
throw new IllegalArgumentException("No block or item with ID " + id + "!");
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
package net.anvilcraft.anvillib.cosmetics;
|
||||
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import net.anvilcraft.anvillib.event.AddEntityRenderLayersEvent;
|
||||
import net.anvilcraft.anvillib.event.Bus;
|
||||
import net.anvilcraft.anvillib.event.IEventBusRegisterable;
|
||||
import net.minecraft.client.render.entity.EntityRenderer;
|
||||
import net.minecraft.client.render.entity.PlayerEntityRenderer;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
|
||||
public class ClientEventHandler implements IEventBusRegisterable {
|
||||
private void onAddLayers(AddEntityRenderLayersEvent ev) {
|
||||
for (Entry<String, EntityRenderer<? extends PlayerEntity>> skin : ev.skinMap().entrySet())
|
||||
if (skin.getValue() instanceof PlayerEntityRenderer render)
|
||||
render.addFeature(new CosmeticFeatureRenderer(render, skin.getKey()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerEventHandlers(Bus bus) {
|
||||
bus.register(AddEntityRenderLayersEvent.class, this::onAddLayers);
|
||||
}
|
||||
}
|
|
@ -3,11 +3,6 @@ package net.anvilcraft.anvillib.cosmetics;
|
|||
import java.util.Arrays;
|
||||
import java.util.Objects;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import org.jetbrains.annotations.ApiStatus.AvailableSince;
|
||||
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
|
@ -26,8 +21,6 @@ import net.minecraft.util.math.Matrix4f;
|
|||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.util.math.Vec3f;
|
||||
import net.minecraft.util.math.Vector4f;
|
||||
import net.minecraftforge.fml.ModList;
|
||||
import software.bernie.geckolib3.compat.PatchouliCompat;
|
||||
import software.bernie.geckolib3.core.IAnimatable;
|
||||
import software.bernie.geckolib3.core.IAnimatableModel;
|
||||
import software.bernie.geckolib3.core.controller.AnimationController;
|
||||
|
@ -72,7 +65,6 @@ public class CosmeticArmorRenderer extends BipedEntityModel<PlayerEntity>
|
|||
{ AnimationController.addModelFetcher(this); }
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public IAnimatableModel<CosmeticItem> apply(IAnimatable t) {
|
||||
if (t instanceof CosmeticItem)
|
||||
return this.getGeoModelProvider();
|
||||
|
@ -162,8 +154,8 @@ public class CosmeticArmorRenderer extends BipedEntityModel<PlayerEntity>
|
|||
renderColor.getAlpha() / 255f
|
||||
);
|
||||
|
||||
if (ModList.get().isLoaded("patchouli"))
|
||||
PatchouliCompat.patchouliLoaded(poseStack);
|
||||
//if (ModList.get().isLoaded("patchouli"))
|
||||
// PatchouliCompat.patchouliLoaded(poseStack);
|
||||
|
||||
poseStack.pop();
|
||||
}
|
||||
|
@ -298,26 +290,21 @@ public class CosmeticArmorRenderer extends BipedEntityModel<PlayerEntity>
|
|||
return this.modelProvider;
|
||||
}
|
||||
|
||||
@AvailableSince(value = "3.1.24")
|
||||
@Override
|
||||
@Nonnull
|
||||
public IRenderCycle getCurrentModelRenderCycle() {
|
||||
return this.currentModelRenderCycle;
|
||||
}
|
||||
|
||||
@AvailableSince(value = "3.1.24")
|
||||
@Override
|
||||
public void setCurrentModelRenderCycle(IRenderCycle currentModelRenderCycle) {
|
||||
this.currentModelRenderCycle = currentModelRenderCycle;
|
||||
}
|
||||
|
||||
@AvailableSince(value = "3.1.24")
|
||||
@Override
|
||||
public float getWidthScale(CosmeticItem animatable) {
|
||||
return this.widthScale;
|
||||
}
|
||||
|
||||
@AvailableSince(value = "3.1.24")
|
||||
@Override
|
||||
public float getHeightScale(CosmeticItem entity) {
|
||||
return this.heightScale;
|
|
@ -0,0 +1,9 @@
|
|||
package net.anvilcraft.anvillib.event;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import net.minecraft.client.render.entity.EntityRenderer;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
|
||||
public record
|
||||
AddEntityRenderLayersEvent(Map<String, EntityRenderer<? extends PlayerEntity>> skinMap) {}
|
|
@ -0,0 +1,31 @@
|
|||
package net.anvilcraft.anvillib.event;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
public class Bus {
|
||||
public static final Bus MAIN = new Bus();
|
||||
|
||||
private final Map<Class<?>, List<Consumer<?>>> handlerMap = new HashMap<>();
|
||||
|
||||
public void register(IEventBusRegisterable obj) {
|
||||
obj.registerEventHandlers(this);
|
||||
}
|
||||
|
||||
public <T> void register(Class<T> clazz, Consumer<T> handler) {
|
||||
handlerMap.computeIfAbsent(clazz, alec -> new ArrayList<>()).add(handler);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public <T> void fire(T ev) {
|
||||
var clazz = ev.getClass();
|
||||
if (handlerMap.containsKey(clazz)) {
|
||||
for (Consumer<?> handler : handlerMap.get(clazz)) {
|
||||
((Consumer<T>) handler).accept(ev);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
package net.anvilcraft.anvillib.event;
|
||||
|
||||
/**
|
||||
* IEventBusRegisterable describes a class which contains one or more event handlers to be
|
||||
* registered on the anvillib event bus.
|
||||
*/
|
||||
public interface IEventBusRegisterable {
|
||||
/**
|
||||
* Register this object's event handlers on the given bus.
|
||||
*/
|
||||
public void registerEventHandlers(Bus bus);
|
||||
}
|
|
@ -12,6 +12,7 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
|||
import com.google.gson.JsonElement;
|
||||
|
||||
import net.anvilcraft.anvillib.AnvilLib;
|
||||
import net.anvilcraft.anvillib.event.Bus;
|
||||
import net.anvilcraft.anvillib.recipe.RecipesEvent;
|
||||
import net.minecraft.recipe.Recipe;
|
||||
import net.minecraft.recipe.RecipeManager;
|
||||
|
@ -19,7 +20,6 @@ import net.minecraft.recipe.RecipeType;
|
|||
import net.minecraft.resource.ResourceManager;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.profiler.Profiler;
|
||||
import net.minecraftforge.fml.ModLoader;
|
||||
|
||||
@Mixin(RecipeManager.class)
|
||||
public class RecipeManagerMixin {
|
||||
|
@ -41,7 +41,7 @@ public class RecipeManagerMixin {
|
|||
this.recipes.forEach((k, v) -> recipes.put(k, new HashMap<>(v)));
|
||||
|
||||
var ev = new RecipesEvent(recipes, new HashMap<>(this.recipesById));
|
||||
ModLoader.get().postEvent(ev);
|
||||
Bus.MAIN.fire(ev);
|
||||
this.recipes = ev.recipes;
|
||||
this.recipesById = ev.recipesById;
|
||||
}
|
|
@ -9,10 +9,8 @@ import java.util.function.Predicate;
|
|||
import net.minecraft.recipe.Recipe;
|
||||
import net.minecraft.recipe.RecipeType;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraftforge.eventbus.api.Event;
|
||||
import net.minecraftforge.fml.event.IModBusEvent;
|
||||
|
||||
public class RecipesEvent extends Event implements IModBusEvent {
|
||||
public class RecipesEvent {
|
||||
public Map<RecipeType<?>, Map<Identifier, Recipe<?>>> recipes;
|
||||
public Map<Identifier, Recipe<?>> recipesById;
|
||||
|
|
@ -13,7 +13,6 @@ import net.minecraft.tag.TagKey;
|
|||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.collection.DefaultedList;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
|
||||
public class ShapedRecipeBuilder {
|
||||
public Identifier ident;
|
||||
|
@ -54,9 +53,9 @@ public class ShapedRecipeBuilder {
|
|||
}
|
||||
|
||||
var ident = new Identifier(s);
|
||||
var maybeItem = ForgeRegistries.ITEMS.getValue(ident);
|
||||
var maybeItem = Registry.ITEM.get(ident);
|
||||
if (maybeItem == null) {
|
||||
var maybeBlock = ForgeRegistries.BLOCKS.getValue(ident);
|
||||
var maybeBlock = Registry.BLOCK.get(ident);
|
||||
if (maybeBlock == null)
|
||||
throw new IllegalArgumentException(
|
||||
"ID " + s + " not found in item or block registry!"
|
|
@ -3,11 +3,11 @@
|
|||
"package": "net.anvilcraft.anvillib.mixin",
|
||||
"compatibilityLevel": "JAVA_17",
|
||||
"minVersion": "0.8",
|
||||
"client": [],
|
||||
"mixins": [
|
||||
"common.RecipeManagerMixin",
|
||||
"common.StructurePoolBasedGeneratorMixin"
|
||||
],
|
||||
"client": [],
|
||||
"injectors": {
|
||||
"defaultRequire": 1
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
accessWidener v2 named
|
||||
# vim: ft=conf
|
||||
|
||||
accessible class net/minecraft/recipe/Ingredient$Entry
|
||||
accessible field net/minecraft/recipe/Ingredient entries [Lnet/minecraft/recipe/Ingredient$Entry;
|
||||
accessible class net/minecraft/recipe/Ingredient$TagEntry
|
||||
accessible field net/minecraft/recipe/Ingredient$TagEntry tag Lnet/minecraft/tag/TagKey;
|
||||
accessible class net/minecraft/recipe/Ingredient$StackEntry
|
||||
accessible field net/minecraft/recipe/Ingredient$StackEntry stack Lnet/minecraft/item/ItemStack;
|
||||
|
||||
accessible method net/minecraft/client/render/entity/LivingEntityRenderer addFeature (Lnet/minecraft/client/render/entity/feature/FeatureRenderer;)Z
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"accessWidener": "anvillib.accesswidener"
|
||||
}
|
|
@ -0,0 +1,71 @@
|
|||
plugins {
|
||||
id "com.github.johnrengelman.shadow" version "7.1.2"
|
||||
}
|
||||
|
||||
architectury {
|
||||
platformSetupLoomIde()
|
||||
fabric()
|
||||
}
|
||||
|
||||
loom {
|
||||
accessWidenerPath = project(":common").loom.accessWidenerPath
|
||||
}
|
||||
|
||||
configurations {
|
||||
common
|
||||
shadowCommon // Don't use shadow from the shadow plugin since it *excludes* files.
|
||||
compileClasspath.extendsFrom common
|
||||
runtimeClasspath.extendsFrom common
|
||||
developmentFabric.extendsFrom common
|
||||
}
|
||||
|
||||
dependencies {
|
||||
modImplementation "net.fabricmc:fabric-loader:${rootProject.fabric_loader_version}"
|
||||
|
||||
modImplementation "software.bernie.geckolib:geckolib-fabric-1.18:3.0.80"
|
||||
|
||||
common(project(path: ":common", configuration: "namedElements")) { transitive false }
|
||||
shadowCommon(project(path: ":common", configuration: "transformProductionFabric")) { transitive false }
|
||||
}
|
||||
|
||||
processResources {
|
||||
inputs.property "version", project.version
|
||||
|
||||
filesMatching("fabric.mod.json") {
|
||||
expand "version": project.version
|
||||
}
|
||||
}
|
||||
|
||||
shadowJar {
|
||||
exclude "architectury.common.json"
|
||||
|
||||
configurations = [project.configurations.shadowCommon]
|
||||
archiveClassifier = "dev-shadow"
|
||||
}
|
||||
|
||||
remapJar {
|
||||
injectAccessWidener = true
|
||||
input.set shadowJar.archiveFile
|
||||
dependsOn shadowJar
|
||||
}
|
||||
|
||||
sourcesJar {
|
||||
def commonSources = project(":common").sourcesJar
|
||||
dependsOn commonSources
|
||||
from commonSources.archiveFile.map { zipTree(it) }
|
||||
}
|
||||
|
||||
components.java {
|
||||
withVariantsFromConfiguration(project.configurations.shadowRuntimeElements) {
|
||||
skip()
|
||||
}
|
||||
}
|
||||
|
||||
publishing {
|
||||
publications {
|
||||
mavenFabric(MavenPublication) {
|
||||
artifactId = rootProject.archives_base_name + "-" + project.name
|
||||
from components.java
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
package net.anvilcraft.anvillib;
|
||||
|
||||
import net.fabricmc.api.ModInitializer;
|
||||
|
||||
public class AnvilLibFabric implements ModInitializer {
|
||||
@Override
|
||||
public void onInitialize() {
|
||||
AnvilLib.initialize();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
package net.anvilcraft.anvillib.mixin.client;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
import net.anvilcraft.anvillib.event.AddEntityRenderLayersEvent;
|
||||
import net.anvilcraft.anvillib.event.Bus;
|
||||
import net.minecraft.client.render.entity.EntityRenderDispatcher;
|
||||
import net.minecraft.client.render.entity.EntityRenderer;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.resource.ResourceManager;
|
||||
|
||||
@Mixin(EntityRenderDispatcher.class)
|
||||
public class EntityRenderDispatcherMixin {
|
||||
@Shadow
|
||||
private Map<String, EntityRenderer<? extends PlayerEntity>> modelRenderers;
|
||||
|
||||
@Inject(method = "reload", at = @At("TAIL"))
|
||||
public void onReload(ResourceManager alec, CallbackInfo ci) {
|
||||
Bus.MAIN.fire(new AddEntityRenderLayersEvent(this.modelRenderers));
|
||||
}
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
{
|
||||
"required": true,
|
||||
"package": "net.anvilcraft.anvillib.mixin.fabric",
|
||||
"compatibilityLevel": "JAVA_17",
|
||||
"minVersion": "0.8",
|
||||
"client": [
|
||||
],
|
||||
"mixins": [
|
||||
],
|
||||
"injectors": {
|
||||
"defaultRequire": 1
|
||||
}
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
{
|
||||
"schemaVersion": 1,
|
||||
"id": "anvillib",
|
||||
"version": "${version}",
|
||||
"name": "AnvilLib",
|
||||
"description": "ALEC!",
|
||||
"authors": [
|
||||
"LordMZTE",
|
||||
"(tilera)"
|
||||
],
|
||||
"contact": {
|
||||
"homepage": "https://anvilcraft.net/",
|
||||
"sources": "https://git.tilera.org/anvilcraft/anvillib"
|
||||
},
|
||||
"license": "AGPL-3.0+ALEC",
|
||||
"environment": "*",
|
||||
"entrypoints": {
|
||||
"main": [
|
||||
"net.anvilcraft.anvillib.AnvilLibFabric"
|
||||
]
|
||||
},
|
||||
"mixins": [
|
||||
"anvillib.mixins.json",
|
||||
"anvillib-common.mixins.json"
|
||||
],
|
||||
"depends": {
|
||||
"minecraft": "1.18.2"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,79 @@
|
|||
plugins {
|
||||
id "com.github.johnrengelman.shadow" version "7.1.2"
|
||||
}
|
||||
|
||||
architectury {
|
||||
platformSetupLoomIde()
|
||||
forge()
|
||||
}
|
||||
|
||||
loom {
|
||||
accessWidenerPath = project(":common").loom.accessWidenerPath
|
||||
|
||||
forge {
|
||||
convertAccessWideners = true
|
||||
extraAccessWideners.add loom.accessWidenerPath.get().asFile.name
|
||||
|
||||
mixinConfig "anvillib-common.mixins.json"
|
||||
mixinConfig "anvillib.mixins.json"
|
||||
}
|
||||
}
|
||||
|
||||
configurations {
|
||||
common
|
||||
shadowCommon // Don't use shadow from the shadow plugin since it *excludes* files.
|
||||
compileClasspath.extendsFrom common
|
||||
runtimeClasspath.extendsFrom common
|
||||
developmentForge.extendsFrom common
|
||||
}
|
||||
|
||||
dependencies {
|
||||
forge "net.minecraftforge:forge:${rootProject.forge_version}"
|
||||
|
||||
modImplementation "software.bernie.geckolib:geckolib-forge-1.18:3.0.57"
|
||||
|
||||
common(project(path: ":common", configuration: "namedElements")) { transitive false }
|
||||
shadowCommon(project(path: ":common", configuration: "transformProductionForge")) { transitive = false }
|
||||
}
|
||||
|
||||
processResources {
|
||||
inputs.property "version", project.version
|
||||
|
||||
filesMatching("META-INF/mods.toml") {
|
||||
expand "version": project.version
|
||||
}
|
||||
}
|
||||
|
||||
shadowJar {
|
||||
exclude "fabric.mod.json"
|
||||
exclude "architectury.common.json"
|
||||
|
||||
configurations = [project.configurations.shadowCommon]
|
||||
archiveClassifier = "dev-shadow"
|
||||
}
|
||||
|
||||
remapJar {
|
||||
input.set shadowJar.archiveFile
|
||||
dependsOn shadowJar
|
||||
}
|
||||
|
||||
sourcesJar {
|
||||
def commonSources = project(":common").sourcesJar
|
||||
dependsOn commonSources
|
||||
from commonSources.archiveFile.map { zipTree(it) }
|
||||
}
|
||||
|
||||
components.java {
|
||||
withVariantsFromConfiguration(project.configurations.shadowRuntimeElements) {
|
||||
skip()
|
||||
}
|
||||
}
|
||||
|
||||
publishing {
|
||||
publications {
|
||||
mavenForge(MavenPublication) {
|
||||
artifactId = rootProject.archives_base_name + "-" + project.name
|
||||
from components.java
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
loom.platform=forge
|
|
@ -0,0 +1,10 @@
|
|||
package net.anvilcraft.anvillib;
|
||||
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
|
||||
@Mod(AnvilLib.MODID)
|
||||
public class AnvilLibForge {
|
||||
public AnvilLibForge() {
|
||||
AnvilLib.initialize();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
package net.anvilcraft.anvillib.client;
|
||||
|
||||
import net.anvilcraft.anvillib.AnvilLib;
|
||||
import net.anvilcraft.anvillib.event.AddEntityRenderLayersEvent;
|
||||
import net.anvilcraft.anvillib.event.Bus;
|
||||
import net.anvilcraft.anvillib.mixin.forge.accessor.AddLayersAccessor;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.client.event.EntityRenderersEvent;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.Mod.EventBusSubscriber;
|
||||
|
||||
@EventBusSubscriber(
|
||||
modid = AnvilLib.MODID, bus = EventBusSubscriber.Bus.MOD, value = { Dist.CLIENT }
|
||||
)
|
||||
public class ClientEventHandler {
|
||||
@SubscribeEvent
|
||||
public static void onAddLayers(EntityRenderersEvent.AddLayers ev) {
|
||||
Bus.MAIN.fire(new AddEntityRenderLayersEvent(((AddLayersAccessor) ev).getSkinMap()
|
||||
));
|
||||
}
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
package net.anvilcraft.anvillib.mixin.forge.accessor;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.gen.Accessor;
|
||||
|
||||
import net.minecraft.client.render.entity.EntityRenderer;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraftforge.client.event.EntityRenderersEvent.AddLayers;
|
||||
|
||||
@Mixin(AddLayers.class)
|
||||
public interface AddLayersAccessor {
|
||||
@Accessor(remap = false)
|
||||
public Map<String, EntityRenderer<? extends PlayerEntity>> getSkinMap();
|
||||
}
|
|
@ -1,27 +1,21 @@
|
|||
modLoader = "javafml"
|
||||
loaderVersion = "[40,)"
|
||||
#issueTrackerURL = ""
|
||||
license = "AGPL-3.0+ALEC"
|
||||
|
||||
issueTrackerURL = "https://git.tilera.org/Anvilcraft/anvillib/issues"
|
||||
|
||||
[[mods]]
|
||||
modId = "anvillib"
|
||||
version = "${version}"
|
||||
displayName = "anvillib"
|
||||
displayURL = "https://anvilcraft.net/"
|
||||
#credits = ""
|
||||
displayName = "AnvilLib"
|
||||
authors = "LordMZTE, (tilera)"
|
||||
|
||||
description = '''
|
||||
Core for Notex 4.
|
||||
|
||||
Includes recipes and tweaks.
|
||||
AnvilLib library mod
|
||||
'''
|
||||
#logoFile = ""
|
||||
|
||||
[[dependencies.anvillib]]
|
||||
modId = "forge"
|
||||
mandatory = true
|
||||
|
||||
versionRange = "[40,)"
|
||||
ordering = "NONE"
|
||||
side = "BOTH"
|
||||
|
@ -39,3 +33,4 @@ mandatory = true
|
|||
versionRange = "[3.0.57,)"
|
||||
ordering = "NONE"
|
||||
side = "BOTH"
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
{
|
||||
"required": true,
|
||||
"package": "net.anvilcraft.anvillib.mixin.forge",
|
||||
"compatibilityLevel": "JAVA_17",
|
||||
"minVersion": "0.8",
|
||||
"client": [],
|
||||
"mixins": [
|
||||
"accessor.AddLayersAccessor"
|
||||
],
|
||||
"injectors": {
|
||||
"defaultRequire": 1
|
||||
}
|
||||
}
|
|
@ -1,23 +1,16 @@
|
|||
# Done to increase the memory available to gradle.
|
||||
org.gradle.jvmargs=-Xmx1G
|
||||
org.gradle.jvmargs=-Xmx2G
|
||||
|
||||
# tell architectury loom that this project is a forge project.
|
||||
# this will enable us to use the "forge" dependency.
|
||||
# using archloom without this is possible and will give you a
|
||||
# "standard" loom installation with some extra features.
|
||||
loom.platform=forge
|
||||
minecraft_version=1.18.2
|
||||
enabled_platforms=fabric,forge
|
||||
|
||||
# Base properties
|
||||
# minecraft version
|
||||
minecraft_version=1.18.2
|
||||
# forge version, latest version can be found on https://files.minecraftforge.net/
|
||||
forge_version=1.18.2-40.2.1
|
||||
# yarn, latest version can be found on https://fabricmc.net/develop/
|
||||
yarn_mappings=1.18.2+build.4
|
||||
#architectury_version=4.11.93
|
||||
fabric_loader_version=0.14.23
|
||||
fabric_api_version=0.76.0+1.18.2
|
||||
forge_version=1.18.2-40.2.10
|
||||
|
||||
# Mod Properties
|
||||
mod_version=0.1.1
|
||||
maven_group=net.anvilcraft
|
||||
archives_base_name=anvillib-18
|
||||
mod_id=anvillib
|
||||
mod_author=LordMZTE
|
||||
mod_version=0.2.0
|
||||
maven_group=net.anvilcraft
|
||||
archives_base_name=anvillib-18
|
||||
mod_id=anvillib
|
||||
mod_author=LordMZTE, (tilera)
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip
|
||||
networkTimeout=10000
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
|
|
|
@ -1,10 +1,14 @@
|
|||
pluginManagement {
|
||||
// when using additional gradle plugins like shadow,
|
||||
// add their repositories to this list!
|
||||
repositories {
|
||||
maven { url "https://maven.fabricmc.net/" }
|
||||
maven { url "https://maven.architectury.dev/" }
|
||||
maven { url "https://files.minecraftforge.net/maven/" }
|
||||
maven { url "https://maven.minecraftforge.net/" }
|
||||
gradlePluginPortal()
|
||||
}
|
||||
}
|
||||
|
||||
include("common")
|
||||
include("fabric")
|
||||
include("forge")
|
||||
|
||||
rootProject.name = "anvillib"
|
||||
|
|
|
@ -1,19 +0,0 @@
|
|||
package net.anvilcraft.anvillib.cosmetics;
|
||||
|
||||
import net.anvilcraft.anvillib.AnvilLib;
|
||||
import net.minecraft.client.render.entity.PlayerEntityRenderer;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.client.event.EntityRenderersEvent;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.Mod.EventBusSubscriber;
|
||||
import net.minecraftforge.fml.common.Mod.EventBusSubscriber.Bus;
|
||||
|
||||
@EventBusSubscriber(modid = AnvilLib.MODID, bus = Bus.MOD, value = { Dist.CLIENT })
|
||||
public class ClientEventHandler {
|
||||
@SubscribeEvent
|
||||
public static void clientSetup(EntityRenderersEvent.AddLayers event) {
|
||||
for (String skin : event.getSkins())
|
||||
if (event.getSkin(skin) instanceof PlayerEntityRenderer render)
|
||||
render.addFeature(new CosmeticFeatureRenderer(render, skin));
|
||||
}
|
||||
}
|
|
@ -1,3 +0,0 @@
|
|||
public net.minecraft.world.item.crafting.Ingredient f_43902_ # Ingredient.entries
|
||||
public net.minecraft.world.item.crafting.Ingredient$TagValue f_43959_ # Ingredient$TagEntry.tag
|
||||
public net.minecraft.world.item.crafting.Ingredient$ItemValue f_43951_ # Ingredient$StackEntry.stack
|
Loading…
Reference in New Issue