mirror of
https://github.com/GeyserMC/Geyser.git
synced 2024-08-14 23:57:35 +00:00
Convert skull floor geometries into a template
Should be easier to modify in needed in the future.
This commit is contained in:
parent
5676870dd8
commit
8244afa8c7
6 changed files with 22 additions and 96 deletions
|
@ -53,7 +53,7 @@ import java.util.zip.ZipOutputStream;
|
||||||
|
|
||||||
public class SkullResourcePackManager {
|
public class SkullResourcePackManager {
|
||||||
|
|
||||||
private static final long RESOURCE_PACK_VERSION = 5;
|
private static final long RESOURCE_PACK_VERSION = 6;
|
||||||
|
|
||||||
private static final Path SKULL_SKIN_CACHE_PATH = GeyserImpl.getInstance().getBootstrap().getConfigFolder().resolve("cache").resolve("player_skulls");
|
private static final Path SKULL_SKIN_CACHE_PATH = GeyserImpl.getInstance().getBootstrap().getConfigFolder().resolve("cache").resolve("player_skulls");
|
||||||
|
|
||||||
|
@ -170,6 +170,8 @@ public class SkullResourcePackManager {
|
||||||
zipOS.closeEntry();
|
zipOS.closeEntry();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
addFloorGeometries(zipOS);
|
||||||
|
|
||||||
ZipEntry entry = new ZipEntry("skull_resource_pack/pack_icon.png");
|
ZipEntry entry = new ZipEntry("skull_resource_pack/pack_icon.png");
|
||||||
zipOS.putNextEntry(entry);
|
zipOS.putNextEntry(entry);
|
||||||
zipOS.write(FileUtils.readAllBytes("icon.png"));
|
zipOS.write(FileUtils.readAllBytes("icon.png"));
|
||||||
|
@ -177,6 +179,23 @@ public class SkullResourcePackManager {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static void addFloorGeometries(ZipOutputStream zipOS) throws IOException {
|
||||||
|
String template = new String(FileUtils.readAllBytes("bedrock/skull_resource_pack/models/blocks/player_skull_floor.geo.json"), StandardCharsets.UTF_8);
|
||||||
|
String[] quadrants = {"a", "b", "c", "d"};
|
||||||
|
for (int i = 0; i < quadrants.length; i++) {
|
||||||
|
String quadrant = quadrants[i];
|
||||||
|
float yRotation = i * 22.5f;
|
||||||
|
String contents = template
|
||||||
|
.replace("${quadrant}", quadrant)
|
||||||
|
.replace("${y_rotation}", String.valueOf(yRotation));
|
||||||
|
|
||||||
|
ZipEntry entry = new ZipEntry("skull_resource_pack/models/blocks/player_skull_floor_" + quadrant + ".geo.json");
|
||||||
|
zipOS.putNextEntry(entry);
|
||||||
|
zipOS.write(contents.getBytes(StandardCharsets.UTF_8));
|
||||||
|
zipOS.closeEntry();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private static void addAttachables(ZipOutputStream zipOS) throws IOException {
|
private static void addAttachables(ZipOutputStream zipOS) throws IOException {
|
||||||
String template = new String(FileUtils.readAllBytes("bedrock/skull_resource_pack/attachables/template_attachable.json"), StandardCharsets.UTF_8);
|
String template = new String(FileUtils.readAllBytes("bedrock/skull_resource_pack/attachables/template_attachable.json"), StandardCharsets.UTF_8);
|
||||||
for (String skinHash : SKULL_SKINS.keySet()) {
|
for (String skinHash : SKULL_SKINS.keySet()) {
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
"minecraft:geometry": [
|
"minecraft:geometry": [
|
||||||
{
|
{
|
||||||
"description": {
|
"description": {
|
||||||
"identifier": "geometry.geyser.player_skull_floor_a",
|
"identifier": "geometry.geyser.player_skull_floor_${quadrant}",
|
||||||
"texture_width": 64,
|
"texture_width": 64,
|
||||||
"texture_height": 64
|
"texture_height": 64
|
||||||
},
|
},
|
||||||
|
@ -11,6 +11,7 @@
|
||||||
{
|
{
|
||||||
"name": "head",
|
"name": "head",
|
||||||
"pivot": [0, 24, 0],
|
"pivot": [0, 24, 0],
|
||||||
|
"rotation": [0, ${y_rotation}, 0],
|
||||||
"cubes": [
|
"cubes": [
|
||||||
{"origin": [-4, 0.5, -4], "size": [8, 8, 8], "uv": [0, 0]}
|
{"origin": [-4, 0.5, -4], "size": [8, 8, 8], "uv": [0, 0]}
|
||||||
]
|
]
|
|
@ -1,30 +0,0 @@
|
||||||
{
|
|
||||||
"format_version": "1.12.0",
|
|
||||||
"minecraft:geometry": [
|
|
||||||
{
|
|
||||||
"description": {
|
|
||||||
"identifier": "geometry.geyser.player_skull_floor_b",
|
|
||||||
"texture_width": 64,
|
|
||||||
"texture_height": 64
|
|
||||||
},
|
|
||||||
"bones": [
|
|
||||||
{
|
|
||||||
"name": "head",
|
|
||||||
"pivot": [0, 24, 0],
|
|
||||||
"rotation": [0, 22.5, 0],
|
|
||||||
"cubes": [
|
|
||||||
{"origin": [-4, 0.5, -4], "size": [8, 8, 8], "uv": [0, 0]}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "hat",
|
|
||||||
"parent": "head",
|
|
||||||
"pivot": [0, 24, 0],
|
|
||||||
"cubes": [
|
|
||||||
{"origin": [-4, 0.5, -4], "size": [8, 8, 8], "uv": [32, 0], "inflate": 0.5}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
|
@ -1,30 +0,0 @@
|
||||||
{
|
|
||||||
"format_version": "1.12.0",
|
|
||||||
"minecraft:geometry": [
|
|
||||||
{
|
|
||||||
"description": {
|
|
||||||
"identifier": "geometry.geyser.player_skull_floor_c",
|
|
||||||
"texture_width": 64,
|
|
||||||
"texture_height": 64
|
|
||||||
},
|
|
||||||
"bones": [
|
|
||||||
{
|
|
||||||
"name": "head",
|
|
||||||
"pivot": [0, 24, 0],
|
|
||||||
"rotation": [0, 45, 0],
|
|
||||||
"cubes": [
|
|
||||||
{"origin": [-4, 0.5, -4], "size": [8, 8, 8], "uv": [0, 0]}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "hat",
|
|
||||||
"parent": "head",
|
|
||||||
"pivot": [0, 24, 0],
|
|
||||||
"cubes": [
|
|
||||||
{"origin": [-4, 0.5, -4], "size": [8, 8, 8], "uv": [32, 0], "inflate": 0.5}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
|
@ -1,30 +0,0 @@
|
||||||
{
|
|
||||||
"format_version": "1.12.0",
|
|
||||||
"minecraft:geometry": [
|
|
||||||
{
|
|
||||||
"description": {
|
|
||||||
"identifier": "geometry.geyser.player_skull_floor_d",
|
|
||||||
"texture_width": 64,
|
|
||||||
"texture_height": 64
|
|
||||||
},
|
|
||||||
"bones": [
|
|
||||||
{
|
|
||||||
"name": "head",
|
|
||||||
"pivot": [0, 24, 0],
|
|
||||||
"rotation": [0, 67.5, 0],
|
|
||||||
"cubes": [
|
|
||||||
{"origin": [-4, 0.5, -4], "size": [8, 8, 8], "uv": [0, 0]}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "hat",
|
|
||||||
"parent": "head",
|
|
||||||
"pivot": [0, 24, 0],
|
|
||||||
"cubes": [
|
|
||||||
{"origin": [-4, 0.5, -4], "size": [8, 8, 8], "uv": [32, 0], "inflate": 0.5}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
|
@ -1,10 +1,6 @@
|
||||||
skull_resource_pack/animations/disable.animation.json
|
skull_resource_pack/animations/disable.animation.json
|
||||||
skull_resource_pack/animations/player_skull.animation.json
|
skull_resource_pack/animations/player_skull.animation.json
|
||||||
skull_resource_pack/models/blocks/player_skull.geo.json
|
skull_resource_pack/models/blocks/player_skull.geo.json
|
||||||
skull_resource_pack/models/blocks/player_skull_floor_a.geo.json
|
|
||||||
skull_resource_pack/models/blocks/player_skull_floor_c.geo.json
|
|
||||||
skull_resource_pack/models/blocks/player_skull_floor_b.geo.json
|
|
||||||
skull_resource_pack/models/blocks/player_skull_floor_d.geo.json
|
|
||||||
skull_resource_pack/models/blocks/player_skull_hand.geo.json
|
skull_resource_pack/models/blocks/player_skull_hand.geo.json
|
||||||
skull_resource_pack/models/blocks/player_skull_wall.geo.json
|
skull_resource_pack/models/blocks/player_skull_wall.geo.json
|
||||||
skull_resource_pack/textures/terrain_texture.json
|
skull_resource_pack/textures/terrain_texture.json
|
||||||
|
|
Loading…
Reference in a new issue