Custom models

Bestaford

New Member
How to create entity with custom skin and geometry? i tried that, but skin just doesnt applies
Java:
try {
            Path path = getDataFolder().toPath();
            CompoundTag nbt = Entity.getDefaultNBT(spawn);
            Skin skin = new Skin();
            skin.setSkinId("coin");
            skin.setSkinData(ImageIO.read(path.resolve("model-texture.png").toFile()));
            skin.setGeometryName("geometry.coin-model");
            skin.setGeometryData(new String(Files.readAllBytes(path.resolve("model-geometry.json")), StandardCharsets.UTF_8));
            CompoundTag skinTag = new CompoundTag()
                    .putByteArray("Data", skin.getSkinData().data)
                    .putInt("SkinImageWidth", skin.getSkinData().width)
                    .putInt("SkinImageHeight", skin.getSkinData().height)
                    .putString("ModelId", skin.getSkinId())
                    .putString("CapeId", skin.getCapeId())
                    .putByteArray("CapeData", skin.getCapeData().data)
                    .putInt("CapeImageWidth", skin.getCapeData().width)
                    .putInt("CapeImageHeight", skin.getCapeData().height)
                    .putByteArray("SkinResourcePatch", skin.getSkinResourcePatch().getBytes(StandardCharsets.UTF_8))
                    .putByteArray("GeometryData", skin.getGeometryData().getBytes(StandardCharsets.UTF_8))
                    .putByteArray("AnimationData", skin.getAnimationData().getBytes(StandardCharsets.UTF_8))
                    .putBoolean("PremiumSkin", skin.isPremium())
                    .putBoolean("PersonaSkin", skin.isPersona())
                    .putBoolean("CapeOnClassicSkin", skin.isCapeOnClassic());
            nbt.putString("NameTag", "geometry.coin-model");
            nbt.putCompound("Skin", skinTag);
            EntityHuman model = new EntityHuman(spawn.getChunk(), nbt);
            model.spawnToAll();
        } catch (Exception exception) {
            getLogger().error(exception.getMessage());
        }
 
Top