Skip to content

Commit

Permalink
Fix null world crash
Browse files Browse the repository at this point in the history
  • Loading branch information
kvverti committed Jun 23, 2019
1 parent 6bc7f89 commit ef73963
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import net.minecraft.block.StemBlock;
import net.minecraft.client.color.block.BlockColors;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.biome.Biome;
import net.minecraft.world.ExtendedBlockView;

import org.spongepowered.asm.mixin.Dynamic;
Expand Down Expand Up @@ -81,7 +82,8 @@ private static void onLilyPadColor(CallbackInfoReturnable<Integer> info) {

@Inject(method = "getColorMultiplier", at = @At("HEAD"), cancellable = true)
private void onColorMultiplier(BlockState state, ExtendedBlockView world, BlockPos pos, int tintIdx, CallbackInfoReturnable<Integer> info) {
BiomeColormap colormap = Colormatic.CUSTOM_BLOCK_COLORS.getColormap(state, world.getBiome(pos));
Biome biome = world != null && pos != null ? world.getBiome(pos) : null;
BiomeColormap colormap = Colormatic.CUSTOM_BLOCK_COLORS.getColormap(state, biome);
if(colormap != null) {
info.setReturnValue(BiomeColormap.getBiomeColor(world, pos, colormap));
}
Expand Down

0 comments on commit ef73963

Please sign in to comment.