fix //regen and cleanup

This commit is contained in:
dfsek
2021-01-06 21:07:57 -07:00
parent e9d0c14eee
commit c6ff808cce
4 changed files with 12 additions and 11 deletions

View File

@@ -16,12 +16,13 @@ public class BiomeGridFactory implements TerraFactory<BiomeGridTemplate, BiomeGr
public UserDefinedGridBuilder build(BiomeGridTemplate config, TerraPlugin main) throws LoadException {
UserDefinedGridBuilder holder = new UserDefinedGridBuilder();
holder.setXFreq(config.getXFreq());
holder.setZFreq(config.getZFreq());
int xSize = config.getGrid().size();
int zSize = config.getGrid().get(0).size();
holder.setXFreq(config.getXFreq() / xSize);
holder.setZFreq(config.getZFreq() / zSize);
Biome[][] biomes = new UserDefinedBiome[xSize][zSize];
for(int x = 0; x < xSize; x++) {

View File

@@ -186,7 +186,7 @@ public class TerraBukkitPlugin extends JavaPlugin implements TerraPlugin {
throw new IllegalArgumentException("Not a Terra world! " + w.getGenerator());
if(!worlds.containsKey(w.getName())) {
getLogger().warning("Unexpected world load detected: \"" + w.getName() + "\"");
return new TerraWorld(w, ((MasterChunkGenerator) w.getGenerator()).getConfigPack(), this);
return new TerraWorld(w, ((MasterChunkGenerator) w.getGenerator().getHandle()).getConfigPack(), this);
}
return worldMap.computeIfAbsent(w, world -> new TerraWorld(w, worlds.get(w.getName()), this));
}

View File

@@ -1,12 +1,16 @@
package com.dfsek.terra.bukkit.command.command.image;
import com.dfsek.terra.bukkit.command.WorldCommand;
import com.dfsek.terra.bukkit.world.BukkitAdapter;
import com.dfsek.terra.config.lang.LangUtil;
import com.dfsek.terra.image.WorldImageGenerator;
import org.bukkit.World;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
import java.io.File;
import java.util.Collections;
import java.util.List;
@@ -17,9 +21,8 @@ public class RenderCommand extends WorldCommand {
@Override
public boolean execute(@NotNull Player sender, @NotNull Command command, @NotNull String label, @NotNull String[] args, World world) {
/*
try {
WorldImageGenerator g = new WorldImageGenerator(world, Integer.parseInt(args[0]), Integer.parseInt(args[1]), (TerraBukkitPlugin) getMain());
WorldImageGenerator g = new WorldImageGenerator(BukkitAdapter.adapt(world), Integer.parseInt(args[0]), Integer.parseInt(args[1]), getMain());
g.drawWorld(sender.getLocation().getBlockX(), sender.getLocation().getBlockZ());
File file = new File(getMain().getDataFolder() + File.separator + "export" + File.separator + "map" + File.separator + "map_" + System.currentTimeMillis() + ".png");
//noinspection ResultOfMethodCallIgnored
@@ -27,16 +30,13 @@ public class RenderCommand extends WorldCommand {
//noinspection ResultOfMethodCallIgnored
file.createNewFile();
g.save(file);
LangUtil.send("command.image.render.save", sender, file.getAbsolutePath());
LangUtil.send("command.image.render.save", BukkitAdapter.adapt(sender), file.getAbsolutePath());
return true;
} catch(Exception e) {
e.printStackTrace();
LangUtil.send("command.image.render.error", sender);
LangUtil.send("command.image.render.error", BukkitAdapter.adapt(sender));
return true;
}
*/
return true;
}
@Override

View File

@@ -29,7 +29,7 @@ public class BukkitSign extends BukkitBlockState implements Sign {
public void applyState(String state) {
SerialState.parse(state).forEach((k, v) -> {
if(!v.startsWith("text")) throw new IllegalArgumentException("Invalid property: " + k);
setLine(Integer.parseInt(k), v.substring(4));
setLine(Integer.parseInt(k) + 1, v.substring(4));
});
}
}