feat: ALEC cosmetic

This commit is contained in:
Timo Ley 2023-10-31 10:31:05 +01:00
parent ed1e725810
commit c7dcadef8a
5 changed files with 130 additions and 0 deletions

View file

@ -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) {

View file

@ -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";
}
}

View file

@ -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<ICosmetic> cosmeticAdder) {
if (Arrays.stream(HAS_ALEC).anyMatch(u -> u.equals(player))) {
cosmeticAdder.accept(ALEC);
}
}
}

View file

@ -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]
}
}
}
}
}
}

View file

@ -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]}
}
}
]
}
]
}
]
}