-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Try to fix the anim model problem.
- Loading branch information
1 parent
e687697
commit 86887e3
Showing
26 changed files
with
487 additions
and
195 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 4 additions & 2 deletions
6
src/generated/resources/assets/kasuga_lib/models/panel/arrow.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,8 @@ | ||
{ | ||
"loader": "kasuga_lib:bedrock_model", | ||
"loader": "kasuga_lib:bedrock_animated", | ||
"model": "kasuga_lib:panel/arrow", | ||
"texture": "kasuga_lib:panel/arrow_texture", | ||
"render_type": "translucent" | ||
"geometry": "geometry.unknown", | ||
"render_type": "translucent", | ||
"identifier": "kasuga_lib:arrow" | ||
} |
72 changes: 72 additions & 0 deletions
72
src/generated/resources/assets/kasuga_lib/models/panel/arrow_2.geo.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
{ | ||
"format_version": "1.12.0", | ||
"minecraft:geometry": [ | ||
{ | ||
"description": { | ||
"identifier": "geometry.unknown", | ||
"texture_width": 16, | ||
"texture_height": 16, | ||
"visible_bounds_width": 3, | ||
"visible_bounds_height": 1.5, | ||
"visible_bounds_offset": [0, 0.25, 0] | ||
}, | ||
"bones": [ | ||
{ | ||
"name": "bone", | ||
"pivot": [0, 0, 0], | ||
"rotation": [0, 0, -90], | ||
"cubes": [ | ||
{ | ||
"origin": [-0.5, 0, -0.5], | ||
"size": [1, 11, 1], | ||
"uv": { | ||
"north": {"uv": [1, 1], "uv_size": [1, 11]}, | ||
"east": {"uv": [0, 1], "uv_size": [1, 11]}, | ||
"south": {"uv": [3, 1], "uv_size": [1, 11]}, | ||
"west": {"uv": [2, 1], "uv_size": [1, 11]}, | ||
"up": {"uv": [1, 0], "uv_size": [1, 1]}, | ||
"down": {"uv": [2, 1], "uv_size": [1, -1]} | ||
} | ||
}, | ||
{ | ||
"origin": [-0.75, 12, -0.75], | ||
"size": [1.5, 1, 1.5], | ||
"uv": { | ||
"north": {"uv": [5, 4], "uv_size": [1, 1]}, | ||
"east": {"uv": [4, 4], "uv_size": [1, 1]}, | ||
"south": {"uv": [7, 4], "uv_size": [1, 1]}, | ||
"west": {"uv": [6, 4], "uv_size": [1, 1]}, | ||
"up": {"uv": [5, 3], "uv_size": [1, 1]}, | ||
"down": {"uv": [6, 4], "uv_size": [1, -1]} | ||
} | ||
}, | ||
{ | ||
"origin": [-1, 11, -1], | ||
"size": [2, 1, 2], | ||
"uv": { | ||
"north": {"uv": [6, 2], "uv_size": [2, 1]}, | ||
"east": {"uv": [4, 2], "uv_size": [2, 1]}, | ||
"south": {"uv": [10, 2], "uv_size": [2, 1]}, | ||
"west": {"uv": [8, 2], "uv_size": [2, 1]}, | ||
"up": {"uv": [6, 0], "uv_size": [2, 2]}, | ||
"down": {"uv": [8, 2], "uv_size": [2, -2]} | ||
} | ||
}, | ||
{ | ||
"origin": [-0.5, 13, -0.5], | ||
"size": [1, 1, 1], | ||
"uv": { | ||
"north": {"uv": [5, 6], "uv_size": [1, 1]}, | ||
"east": {"uv": [4, 6], "uv_size": [1, 1]}, | ||
"south": {"uv": [7, 6], "uv_size": [1, 1]}, | ||
"west": {"uv": [6, 6], "uv_size": [1, 1]}, | ||
"up": {"uv": [5, 5], "uv_size": [1, 1]}, | ||
"down": {"uv": [6, 6], "uv_size": [1, -1]} | ||
} | ||
} | ||
] | ||
} | ||
] | ||
} | ||
] | ||
} |
8 changes: 8 additions & 0 deletions
8
src/generated/resources/assets/kasuga_lib/models/panel/arrow_2.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"loader": "kasuga_lib:bedrock_animated", | ||
"model": "kasuga_lib:panel/arrow_2", | ||
"texture": "kasuga_lib:panel/arrow_texture", | ||
"geometry": "geometry.unknown", | ||
"render_type": "translucent", | ||
"identifier": "kasuga_lib:arrow_2" | ||
} |
6 changes: 4 additions & 2 deletions
6
src/generated/resources/assets/kasuga_lib/models/panel/panel.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,8 @@ | ||
{ | ||
"loader": "kasuga_lib:bedrock_model", | ||
"loader": "kasuga_lib:bedrock_animated", | ||
"model": "kasuga_lib:panel/panel", | ||
"texture": "kasuga_lib:panel/panel_texture", | ||
"render_type": "translucent" | ||
"render_type": "translucent", | ||
"geometry": "geometry.unknown", | ||
"identifier": "kasuga_lib:panel" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
65 changes: 65 additions & 0 deletions
65
src/main/java/kasuga/lib/core/client/model/AnimModelLoader.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
package kasuga.lib.core.client.model; | ||
|
||
import com.google.gson.JsonDeserializationContext; | ||
import com.google.gson.JsonObject; | ||
import com.google.gson.JsonParseException; | ||
import kasuga.lib.KasugaLib; | ||
import kasuga.lib.core.client.model.anim_model.AnimModel; | ||
import kasuga.lib.core.client.model.model_json.BedrockModel; | ||
import kasuga.lib.core.client.model.model_json.Geometry; | ||
import net.minecraft.resources.ResourceLocation; | ||
import net.minecraft.server.packs.resources.ResourceManager; | ||
import net.minecraft.server.packs.resources.ResourceManagerReloadListener; | ||
import net.minecraftforge.client.model.geometry.IGeometryLoader; | ||
|
||
import javax.annotation.Nullable; | ||
import java.lang.reflect.Type; | ||
import java.util.HashMap; | ||
|
||
public class AnimModelLoader implements IGeometryLoader<AnimModel>, ResourceManagerReloadListener, ItemTransformProvider { | ||
|
||
private ResourceManager manager; | ||
private final HashMap<ResourceLocation, AnimModel> MODELS; | ||
|
||
public static final AnimModelLoader INSTANCE = new AnimModelLoader(); | ||
|
||
private AnimModelLoader() { | ||
this.MODELS = new HashMap<>(); | ||
} | ||
|
||
@Override | ||
public void onResourceManagerReload(ResourceManager pResourceManager) { | ||
this.manager = pResourceManager; | ||
} | ||
|
||
@Override | ||
public AnimModel read(JsonObject jsonObject, JsonDeserializationContext deserializationContext) throws JsonParseException { | ||
BedrockModel model = BedrockModelLoader.readModel(jsonObject, deserializationContext); | ||
ResourceLocation renderTypeHint; | ||
if (jsonObject.has("render_type")) { | ||
renderTypeHint = new ResourceLocation(jsonObject.get("render_type").getAsString()); | ||
} else { | ||
renderTypeHint = new ResourceLocation("solid"); | ||
} | ||
String geometry = jsonObject.get("geometry").getAsString(); | ||
Geometry geo = null; | ||
for (Geometry g : model.getGeometries()) { | ||
if (g.getDescription().getIdentifier().equals(geometry)) { | ||
geo = g; | ||
break; | ||
} | ||
} | ||
if (geo == null) return null; | ||
ResourceLocation identifier = new ResourceLocation(jsonObject.get("identifier").getAsString()); | ||
AnimModel animModel = new AnimModel(geo, model.getMaterials(), renderTypeHint); | ||
if (MODELS.containsKey(identifier)) { | ||
KasugaLib.MAIN_LOGGER.warn("Anim Model: " + identifier + " already exists, COVERED!"); | ||
} | ||
MODELS.put(identifier, animModel); | ||
return animModel; | ||
} | ||
|
||
public @Nullable AnimModel getModel(ResourceLocation location) { | ||
return MODELS.get(location); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.