Change Java whitespace handling in .editorconfig (#425)

* Change whitespace handling in .editorconfig

* Reformat code

* fix format error

* Reformat code

---------

Co-authored-by: Zoë Gidiere <duplexsys@protonmail.com>
This commit is contained in:
Astrashh
2023-11-13 11:57:01 +11:00
committed by GitHub
parent a73fda7d04
commit defd775f13
793 changed files with 7579 additions and 7577 deletions
@@ -20,19 +20,19 @@ import com.dfsek.terra.api.inject.annotations.Inject;
public class FloraAddon implements AddonInitializer {
@Inject
private Platform platform;
@Inject
private BaseAddon addon;
@Override
public void initialize() {
platform.getEventManager()
.getHandler(FunctionalEventHandler.class)
.register(addon, ConfigPackPreLoadEvent.class)
.then(event -> {
event.getPack().registerConfigType(new FloraConfigType(), addon.key("FLORA"), 2);
event.getPack().applyLoader(BlockLayer.class, BlockLayerTemplate::new);
})
.failThrough();
.getHandler(FunctionalEventHandler.class)
.register(addon, ConfigPackPreLoadEvent.class)
.then(event -> {
event.getPack().registerConfigType(new FloraConfigType(), addon.key("FLORA"), 2);
event.getPack().applyLoader(BlockLayer.class, BlockLayerTemplate::new);
})
.failThrough();
}
}
@@ -19,17 +19,17 @@ public class FloraConfigType implements ConfigType<FloraTemplate, Structure> {
public static final TypeKey<Structure> FLORA_TYPE_TOKEN = new TypeKey<>() {
};
private final FloraFactory factory = new FloraFactory();
@Override
public FloraTemplate getTemplate(ConfigPack pack, Platform platform) {
return new FloraTemplate();
}
@Override
public ConfigFactory<FloraTemplate, Structure> getFactory() {
return factory;
}
@Override
public TypeKey<Structure> getTypeKey() {
return FLORA_TYPE_TOKEN;
@@ -17,7 +17,7 @@ public class FloraFactory implements ConfigFactory<FloraTemplate, Structure> {
@Override
public TerraFlora build(FloraTemplate config, Platform platform) {
return new TerraFlora(config.getLayers(), config.doPhysics(), config.isCeiling(),
config.getRotatable(),
config.getNoiseDistribution(), config.getID());
config.getRotatable(),
config.getNoiseDistribution(), config.getID());
}
}
@@ -28,41 +28,41 @@ public class FloraTemplate implements AbstractableTemplate {
@Value("rotatable")
@Default
private @Meta MaterialSet rotatable = MaterialSet.empty();
@Value("physics")
@Default
private @Meta boolean doPhysics = false;
@Value("ceiling")
@Default
private @Meta boolean ceiling = false;
@Value("layers")
private @Meta List<@Meta BlockLayer> layers;
@Value("layer-distribution")
private @Meta NoiseSampler noiseDistribution;
public boolean doPhysics() {
return doPhysics;
}
public NoiseSampler getNoiseDistribution() {
return noiseDistribution;
}
public List<BlockLayer> getLayers() {
return layers;
}
public String getID() {
return id;
}
public boolean isCeiling() {
return ceiling;
}
public MaterialSet getRotatable() {
return rotatable;
}
@@ -19,10 +19,10 @@ import com.dfsek.terra.api.util.collection.ProbabilityCollection;
public class BlockLayerTemplate implements ObjectTemplate<BlockLayer> {
@Value("layers")
private @Meta int layers;
@Value("materials")
private @Meta ProbabilityCollection<BlockState> data;
@Override
public BlockLayer get() {
return new BlockLayer(layers, data);
@@ -14,16 +14,16 @@ import com.dfsek.terra.api.util.collection.ProbabilityCollection;
public class BlockLayer {
private final int layers;
private final ProbabilityCollection<BlockState> blocks;
public BlockLayer(int layers, ProbabilityCollection<BlockState> blocks) {
this.layers = layers;
this.blocks = blocks;
}
public int getLayers() {
return layers;
}
public ProbabilityCollection<BlockState> getBlocks() {
return blocks;
}
@@ -27,13 +27,13 @@ public class TerraFlora implements Structure {
private final List<ProbabilityCollection<BlockState>> layers;
private final boolean physics;
private final boolean ceiling;
private final MaterialSet testRotation;
private final NoiseSampler distribution;
private final String id;
public TerraFlora(List<BlockLayer> layers, boolean physics, boolean ceiling,
MaterialSet testRotation,
NoiseSampler distribution, String id) {
@@ -42,7 +42,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++) {
@@ -50,17 +50,17 @@ public class TerraFlora implements Structure {
}
});
}
private void test(EnumSet<Direction> faces, Direction f, Vector3Int b, WritableWorld world) {
if(testRotation.contains(
world.getBlockState(b.getX() + f.getModX(), b.getY() + f.getModY(), b.getZ() + f.getModZ()).getBlockType()))
world.getBlockState(b.getX() + f.getModX(), b.getY() + f.getModY(), b.getZ() + f.getModZ()).getBlockType()))
faces.add(f);
}
private ProbabilityCollection<BlockState> getStateCollection(int layer) {
return layers.get(Math.max(Math.min(layer, layers.size() - 1), 0));
}
private EnumSet<Direction> getFaces(Vector3Int b, WritableWorld world) {
EnumSet<Direction> faces = EnumSet.noneOf(Direction.class);
test(faces, Direction.NORTH, b, world);
@@ -69,24 +69,24 @@ public class TerraFlora implements Structure {
test(faces, Direction.WEST, b, world);
return faces;
}
@Override
public boolean generate(Vector3Int location, WritableWorld world, Random random, Rotation rotation) {
boolean doRotation = testRotation.size() > 0;
int size = layers.size();
int c = ceiling ? -1 : 1;
EnumSet<Direction> faces = doRotation ? getFaces(location.mutable().add(0, c, 0).immutable(), world) : EnumSet.noneOf(
Direction.class);
Direction.class);
if(doRotation && faces.size() == 0) return false; // Don't plant if no faces are valid.
for(int i = 0; Math.abs(i) < size; i += c) { // Down if ceiling, up if floor
int lvl = (Math.abs(i));
BlockState data = getStateCollection((ceiling ? lvl : size - lvl - 1)).get(distribution, location.getX(), location.getY(),
location.getZ(), world.getSeed());
location.getZ(), world.getSeed());
if(doRotation) {
Direction oneFace = new ArrayList<>(faces).get(
new Random(location.getX() ^ location.getZ()).nextInt(faces.size())); // Get random face.
new Random(location.getX() ^ location.getZ()).nextInt(faces.size())); // Get random face.
}
world.setBlockState(location.mutable().add(0, i + c, 0).immutable(), data, physics);
}