diff --git a/fabric/src/main/java/gripe/_90/megacells/MEGACellsClient.java b/fabric/src/main/java/gripe/_90/megacells/MEGACellsClient.java index 4d2d7067..0b3cc2bc 100644 --- a/fabric/src/main/java/gripe/_90/megacells/MEGACellsClient.java +++ b/fabric/src/main/java/gripe/_90/megacells/MEGACellsClient.java @@ -14,7 +14,6 @@ import net.minecraft.client.renderer.blockentity.BlockEntityRenderers; import net.minecraft.client.renderer.item.ItemProperties; import net.minecraft.client.resources.model.BakedModel; -import net.minecraft.resources.ResourceLocation; import net.minecraft.world.level.ItemLike; import appeng.api.IAEAddonEntrypoint; @@ -70,14 +69,14 @@ private void initBlockModels() { BlockEntityRenderers.register(MEGABlockEntities.MEGA_CRAFTING_MONITOR, CraftingMonitorRenderer::new); ModelsReloadCallback.EVENT.register(modelRegistry -> { - var customizers = new HashMap>(); - customizers.put(MEGABlocks.CRAFTING_MONITOR.id(), model -> model instanceof MonitorBakedModel + var customizers = new HashMap>(); + customizers.put(MEGABlocks.CRAFTING_MONITOR.id().getPath(), model -> model instanceof MonitorBakedModel ? model : new AutoRotatingBakedModel(model)); for (var block : MEGABlocks.getBlocks()) { if (!(block.block() instanceof CraftingUnitBlock)) { - customizers.put(block.id(), AutoRotatingBakedModel::new); + customizers.put(block.id().getPath(), AutoRotatingBakedModel::new); } } @@ -87,14 +86,11 @@ private void initBlockModels() { } var originalModel = modelRegistry.get(location); - var customizer = customizers.get(location); + var customizer = customizers.get(location.getPath()); if (customizer != null) { var newModel = customizer.apply(originalModel); - - if (newModel != originalModel) { - modelRegistry.put(location, newModel); - } + modelRegistry.put(location, newModel); } } }); diff --git a/forge/src/main/java/gripe/_90/megacells/forge/MEGACellsClient.java b/forge/src/main/java/gripe/_90/megacells/forge/MEGACellsClient.java index 6c97c2aa..47310646 100644 --- a/forge/src/main/java/gripe/_90/megacells/forge/MEGACellsClient.java +++ b/forge/src/main/java/gripe/_90/megacells/forge/MEGACellsClient.java @@ -9,7 +9,6 @@ import net.minecraft.client.renderer.blockentity.BlockEntityRenderers; import net.minecraft.client.renderer.item.ItemProperties; import net.minecraft.client.resources.model.BakedModel; -import net.minecraft.resources.ResourceLocation; import net.minecraft.world.level.ItemLike; import net.minecraftforge.client.event.ModelEvent; import net.minecraftforge.client.event.RegisterColorHandlersEvent; @@ -81,14 +80,14 @@ private void initModels(ModelEvent.RegisterGeometryLoaders event) { private void initModelRotation(ModelEvent.BakingCompleted event) { var modelRegistry = event.getModels(); - var customizers = new HashMap>(); - customizers.put(MEGABlocks.CRAFTING_MONITOR.id(), model -> model instanceof MonitorBakedModel + var customizers = new HashMap>(); + customizers.put(MEGABlocks.CRAFTING_MONITOR.id().getPath(), model -> model instanceof MonitorBakedModel ? model : new AutoRotatingBakedModel(model)); for (var block : MEGABlocks.getBlocks()) { if (!(block.block() instanceof CraftingUnitBlock)) { - customizers.put(block.id(), AutoRotatingBakedModel::new); + customizers.put(block.id().getPath(), AutoRotatingBakedModel::new); } } @@ -98,14 +97,11 @@ private void initModelRotation(ModelEvent.BakingCompleted event) { } var originalModel = modelRegistry.get(location); - var customizer = customizers.get(location); + var customizer = customizers.get(location.getPath()); if (customizer != null) { var newModel = customizer.apply(originalModel); - - if (newModel != originalModel) { - modelRegistry.put(location, newModel); - } + modelRegistry.put(location, newModel); } } }