Removed old End Caves (temporary), added new Caves and Cave API (WIP)
This commit is contained in:
parent
2135fe50b5
commit
231794363b
14 changed files with 384 additions and 28 deletions
46
src/main/java/ru/betterend/mixin/common/BiomeArrayMixin.java
Normal file
46
src/main/java/ru/betterend/mixin/common/BiomeArrayMixin.java
Normal file
|
@ -0,0 +1,46 @@
|
|||
package ru.betterend.mixin.common;
|
||||
|
||||
import org.spongepowered.asm.mixin.Final;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.world.biome.Biome;
|
||||
import net.minecraft.world.biome.source.BiomeArray;
|
||||
import ru.betterend.interfaces.IBiomeArray;
|
||||
|
||||
@Mixin(BiomeArray.class)
|
||||
public class BiomeArrayMixin implements IBiomeArray {
|
||||
@Final
|
||||
@Shadow
|
||||
private Biome[] data;
|
||||
|
||||
@Final
|
||||
@Shadow
|
||||
private static int HORIZONTAL_SECTION_COUNT;
|
||||
|
||||
@Final
|
||||
@Shadow
|
||||
public static int HORIZONTAL_BIT_MASK;
|
||||
|
||||
@Final
|
||||
@Shadow
|
||||
public static int VERTICAL_BIT_MASK;
|
||||
|
||||
@Override
|
||||
public void setBiome(Biome biome, BlockPos pos) {
|
||||
int biomeX = pos.getX() >> 2;
|
||||
int biomeY = pos.getY() >> 2;
|
||||
int biomeZ = pos.getZ() >> 2;
|
||||
int index = be_getArrayIndex(biomeX, biomeY, biomeZ);
|
||||
data[index] = biome;
|
||||
}
|
||||
|
||||
private int be_getArrayIndex(int biomeX, int biomeY, int biomeZ) {
|
||||
int i = biomeX & HORIZONTAL_BIT_MASK;
|
||||
int j = MathHelper.clamp(biomeY, 0, VERTICAL_BIT_MASK);
|
||||
int k = biomeZ & HORIZONTAL_BIT_MASK;
|
||||
return j << HORIZONTAL_SECTION_COUNT + HORIZONTAL_SECTION_COUNT | k << HORIZONTAL_SECTION_COUNT | i;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue