diff --git a/src/main/java/net/anvilcraft/ntx4core/Ntx4Core.java b/src/main/java/net/anvilcraft/ntx4core/Ntx4Core.java index 67402aa..79eb38e 100644 --- a/src/main/java/net/anvilcraft/ntx4core/Ntx4Core.java +++ b/src/main/java/net/anvilcraft/ntx4core/Ntx4Core.java @@ -3,6 +3,8 @@ package net.anvilcraft.ntx4core; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; +import net.anvilcraft.anvillib.cosmetics.CosmeticsManager; +import net.anvilcraft.ntx4core.cosmetics.StaticCosmeticProvider; import net.anvilcraft.ntx4core.worldgen.Ntx4CoreFeatures; import net.anvilcraft.ntx4core.worldgen.Ntx4CoreStructures; import net.minecraft.util.Identifier; @@ -25,6 +27,7 @@ public class Ntx4Core { Ntx4CoreStructures.CONFIGURED_STRUCTURE_FEATURES.register(bus); MinecraftForge.EVENT_BUS.register(Ntx4CoreShaders.class); + CosmeticsManager.registerProvider(new StaticCosmeticProvider()); } public static Identifier id(String s) { diff --git a/src/main/java/net/anvilcraft/ntx4core/cosmetics/AlecCosmetic.java b/src/main/java/net/anvilcraft/ntx4core/cosmetics/AlecCosmetic.java new file mode 100644 index 0000000..4901417 --- /dev/null +++ b/src/main/java/net/anvilcraft/ntx4core/cosmetics/AlecCosmetic.java @@ -0,0 +1,33 @@ +package net.anvilcraft.ntx4core.cosmetics; + +import net.anvilcraft.anvillib.cosmetics.ICosmetic; +import net.minecraft.util.Identifier; + +public class AlecCosmetic implements ICosmetic { + + @Override + public Identifier getAnimationFileLocation() { + return new Identifier("ntx4core", "animations/alec.json"); + } + + @Override + public Identifier getModelLocation() { + return new Identifier("ntx4core", "geo/alec.json"); + } + + @Override + public Identifier getTextureLocation() { + return new Identifier("ntx4core", "textures/alec.png"); + } + + @Override + public Identifier getID() { + return new Identifier("ntx4core", "alec"); + } + + @Override + public String getIdleAnimationName() { + return "animation.alec.idle"; + } + +} \ No newline at end of file diff --git a/src/main/java/net/anvilcraft/ntx4core/cosmetics/StaticCosmeticProvider.java b/src/main/java/net/anvilcraft/ntx4core/cosmetics/StaticCosmeticProvider.java new file mode 100644 index 0000000..a2bfb8e --- /dev/null +++ b/src/main/java/net/anvilcraft/ntx4core/cosmetics/StaticCosmeticProvider.java @@ -0,0 +1,30 @@ +package net.anvilcraft.ntx4core.cosmetics; + +import java.util.Arrays; +import java.util.UUID; +import java.util.function.Consumer; + +import net.anvilcraft.anvillib.cosmetics.ICosmetic; +import net.anvilcraft.anvillib.cosmetics.ICosmeticProvider; + +public class StaticCosmeticProvider implements ICosmeticProvider { + + final static UUID[] HAS_ALEC = new UUID[]{ + UUID.fromString("380df991-f603-344c-a090-369bad2a924a"), + UUID.fromString("81f895e1-33ca-46ec-b1b6-124ba832a352") + }; + final static ICosmetic ALEC = new AlecCosmetic(); + + @Override + public boolean requestsRefresh() { + return false; + } + + @Override + public void addCosmetics(UUID player, Consumer cosmeticAdder) { + if (Arrays.stream(HAS_ALEC).anyMatch(u -> u.equals(player))) { + cosmeticAdder.accept(ALEC); + } + } + +} diff --git a/src/main/resources/assets/ntx4core/animations/alec.json b/src/main/resources/assets/ntx4core/animations/alec.json new file mode 100644 index 0000000..fbb2b7d --- /dev/null +++ b/src/main/resources/assets/ntx4core/animations/alec.json @@ -0,0 +1,24 @@ +{ + "format_version": "1.8.0", + "animations": { + "animation.alec.idle": { + "loop": true, + "animation_length": 4, + "bones": { + "alecubus": { + "rotation": { + "0.0": [0, 0, 0], + "0.5": [0, 45, 0], + "1.0": [0, 90, 0], + "1.5": [0, 135, 0], + "2.0": [0, 180, 0], + "2.5": [0, 225, 0], + "3.0": [0, 270, 0], + "3.5": [0, 315, 0], + "4.0": [0, 360, 0] + } + } + } + } + } +} \ No newline at end of file diff --git a/src/main/resources/assets/ntx4core/geo/alec.json b/src/main/resources/assets/ntx4core/geo/alec.json new file mode 100644 index 0000000..35d91ab --- /dev/null +++ b/src/main/resources/assets/ntx4core/geo/alec.json @@ -0,0 +1,40 @@ +{ + "format_version": "1.12.0", + "minecraft:geometry": [ + { + "description": { + "identifier": "geometry.alec", + "texture_width": 16, + "texture_height": 16, + "visible_bounds_width": 3, + "visible_bounds_height": 5, + "visible_bounds_offset": [0, 1.5, 0] + }, + "bones": [ + { + "name": "root", + "pivot": [0, 0, 0] + }, + { + "name": "alecubus", + "parent": "root", + "pivot": [0, 34, 0], + "cubes": [ + { + "origin": [-16, 34, -16], + "size": [32, 32, 32], + "uv": { + "north": {"uv": [0, 0], "uv_size": [16, 16]}, + "east": {"uv": [0, 0], "uv_size": [16, 16]}, + "south": {"uv": [0, 0], "uv_size": [16, 16]}, + "west": {"uv": [0, 0], "uv_size": [16, 16]}, + "up": {"uv": [16, 16], "uv_size": [-16, -16]}, + "down": {"uv": [16, 16], "uv_size": [-16, -16]} + } + } + ] + } + ] + } + ] +} \ No newline at end of file