mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2025-07-03 16:35:50 +00:00
format
This commit is contained in:
parent
a76e583c51
commit
34acf03564
@ -10,7 +10,6 @@ import com.dfsek.terra.api.event.functional.FunctionalEventHandler;
|
|||||||
import com.dfsek.terra.api.inject.annotations.Inject;
|
import com.dfsek.terra.api.inject.annotations.Inject;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public class FloraAddon implements AddonInitializer {
|
public class FloraAddon implements AddonInitializer {
|
||||||
@Inject
|
@Inject
|
||||||
private Platform platform;
|
private Platform platform;
|
||||||
@ -24,9 +23,9 @@ public class FloraAddon implements AddonInitializer {
|
|||||||
.getHandler(FunctionalEventHandler.class)
|
.getHandler(FunctionalEventHandler.class)
|
||||||
.register(addon, ConfigPackPreLoadEvent.class)
|
.register(addon, ConfigPackPreLoadEvent.class)
|
||||||
.then(event -> {
|
.then(event -> {
|
||||||
event.getPack().registerConfigType(new FloraConfigType(), "FLORA", 2);
|
event.getPack().registerConfigType(new FloraConfigType(), "FLORA", 2);
|
||||||
event.getPack().applyLoader(BlockLayer.class, BlockLayerTemplate::new);
|
event.getPack().applyLoader(BlockLayer.class, BlockLayerTemplate::new);
|
||||||
})
|
})
|
||||||
.failThrough();
|
.failThrough();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,6 @@ import com.dfsek.tectonic.annotations.Value;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import com.dfsek.terra.addons.flora.flora.gen.BlockLayer;
|
import com.dfsek.terra.addons.flora.flora.gen.BlockLayer;
|
||||||
import com.dfsek.terra.addons.flora.flora.gen.TerraFlora;
|
|
||||||
import com.dfsek.terra.api.config.AbstractableTemplate;
|
import com.dfsek.terra.api.config.AbstractableTemplate;
|
||||||
import com.dfsek.terra.api.config.meta.Meta;
|
import com.dfsek.terra.api.config.meta.Meta;
|
||||||
import com.dfsek.terra.api.noise.NoiseSampler;
|
import com.dfsek.terra.api.noise.NoiseSampler;
|
||||||
|
@ -40,7 +40,7 @@ public class TerraFlora implements Structure {
|
|||||||
this.ceiling = ceiling;
|
this.ceiling = ceiling;
|
||||||
this.distribution = distribution;
|
this.distribution = distribution;
|
||||||
this.id = id;
|
this.id = id;
|
||||||
|
|
||||||
this.layers = new ArrayList<>();
|
this.layers = new ArrayList<>();
|
||||||
layers.forEach(layer -> {
|
layers.forEach(layer -> {
|
||||||
for(int i = 0; i < layer.getLayers(); i++) {
|
for(int i = 0; i < layer.getLayers(); i++) {
|
||||||
@ -88,10 +88,10 @@ public class TerraFlora implements Structure {
|
|||||||
boolean doRotation = testRotation.size() > 0;
|
boolean doRotation = testRotation.size() > 0;
|
||||||
int size = layers.size();
|
int size = layers.size();
|
||||||
int c = ceiling ? -1 : 1;
|
int c = ceiling ? -1 : 1;
|
||||||
|
|
||||||
EnumSet<Direction> faces = doRotation ? getFaces(location.clone().add(0, c, 0), world) : EnumSet.noneOf(Direction.class);
|
EnumSet<Direction> faces = doRotation ? getFaces(location.clone().add(0, c, 0), world) : EnumSet.noneOf(Direction.class);
|
||||||
if(doRotation && faces.size() == 0) return false; // Don't plant if no faces are valid.
|
if(doRotation && faces.size() == 0) return false; // Don't plant if no faces are valid.
|
||||||
|
|
||||||
for(int i = 0; FastMath.abs(i) < size; i += c) { // Down if ceiling, up if floor
|
for(int i = 0; FastMath.abs(i) < size; i += c) { // Down if ceiling, up if floor
|
||||||
int lvl = (FastMath.abs(i));
|
int lvl = (FastMath.abs(i));
|
||||||
BlockState data = getStateCollection((ceiling ? lvl : size - lvl - 1)).get(distribution, location.getX(), location.getY(),
|
BlockState data = getStateCollection((ceiling ? lvl : size - lvl - 1)).get(distribution, location.getX(), location.getY(),
|
||||||
@ -99,7 +99,7 @@ public class TerraFlora implements Structure {
|
|||||||
if(doRotation) {
|
if(doRotation) {
|
||||||
Direction oneFace = new ArrayList<>(faces).get(
|
Direction oneFace = new ArrayList<>(faces).get(
|
||||||
new Random(location.getBlockX() ^ location.getBlockZ()).nextInt(faces.size())); // Get random face.
|
new Random(location.getBlockX() ^ location.getBlockZ()).nextInt(faces.size())); // Get random face.
|
||||||
|
|
||||||
data.setIfPresent(Properties.DIRECTION, oneFace.opposite())
|
data.setIfPresent(Properties.DIRECTION, oneFace.opposite())
|
||||||
.setIfPresent(Properties.NORTH, faces.contains(Direction.NORTH))
|
.setIfPresent(Properties.NORTH, faces.contains(Direction.NORTH))
|
||||||
.setIfPresent(Properties.SOUTH, faces.contains(Direction.SOUTH))
|
.setIfPresent(Properties.SOUTH, faces.contains(Direction.SOUTH))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user