Re-implemented lost object placement heightmap

This commit is contained in:
StrangeOne101 2021-07-04 16:32:04 +12:00
parent 79e12c8dd8
commit 3299e0fa6a
3 changed files with 49 additions and 2 deletions

View File

@ -460,8 +460,52 @@ public class IrisObject extends IrisRegistrant
return place(x, yv, z, placer, config, rng, null, null, rdata);
}
public int place(int x, int yv, int z, IObjectPlacer placer, IrisObjectPlacement config, RNG rng, Consumer<BlockPosition> listener, CarveResult c, IrisDataManager rdata)
public int place(int x, int yv, int z, IObjectPlacer oplacer, IrisObjectPlacement config, RNG rng, Consumer<BlockPosition> listener, CarveResult c, IrisDataManager rdata)
{
IObjectPlacer placer = (config.getHeightmap() != null) ? new IObjectPlacer() {
final long s = rng.nextLong() + yv + z - x;
public int getHighest(int param1Int1, int param1Int2) {
return (int)Math.round(config.getHeightmap().getNoise(this.s, param1Int1, param1Int2));
}
public int getHighest(int param1Int1, int param1Int2, boolean param1Boolean) {
return (int)Math.round(config.getHeightmap().getNoise(this.s, param1Int1, param1Int2));
}
public void set(int param1Int1, int param1Int2, int param1Int3, BlockData param1BlockData) {
oplacer.set(param1Int1, param1Int2, param1Int3, param1BlockData);
}
public BlockData get(int param1Int1, int param1Int2, int param1Int3) {
return oplacer.get(param1Int1, param1Int2, param1Int3);
}
public boolean isPreventingDecay() {
return oplacer.isPreventingDecay();
}
public boolean isSolid(int param1Int1, int param1Int2, int param1Int3) {
return oplacer.isSolid(param1Int1, param1Int2, param1Int3);
}
public boolean isUnderwater(int param1Int1, int param1Int2) {
return oplacer.isUnderwater(param1Int1, param1Int2);
}
public int getFluidHeight() {
return oplacer.getFluidHeight();
}
public boolean isDebugSmartBore() {
return oplacer.isDebugSmartBore();
}
public void setTile(int param1Int1, int param1Int2, int param1Int3, TileData<? extends TileState> param1TileData) {
oplacer.setTile(param1Int1, param1Int2, param1Int3, param1TileData);
}
} : oplacer;
if(config.isSmartBore())
{
ensureSmartBored(placer.isDebugSmartBore());

View File

@ -80,6 +80,10 @@ public class IrisObjectPlacement
@Desc("If set to true, objects will place in carvings (such as underground) or under an overhang.")
private CarvingMode carvingSupport = CarvingMode.SURFACE_ONLY;
@DontObfuscate
@Desc("If this is defined, this object wont place on the terrain heightmap, but instead on this virtual heightmap")
private IrisNoiseGenerator heightmap;
@DontObfuscate
@Desc("If set to true, Iris will try to fill the insides of 'rooms' and 'pockets' where air should fit based off of raytrace checks. This prevents a village house placing in an area where a tree already exists, and instead replaces the parts of the tree where the interior of the structure is. \n\nThis operation does not affect warmed-up generation speed however it does slow down loading objects.")
private boolean smartBore = false;

View File

@ -80,7 +80,6 @@ public class PlannedStructure {
options= i.getPiece().getPlacementOptions();
options.getRotation().setEnabled(false);
}
else
{
options.setMode(i.getPiece().getPlaceMode());