mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2025-07-18 18:23:06 +00:00
Dripstone support
This commit is contained in:
parent
2db34f4d49
commit
d2806c7ec0
@ -25,7 +25,10 @@ import com.volmit.iris.engine.object.decoration.IrisDecorationPart;
|
||||
import com.volmit.iris.engine.object.decoration.IrisDecorator;
|
||||
import com.volmit.iris.util.documentation.BlockCoordinates;
|
||||
import com.volmit.iris.util.hunk.Hunk;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
import org.bukkit.block.data.type.PointedDripstone;
|
||||
|
||||
public class IrisCeilingDecorator extends IrisEngineDecorator {
|
||||
public IrisCeilingDecorator(Engine engine) {
|
||||
@ -45,8 +48,10 @@ public class IrisCeilingDecorator extends IrisEngineDecorator {
|
||||
} else {
|
||||
int stack = decorator.getHeight(getRng().nextParallelRNG(Cache.key(realX, realZ)), realX, realZ, getData());
|
||||
if (decorator.isScaleStack()) {
|
||||
stack = (int) Math.ceil((double) max * ((double) stack / 100));
|
||||
} else stack = Math.min(max, stack);
|
||||
stack = Math.min((int) Math.ceil((double) max * ((double) stack / 100)), decorator.getAbsoluteMaxStack());
|
||||
} else {
|
||||
stack = Math.min(max, stack);
|
||||
}
|
||||
|
||||
if (stack == 1) {
|
||||
data.set(x, height, z, decorator.getBlockDataForTop(biome, getRng(), realX, height, realZ, getData()));
|
||||
@ -60,9 +65,45 @@ public class IrisCeilingDecorator extends IrisEngineDecorator {
|
||||
}
|
||||
|
||||
double threshold = (((double) i) / (double) (stack - 1));
|
||||
data.set(x, h, z, threshold >= decorator.getTopThreshold() ?
|
||||
|
||||
BlockData bd = threshold >= decorator.getTopThreshold() ?
|
||||
decorator.getBlockDataForTop(biome, getRng(), realX, h, realZ, getData()) :
|
||||
decorator.getBlockData100(biome, getRng(), realX, h, realZ, getData()));
|
||||
decorator.getBlockData100(biome, getRng(), realX, h, realZ, getData());
|
||||
|
||||
if(bd instanceof PointedDripstone)
|
||||
{
|
||||
PointedDripstone.Thickness th = PointedDripstone.Thickness.BASE;
|
||||
|
||||
if(stack == 2)
|
||||
{
|
||||
th = PointedDripstone.Thickness.FRUSTUM;
|
||||
|
||||
if(i == stack-1)
|
||||
{
|
||||
th = PointedDripstone.Thickness.TIP;
|
||||
}
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
if(i == stack-1)
|
||||
{
|
||||
th = PointedDripstone.Thickness.TIP;
|
||||
}
|
||||
|
||||
else if(i == stack-2)
|
||||
{
|
||||
th = PointedDripstone.Thickness.FRUSTUM;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bd = Material.POINTED_DRIPSTONE.createBlockData();
|
||||
((PointedDripstone)bd).setThickness(th);
|
||||
((PointedDripstone)bd).setVerticalDirection(BlockFace.DOWN);
|
||||
}
|
||||
|
||||
data.set(x, h, z, bd);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -27,8 +27,12 @@ import com.volmit.iris.engine.object.decoration.IrisDecorationPart;
|
||||
import com.volmit.iris.engine.object.decoration.IrisDecorator;
|
||||
import com.volmit.iris.util.documentation.BlockCoordinates;
|
||||
import com.volmit.iris.util.hunk.Hunk;
|
||||
import net.minecraft.world.level.block.PointedDripstoneBlock;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.block.data.Bisected;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
import org.bukkit.block.data.type.PointedDripstone;
|
||||
|
||||
public class IrisSurfaceDecorator extends IrisEngineDecorator {
|
||||
public IrisSurfaceDecorator(Engine engine) {
|
||||
@ -78,6 +82,12 @@ public class IrisSurfaceDecorator extends IrisEngineDecorator {
|
||||
|
||||
int stack = decorator.getHeight(getRng().nextParallelRNG(Cache.key(realX, realZ)), realX, realZ, getData());
|
||||
|
||||
if (decorator.isScaleStack()) {
|
||||
stack = Math.min((int) Math.ceil((double) max * ((double) stack / 100)), decorator.getAbsoluteMaxStack());
|
||||
} else {
|
||||
stack = Math.min(max, stack);
|
||||
}
|
||||
|
||||
if (stack == 1) {
|
||||
data.set(x, height, z, decorator.getBlockDataForTop(biome, getRng(), realX, height, realZ, getData()));
|
||||
return;
|
||||
@ -102,6 +112,39 @@ public class IrisSurfaceDecorator extends IrisEngineDecorator {
|
||||
break;
|
||||
}
|
||||
|
||||
if(bd instanceof PointedDripstone)
|
||||
{
|
||||
PointedDripstone.Thickness th = PointedDripstone.Thickness.BASE;
|
||||
|
||||
if(stack == 2)
|
||||
{
|
||||
th = PointedDripstone.Thickness.FRUSTUM;
|
||||
|
||||
if(i == stack-1)
|
||||
{
|
||||
th = PointedDripstone.Thickness.TIP;
|
||||
}
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
if(i == stack-1)
|
||||
{
|
||||
th = PointedDripstone.Thickness.TIP;
|
||||
}
|
||||
|
||||
else if(i == stack-2)
|
||||
{
|
||||
th = PointedDripstone.Thickness.FRUSTUM;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bd = Material.POINTED_DRIPSTONE.createBlockData();
|
||||
((PointedDripstone)bd).setThickness(th);
|
||||
((PointedDripstone)bd).setVerticalDirection(BlockFace.UP);
|
||||
}
|
||||
|
||||
data.set(x, height + 1 + i, z, bd);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user