Worldgen, Configs
This commit is contained in:
@@ -33,18 +33,32 @@ import java.util.stream.Collectors;
|
||||
public final class AEConfig {
|
||||
|
||||
public final ClientConfig clientConfig;
|
||||
public final ConfigFileManager clientConfigManager;
|
||||
public final CommonConfig commonConfig;
|
||||
public final ConfigFileManager commonConfigManager;
|
||||
|
||||
AEConfig(File configDir) {
|
||||
ConfigSection clientRoot = ConfigSection.createRoot();
|
||||
clientConfig = new ClientConfig(clientRoot);
|
||||
syncClientConfig();
|
||||
clientConfigManager = createConfigFileManager(clientRoot, configDir, "appliedenergistics2/client.json");
|
||||
|
||||
ConfigSection commonRoot = ConfigSection.createRoot();
|
||||
commonConfig = new CommonConfig(commonRoot);
|
||||
syncCommonConfig();
|
||||
commonConfigManager = createConfigFileManager(commonRoot, configDir, "appliedenergistics2/common.json");
|
||||
|
||||
// FIXME config loading/saving
|
||||
syncClientConfig();
|
||||
syncCommonConfig();
|
||||
}
|
||||
|
||||
private static ConfigFileManager createConfigFileManager(ConfigSection commonRoot, File configDir, String filename) {
|
||||
File configFile = new File(configDir, filename);
|
||||
ConfigFileManager result = new ConfigFileManager(commonRoot, configFile);
|
||||
if (!configFile.exists()) {
|
||||
result.save(); // Save a default file
|
||||
} else {
|
||||
result.load();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
// Default Energy Conversion Rates
|
||||
|
||||
@@ -33,10 +33,12 @@ import appeng.items.tools.NetworkToolItem;
|
||||
import appeng.me.cache.*;
|
||||
import appeng.mixins.CriteriaRegisterMixin;
|
||||
import appeng.recipes.handlers.*;
|
||||
import appeng.server.AECommand;
|
||||
import appeng.worldgen.ChargedQuartzOreConfig;
|
||||
import appeng.worldgen.ChargedQuartzOreFeature;
|
||||
import appeng.worldgen.meteorite.MeteoriteStructure;
|
||||
import net.earthcomputer.libstructure.LibStructure;
|
||||
import net.fabricmc.fabric.api.command.v1.CommandRegistrationCallback;
|
||||
import net.fabricmc.fabric.api.screenhandler.v1.ScreenHandlerRegistry;
|
||||
import net.fabricmc.loader.api.FabricLoader;
|
||||
import net.minecraft.block.BlockState;
|
||||
@@ -56,7 +58,10 @@ import net.minecraft.world.gen.chunk.StructureConfig;
|
||||
import net.minecraft.world.gen.decorator.Decorator;
|
||||
import net.minecraft.world.gen.decorator.NopeDecoratorConfig;
|
||||
import net.minecraft.world.gen.decorator.RangeDecoratorConfig;
|
||||
import net.minecraft.world.gen.feature.*;
|
||||
import net.minecraft.world.gen.feature.DefaultFeatureConfig;
|
||||
import net.minecraft.world.gen.feature.Feature;
|
||||
import net.minecraft.world.gen.feature.FeatureConfig;
|
||||
import net.minecraft.world.gen.feature.OreFeatureConfig;
|
||||
|
||||
import java.util.function.Consumer;
|
||||
|
||||
@@ -90,10 +95,10 @@ public abstract class AppEngBase implements AppEng {
|
||||
registerRecipeTypes();
|
||||
registerRecipeSerializers();
|
||||
registerWorldGen();
|
||||
registerServerCommands();
|
||||
|
||||
setupInternalRegistries();
|
||||
|
||||
|
||||
}
|
||||
|
||||
public static void setupInternalRegistries() {
|
||||
@@ -350,4 +355,11 @@ public abstract class AppEngBase implements AppEng {
|
||||
}
|
||||
}
|
||||
|
||||
private void registerServerCommands() {
|
||||
// The server commands need to know what the current minecraft server is.
|
||||
CommandRegistrationCallback.EVENT.register((dispatcher, dedicated) -> {
|
||||
new AECommand().register(dispatcher);
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,65 @@
|
||||
package appeng.core.config;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import com.google.gson.JsonObject;
|
||||
|
||||
import java.io.*;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.nio.file.Files;
|
||||
|
||||
public class ConfigFileManager {
|
||||
|
||||
private static Gson GSON = new GsonBuilder()
|
||||
.setPrettyPrinting()
|
||||
.setLenient()
|
||||
.create();
|
||||
|
||||
private final ConfigSection rootSection;
|
||||
|
||||
private final File file;
|
||||
|
||||
private boolean loading;
|
||||
|
||||
public ConfigFileManager(ConfigSection rootSection, File file) {
|
||||
this.rootSection = rootSection;
|
||||
this.file = file;
|
||||
rootSection.setChangeListener(() -> {
|
||||
if (!loading) {
|
||||
save();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void load() {
|
||||
loading = true;
|
||||
try (InputStream in = new FileInputStream(file)) {
|
||||
JsonObject rootObj = GSON.fromJson(new InputStreamReader(in, StandardCharsets.UTF_8), JsonObject.class);
|
||||
rootSection.read(rootObj);
|
||||
} catch (FileNotFoundException ignored) {
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException("Failed to load AE2 config: " + file, e);
|
||||
} finally {
|
||||
loading = false;
|
||||
}
|
||||
}
|
||||
|
||||
public void save() {
|
||||
File parent = file.getParentFile();
|
||||
if (parent != null && !parent.exists()) {
|
||||
try {
|
||||
Files.createDirectories(parent.toPath());
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException("Failed to create AE2 config directory: " + parent);
|
||||
}
|
||||
}
|
||||
|
||||
try (OutputStreamWriter writer = new OutputStreamWriter(new FileOutputStream(file), StandardCharsets.UTF_8)) {
|
||||
GSON.toJson(rootSection.write(), writer);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException("Failed to write AE2 config: " + file, e);
|
||||
}
|
||||
rootSection.write();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,11 +1,18 @@
|
||||
package appeng.core.config;
|
||||
|
||||
import com.google.gson.JsonObject;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class ConfigSection {
|
||||
|
||||
private final ConfigSection parent;
|
||||
|
||||
private final List<ConfigSection> subsections = new ArrayList<>();
|
||||
|
||||
private final List<BaseOption> options = new ArrayList<>();
|
||||
|
||||
private final String id;
|
||||
|
||||
private final String fullId;
|
||||
@@ -41,7 +48,14 @@ public class ConfigSection {
|
||||
}
|
||||
|
||||
public ConfigSection subsection(String id, String comment) {
|
||||
return new ConfigSection(this, id, comment);
|
||||
ConfigSection section = new ConfigSection(this, id, comment);
|
||||
subsections.add(section);
|
||||
return section;
|
||||
}
|
||||
|
||||
private <T extends BaseOption> T addOption(T option) {
|
||||
this.options.add(option);
|
||||
return option;
|
||||
}
|
||||
|
||||
public IntegerOption addInt(String id, int defaultValue) {
|
||||
@@ -53,7 +67,7 @@ public class ConfigSection {
|
||||
}
|
||||
|
||||
public IntegerOption addInt(String id, int defaultValue, int minValue, int maxValue, String comment) {
|
||||
return new IntegerOption(this, id, comment, defaultValue, minValue, maxValue);
|
||||
return addOption(new IntegerOption(this, id, comment, defaultValue, minValue, maxValue));
|
||||
}
|
||||
|
||||
public DoubleOption addDouble(String id, double defaultValue) {
|
||||
@@ -69,7 +83,7 @@ public class ConfigSection {
|
||||
}
|
||||
|
||||
public DoubleOption addDouble(String id, double defaultValue, double minValue, double maxValue, String comment) {
|
||||
return new DoubleOption(this, id, comment, defaultValue, minValue, maxValue);
|
||||
return addOption(new DoubleOption(this, id, comment, defaultValue, minValue, maxValue));
|
||||
}
|
||||
|
||||
public BooleanOption addBoolean(String id, boolean defaultValue) {
|
||||
@@ -77,7 +91,7 @@ public class ConfigSection {
|
||||
}
|
||||
|
||||
public BooleanOption addBoolean(String id, boolean defaultValue, String comment) {
|
||||
return new BooleanOption(this, id, comment, defaultValue);
|
||||
return addOption(new BooleanOption(this, id, comment, defaultValue));
|
||||
}
|
||||
|
||||
public StringListOption addStringList(String id, List<String> defaultValue) {
|
||||
@@ -85,7 +99,7 @@ public class ConfigSection {
|
||||
}
|
||||
|
||||
public StringListOption addStringList(String id, List<String> defaultValue, String comment) {
|
||||
return new StringListOption(this, id, comment, defaultValue);
|
||||
return addOption(new StringListOption(this, id, comment, defaultValue));
|
||||
}
|
||||
|
||||
public <T extends Enum<T>> EnumOption<T> addEnum(String id, T defaultValue) {
|
||||
@@ -93,7 +107,7 @@ public class ConfigSection {
|
||||
}
|
||||
|
||||
public <T extends Enum<T>> EnumOption<T> addEnum(String id, T defaultValue, String comment) {
|
||||
return new EnumOption<>(this, id, comment, defaultValue);
|
||||
return addOption(new EnumOption<>(this, id, comment, defaultValue));
|
||||
}
|
||||
|
||||
public void setChangeListener(Runnable changeListener) {
|
||||
@@ -109,5 +123,41 @@ public class ConfigSection {
|
||||
}
|
||||
}
|
||||
|
||||
public JsonObject write() {
|
||||
JsonObject obj = new JsonObject();
|
||||
|
||||
if (comment != null) {
|
||||
obj.addProperty("__comment", comment);
|
||||
}
|
||||
|
||||
for (BaseOption option : options) {
|
||||
if (option.comment != null) {
|
||||
obj.addProperty("__comment", option.comment);
|
||||
}
|
||||
obj.add(option.id, option.write());
|
||||
}
|
||||
|
||||
for (ConfigSection subsection : subsections) {
|
||||
obj.add(subsection.id, subsection.write());
|
||||
}
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
public void read(JsonObject obj) {
|
||||
|
||||
for (BaseOption option : options) {
|
||||
if (obj.has(option.id)) {
|
||||
option.read(obj.get(option.id));
|
||||
}
|
||||
}
|
||||
|
||||
for (ConfigSection subsection : subsections) {
|
||||
if (obj.has(subsection.id)) {
|
||||
subsection.read(obj.getAsJsonObject(subsection.id));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+8
-7
@@ -18,16 +18,16 @@
|
||||
|
||||
package appeng.server;
|
||||
|
||||
import static net.minecraft.server.command.CommandManager.literal;
|
||||
import appeng.api.features.AEFeature;
|
||||
import appeng.core.AEConfig;
|
||||
import appeng.core.AppEng;
|
||||
|
||||
import com.mojang.brigadier.CommandDispatcher;
|
||||
import com.mojang.brigadier.builder.LiteralArgumentBuilder;
|
||||
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.server.command.ServerCommandSource;
|
||||
import net.minecraftforge.fml.server.ServerLifecycleHooks;
|
||||
|
||||
import appeng.api.features.AEFeature;
|
||||
import appeng.core.AEConfig;
|
||||
import static net.minecraft.server.command.CommandManager.literal;
|
||||
|
||||
public final class AECommand {
|
||||
|
||||
@@ -44,13 +44,14 @@ public final class AECommand {
|
||||
dispatcher.register(builder);
|
||||
}
|
||||
|
||||
private void add(LiteralArgumentBuilder<net.minecraft.server.command.ServerCommandSource> builder, Commands subCommand) {
|
||||
private void add(LiteralArgumentBuilder<ServerCommandSource> builder, Commands subCommand) {
|
||||
|
||||
LiteralArgumentBuilder<ServerCommandSource> subCommandBuilder = literal(subCommand.name().toLowerCase())
|
||||
.requires(src -> src.hasPermissionLevel(subCommand.level));
|
||||
subCommand.command.addArguments(subCommandBuilder);
|
||||
subCommandBuilder.executes(ctx -> {
|
||||
subCommand.command.call(ServerLifecycleHooks.getCurrentServer(), ctx, ctx.getSource());
|
||||
MinecraftServer server = AppEng.instance().getServer();
|
||||
subCommand.command.call(server, ctx, ctx.getSource());
|
||||
return 1;
|
||||
});
|
||||
builder.then(subCommandBuilder);
|
||||
+30
-23
@@ -20,22 +20,41 @@ package appeng.server.subcommands;
|
||||
|
||||
import com.mojang.brigadier.context.CommandContext;
|
||||
|
||||
import net.fabricmc.fabric.api.event.lifecycle.v1.ServerChunkEvents;
|
||||
import net.minecraft.server.command.ServerCommandSource;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.server.world.ServerWorld;
|
||||
import net.minecraft.text.TranslatableText;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.event.world.ChunkEvent;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
|
||||
import appeng.api.features.AEFeature;
|
||||
import appeng.core.AEConfig;
|
||||
import appeng.core.AELog;
|
||||
import appeng.server.ISubCommand;
|
||||
import net.minecraft.world.chunk.WorldChunk;
|
||||
|
||||
public class ChunkLogger implements ISubCommand {
|
||||
|
||||
private boolean enabled = false;
|
||||
|
||||
// Since we cannot unregister a listener once it's registered, but
|
||||
// we still only want to register it if the command is ever used we track it here
|
||||
private boolean listenerRegistered = false;
|
||||
|
||||
private void onChunkLoadEvent(ServerWorld world, WorldChunk chunk) {
|
||||
if (!this.enabled) {
|
||||
return;
|
||||
}
|
||||
AELog.info("Chunk Loaded: " + chunk.getPos().x + ", " + chunk.getPos().z);
|
||||
this.displayStack();
|
||||
}
|
||||
|
||||
private void onChunkUnloadEvent(ServerWorld world, WorldChunk chunk) {
|
||||
if (!this.enabled) {
|
||||
return;
|
||||
}
|
||||
AELog.info("Chunk Unloaded: " + chunk.getPos().x + ", " + chunk.getPos().z);
|
||||
this.displayStack();
|
||||
}
|
||||
|
||||
private void displayStack() {
|
||||
if (AEConfig.instance().isFeatureEnabled(AEFeature.CHUNK_LOGGER_TRACE)) {
|
||||
boolean output = false;
|
||||
@@ -50,31 +69,19 @@ public class ChunkLogger implements ISubCommand {
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onChunkLoadEvent(final ChunkEvent.Load event) {
|
||||
if (!event.getWorld().isClient()) {
|
||||
AELog.info("Chunk Loaded: " + event.getChunk().getPos().x + ", " + event.getChunk().getPos().z);
|
||||
this.displayStack();
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onChunkUnloadEvent(final ChunkEvent.Unload unload) {
|
||||
if (!unload.getWorld().isClient()) {
|
||||
AELog.info("Chunk Unloaded: " + unload.getChunk().getPos().x + ", " + unload.getChunk().getPos().z);
|
||||
this.displayStack();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void call(final MinecraftServer srv, final CommandContext<ServerCommandSource> data, final ServerCommandSource sender) {
|
||||
public synchronized void call(final MinecraftServer srv, final CommandContext<ServerCommandSource> data, final ServerCommandSource sender) {
|
||||
this.enabled = !this.enabled;
|
||||
|
||||
if (this.enabled) {
|
||||
MinecraftForge.EVENT_BUS.register(this);
|
||||
if (!this.listenerRegistered) {
|
||||
ServerChunkEvents.CHUNK_LOAD.register(this::onChunkLoadEvent);
|
||||
ServerChunkEvents.CHUNK_UNLOAD.register(this::onChunkUnloadEvent);
|
||||
this.listenerRegistered = true;
|
||||
}
|
||||
|
||||
sender.sendFeedback(new TranslatableText("commands.ae2.ChunkLoggerOn"), true);
|
||||
} else {
|
||||
MinecraftForge.EVENT_BUS.unregister(this);
|
||||
sender.sendFeedback(new TranslatableText("commands.ae2.ChunkLoggerOff"), true);
|
||||
}
|
||||
}
|
||||
+19
-22
@@ -25,6 +25,7 @@ import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
import appeng.core.AppEng;
|
||||
import com.google.common.math.StatsAccumulator;
|
||||
import com.mojang.brigadier.builder.LiteralArgumentBuilder;
|
||||
import com.mojang.brigadier.context.CommandContext;
|
||||
@@ -33,21 +34,16 @@ import com.mojang.brigadier.exceptions.CommandSyntaxException;
|
||||
import net.minecraft.server.command.ServerCommandSource;
|
||||
import net.minecraft.server.network.ServerPlayerEntity;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.text.ClickEvent;
|
||||
import net.minecraft.structure.StructureStart;
|
||||
import net.minecraft.text.*;
|
||||
import net.minecraft.util.Formatting;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.ChunkPos;
|
||||
import net.minecraft.text.Text;
|
||||
import net.minecraft.text.LiteralText;
|
||||
import net.minecraft.util.text.event.ClickEvent;
|
||||
import net.minecraft.util.text.event.HoverEvent;
|
||||
import net.minecraft.world.chunk.Chunk;
|
||||
import net.minecraft.world.chunk.ChunkStatus;
|
||||
import net.minecraft.world.gen.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.Heightmap;
|
||||
import net.minecraft.world.gen.feature.structure.StructureStart;
|
||||
import net.minecraft.server.world.ServerWorld;
|
||||
import net.minecraftforge.fml.server.ServerLifecycleHooks;
|
||||
|
||||
import appeng.server.ISubCommand;
|
||||
import appeng.worldgen.meteorite.MeteoriteStructure;
|
||||
@@ -62,7 +58,8 @@ public class TestMeteoritesCommand implements ISubCommand {
|
||||
@Override
|
||||
public void addArguments(LiteralArgumentBuilder<ServerCommandSource> builder) {
|
||||
builder.then(literal("force").executes(ctx -> {
|
||||
test(ServerLifecycleHooks.getCurrentServer(), ctx.getSource(), true);
|
||||
MinecraftServer server = AppEng.instance().getServer();
|
||||
test(server, ctx.getSource(), true);
|
||||
return 1;
|
||||
}));
|
||||
}
|
||||
@@ -77,7 +74,7 @@ public class TestMeteoritesCommand implements ISubCommand {
|
||||
|
||||
ServerPlayerEntity player = null;
|
||||
try {
|
||||
player = sender.asPlayer();
|
||||
player = sender.getPlayer();
|
||||
} catch (CommandSyntaxException ignored) {
|
||||
}
|
||||
ServerWorld world;
|
||||
@@ -87,7 +84,7 @@ public class TestMeteoritesCommand implements ISubCommand {
|
||||
centerBlock = new BlockPos(player.getX(), 0, player.getZ());
|
||||
} else {
|
||||
world = srv.getOverworld();
|
||||
centerBlock = world.getSpawnPoint();
|
||||
centerBlock = world.getSpawnPos();
|
||||
}
|
||||
|
||||
ChunkPos center = new ChunkPos(centerBlock);
|
||||
@@ -101,8 +98,8 @@ public class TestMeteoritesCommand implements ISubCommand {
|
||||
for (int cz = center.z - radius; cz <= center.z + radius; cz++) {
|
||||
chunksChecked++;
|
||||
ChunkPos cp = new ChunkPos(cx, cz);
|
||||
BlockPos p = new BlockPos(cp.getXStart(), 0, cp.getZStart());
|
||||
BlockPos nearest = MeteoriteStructure.INSTANCE.findNearest(world, generator, p, 0, false);
|
||||
BlockPos p = new BlockPos(cp.getStartX(), 0, cp.getStartZ());
|
||||
BlockPos nearest = generator.locateStructure(world, MeteoriteStructure.INSTANCE, p, 0, false);
|
||||
if (nearest != null) {
|
||||
Chunk chunk = world.getChunk(cx, cz, ChunkStatus.STRUCTURE_STARTS);
|
||||
// The actual relevant information is in the structure piece
|
||||
@@ -120,7 +117,7 @@ public class TestMeteoritesCommand implements ISubCommand {
|
||||
double closestOther = Double.NaN;
|
||||
for (PlacedMeteoriteSettings otherSettings : found) {
|
||||
if (otherSettings != settings) {
|
||||
double d = settings.getPos().distanceSq(otherSettings.getPos());
|
||||
double d = settings.getPos().getSquaredDistance(otherSettings.getPos());
|
||||
if (Double.isNaN(closestOther) || d < closestOther) {
|
||||
closestOther = d;
|
||||
}
|
||||
@@ -132,7 +129,7 @@ public class TestMeteoritesCommand implements ISubCommand {
|
||||
}
|
||||
}
|
||||
|
||||
found.sort(Comparator.comparingDouble(settings -> settings.getPos().distanceSq(centerBlock)));
|
||||
found.sort(Comparator.comparingDouble(settings -> settings.getPos().getSquaredDistance(centerBlock)));
|
||||
|
||||
sendLine(sender, "Chunks checked: %d", chunksChecked);
|
||||
sendLine(sender, "Meteorites found: %d", found.size());
|
||||
@@ -167,13 +164,13 @@ public class TestMeteoritesCommand implements ISubCommand {
|
||||
settings.getFallout().name().toLowerCase()));
|
||||
}
|
||||
|
||||
Text msg = new LiteralText(" #" + (i + 1) + " ");
|
||||
MutableText msg = new LiteralText(" #" + (i + 1) + " ");
|
||||
msg.append(getClickablePosition(world, settings, pos)).append(restOfLine);
|
||||
|
||||
// Add a tooltip
|
||||
Text tooltip = new LiteralText(settings.toString() + "\nBiome: ")
|
||||
MutableText tooltip = new LiteralText(settings.toString() + "\nBiome: ")
|
||||
.append(world.getBiome(pos).getName());
|
||||
msg.formatted(style -> style.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, tooltip)));
|
||||
msg.styled(style -> style.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, tooltip)));
|
||||
|
||||
sender.sendFeedback(msg, true);
|
||||
}
|
||||
@@ -183,7 +180,7 @@ public class TestMeteoritesCommand implements ISubCommand {
|
||||
private static Text getClickablePosition(ServerWorld world, PlacedMeteoriteSettings settings,
|
||||
BlockPos pos) {
|
||||
BlockPos tpPos = pos.up((int) Math.ceil(settings.getMeteoriteRadius()));
|
||||
int surfaceY = world.getHeight(Heightmap.Type.WORLD_SURFACE, tpPos).getY();
|
||||
int surfaceY = world.getTopY(Heightmap.Type.WORLD_SURFACE, tpPos.getX(), tpPos.getZ());
|
||||
if (surfaceY > tpPos.getY()) {
|
||||
tpPos = new BlockPos(tpPos.getX(), surfaceY, tpPos.getZ());
|
||||
}
|
||||
@@ -197,11 +194,11 @@ public class TestMeteoritesCommand implements ISubCommand {
|
||||
}
|
||||
|
||||
private static MeteoriteStructurePiece getMeteoritePieceFromChunk(Chunk chunk) {
|
||||
StructureStart start = chunk.getStructureStart(MeteoriteStructure.INSTANCE.getStructureName());
|
||||
StructureStart<?> start = chunk.getStructureStart(MeteoriteStructure.INSTANCE);
|
||||
|
||||
if (start != null && start.getComponents().size() > 0
|
||||
&& start.getComponents().get(0) instanceof MeteoriteStructurePiece) {
|
||||
return (MeteoriteStructurePiece) start.getComponents().get(0);
|
||||
if (start != null && start.getChildren().size() > 0
|
||||
&& start.getChildren().get(0) instanceof MeteoriteStructurePiece) {
|
||||
return (MeteoriteStructurePiece) start.getChildren().get(0);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
+5
-5
@@ -63,12 +63,12 @@ public class TestOreGenCommand implements ISubCommand {
|
||||
ServerWorld world;
|
||||
BlockPos center;
|
||||
try {
|
||||
ServerPlayerEntity player = sender.asPlayer();
|
||||
ServerPlayerEntity player = sender.getPlayer();
|
||||
world = player.getServerWorld();
|
||||
center = new BlockPos(player.getX(), 0, player.getZ());
|
||||
} catch (CommandSyntaxException e) {
|
||||
world = srv.getOverworld();
|
||||
center = world.getSpawnPoint();
|
||||
center = world.getSpawnPos();
|
||||
}
|
||||
|
||||
ChunkPos tl = new ChunkPos(center.add(-radius, 0, -radius));
|
||||
@@ -107,11 +107,11 @@ public class TestOreGenCommand implements ISubCommand {
|
||||
|
||||
BlockPos.Mutable blockPos = new BlockPos.Mutable();
|
||||
sendLine(sender, "Checking chunk %s", cp);
|
||||
for (int x = cp.getXStart(); x <= cp.getXEnd(); x++) {
|
||||
for (int x = cp.getStartX(); x <= cp.getEndX(); x++) {
|
||||
blockPos.setX(x);
|
||||
for (int z = cp.getZStart(); z <= cp.getZEnd(); z++) {
|
||||
for (int z = cp.getStartZ(); z <= cp.getEndZ(); z++) {
|
||||
blockPos.setZ(z);
|
||||
for (int y = 0; y < world.getMaxHeight(); y++) {
|
||||
for (int y = 0; y < world.getHeight(); y++) {
|
||||
blockPos.setY(y);
|
||||
BlockState state = chunk.getBlockState(blockPos);
|
||||
if (state == quartzOre || state == chargedQuartzOre) {
|
||||
@@ -101,11 +101,6 @@ public final class CompassService {
|
||||
updateArea((ServerWorld) world, chunk);
|
||||
}
|
||||
|
||||
public void updateArea(final ServerWorld w, ChunkPos chunkPos) {
|
||||
Chunk chunk = w.getChunk(chunkPos.x, chunkPos.z);
|
||||
updateArea(w, chunk);
|
||||
}
|
||||
|
||||
public void updateArea(final ServerWorld w, Chunk chunk) {
|
||||
this.updateArea(w, chunk, CHUNK_SIZE);
|
||||
this.updateArea(w, chunk, CHUNK_SIZE + 32);
|
||||
|
||||
@@ -1,51 +0,0 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* Applied Energistics 2 is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Applied Energistics 2 is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
||||
*/
|
||||
|
||||
package appeng.server;
|
||||
|
||||
public enum AccessType {
|
||||
/**
|
||||
* allows basic access to manipulate the block via gui, or other.
|
||||
*/
|
||||
BLOCK_ACCESS,
|
||||
|
||||
/**
|
||||
* Can player deposit items into the network.
|
||||
*/
|
||||
NETWORK_DEPOSIT,
|
||||
|
||||
/**
|
||||
* can player withdraw items from the network.
|
||||
*/
|
||||
NETWORK_WITHDRAW,
|
||||
|
||||
/**
|
||||
* can player issue crafting requests?
|
||||
*/
|
||||
NETWORK_CRAFT,
|
||||
|
||||
/**
|
||||
* can player add new blocks to the network.
|
||||
*/
|
||||
NETWORK_BUILD,
|
||||
|
||||
/**
|
||||
* can player manipulate security settings.
|
||||
*/
|
||||
NETWORK_SECURITY
|
||||
}
|
||||
Reference in New Issue
Block a user