Skip to content

Commit

Permalink
Add a log message when a resource is missing for block states
Browse files Browse the repository at this point in the history
  • Loading branch information
NikitaCartes committed Dec 20, 2024
1 parent 7392447 commit 4ab500a
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
*/
package de.bluecolored.bluemap.core.map.hires.blockmodel;

import de.bluecolored.bluemap.core.logger.Logger;
import de.bluecolored.bluemap.core.map.TextureGallery;
import de.bluecolored.bluemap.core.map.hires.RenderSettings;
import de.bluecolored.bluemap.core.resources.pack.resourcepack.ResourcePack;
Expand All @@ -34,11 +35,14 @@
import lombok.Getter;
import lombok.RequiredArgsConstructor;

import java.util.HashSet;

public interface BlockRendererType extends Keyed, BlockRendererFactory {

BlockRendererType DEFAULT = new Impl(Key.bluemap("default"), ResourceModelRenderer::new);
BlockRendererType LIQUID = new Impl(Key.bluemap("liquid"), LiquidModelRenderer::new);
BlockRendererType MISSING = new Impl(Key.bluemap("missing"), MissingModelRenderer::new);
HashSet<BlockState> missingBlockStates = new HashSet<>();

Registry<BlockRendererType> REGISTRY = new Registry<>(
DEFAULT,
Expand All @@ -61,6 +65,9 @@ public interface BlockRendererType extends Keyed, BlockRendererFactory {
* @return true if this renderer-type can render the provided {@link BlockState} despite missing resources.
*/
default boolean isFallbackFor(BlockState blockState) {
if (missingBlockStates.contains(blockState)) return false;
missingBlockStates.add(blockState);
Logger.global.logDebug("Missing resources for blockState: " + blockState);
return false;
}

Expand Down

0 comments on commit 4ab500a

Please sign in to comment.