mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2026-04-21 07:40:27 +00:00
reformat
This commit is contained in:
@@ -9,6 +9,10 @@ package com.dfsek.terra.addons.terrascript;
|
||||
|
||||
import com.dfsek.tectonic.api.exception.LoadException;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.lang.reflect.Type;
|
||||
import java.util.Map;
|
||||
|
||||
import com.dfsek.terra.addons.manifest.api.AddonInitializer;
|
||||
import com.dfsek.terra.addons.terrascript.parser.exceptions.ParseException;
|
||||
import com.dfsek.terra.addons.terrascript.parser.lang.functions.FunctionBuilder;
|
||||
@@ -23,10 +27,6 @@ import com.dfsek.terra.api.structure.LootTable;
|
||||
import com.dfsek.terra.api.structure.Structure;
|
||||
import com.dfsek.terra.api.util.StringUtil;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.lang.reflect.Type;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
public class TerraScriptAddon implements AddonInitializer {
|
||||
@Inject
|
||||
|
||||
@@ -7,6 +7,9 @@
|
||||
|
||||
package com.dfsek.terra.addons.terrascript.buffer.items;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import com.dfsek.terra.addons.terrascript.script.StructureScript;
|
||||
@@ -17,20 +20,15 @@ import com.dfsek.terra.api.event.events.world.generation.LootPopulateEvent;
|
||||
import com.dfsek.terra.api.structure.LootTable;
|
||||
import com.dfsek.terra.api.structure.buffer.BufferedItem;
|
||||
import com.dfsek.terra.api.util.vector.Vector3;
|
||||
|
||||
import com.dfsek.terra.api.world.WritableWorld;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
|
||||
public class BufferedLootApplication implements BufferedItem {
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(BufferedLootApplication.class);
|
||||
private final LootTable table;
|
||||
private final Platform platform;
|
||||
private final StructureScript structure;
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(BufferedLootApplication.class);
|
||||
|
||||
public BufferedLootApplication(LootTable table, Platform platform, StructureScript structure) {
|
||||
this.table = table;
|
||||
this.platform = platform;
|
||||
@@ -45,7 +43,7 @@ public class BufferedLootApplication implements BufferedItem {
|
||||
LOGGER.error("Failed to place loot at {}; block {} is not a container", origin, data);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
LootPopulateEvent event = new LootPopulateEvent(container, table, world.getPack(), structure);
|
||||
platform.getEventManager().callEvent(event);
|
||||
if(event.isCancelled()) return;
|
||||
|
||||
@@ -7,20 +7,18 @@
|
||||
|
||||
package com.dfsek.terra.addons.terrascript.buffer.items;
|
||||
|
||||
import com.dfsek.terra.api.block.entity.BlockEntity;
|
||||
import com.dfsek.terra.api.structure.buffer.BufferedItem;
|
||||
import com.dfsek.terra.api.util.vector.Vector3;
|
||||
|
||||
import com.dfsek.terra.api.world.WritableWorld;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import com.dfsek.terra.api.block.entity.BlockEntity;
|
||||
import com.dfsek.terra.api.structure.buffer.BufferedItem;
|
||||
import com.dfsek.terra.api.util.vector.Vector3;
|
||||
import com.dfsek.terra.api.world.WritableWorld;
|
||||
|
||||
|
||||
public class BufferedStateManipulator implements BufferedItem {
|
||||
private final String data;
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(BufferedStateManipulator.class);
|
||||
private final String data;
|
||||
|
||||
public BufferedStateManipulator(String state) {
|
||||
this.data = state;
|
||||
|
||||
@@ -7,10 +7,10 @@
|
||||
|
||||
package com.dfsek.terra.addons.terrascript.parser.exceptions;
|
||||
|
||||
import com.dfsek.terra.addons.terrascript.tokenizer.Position;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
import com.dfsek.terra.addons.terrascript.tokenizer.Position;
|
||||
|
||||
|
||||
public class ParseException extends RuntimeException {
|
||||
@Serial
|
||||
|
||||
@@ -57,13 +57,12 @@ import com.dfsek.terra.api.world.chunk.Chunk;
|
||||
|
||||
|
||||
public class StructureScript implements Structure {
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(StructureScript.class);
|
||||
private final Block block;
|
||||
private final String id;
|
||||
private final Cache<Vector3, StructureBuffer> cache;
|
||||
private final Platform platform;
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(StructureScript.class);
|
||||
|
||||
public StructureScript(InputStream inputStream, String id, Platform platform, Registry<Structure> registry,
|
||||
Registry<LootTable> lootRegistry,
|
||||
Registry<FunctionBuilder<?>> functionRegistry) {
|
||||
|
||||
@@ -30,6 +30,7 @@ import com.dfsek.terra.api.util.vector.Vector3;
|
||||
|
||||
|
||||
public class LootFunction implements Function<Void> {
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(LootFunction.class);
|
||||
private final Registry<LootTable> registry;
|
||||
private final Returnable<String> data;
|
||||
private final Returnable<Number> x, y, z;
|
||||
@@ -37,8 +38,6 @@ public class LootFunction implements Function<Void> {
|
||||
private final Platform platform;
|
||||
private final StructureScript script;
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(LootFunction.class);
|
||||
|
||||
public LootFunction(Registry<LootTable> registry, Returnable<Number> x, Returnable<Number> y, Returnable<Number> z,
|
||||
Returnable<String> data, Platform platform, Position position, StructureScript script) {
|
||||
this.registry = registry;
|
||||
|
||||
@@ -8,6 +8,8 @@
|
||||
package com.dfsek.terra.addons.terrascript.script.functions;
|
||||
|
||||
import net.jafama.FastMath;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -27,19 +29,16 @@ import com.dfsek.terra.api.util.RotationUtil;
|
||||
import com.dfsek.terra.api.util.vector.Vector2;
|
||||
import com.dfsek.terra.api.util.vector.Vector3;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
|
||||
public class StructureFunction implements Function<Boolean> {
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(StructureFunction.class);
|
||||
private final Registry<Structure> registry;
|
||||
private final Returnable<String> id;
|
||||
private final Returnable<Number> x, y, z;
|
||||
private final Position position;
|
||||
private final Platform platform;
|
||||
private final List<Returnable<String>> rotations;
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(StructureFunction.class);
|
||||
|
||||
public StructureFunction(Returnable<Number> x, Returnable<Number> y, Returnable<Number> z, Returnable<String> id,
|
||||
List<Returnable<String>> rotations, Registry<Structure> registry, Position position, Platform platform) {
|
||||
this.registry = registry;
|
||||
@@ -79,10 +78,10 @@ public class StructureFunction implements Function<Boolean> {
|
||||
LOGGER.warn("Invalid rotation {}", rotString);
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
Vector3 offset = new Vector3(FastMath.roundToInt(xz.getX()), y.apply(implementationArguments, variableMap).doubleValue(),
|
||||
FastMath.roundToInt(xz.getZ()));
|
||||
|
||||
|
||||
return script.generate(new IntermediateBuffer(arguments.getBuffer(), offset), arguments.getWorld(), arguments.getRandom(),
|
||||
arguments.getRotation().rotate(rotation1), arguments.getRecursions() + 1);
|
||||
}).orElseGet(() -> {
|
||||
|
||||
@@ -7,10 +7,10 @@
|
||||
|
||||
package com.dfsek.terra.addons.terrascript.tokenizer.exceptions;
|
||||
|
||||
import com.dfsek.terra.addons.terrascript.tokenizer.Position;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
import com.dfsek.terra.addons.terrascript.tokenizer.Position;
|
||||
|
||||
|
||||
public class EOFException extends TokenizerException {
|
||||
|
||||
|
||||
@@ -7,10 +7,10 @@
|
||||
|
||||
package com.dfsek.terra.addons.terrascript.tokenizer.exceptions;
|
||||
|
||||
import com.dfsek.terra.addons.terrascript.tokenizer.Position;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
import com.dfsek.terra.addons.terrascript.tokenizer.Position;
|
||||
|
||||
|
||||
public class FormatException extends TokenizerException {
|
||||
|
||||
|
||||
@@ -7,11 +7,11 @@
|
||||
|
||||
package com.dfsek.terra.addons.terrascript.tokenizer.exceptions;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
import com.dfsek.terra.addons.terrascript.parser.exceptions.ParseException;
|
||||
import com.dfsek.terra.addons.terrascript.tokenizer.Position;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
|
||||
public abstract class TokenizerException extends ParseException {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user