This commit is contained in:
dfsek 2021-11-17 16:28:40 -07:00
parent a76e583c51
commit 34acf03564
3 changed files with 7 additions and 9 deletions

View File

@ -10,7 +10,6 @@ import com.dfsek.terra.api.event.functional.FunctionalEventHandler;
import com.dfsek.terra.api.inject.annotations.Inject;
public class FloraAddon implements AddonInitializer {
@Inject
private Platform platform;
@ -24,9 +23,9 @@ public class FloraAddon implements AddonInitializer {
.getHandler(FunctionalEventHandler.class)
.register(addon, ConfigPackPreLoadEvent.class)
.then(event -> {
event.getPack().registerConfigType(new FloraConfigType(), "FLORA", 2);
event.getPack().applyLoader(BlockLayer.class, BlockLayerTemplate::new);
})
event.getPack().registerConfigType(new FloraConfigType(), "FLORA", 2);
event.getPack().applyLoader(BlockLayer.class, BlockLayerTemplate::new);
})
.failThrough();
}
}

View File

@ -7,7 +7,6 @@ import com.dfsek.tectonic.annotations.Value;
import java.util.List;
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.meta.Meta;
import com.dfsek.terra.api.noise.NoiseSampler;

View File

@ -40,7 +40,7 @@ public class TerraFlora implements Structure {
this.ceiling = ceiling;
this.distribution = distribution;
this.id = id;
this.layers = new ArrayList<>();
layers.forEach(layer -> {
for(int i = 0; i < layer.getLayers(); i++) {
@ -88,10 +88,10 @@ public class TerraFlora implements Structure {
boolean doRotation = testRotation.size() > 0;
int size = layers.size();
int c = ceiling ? -1 : 1;
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.
for(int i = 0; FastMath.abs(i) < size; i += c) { // Down if ceiling, up if floor
int lvl = (FastMath.abs(i));
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) {
Direction oneFace = new ArrayList<>(faces).get(
new Random(location.getBlockX() ^ location.getBlockZ()).nextInt(faces.size())); // Get random face.
data.setIfPresent(Properties.DIRECTION, oneFace.opposite())
.setIfPresent(Properties.NORTH, faces.contains(Direction.NORTH))
.setIfPresent(Properties.SOUTH, faces.contains(Direction.SOUTH))