Skip to content

Commit

Permalink
Attempt at fixing #1 by not loading a custom model when res is defaul…
Browse files Browse the repository at this point in the history
…t (16)
  • Loading branch information
CAS-ual-TY committed Aug 21, 2020
1 parent 3252388 commit 09201c0
Showing 1 changed file with 20 additions and 11 deletions.
31 changes: 20 additions & 11 deletions src/main/java/de/cas_ual_ty/ydm/clientutil/ClientProxy.java
Original file line number Diff line number Diff line change
Expand Up @@ -209,23 +209,32 @@ private void textureStitchPre(TextureStitchEvent.Pre event)
private void modelRegistry(ModelRegistryEvent event)
{
YDM.log("Registering models (size: " + ClientProxy.activeItemImageSize + ") for " + YdmItems.BLANC_CARD.getRegistryName().toString() + " and " + YdmItems.CARD_BACK.getRegistryName().toString());
ModelLoader.addSpecialModel(new ModelResourceLocation(new ResourceLocation(YdmItems.BLANC_CARD.getRegistryName().toString() + "_" + ClientProxy.activeItemImageSize), "inventory"));
ModelLoader.addSpecialModel(new ModelResourceLocation(new ResourceLocation(YdmItems.CARD_BACK.getRegistryName().toString() + "_" + ClientProxy.activeItemImageSize), "inventory"));

// 16 is default texture; no need to do anything special in that case
if(ClientProxy.activeItemImageSize != 16)
{
ModelLoader.addSpecialModel(new ModelResourceLocation(new ResourceLocation(YdmItems.BLANC_CARD.getRegistryName().toString() + "_" + ClientProxy.activeItemImageSize), "inventory"));
ModelLoader.addSpecialModel(new ModelResourceLocation(new ResourceLocation(YdmItems.CARD_BACK.getRegistryName().toString() + "_" + ClientProxy.activeItemImageSize), "inventory"));
}
}

private void modelBake(ModelBakeEvent event)
{
YDM.log("Baking models (size: " + ClientProxy.activeItemImageSize + ") for " + YdmItems.BLANC_CARD.getRegistryName().toString() + " and " + YdmItems.CARD_BACK.getRegistryName().toString());

event.getModelRegistry().put(new ModelResourceLocation(YdmItems.BLANC_CARD.getRegistryName(), "inventory"),
event.getModelRegistry().get(
new ModelResourceLocation(
new ResourceLocation(YdmItems.BLANC_CARD.getRegistryName().toString() + "_" + ClientProxy.activeItemImageSize), "inventory")));

event.getModelRegistry().put(new ModelResourceLocation(YdmItems.CARD_BACK.getRegistryName(), "inventory"),
event.getModelRegistry().get(
new ModelResourceLocation(
new ResourceLocation(YdmItems.CARD_BACK.getRegistryName().toString() + "_" + ClientProxy.activeItemImageSize), "inventory")));
// 16 is default texture; no need to do anything special in that case
if(ClientProxy.activeItemImageSize != 16)
{
event.getModelRegistry().put(new ModelResourceLocation(YdmItems.BLANC_CARD.getRegistryName(), "inventory"),
event.getModelRegistry().get(
new ModelResourceLocation(
new ResourceLocation(YdmItems.BLANC_CARD.getRegistryName().toString() + "_" + ClientProxy.activeItemImageSize), "inventory")));

event.getModelRegistry().put(new ModelResourceLocation(YdmItems.CARD_BACK.getRegistryName(), "inventory"),
event.getModelRegistry().get(
new ModelResourceLocation(
new ResourceLocation(YdmItems.CARD_BACK.getRegistryName().toString() + "_" + ClientProxy.activeItemImageSize), "inventory")));
}

ModelResourceLocation key = new ModelResourceLocation(YdmItems.CARD.getRegistryName(), "inventory");
event.getModelRegistry().put(key, new CardBakedModel(event.getModelRegistry().get(key)));
Expand Down

0 comments on commit 09201c0

Please sign in to comment.