remove buffer api

This commit is contained in:
dfsek
2021-12-20 00:01:04 -07:00
parent f088928483
commit 62d0f109b4
24 changed files with 217 additions and 185 deletions
@@ -7,6 +7,8 @@
package com.dfsek.terra.addons.ore.ores;
import com.dfsek.terra.api.util.vector.integer.Vector3Int;
import net.jafama.FastMath;
import java.util.Map;
@@ -40,50 +42,40 @@ public class VanillaOre implements Structure {
}
@Override
public boolean generate(Vector3 location, WritableWorld world, Random random, Rotation rotation) {
generate(location, world, random);
return true;
}
public boolean generate(Vector3Int location, WritableWorld world, Random random, Rotation rotation) {
int centerX = location.getX();
int centerZ = location.getZ();
int centerY = location.getY();
@Override
public String getID() {
return null;
}
public void generate(Vector3 location, WritableWorld world, Random random) {
int centerX = location.getBlockX();
int centerZ = location.getBlockZ();
int centerY = location.getBlockY();
float f = random.nextFloat() * (float) Math.PI;
double d1 = centerX + 8 + FastMath.sin(f) * size / 8.0F;
double d2 = centerX + 8 - FastMath.sin(f) * size / 8.0F;
double d3 = centerZ + 8 + FastMath.cos(f) * size / 8.0F;
double d4 = centerZ + 8 - FastMath.cos(f) * size / 8.0F;
double d5 = centerY + random.nextInt(3) - 2D;
double d6 = centerY + random.nextInt(3) - 2D;
for(int i = 0; i < size; i++) {
float iFactor = (float) i / (float) size;
double d10 = random.nextDouble() * size / 16.0D;
double d11 = (FastMath.sin(Math.PI * iFactor) + 1.0) * d10 + 1.0;
double d12 = (FastMath.sin(Math.PI * iFactor) + 1.0) * d10 + 1.0;
int xStart = FastMath.roundToInt(FastMath.floor(d1 + (d2 - d1) * iFactor - d11 / 2.0D));
int yStart = FastMath.roundToInt(FastMath.floor(d5 + (d6 - d5) * iFactor - d12 / 2.0D));
int zStart = FastMath.roundToInt(FastMath.floor(d3 + (d4 - d3) * iFactor - d11 / 2.0D));
int xEnd = FastMath.roundToInt(FastMath.floor(d1 + (d2 - d1) * iFactor + d11 / 2.0D));
int yEnd = FastMath.roundToInt(FastMath.floor(d5 + (d6 - d5) * iFactor + d12 / 2.0D));
int zEnd = FastMath.roundToInt(FastMath.floor(d3 + (d4 - d3) * iFactor + d11 / 2.0D));
for(int x = xStart; x <= xEnd; x++) {
double d13 = (x + 0.5D - (d1 + (d2 - d1) * iFactor)) / (d11 / 2.0D);
if(d13 * d13 < 1.0D) {
for(int y = yStart; y <= yEnd; y++) {
double d14 = (y + 0.5D - (d5 + (d6 - d5) * iFactor)) / (d12 / 2.0D);
@@ -101,6 +93,12 @@ public class VanillaOre implements Structure {
}
}
}
return true;
}
@Override
public String getID() {
return null;
}
public BlockState getMaterial(BlockType replace) {