Skip to content

Commit

Permalink
Merge branch '1.20.1' into 1.20.2
Browse files Browse the repository at this point in the history
  • Loading branch information
spiralhalo committed May 15, 2024
2 parents 686aa8e + 2694fa3 commit fa97ff2
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,24 @@

import org.spongepowered.asm.mixin.Mixin;

import net.minecraft.core.BlockPos;
import net.minecraft.core.Holder;
import net.minecraft.world.level.biome.Biome;

import net.fabricmc.fabric.api.blockview.v2.FabricBlockView;

import grondag.canvas.terrain.region.input.InputRegion;

/** Attached Fabric API interface to our render regions when needed for compat. */
@Mixin(InputRegion.class)
public class MixinInputRegion implements FabricBlockView { }
public class MixinInputRegion implements FabricBlockView {
@Override
public boolean hasBiomes() {
return true;
}

@Override
public Holder<Biome> getBiomeFabric(BlockPos pos) {
return ((InputRegion) (Object) this).getBiome(pos);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -104,12 +104,12 @@ protected int fastBrightness(BlockPos pos) {

@Override
public @Nullable Object blockEntityRenderData(BlockPos pos) {
return region.getBlockEntityRenderAttachment(pos);
return region.getBlockEntityRenderData(pos);
}

@Override
public Biome getBiome(BlockPos pos) {
return region.getBiome(pos);
return region.getBiome(pos).value();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
package grondag.canvas.mixin;

import org.joml.Quaternionf;
import org.joml.Vector3f;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@
import net.minecraft.client.renderer.LevelRenderer;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.core.Holder;
import net.minecraft.world.level.BlockAndTintGetter;
import net.minecraft.world.level.ColorResolver;
import net.minecraft.world.level.LightLayer;
Expand Down Expand Up @@ -355,8 +356,8 @@ public int getBrightness(LightLayer type, BlockPos pos) {
return world.getBrightness(type, pos);
}

// Implements Fabrics API RenderAttachedBlockView
public Object getBlockEntityRenderAttachment(BlockPos pos) {
// Implements Fabrics API FabricBlockView
public Object getBlockEntityRenderData(BlockPos pos) {
return isInMainChunk(pos) ? renderData[interiorIndex(pos)] : null;
}

Expand Down Expand Up @@ -432,10 +433,8 @@ public int getBlockTint(BlockPos blockPos, ColorResolver colorResolver) {
return ChunkColorCache.get(getChunk(x >> 4, z >> 4)).getColor(x, blockPos.getY(), z, colorResolver);
}

public Biome getBiome(BlockPos blockPos) {
final int x = blockPos.getX();
final int z = blockPos.getZ();
return ChunkColorCache.get(getChunk(x >> 4, z >> 4)).getBiome(x, blockPos.getY(), z);
public Holder<Biome> getBiome(BlockPos blockPos) {
return world.getBiomeManager().getBiome(blockPos);
}

/**
Expand Down

0 comments on commit fa97ff2

Please sign in to comment.