Skip to content

Commit

Permalink
Turn exception into warning in ColorProviderRegistryImpl
Browse files Browse the repository at this point in the history
  • Loading branch information
Su5eD committed Nov 2, 2024
1 parent e6b742f commit 077ba95
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,20 @@

import java.util.IdentityHashMap;
import java.util.Map;

import com.mojang.logging.LogUtils;
import net.minecraft.client.color.block.BlockColor;
import net.minecraft.client.color.block.BlockColors;
import net.minecraft.client.color.item.ItemColor;
import net.minecraft.client.color.item.ItemColors;
import net.minecraft.world.level.ItemLike;
import net.minecraft.world.level.block.Block;
import net.fabricmc.fabric.api.client.rendering.v1.ColorProviderRegistry;
import org.slf4j.Logger;

public abstract class ColorProviderRegistryImpl<T, Provider, Underlying> implements ColorProviderRegistry<T, Provider> {
private static final Logger LOGGER = LogUtils.getLogger();

public static final ColorProviderRegistryImpl<Block, BlockColor, BlockColors> BLOCK = new ColorProviderRegistryImpl<Block, BlockColor, BlockColors>() {
@Override
void registerUnderlying(BlockColors map, BlockColor mapper, Block block) {
Expand All @@ -48,7 +53,9 @@ void registerUnderlying(ItemColors map, ItemColor mapper, ItemLike block) {

public void initialize(Underlying colorMap) {
if (this.colorMap != null) {
if (this.colorMap != colorMap) throw new IllegalStateException("Cannot set colorMap twice");
if (this.colorMap != colorMap) {
LOGGER.warn("Tried to set colorMap twice in {}", getClass().getName());
}
return;
}

Expand Down
2 changes: 1 addition & 1 deletion ffapi.gradle.properties
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
loom.platform=neoforge
fabric.loom.dontRemap=true

implementationVersion=2.0.15
implementationVersion=2.0.16

versionMc=1.21.1
versionForge=21.1.57
Expand Down

0 comments on commit 077ba95

Please sign in to comment.