19w41a first pass

This commit is contained in:
gnembon committed 2019-10-09 19:43:37 -03:00
1 parent 5ebfb7d1c0
commit 7b649f9ccd
28 files changed
+164 -178

No files matched your search

@@ -0,0 +1,35 @@
package carpet.mixins;
import carpet.fakes.BiomeArrayInterface;
import carpet.settings.CarpetSettings;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.MathHelper;
import net.minecraft.world.World;
import net.minecraft.world.biome.Biome;
import net.minecraft.world.biome.BiomeArray;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
@Mixin(BiomeArray.class)
public class BiomeArray_getBiomeArrayMixin implements BiomeArrayInterface
{
@Shadow @Final private static int HORIZONTAL_SECTION_COUNT;
@Shadow @Final public static int HORIZONTAL_BIT_MASK;
@Shadow @Final public static int VERTICAL_BIT_MASK;
@Shadow @Final private Biome[] data;
@Override
public void setBiomeAtIndex(BlockPos pos, World world, Biome what)
{
int seaLevel = 0;// seems to be a fixed value for now. world.getSeaLevel();
int int_4 = (pos.getX() >> 2) & HORIZONTAL_BIT_MASK;
int int_5 = MathHelper.clamp(seaLevel, 0, VERTICAL_BIT_MASK);
int int_6 = (pos.getZ() >> 2) & HORIZONTAL_BIT_MASK;
data[(int_5 << (HORIZONTAL_SECTION_COUNT + HORIZONTAL_SECTION_COUNT)) | (int_6 << HORIZONTAL_SECTION_COUNT) | int_4] = what;
}
}