feat(api): Make PartialModel's use RL's instead of MRL's

This commit is contained in:
IThundxr 2024-07-15 17:36:57 -04:00
parent 1d9f96a822
commit 6533723fdf
Failed to generate hash of commit
2 changed files with 6 additions and 6 deletions

View file

@ -4,7 +4,7 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import net.minecraft.client.resources.model.BakedModel; import net.minecraft.client.resources.model.BakedModel;
import net.minecraft.client.resources.model.ModelResourceLocation; import net.minecraft.resources.ResourceLocation;
/** /**
* A helper class for loading and accessing JSON models not directly used by any blocks or items. * A helper class for loading and accessing JSON models not directly used by any blocks or items.
@ -19,10 +19,10 @@ public class PartialModel {
static final List<PartialModel> ALL = new ArrayList<>(); static final List<PartialModel> ALL = new ArrayList<>();
static boolean tooLate = false; static boolean tooLate = false;
protected final ModelResourceLocation modelLocation; protected final ResourceLocation modelLocation;
protected BakedModel bakedModel; protected BakedModel bakedModel;
public PartialModel(ModelResourceLocation modelLocation) { public PartialModel(ResourceLocation modelLocation) {
if (tooLate) { if (tooLate) {
throw new RuntimeException("Attempted to create PartialModel with location '" + modelLocation + "' after start of initial resource reload!"); throw new RuntimeException("Attempted to create PartialModel with location '" + modelLocation + "' after start of initial resource reload!");
} }
@ -34,7 +34,7 @@ public class PartialModel {
} }
} }
public ModelResourceLocation getLocation() { public ResourceLocation getLocation() {
return modelLocation; return modelLocation;
} }

View file

@ -15,7 +15,7 @@ public final class PartialModelEventHandler {
public static void onRegisterAdditional(ModelEvent.RegisterAdditional event) { public static void onRegisterAdditional(ModelEvent.RegisterAdditional event) {
for (PartialModel partial : PartialModel.ALL) { for (PartialModel partial : PartialModel.ALL) {
event.register(partial.getLocation()); event.register(ModelResourceLocation.standalone(partial.getLocation()));
} }
PartialModel.tooLate = true; PartialModel.tooLate = true;
@ -25,7 +25,7 @@ public final class PartialModelEventHandler {
Map<ModelResourceLocation, BakedModel> models = event.getModels(); Map<ModelResourceLocation, BakedModel> models = event.getModels();
for (PartialModel partial : PartialModel.ALL) { for (PartialModel partial : PartialModel.ALL) {
partial.set(models.get(partial.getLocation())); partial.set(models.get(ModelResourceLocation.standalone(partial.getLocation())));
} }
} }
} }