mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2026-06-17 14:21:08 +00:00
add ore exposed option
This commit is contained in:
@@ -18,6 +18,6 @@ public class OreFactory implements ConfigFactory<OreTemplate, Structure> {
|
|||||||
@Override
|
@Override
|
||||||
public VanillaOre build(OreTemplate config, Platform platform) {
|
public VanillaOre build(OreTemplate config, Platform platform) {
|
||||||
BlockState m = config.getMaterial();
|
BlockState m = config.getMaterial();
|
||||||
return new VanillaOre(m, config.getSize(), config.getReplaceable(), config.doPhysics(), config.getMaterialOverrides());
|
return new VanillaOre(m, config.getSize(), config.getReplaceable(), config.doPhysics(), config.isExposed(), config.getMaterialOverrides());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,6 +44,10 @@ public class OreTemplate implements AbstractableTemplate {
|
|||||||
@Value("size")
|
@Value("size")
|
||||||
private @Meta double size;
|
private @Meta double size;
|
||||||
|
|
||||||
|
@Value("exposed")
|
||||||
|
@Default
|
||||||
|
private @Meta boolean exposed = true;
|
||||||
|
|
||||||
public boolean doPhysics() {
|
public boolean doPhysics() {
|
||||||
return physics;
|
return physics;
|
||||||
}
|
}
|
||||||
@@ -67,4 +71,8 @@ public class OreTemplate implements AbstractableTemplate {
|
|||||||
public Map<BlockType, BlockState> getMaterialOverrides() {
|
public Map<BlockType, BlockState> getMaterialOverrides() {
|
||||||
return materials;
|
return materials;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isExposed() {
|
||||||
|
return exposed;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+11
-2
@@ -29,14 +29,16 @@ public class VanillaOre implements Structure {
|
|||||||
private final double size;
|
private final double size;
|
||||||
private final MaterialSet replaceable;
|
private final MaterialSet replaceable;
|
||||||
private final boolean applyGravity;
|
private final boolean applyGravity;
|
||||||
|
private final boolean exposed;
|
||||||
private final Map<BlockType, BlockState> materials;
|
private final Map<BlockType, BlockState> materials;
|
||||||
|
|
||||||
public VanillaOre(BlockState material, double size, MaterialSet replaceable, boolean applyGravity,
|
public VanillaOre(BlockState material, double size, MaterialSet replaceable, boolean applyGravity,
|
||||||
Map<BlockType, BlockState> materials) {
|
boolean exposed, Map<BlockType, BlockState> materials) {
|
||||||
this.material = material;
|
this.material = material;
|
||||||
this.size = size;
|
this.size = size;
|
||||||
this.replaceable = replaceable;
|
this.replaceable = replaceable;
|
||||||
this.applyGravity = applyGravity;
|
this.applyGravity = applyGravity;
|
||||||
|
this.exposed = exposed;
|
||||||
this.materials = materials;
|
this.materials = materials;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -84,7 +86,14 @@ public class VanillaOre implements Structure {
|
|||||||
if(y >= world.getMaxHeight() || y < world.getMinHeight()) continue;
|
if(y >= world.getMaxHeight() || y < world.getMinHeight()) continue;
|
||||||
BlockType block = world.getBlockState(x, y, z).getBlockType();
|
BlockType block = world.getBlockState(x, y, z).getBlockType();
|
||||||
if((d13 * d13 + d14 * d14 + d15 * d15 < 1.0D) && getReplaceable().contains(block)) {
|
if((d13 * d13 + d14 * d14 + d15 * d15 < 1.0D) && getReplaceable().contains(block)) {
|
||||||
world.setBlockState(x, y, z, getMaterial(block), isApplyGravity());
|
if(exposed || !(world.getBlockState(x, y, z - 1).isAir() ||
|
||||||
|
world.getBlockState(x, y, z + 1).isAir() ||
|
||||||
|
world.getBlockState(x, y - 1, z).isAir() ||
|
||||||
|
world.getBlockState(x, y + 1, z).isAir() ||
|
||||||
|
world.getBlockState(x - 1, y, z).isAir() ||
|
||||||
|
world.getBlockState(x + 1, y, z).isAir())) {
|
||||||
|
world.setBlockState(x, y, z, getMaterial(block), isApplyGravity());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user