Skip to content
This repository has been archived by the owner on Nov 5, 2024. It is now read-only.

Commit

Permalink
started work on reactor model loader
Browse files Browse the repository at this point in the history
  • Loading branch information
Trinsdar committed Aug 11, 2024
1 parent 2975ca2 commit 0f303c9
Showing 1 changed file with 45 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
package muramasa.gregtech.client;

import com.google.gson.JsonArray;
import com.google.gson.JsonDeserializationContext;
import com.google.gson.JsonObject;
import muramasa.antimatter.AntimatterAPI;
import muramasa.antimatter.client.model.loader.AntimatterModelLoader;
import muramasa.antimatter.machine.MachineState;
import net.minecraft.client.renderer.block.model.BlockModel;
import net.minecraft.client.renderer.texture.MissingTextureAtlasSprite;
import net.minecraft.client.resources.model.UnbakedModel;
import net.minecraft.resources.ResourceLocation;

import java.util.HashMap;
import java.util.Map;

public class ReactorModelLoader extends AntimatterModelLoader<ReactorModel> {
public ReactorModelLoader(ResourceLocation loc) {
super(loc);
}

@Override
public ReactorModel readModel(JsonDeserializationContext context, JsonObject json) {
ResourceLocation particle = json.has("particle") ? new ResourceLocation(json.get("particle").getAsString()) : MissingTextureAtlasSprite.getLocation();
Map<MachineState, UnbakedModel[]> m = new HashMap<>();
AntimatterAPI.all(MachineState.class, t -> {
if (json.has(t.toString().toLowerCase())) {
JsonArray arr = json.get(t.toString().toLowerCase()).getAsJsonArray();
UnbakedModel[] a = new UnbakedModel[6];
for (int i = 0; i < 6; i++) {
a[i] = context.deserialize(arr.get(i), BlockModel.class);
}
m.put(t, a);
}
});
UnbakedModel[] rods = new UnbakedModel[4];
String[] array = new String[]{"north-west", "south-west", "north-east", "south-east"};
//northwest is 0, southwest is 1, northeast is 2, southeast is 3
for (int i = 0; i < 4; i++) {
//rods[i] = context.deserialize(J)
}

return null;
}
}

0 comments on commit 0f303c9

Please sign in to comment.