mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2026-10-20 15:27:24 +00:00
Reformat again
This commit is contained in:
1 parent
4f40550465
commit
a362ed47ce
45 files changed
+192
-113
No files matched your search
+80
-1
@@ -210,7 +210,7 @@ ij_java_spaces_around_multiplicative_operators = true
|
||||
ij_java_spaces_around_relational_operators = true
|
||||
ij_java_spaces_around_shift_operators = true
|
||||
ij_java_spaces_around_type_bounds_in_type_parameters = true
|
||||
ij_java_spaces_around_unary_operator = true
|
||||
ij_java_spaces_around_unary_operator = false
|
||||
ij_java_spaces_within_angle_brackets = false
|
||||
ij_java_spaces_within_annotation_parentheses = false
|
||||
ij_java_spaces_within_array_initializer_braces = false
|
||||
@@ -246,6 +246,85 @@ ij_java_wrap_comments = false
|
||||
ij_java_wrap_first_method_in_call_chain = false
|
||||
ij_java_wrap_long_lines = false
|
||||
|
||||
[{*.gradle.kts,*.kt,*.kts,*.main.kts}]
|
||||
ij_kotlin_align_in_columns_case_branch = false
|
||||
ij_kotlin_align_multiline_binary_operation = false
|
||||
ij_kotlin_align_multiline_extends_list = false
|
||||
ij_kotlin_align_multiline_method_parentheses = false
|
||||
ij_kotlin_align_multiline_parameters = true
|
||||
ij_kotlin_align_multiline_parameters_in_calls = false
|
||||
ij_kotlin_allow_trailing_comma = false
|
||||
ij_kotlin_allow_trailing_comma_on_call_site = false
|
||||
ij_kotlin_assignment_wrap = off
|
||||
ij_kotlin_blank_lines_after_class_header = 0
|
||||
ij_kotlin_blank_lines_around_block_when_branches = 0
|
||||
ij_kotlin_blank_lines_before_declaration_with_comment_or_annotation_on_separate_line = 1
|
||||
ij_kotlin_block_comment_at_first_column = true
|
||||
ij_kotlin_call_parameters_new_line_after_left_paren = false
|
||||
ij_kotlin_call_parameters_right_paren_on_new_line = false
|
||||
ij_kotlin_call_parameters_wrap = off
|
||||
ij_kotlin_catch_on_new_line = false
|
||||
ij_kotlin_class_annotation_wrap = split_into_lines
|
||||
ij_kotlin_continuation_indent_for_chained_calls = true
|
||||
ij_kotlin_continuation_indent_for_expression_bodies = true
|
||||
ij_kotlin_continuation_indent_in_argument_lists = true
|
||||
ij_kotlin_continuation_indent_in_elvis = true
|
||||
ij_kotlin_continuation_indent_in_if_conditions = true
|
||||
ij_kotlin_continuation_indent_in_parameter_lists = true
|
||||
ij_kotlin_continuation_indent_in_supertype_lists = true
|
||||
ij_kotlin_else_on_new_line = false
|
||||
ij_kotlin_enum_constants_wrap = off
|
||||
ij_kotlin_extends_list_wrap = off
|
||||
ij_kotlin_field_annotation_wrap = split_into_lines
|
||||
ij_kotlin_finally_on_new_line = false
|
||||
ij_kotlin_if_rparen_on_new_line = false
|
||||
ij_kotlin_import_nested_classes = false
|
||||
ij_kotlin_insert_whitespaces_in_simple_one_line_method = true
|
||||
ij_kotlin_keep_blank_lines_before_right_brace = 2
|
||||
ij_kotlin_keep_blank_lines_in_code = 2
|
||||
ij_kotlin_keep_blank_lines_in_declarations = 2
|
||||
ij_kotlin_keep_first_column_comment = true
|
||||
ij_kotlin_keep_indents_on_empty_lines = false
|
||||
ij_kotlin_keep_line_breaks = true
|
||||
ij_kotlin_lbrace_on_next_line = false
|
||||
ij_kotlin_line_comment_add_space = false
|
||||
ij_kotlin_line_comment_at_first_column = true
|
||||
ij_kotlin_method_annotation_wrap = split_into_lines
|
||||
ij_kotlin_method_call_chain_wrap = off
|
||||
ij_kotlin_method_parameters_new_line_after_left_paren = false
|
||||
ij_kotlin_method_parameters_right_paren_on_new_line = false
|
||||
ij_kotlin_method_parameters_wrap = off
|
||||
ij_kotlin_name_count_to_use_star_import = 5
|
||||
ij_kotlin_name_count_to_use_star_import_for_members = 3
|
||||
ij_kotlin_parameter_annotation_wrap = off
|
||||
ij_kotlin_space_after_comma = true
|
||||
ij_kotlin_space_after_extend_colon = true
|
||||
ij_kotlin_space_after_type_colon = true
|
||||
ij_kotlin_space_before_catch_parentheses = true
|
||||
ij_kotlin_space_before_comma = false
|
||||
ij_kotlin_space_before_extend_colon = true
|
||||
ij_kotlin_space_before_for_parentheses = true
|
||||
ij_kotlin_space_before_if_parentheses = true
|
||||
ij_kotlin_space_before_lambda_arrow = true
|
||||
ij_kotlin_space_before_type_colon = false
|
||||
ij_kotlin_space_before_when_parentheses = true
|
||||
ij_kotlin_space_before_while_parentheses = true
|
||||
ij_kotlin_spaces_around_additive_operators = true
|
||||
ij_kotlin_spaces_around_assignment_operators = true
|
||||
ij_kotlin_spaces_around_equality_operators = true
|
||||
ij_kotlin_spaces_around_function_type_arrow = true
|
||||
ij_kotlin_spaces_around_logical_operators = true
|
||||
ij_kotlin_spaces_around_multiplicative_operators = true
|
||||
ij_kotlin_spaces_around_range = false
|
||||
ij_kotlin_spaces_around_relational_operators = true
|
||||
ij_kotlin_spaces_around_unary_operator = false
|
||||
ij_kotlin_spaces_around_when_arrow = true
|
||||
ij_kotlin_variable_annotation_wrap = off
|
||||
ij_kotlin_while_on_new_line = false
|
||||
ij_kotlin_wrap_elvis_expressions = 1
|
||||
ij_kotlin_wrap_expression_body_functions = 0
|
||||
ij_kotlin_wrap_first_method_in_call_chain = false
|
||||
|
||||
[{*.har,*.jsb2,*.jsb3,*.json,.babelrc,.eslintrc,.stylelintrc,bowerrc,jest.config}]
|
||||
indent_size = 2
|
||||
ij_json_keep_blank_lines_in_code = 0
|
||||
|
||||
@@ -44,7 +44,7 @@ public class EventListener implements Listener {
|
||||
|
||||
@EventHandler
|
||||
public void onCartographerChange(VillagerAcquireTradeEvent e) {
|
||||
if(! (e.getEntity() instanceof Villager)) return;
|
||||
if(!(e.getEntity() instanceof Villager)) return;
|
||||
if(((Villager) e.getEntity()).getProfession().equals(Villager.Profession.CARTOGRAPHER))
|
||||
e.setCancelled(true); // Cancel leveling if the villager is a Cartographer, to prevent crashing server.
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ public class AsyncBiomeFinder implements Runnable {
|
||||
else z--;
|
||||
}
|
||||
run++;
|
||||
toggle = ! toggle;
|
||||
toggle = !toggle;
|
||||
}
|
||||
if(p.isOnline()) {
|
||||
if(checkBiome(x, z).equals(target)) {
|
||||
|
||||
@@ -74,7 +74,7 @@ public class AsyncStructureFinder implements Runnable {
|
||||
else z -= 1;
|
||||
}
|
||||
run++;
|
||||
toggle = ! toggle;
|
||||
toggle = !toggle;
|
||||
}
|
||||
final Vector finalSpawn = found ? spawn : null;
|
||||
Bukkit.getScheduler().runTask(Terra.getInstance(), () -> callback.accept(finalSpawn));
|
||||
@@ -89,15 +89,15 @@ public class AsyncStructureFinder implements Runnable {
|
||||
*/
|
||||
private boolean isValidSpawn(int x, int z) {
|
||||
Location spawn = target.getSpawn().getNearestSpawn(x, z, world.getSeed()).toLocation(world);
|
||||
if(! TerraWorld.getWorld(world).getConfig().getBiome((UserDefinedBiome) grid.getBiome(spawn)).getStructures().contains(target))
|
||||
if(!TerraWorld.getWorld(world).getConfig().getBiome((UserDefinedBiome) grid.getBiome(spawn)).getStructures().contains(target))
|
||||
return false;
|
||||
Random r2 = new Random(spawn.hashCode());
|
||||
Structure struc = target.getStructure(r2);
|
||||
Structure.Rotation rotation = Structure.Rotation.fromDegrees(r2.nextInt(4) * 90);
|
||||
for(int y = target.getSearchStart().get(r2); y > 0; y--) {
|
||||
if(! target.getBound().isInRange(y)) return false;
|
||||
if(!target.getBound().isInRange(y)) return false;
|
||||
spawn.setY(y);
|
||||
if(! struc.checkSpawns(spawn, rotation)) continue;
|
||||
if(!struc.checkSpawns(spawn, rotation)) continue;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
@@ -67,10 +67,10 @@ public class SimplexCarver extends Carver {
|
||||
CarvingData.CarvingType type = CarvingData.CarvingType.BOTTOM;
|
||||
double simplex = (Math.pow(mainNoise + root2inverse, 3) / 2 + columnNoise) * hc;
|
||||
for(int y = 0; y < 64; y++) {
|
||||
double finalNoise = (- 0.05 * Math.abs(y - (heightNoise * 16 + 24)) + 1 - simplex) * hc;
|
||||
double finalNoise = (-0.05 * Math.abs(y - (heightNoise * 16 + 24)) + 1 - simplex) * hc;
|
||||
if(finalNoise > 0.5) {
|
||||
c.carve(x - ox, y, z - oz, type);
|
||||
double finalNoiseUp = (- 0.05 * Math.abs((y + 1) - (heightNoise * 16 + 24)) + 1 - simplex) * hc;
|
||||
double finalNoiseUp = (-0.05 * Math.abs((y + 1) - (heightNoise * 16 + 24)) + 1 - simplex) * hc;
|
||||
if(finalNoiseUp > 0.5) {
|
||||
type = CarvingData.CarvingType.CENTER;
|
||||
} else type = CarvingData.CarvingType.TOP;
|
||||
|
||||
@@ -73,7 +73,7 @@ public class BiomeInfoCommand extends WorldCommand {
|
||||
compHeight = i;
|
||||
}
|
||||
}
|
||||
if(! changed) {
|
||||
if(!changed) {
|
||||
snowMessage.append("Y=0")
|
||||
.append("-255")
|
||||
.append(": ")
|
||||
@@ -104,7 +104,7 @@ public class BiomeInfoCommand extends WorldCommand {
|
||||
|
||||
@Override
|
||||
public List<String> getTabCompletions(@NotNull CommandSender sender, @NotNull String alias, @NotNull String[] args) {
|
||||
if(! (sender instanceof Player) || ! (((Player) sender).getWorld().getGenerator() instanceof TerraChunkGenerator))
|
||||
if(!(sender instanceof Player) || !(((Player) sender).getWorld().getGenerator() instanceof TerraChunkGenerator))
|
||||
return Collections.emptyList();
|
||||
List<String> ids = TerraWorld.getWorld(((Player) sender).getWorld()).getConfig().getBiomeIDs();
|
||||
if(args.length == 1)
|
||||
|
||||
@@ -64,7 +64,7 @@ public class BiomeLocateCommand extends WorldCommand {
|
||||
|
||||
@Override
|
||||
public List<String> getTabCompletions(@NotNull CommandSender sender, @NotNull String alias, @NotNull String[] args) {
|
||||
if(! (sender instanceof Player) || ! (((Player) sender).getWorld().getGenerator() instanceof TerraChunkGenerator))
|
||||
if(!(sender instanceof Player) || !(((Player) sender).getWorld().getGenerator() instanceof TerraChunkGenerator))
|
||||
return Collections.emptyList();
|
||||
List<String> ids = TerraWorld.getWorld(((Player) sender).getWorld()).getConfig().getBiomeIDs();
|
||||
if(args.length == 1)
|
||||
|
||||
@@ -21,7 +21,7 @@ public class RawGUICommand extends WorldCommand {
|
||||
|
||||
@Override
|
||||
public boolean execute(@NotNull Player sender, @NotNull Command command, @NotNull String label, @NotNull String[] args, World world) {
|
||||
if(! ConfigUtil.debug) {
|
||||
if(!ConfigUtil.debug) {
|
||||
LangUtil.send("command.image.gui.debug", sender);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ public class StepGUICommand extends WorldCommand {
|
||||
|
||||
@Override
|
||||
public boolean execute(@NotNull Player sender, @NotNull Command command, @NotNull String label, @NotNull String[] args, World world) {
|
||||
if(! ConfigUtil.debug) {
|
||||
if(!ConfigUtil.debug) {
|
||||
LangUtil.send("command.image.gui.debug", sender);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -77,7 +77,7 @@ public class LocateCommand extends WorldCommand {
|
||||
|
||||
@Override
|
||||
public List<String> getTabCompletions(@NotNull CommandSender sender, @NotNull String alias, @NotNull String[] args) {
|
||||
if(! (sender instanceof Player) || ! (((Player) sender).getWorld().getGenerator() instanceof TerraChunkGenerator))
|
||||
if(!(sender instanceof Player) || !(((Player) sender).getWorld().getGenerator() instanceof TerraChunkGenerator))
|
||||
return Collections.emptyList();
|
||||
List<String> ids = TerraWorld.getWorld(((Player) sender).getWorld()).getConfig().getStructureIDs();
|
||||
if(args.length == 1)
|
||||
|
||||
@@ -77,7 +77,7 @@ public class ConfigPack extends YamlConfiguration {
|
||||
load(new File(file, "pack.yml"));
|
||||
dataFolder = file;
|
||||
|
||||
if(! contains("id")) throw new ConfigException("No ID specified!", "null");
|
||||
if(!contains("id")) throw new ConfigException("No ID specified!", "null");
|
||||
this.id = getString("id");
|
||||
|
||||
ores = ConfigLoader.load(new File(file, "ores").toPath(), this, OreConfig.class);
|
||||
|
||||
@@ -47,7 +47,7 @@ public class WorldConfig {
|
||||
if(configID == null || configID.equals(""))
|
||||
throw new ConfigException("Config pack unspecified in bukkit.yml!", worldID);
|
||||
File configFile = new File(main.getDataFolder() + File.separator + "worlds", worldID + ".yml");
|
||||
if(! configFile.exists()) {
|
||||
if(!configFile.exists()) {
|
||||
configFile.getParentFile().mkdirs();
|
||||
LangUtil.log("world-config.not-found", Level.WARNING, worldID);
|
||||
FileUtils.copyInputStreamToFile(Objects.requireNonNull(main.getResource("world.yml")), configFile);
|
||||
|
||||
@@ -25,9 +25,9 @@ public class BiomeGridConfig extends TerraConfig {
|
||||
public BiomeGridConfig(File file, ConfigPack config) throws IOException, InvalidConfigurationException {
|
||||
super(file, config);
|
||||
load(file);
|
||||
if(! contains("id")) throw new ConfigException("Grid ID unspecified!", "null");
|
||||
if(!contains("id")) throw new ConfigException("Grid ID unspecified!", "null");
|
||||
this.gridID = getString("id");
|
||||
if(! contains("grid")) throw new ConfigException("Grid key not found!", getID());
|
||||
if(!contains("grid")) throw new ConfigException("Grid key not found!", getID());
|
||||
this.sizeX = Objects.requireNonNull(getList("grid")).size();
|
||||
this.sizeZ = ((List<List<String>>) Objects.requireNonNull(getList("grid"))).get(0).size();
|
||||
gridRaw = new UserDefinedBiome[sizeX][sizeZ];
|
||||
|
||||
@@ -46,7 +46,7 @@ public class CarverConfig extends TerraConfig {
|
||||
public CarverConfig(File file, ConfigPack config) throws IOException, InvalidConfigurationException {
|
||||
super(file, config);
|
||||
load(file);
|
||||
if(! contains("id")) throw new ConfigException("No ID specified for Carver!", "null");
|
||||
if(!contains("id")) throw new ConfigException("No ID specified for Carver!", "null");
|
||||
id = getString("id");
|
||||
|
||||
inner = getBlocks("palette.inner.layers");
|
||||
@@ -105,7 +105,7 @@ public class CarverConfig extends TerraConfig {
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private Map<Integer, ProbabilityCollection<BlockData>> getBlocks(String key) throws InvalidConfigurationException {
|
||||
if(! contains(key)) throw new ConfigException("Missing Carver Palette!", getID());
|
||||
if(!contains(key)) throw new ConfigException("Missing Carver Palette!", getID());
|
||||
Map<Integer, ProbabilityCollection<BlockData>> result = new TreeMap<>();
|
||||
for(Map<?, ?> m : getMapList(key)) {
|
||||
try {
|
||||
@@ -133,28 +133,28 @@ public class CarverConfig extends TerraConfig {
|
||||
|
||||
public boolean isReplaceableInner(Material m) {
|
||||
if(replaceIsBlacklistInner) {
|
||||
return ! replaceableInner.contains(m);
|
||||
return !replaceableInner.contains(m);
|
||||
}
|
||||
return replaceableInner.contains(m);
|
||||
}
|
||||
|
||||
public boolean isReplaceableOuter(Material m) {
|
||||
if(replaceIsBlacklistOuter) {
|
||||
return ! replaceableOuter.contains(m);
|
||||
return !replaceableOuter.contains(m);
|
||||
}
|
||||
return replaceableOuter.contains(m);
|
||||
}
|
||||
|
||||
public boolean isReplaceableTop(Material m) {
|
||||
if(replaceIsBlacklistTop) {
|
||||
return ! replaceableTop.contains(m);
|
||||
return !replaceableTop.contains(m);
|
||||
}
|
||||
return replaceableTop.contains(m);
|
||||
}
|
||||
|
||||
public boolean isReplaceableBottom(Material m) {
|
||||
if(replaceIsBlacklistBottom) {
|
||||
return ! replaceableBottom.contains(m);
|
||||
return !replaceableBottom.contains(m);
|
||||
}
|
||||
return replaceableBottom.contains(m);
|
||||
}
|
||||
|
||||
@@ -34,10 +34,10 @@ public class FloraConfig extends TerraConfig implements Flora {
|
||||
public FloraConfig(File file, ConfigPack config) throws IOException, InvalidConfigurationException {
|
||||
super(file, config);
|
||||
load(file);
|
||||
if(! contains("id")) throw new ConfigException("Flora ID unspecified!", "null");
|
||||
if(!contains("id")) throw new ConfigException("Flora ID unspecified!", "null");
|
||||
this.id = getString("id");
|
||||
if(! contains("layers")) throw new ConfigException("No blocks defined in custom flora!", getID());
|
||||
if(! contains("spawnable")) throw new ConfigException("Flora spawnable blocks unspecified!", getID());
|
||||
if(!contains("layers")) throw new ConfigException("No blocks defined in custom flora!", getID());
|
||||
if(!contains("spawnable")) throw new ConfigException("Flora spawnable blocks unspecified!", getID());
|
||||
|
||||
spawnable = ConfigUtil.toBlockData(getStringList("spawnable"), "spawnable", getID());
|
||||
replaceable = ConfigUtil.toBlockData(getStringList("replaceable"), "replaceable", getID());
|
||||
@@ -78,10 +78,10 @@ public class FloraConfig extends TerraConfig implements Flora {
|
||||
@Override
|
||||
public boolean plant(Location location) {
|
||||
int size = floraPalette.getSize();
|
||||
int c = ceiling ? - 1 : 1;
|
||||
int c = ceiling ? -1 : 1;
|
||||
for(int i = 0; Math.abs(i) < size; i += c) { // Down if ceiling, up if floor
|
||||
if(i + 1 > 255) return false;
|
||||
if(! replaceable.contains(location.clone().add(0, i + c, 0).getBlock().getType())) return false;
|
||||
if(!replaceable.contains(location.clone().add(0, i + c, 0).getBlock().getType())) return false;
|
||||
}
|
||||
for(int i = 0; Math.abs(i) < size; i += c) { // Down if ceiling, up if floor
|
||||
int lvl = (Math.abs(i));
|
||||
|
||||
@@ -36,11 +36,11 @@ public class OreConfig extends TerraConfig {
|
||||
|
||||
public OreConfig(File file, ConfigPack config) throws IOException, InvalidConfigurationException {
|
||||
super(file, config);
|
||||
if(! contains("id")) throw new ConfigException("Ore ID not found!", "null");
|
||||
if(!contains("id")) throw new ConfigException("Ore ID not found!", "null");
|
||||
this.id = getString("id");
|
||||
if(! contains("material")) throw new ConfigException("Ore material not found!", getID());
|
||||
if(! contains("deform")) throw new ConfigException("Ore vein deformation not found!", getID());
|
||||
if(! contains("replace")) throw new ConfigException("Ore replaceable materials not found!", getID());
|
||||
if(!contains("material")) throw new ConfigException("Ore material not found!", getID());
|
||||
if(!contains("deform")) throw new ConfigException("Ore vein deformation not found!", getID());
|
||||
if(!contains("replace")) throw new ConfigException("Ore replaceable materials not found!", getID());
|
||||
min = getInt("radius.min", 1);
|
||||
max = getInt("radius.max", 1);
|
||||
deform = getDouble("deform", 0.75);
|
||||
@@ -73,9 +73,9 @@ public class OreConfig extends TerraConfig {
|
||||
Map<ChunkCoordinate, Chunk> chunks = new HashMap<>(); // Cache chunks to prevent re-loading chunks every time one is needed.
|
||||
chunks.put(new ChunkCoordinate(chunk), chunk);
|
||||
Vector orig = new Vector(l.getBlockX() + (chunk.getX() << 4), l.getBlockY(), l.getBlockZ() + (chunk.getZ() << 4));
|
||||
for(int x = - rad; x <= rad; x++) {
|
||||
for(int y = - rad; y <= rad; y++) {
|
||||
for(int z = - rad; z <= rad; z++) {
|
||||
for(int x = -rad; x <= rad; x++) {
|
||||
for(int y = -rad; y <= rad; y++) {
|
||||
for(int z = -rad; z <= rad; z++) {
|
||||
Vector oreLoc = orig.clone().add(new Vector(x, y, z));
|
||||
Vector source = l.clone().add(new Vector(x, y, z));
|
||||
if(oreLoc.getBlockY() > 255 || oreLoc.getBlockY() < 0) continue;
|
||||
@@ -96,9 +96,9 @@ public class OreConfig extends TerraConfig {
|
||||
ore.setNoiseType(FastNoiseLite.NoiseType.OpenSimplex2);
|
||||
ore.setFrequency(deformFrequency);
|
||||
int rad = randomInRange(r);
|
||||
for(int x = - rad; x <= rad; x++) {
|
||||
for(int y = - rad; y <= rad; y++) {
|
||||
for(int z = - rad; z <= rad; z++) {
|
||||
for(int x = -rad; x <= rad; x++) {
|
||||
for(int y = -rad; y <= rad; y++) {
|
||||
for(int z = -rad; z <= rad; z++) {
|
||||
Vector oreLoc = l.clone().add(new Vector(x, y, z));
|
||||
if(oreLoc.getBlockX() > 15 || oreLoc.getBlockZ() > 15 || oreLoc.getBlockY() > 255 || oreLoc.getBlockX() < 0 || oreLoc.getBlockZ() < 0 || oreLoc.getBlockY() < 0)
|
||||
continue;
|
||||
|
||||
@@ -26,7 +26,7 @@ public class PaletteConfig extends TerraConfig {
|
||||
|
||||
public PaletteConfig(File file, ConfigPack config) throws IOException, InvalidConfigurationException {
|
||||
super(file, config);
|
||||
if(! contains("id")) throw new ConfigException("Palette ID unspecified!", "null");
|
||||
if(!contains("id")) throw new ConfigException("Palette ID unspecified!", "null");
|
||||
this.paletteID = getString("id");
|
||||
Palette<BlockData> pal;
|
||||
if(getBoolean("simplex", false)) {
|
||||
|
||||
@@ -31,9 +31,9 @@ public class TreeConfig extends TerraConfig implements Tree {
|
||||
public TreeConfig(File file, ConfigPack config) throws IOException, InvalidConfigurationException {
|
||||
super(file, config);
|
||||
spawnable = ConfigUtil.toBlockData(getStringList("spawnable"), "spawnable", getID());
|
||||
if(! contains("id")) throw new ConfigException("No ID specified!", "null");
|
||||
if(!contains("id")) throw new ConfigException("No ID specified!", "null");
|
||||
id = getString("id");
|
||||
if(! contains("files")) throw new ConfigException("No files specified!", getID());
|
||||
if(!contains("files")) throw new ConfigException("No files specified!", getID());
|
||||
yOffset = getInt("y-offset", 0);
|
||||
try {
|
||||
for(Map.Entry<String, Object> e : Objects.requireNonNull(getConfigurationSection("files")).getValues(false).entrySet()) {
|
||||
@@ -65,10 +65,10 @@ public class TreeConfig extends TerraConfig implements Tree {
|
||||
public boolean plant(Location location, Random random, JavaPlugin javaPlugin) {
|
||||
location.subtract(0, 1, 0);
|
||||
Location mut = location.clone().subtract(0, yOffset, 0);
|
||||
if(! spawnable.contains(location.getBlock().getType())) return false;
|
||||
if(!spawnable.contains(location.getBlock().getType())) return false;
|
||||
Structure struc = structure.get(random);
|
||||
Structure.Rotation rotation = Structure.Rotation.fromDegrees(random.nextInt(4) * 90);
|
||||
if(! struc.checkSpawns(mut, rotation)) return false;
|
||||
if(!struc.checkSpawns(mut, rotation)) return false;
|
||||
struc.paste(mut, rotation);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ public class AbstractBiomeConfig extends TerraConfig {
|
||||
public AbstractBiomeConfig(File file, ConfigPack config) throws IOException, InvalidConfigurationException {
|
||||
super(file, config);
|
||||
load(file);
|
||||
if(! contains("id")) throw new ConfigException("Abstract Biome ID unspecified!", "null");
|
||||
if(!contains("id")) throw new ConfigException("Abstract Biome ID unspecified!", "null");
|
||||
this.biomeID = getString("id");
|
||||
|
||||
equation = getString("noise-equation");
|
||||
|
||||
@@ -42,7 +42,7 @@ public class BiomeConfig extends TerraConfig {
|
||||
super(file, config);
|
||||
load(file);
|
||||
this.config = config;
|
||||
if(! contains("id")) throw new ConfigException("Biome ID unspecified!", "null");
|
||||
if(!contains("id")) throw new ConfigException("Biome ID unspecified!", "null");
|
||||
this.biomeID = getString("id");
|
||||
|
||||
AbstractBiomeConfig abstractBiome = null;
|
||||
@@ -69,7 +69,7 @@ public class BiomeConfig extends TerraConfig {
|
||||
|
||||
BiomePaletteConfig palette;
|
||||
// Check if biome is extending abstract biome, only use abstract biome's palette if palette is NOT defined for current biome.
|
||||
if(extending && abstractBiome.getPaletteData() != null && ! contains("palette")) {
|
||||
if(extending && abstractBiome.getPaletteData() != null && !contains("palette")) {
|
||||
palette = abstractBiome.getPaletteData();
|
||||
Debug.info("Using super palette");
|
||||
} else palette = new BiomePaletteConfig(this);
|
||||
@@ -79,31 +79,31 @@ public class BiomeConfig extends TerraConfig {
|
||||
throw new ConfigException("No Palette specified in biome or super biome.", getID());
|
||||
|
||||
// Check if carving should be handled by super biome.
|
||||
if(extending && abstractBiome.getCarving() != null && ! contains("carving")) {
|
||||
if(extending && abstractBiome.getCarving() != null && !contains("carving")) {
|
||||
carver = abstractBiome.getCarving();
|
||||
Debug.info("Using super carvers");
|
||||
} else carver = new BiomeCarverConfig(this);
|
||||
|
||||
// Check if flora should be handled by super biome.
|
||||
if(extending && abstractBiome.getFlora() != null && ! contains("flora")) {
|
||||
if(extending && abstractBiome.getFlora() != null && !contains("flora")) {
|
||||
flora = abstractBiome.getFlora();
|
||||
Debug.info("Using super flora (" + flora.getFlora().size() + " entries, " + flora.getFloraChance() + " % chance)");
|
||||
} else flora = new BiomeFloraConfig(this);
|
||||
|
||||
// Check if trees should be handled by super biome.
|
||||
if(extending && abstractBiome.getTrees() != null && ! contains("trees")) {
|
||||
if(extending && abstractBiome.getTrees() != null && !contains("trees")) {
|
||||
tree = abstractBiome.getTrees();
|
||||
Debug.info("Using super trees");
|
||||
} else tree = new BiomeTreeConfig(this);
|
||||
|
||||
// Check if ores should be handled by super biome.
|
||||
if(extending && abstractBiome.getOres() != null && ! contains("ores")) {
|
||||
if(extending && abstractBiome.getOres() != null && !contains("ores")) {
|
||||
ore = abstractBiome.getOres();
|
||||
Debug.info("Using super ores");
|
||||
} else ore = new BiomeOreConfig(this);
|
||||
|
||||
// Get slab stuff
|
||||
if(extending && abstractBiome.getSlabs() != null && ! contains("slabs")) {
|
||||
if(extending && abstractBiome.getSlabs() != null && !contains("slabs")) {
|
||||
slab = abstractBiome.getSlabs();
|
||||
Debug.info("Using super slabs");
|
||||
} else slab = new BiomeSlabConfig(this);
|
||||
@@ -130,7 +130,7 @@ public class BiomeConfig extends TerraConfig {
|
||||
// Get Vanilla biome, throw exception if it is invalid/unspecified.
|
||||
org.bukkit.block.Biome vanillaBiome;
|
||||
try {
|
||||
if(! contains("vanilla")) throw new ConfigException("Vanilla Biome unspecified!", getID());
|
||||
if(!contains("vanilla")) throw new ConfigException("Vanilla Biome unspecified!", getID());
|
||||
vanillaBiome = org.bukkit.block.Biome.valueOf(getString("vanilla"));
|
||||
} catch(IllegalArgumentException e) {
|
||||
throw new ConfigException("Invalid Vanilla biome: \"" + getString("vanilla") + "\"", getID());
|
||||
@@ -172,7 +172,7 @@ public class BiomeConfig extends TerraConfig {
|
||||
}
|
||||
|
||||
public Range getFloraHeights(Flora f) {
|
||||
return flora.getFloraHeights().computeIfAbsent(f, input -> new Range(- 1, - 1));
|
||||
return flora.getFloraHeights().computeIfAbsent(f, input -> new Range(-1, -1));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -201,7 +201,7 @@ public class BiomeConfig extends TerraConfig {
|
||||
}
|
||||
|
||||
public Range getTreeRange(Tree t) {
|
||||
return tree.getTreeHeights().getOrDefault(t, new Range(- 1, - 1));
|
||||
return tree.getTreeHeights().getOrDefault(t, new Range(-1, -1));
|
||||
}
|
||||
|
||||
public BiomeSnowConfig getSnow() {
|
||||
|
||||
@@ -19,14 +19,14 @@ public class EntityFeatureConfig implements FeatureConfig {
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public EntityFeatureConfig(Map<String, Object> items) throws InvalidConfigurationException {
|
||||
if(! items.containsKey("entity")) throw new ConfigException("No EntityType specified!", "EntityFeature");
|
||||
if(! items.containsKey("amount")) throw new ConfigException("No amount specified!", "EntityFeature");
|
||||
if(! items.containsKey("attempts")) throw new ConfigException("Attempts not specified!", "EntityFeature");
|
||||
if(! items.containsKey("in-height"))
|
||||
if(!items.containsKey("entity")) throw new ConfigException("No EntityType specified!", "EntityFeature");
|
||||
if(!items.containsKey("amount")) throw new ConfigException("No amount specified!", "EntityFeature");
|
||||
if(!items.containsKey("attempts")) throw new ConfigException("Attempts not specified!", "EntityFeature");
|
||||
if(!items.containsKey("in-height"))
|
||||
throw new ConfigException("Spawn Checking Height not specified!", "EntityFeature");
|
||||
if(! items.containsKey("spawnable-on"))
|
||||
if(!items.containsKey("spawnable-on"))
|
||||
throw new ConfigException("No Spawnable-on materials specified!", "EntityFeature");
|
||||
if(! items.containsKey("spawnable-in"))
|
||||
if(!items.containsKey("spawnable-in"))
|
||||
throw new ConfigException("No Spawnable-in materials specified!", "EntityFeature");
|
||||
|
||||
EntityType type;
|
||||
|
||||
@@ -41,9 +41,9 @@ public class StructureConfig extends TerraConfig {
|
||||
@SuppressWarnings("unchecked")
|
||||
public StructureConfig(File file, ConfigPack config) throws IOException, InvalidConfigurationException {
|
||||
super(file, config);
|
||||
if(! contains("id")) throw new ConfigException("No ID specified!", "null");
|
||||
if(!contains("id")) throw new ConfigException("No ID specified!", "null");
|
||||
id = getString("id");
|
||||
if(! contains("files")) throw new ConfigException("No files specified!", getID());
|
||||
if(!contains("files")) throw new ConfigException("No files specified!", getID());
|
||||
try {
|
||||
for(Map.Entry<String, Object> e : Objects.requireNonNull(getConfigurationSection("files")).getValues(false).entrySet()) {
|
||||
try {
|
||||
|
||||
@@ -31,7 +31,7 @@ public class DebugFrame extends JFrame implements ActionListener {
|
||||
public void paint(Graphics g) {
|
||||
super.paintComponents(g);
|
||||
for(Player p : Bukkit.getOnlinePlayers()) {
|
||||
if(! (p.getWorld().getGenerator() instanceof TerraChunkGenerator)) break;
|
||||
if(!(p.getWorld().getGenerator() instanceof TerraChunkGenerator)) break;
|
||||
int xp = (int) (((double) Math.floorMod(p.getLocation().getBlockX() - (img.getWidth() / 2), x) / x) * getWidth());
|
||||
int zp = (int) (((double) Math.floorMod(p.getLocation().getBlockZ() - (img.getHeight() / 2), z) / z) * getHeight());
|
||||
ImageLoader loader = TerraWorld.getWorld(p.getWorld()).getWorldConfig().imageLoader;
|
||||
|
||||
@@ -69,7 +69,7 @@ public class TerraChunkGenerator extends GaeaChunkGenerator {
|
||||
}
|
||||
|
||||
public static synchronized void fixChunk(Chunk c) {
|
||||
if(! (c.getWorld().getGenerator() instanceof TerraChunkGenerator)) throw new IllegalArgumentException();
|
||||
if(!(c.getWorld().getGenerator() instanceof TerraChunkGenerator)) throw new IllegalArgumentException();
|
||||
popMap.get(c.getWorld()).checkNeighbors(c.getX(), c.getZ(), c.getWorld());
|
||||
}
|
||||
|
||||
@@ -78,7 +78,7 @@ public class TerraChunkGenerator extends GaeaChunkGenerator {
|
||||
if(needsLoad) load(world); // Load population data for world.
|
||||
ChunkData chunk = createChunkData(world);
|
||||
TerraWorld tw = TerraWorld.getWorld(world);
|
||||
if(! tw.isSafe()) return chunk;
|
||||
if(!tw.isSafe()) return chunk;
|
||||
ConfigPack config = tw.getConfig();
|
||||
int xOrig = (chunkX << 4);
|
||||
int zOrig = (chunkZ << 4);
|
||||
|
||||
@@ -25,7 +25,7 @@ public class ImageLoader {
|
||||
}
|
||||
|
||||
public static void debugWorld(boolean genStep, World w) {
|
||||
if(! ConfigUtil.debug) return;
|
||||
if(!ConfigUtil.debug) return;
|
||||
BufferedImage newImg = new WorldImageGenerator(w, 1024, 1024).drawWorld(0, 0).getDraw();
|
||||
if(genStep) newImg = redrawStepped(newImg, w, Align.CENTER);
|
||||
DebugGUI debugGUI = new DebugGUI(newImg);
|
||||
@@ -77,7 +77,7 @@ public class ImageLoader {
|
||||
}
|
||||
|
||||
public void debug(boolean genStep, World w) {
|
||||
if(! ConfigUtil.debug) return;
|
||||
if(!ConfigUtil.debug) return;
|
||||
BufferedImage newImg = copyImage(image);
|
||||
if(genStep) {
|
||||
newImg = redrawStepped(image, w, align);
|
||||
|
||||
@@ -33,7 +33,7 @@ public class CavePopulator extends BlockPopulator {
|
||||
if(ConfigUtil.masterDisableCaves) return;
|
||||
try(ProfileFuture ignored = TerraProfiler.fromWorld(world).measure("CaveTime")) {
|
||||
TerraWorld tw = TerraWorld.getWorld(world);
|
||||
if(! tw.isSafe()) return;
|
||||
if(!tw.isSafe()) return;
|
||||
ConfigPack config = tw.getConfig();
|
||||
|
||||
for(CarverConfig c : config.getCarvers().values()) {
|
||||
|
||||
@@ -34,12 +34,12 @@ public class FloraPopulator extends GaeaBlockPopulator {
|
||||
for(Block block : getValidTreeSpawnsAt(chunk, x, z, new Range(0, 254))) {
|
||||
Tree tree = biome.getDecorator().getTrees().get(random);
|
||||
Range range = world.getConfig().getBiome(biome).getTreeRange(tree);
|
||||
if(! range.isInRange(block.getY())) continue;
|
||||
if(!range.isInRange(block.getY())) continue;
|
||||
try {
|
||||
Location l = block.getLocation();
|
||||
TreeGenerateEvent event = new TreeGenerateEvent(world, l, tree);
|
||||
Bukkit.getPluginManager().callEvent(event);
|
||||
if(! event.isCancelled()) tree.plant(l, random, Terra.getInstance());
|
||||
if(!event.isCancelled()) tree.plant(l, random, Terra.getInstance());
|
||||
} catch(NullPointerException ignore) {
|
||||
}
|
||||
}
|
||||
@@ -64,7 +64,7 @@ public class FloraPopulator extends GaeaBlockPopulator {
|
||||
public void populate(@NotNull World world, @NotNull Random random, @NotNull Chunk chunk) {
|
||||
try(ProfileFuture ignored = TerraProfiler.fromWorld(world).measure("FloraTime")) {
|
||||
TerraWorld tw = TerraWorld.getWorld(world);
|
||||
if(! tw.isSafe()) return;
|
||||
if(!tw.isSafe()) return;
|
||||
int originX = chunk.getX() << 4;
|
||||
int originZ = chunk.getZ() << 4;
|
||||
TerraBiomeGrid grid = tw.getGrid();
|
||||
|
||||
@@ -26,7 +26,7 @@ public class OrePopulator extends GaeaBlockPopulator {
|
||||
public void populate(@NotNull World world, @NotNull Random random, @NotNull Chunk chunk) {
|
||||
try(ProfileFuture ignored = TerraProfiler.fromWorld(world).measure("OreTime")) {
|
||||
TerraWorld tw = TerraWorld.getWorld(world);
|
||||
if(! tw.isSafe()) return;
|
||||
if(!tw.isSafe()) return;
|
||||
ConfigPack config = tw.getConfig();
|
||||
Biome b = TerraWorld.getWorld(world).getGrid().getBiome((chunk.getX() << 4) + 8, (chunk.getZ() << 4) + 8, GenerationPhase.POPULATE);
|
||||
BiomeOreConfig ores = config.getBiome((UserDefinedBiome) b).getOres();
|
||||
@@ -42,7 +42,7 @@ public class OrePopulator extends GaeaBlockPopulator {
|
||||
Vector v = new Vector(x, y, z);
|
||||
OreVeinGenerateEvent event = new OreVeinGenerateEvent(tw, v.toLocation(world), ore);
|
||||
Bukkit.getPluginManager().callEvent(event);
|
||||
if(! event.isCancelled()) {
|
||||
if(!event.isCancelled()) {
|
||||
if(ore.crossChunks()) ore.doVein(v, chunk, random);
|
||||
else ore.doVeinSingle(new Vector(x, y, z), chunk, random);
|
||||
}
|
||||
|
||||
@@ -50,22 +50,22 @@ public class SnowPopulator extends GaeaBlockPopulator {
|
||||
int origX = chunk.getX() << 4;
|
||||
int origZ = chunk.getZ() << 4;
|
||||
TerraWorld w = TerraWorld.getWorld(world);
|
||||
if(! w.isSafe()) return;
|
||||
if(!w.isSafe()) return;
|
||||
TerraBiomeGrid g = w.getGrid();
|
||||
for(int x = 0; x < 16; x++) {
|
||||
for(int z = 0; z < 16; z++) {
|
||||
BiomeConfig biome = w.getConfig().getBiome((UserDefinedBiome) g.getBiome(origX + x, origZ + z, GenerationPhase.PALETTE_APPLY));
|
||||
if(! biome.getSnow().doSnow()) continue;
|
||||
if(!biome.getSnow().doSnow()) continue;
|
||||
int y;
|
||||
Block b = null;
|
||||
for(y = 254; y > 0; y--) {
|
||||
b = chunk.getBlock(x, y, z);
|
||||
if(! b.getType().isAir()) break;
|
||||
if(!b.getType().isAir()) break;
|
||||
}
|
||||
if(random.nextInt(100) >= biome.getSnow().getSnowChance(y))
|
||||
continue;
|
||||
if(blacklistSpawn.contains(b.getType()) || b.isPassable()) continue;
|
||||
chunk.getBlock(x, ++ y, z).setBlockData(DataUtil.SNOW);
|
||||
chunk.getBlock(x, ++y, z).setBlockData(DataUtil.SNOW);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,20 +31,20 @@ public class StructurePopulator extends BlockPopulator {
|
||||
int cx = (chunk.getX() << 4);
|
||||
int cz = (chunk.getZ() << 4);
|
||||
TerraWorld tw = TerraWorld.getWorld(world);
|
||||
if(! tw.isSafe()) return;
|
||||
if(!tw.isSafe()) return;
|
||||
TerraBiomeGrid grid = tw.getGrid();
|
||||
ConfigPack config = tw.getConfig();
|
||||
structure:
|
||||
for(StructureConfig conf : config.getAllStructures()) {
|
||||
Location spawn = conf.getSpawn().getNearestSpawn(cx + 8, cz + 8, world.getSeed()).toLocation(world);
|
||||
if(! config.getBiome((UserDefinedBiome) grid.getBiome(spawn)).getStructures().contains(conf)) continue;
|
||||
if(!config.getBiome((UserDefinedBiome) grid.getBiome(spawn)).getStructures().contains(conf)) continue;
|
||||
Random r2 = new Random(spawn.hashCode());
|
||||
Structure struc = conf.getStructure(r2);
|
||||
Structure.Rotation rotation = Structure.Rotation.fromDegrees(r2.nextInt(4) * 90);
|
||||
for(int y = conf.getSearchStart().get(r2); y > 0; y--) {
|
||||
if(! conf.getBound().isInRange(y)) continue structure;
|
||||
if(!conf.getBound().isInRange(y)) continue structure;
|
||||
spawn.setY(y);
|
||||
if(! struc.checkSpawns(spawn, rotation)) continue;
|
||||
if(!struc.checkSpawns(spawn, rotation)) continue;
|
||||
double horizontal = struc.getStructureInfo().getMaxHorizontal();
|
||||
if(Math.abs((cx + 8) - spawn.getBlockX()) <= horizontal && Math.abs((cz + 8) - spawn.getBlockZ()) <= horizontal) {
|
||||
try(ProfileFuture ignore = TerraProfiler.fromWorld(world).measure("StructurePasteTime")) {
|
||||
|
||||
@@ -146,7 +146,7 @@ public class Vector2 implements Cloneable {
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if(! (obj instanceof Vector2)) {
|
||||
if(!(obj instanceof Vector2)) {
|
||||
return false;
|
||||
}
|
||||
Vector2 other = (Vector2) obj;
|
||||
|
||||
@@ -5,9 +5,9 @@ import org.polydev.gaea.math.FastNoiseLite;
|
||||
|
||||
public class DeformedSphere extends VoxelGeometry {
|
||||
public DeformedSphere(Vector start, int rad, double deform, FastNoiseLite noise) {
|
||||
for(int x = - rad; x <= rad; x++) {
|
||||
for(int y = - rad; y <= rad; y++) {
|
||||
for(int z = - rad; z <= rad; z++) {
|
||||
for(int x = -rad; x <= rad; x++) {
|
||||
for(int y = -rad; y <= rad; y++) {
|
||||
for(int z = -rad; z <= rad; z++) {
|
||||
Vector c = new Vector(x, y, z);
|
||||
if(c.length() < (rad + 0.5) * ((noise.getNoise(x, y, z) + 1) * deform)) {
|
||||
addVector(c.add(start));
|
||||
|
||||
@@ -4,9 +4,9 @@ import org.bukkit.util.Vector;
|
||||
|
||||
public class Sphere extends VoxelGeometry {
|
||||
public Sphere(Vector start, int rad) {
|
||||
for(int x = - rad; x <= rad; x++) {
|
||||
for(int y = - rad; y <= rad; y++) {
|
||||
for(int z = - rad; z <= rad; z++) {
|
||||
for(int x = -rad; x <= rad; x++) {
|
||||
for(int y = -rad; y <= rad; y++) {
|
||||
for(int z = -rad; z <= rad; z++) {
|
||||
Vector c = new Vector(x, y, z);
|
||||
if(c.length() < rad + 0.5) {
|
||||
addVector(c.add(start));
|
||||
|
||||
@@ -39,7 +39,7 @@ import java.util.function.Consumer;
|
||||
import static com.dfsek.terra.util.structure.RotationUtil.*;
|
||||
|
||||
public class Structure implements Serializable {
|
||||
public static final long serialVersionUID = - 6664585217063842035L;
|
||||
public static final long serialVersionUID = -6664585217063842035L;
|
||||
private final StructureContainedBlock[][][] structure;
|
||||
private final StructureInfo structureInfo;
|
||||
private final String id;
|
||||
@@ -48,7 +48,7 @@ public class Structure implements Serializable {
|
||||
private final HashSet<StructureContainedInventory> inventories;
|
||||
|
||||
public Structure(@NotNull Location l1, @NotNull Location l2, @NotNull String id) throws InitializationException {
|
||||
int centerX = - 1, centerZ = - 1;
|
||||
int centerX = -1, centerZ = -1;
|
||||
this.id = id;
|
||||
this.uuid = UUID.randomUUID();
|
||||
this.spawns = new HashSet<>();
|
||||
@@ -108,7 +108,7 @@ public class Structure implements Serializable {
|
||||
if(state instanceof BlockInventoryHolder) {
|
||||
inventories.add(new StructureContainedInventory(((BlockInventoryHolder) state).getInventory(), block));
|
||||
}
|
||||
if(! requirement.equals(StructureSpawnRequirement.BLANK)) spawns.add(block);
|
||||
if(!requirement.equals(StructureSpawnRequirement.BLANK)) spawns.add(block);
|
||||
structure[x][z][y] = block;
|
||||
}
|
||||
}
|
||||
@@ -181,7 +181,7 @@ public class Structure implements Serializable {
|
||||
public boolean checkSpawns(Location origin, Rotation r) {
|
||||
for(StructureContainedBlock b : spawns) {
|
||||
Vector2 rot = getRotatedCoords(new Vector2(b.getX() - structureInfo.getCenterX(), b.getZ() - structureInfo.getCenterZ()), r);
|
||||
if(! b.getRequirement().matches(origin.getWorld(), (int) rot.getX() + origin.getBlockX(), origin.getBlockY() + b.getY(), (int) rot.getZ() + origin.getBlockZ()))
|
||||
if(!b.getRequirement().matches(origin.getWorld(), (int) rot.getX() + origin.getBlockX(), origin.getBlockY() + b.getY(), (int) rot.getZ() + origin.getBlockZ()))
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@@ -217,7 +217,7 @@ public class Structure implements Serializable {
|
||||
*/
|
||||
private void pasteBlock(StructureContainedBlock block, Location origin, Rotation r) {
|
||||
BlockData data = block.getBlockData().clone();
|
||||
if(! data.getMaterial().equals(Material.STRUCTURE_VOID)) {
|
||||
if(!data.getMaterial().equals(Material.STRUCTURE_VOID)) {
|
||||
|
||||
Location loc = origin.clone().add(block.getX(), block.getY(), block.getZ());
|
||||
Block worldBlock = loc.getBlock();
|
||||
|
||||
@@ -6,7 +6,7 @@ import org.bukkit.inventory.ItemStack;
|
||||
import java.io.Serializable;
|
||||
|
||||
public class StructureContainedInventory implements Serializable {
|
||||
public static final long serialVersionUID = - 175339605585943678L;
|
||||
public static final long serialVersionUID = -175339605585943678L;
|
||||
private final int uid;
|
||||
private final int x, y, z;
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ import com.dfsek.terra.procgen.math.Vector2;
|
||||
import java.io.Serializable;
|
||||
|
||||
public class StructureInfo implements Serializable {
|
||||
public static final long serialVersionUID = - 175639605885943678L;
|
||||
public static final long serialVersionUID = -175639605885943678L;
|
||||
private final int sizeX;
|
||||
private final int sizeY;
|
||||
private final int sizeZ;
|
||||
|
||||
@@ -46,7 +46,7 @@ public enum StructureSpawnRequirement implements Serializable {
|
||||
return true;
|
||||
}
|
||||
};
|
||||
private static final long serialVersionUID = - 175639605885943679L;
|
||||
private static final long serialVersionUID = -175639605885943679L;
|
||||
private static final transient Map<World, FastNoiseLite> noiseMap = new HashMap<>();
|
||||
|
||||
public static void putNoise(World w, FastNoiseLite noise) {
|
||||
|
||||
@@ -53,7 +53,7 @@ public class EntityFeature implements Feature {
|
||||
for(int i = 0; i < amountSpawn && i < attempts; i++) {
|
||||
int yv = y.get(random);
|
||||
Location attempt = l.clone().add(x.get(random) - cx, yv, z.get(random) - cz);
|
||||
if(! isInChunk(chunk, attempt)) continue; // Don't attempt spawn if not in current chunk.
|
||||
if(!isInChunk(chunk, attempt)) continue; // Don't attempt spawn if not in current chunk.
|
||||
|
||||
boolean canSpawn = false;
|
||||
while(yv >= 0 && attempt.getBlockY() >= l.getBlockY()) { // Go down, see if valid spawns exist.
|
||||
@@ -62,10 +62,10 @@ public class EntityFeature implements Feature {
|
||||
attempt.subtract(0, 1, 0);
|
||||
yv--;
|
||||
|
||||
if(! stand.contains(on.getType())) continue;
|
||||
if(!stand.contains(on.getType())) continue;
|
||||
|
||||
for(int j = 1; j < inSize + 1; j++)
|
||||
if(! in.contains(on.getRelative(BlockFace.UP, j).getType())) canSpawn = false;
|
||||
if(!in.contains(on.getRelative(BlockFace.UP, j).getType())) canSpawn = false;
|
||||
|
||||
if(canSpawn) break;
|
||||
}
|
||||
@@ -99,10 +99,10 @@ public class EntityFeature implements Feature {
|
||||
attempt.subtract(0, 1, 0);
|
||||
yv--;
|
||||
|
||||
if(! stand.contains(on.getType())) continue;
|
||||
if(!stand.contains(on.getType())) continue;
|
||||
|
||||
for(int j = 1; j < inSize + 1; j++)
|
||||
if(! in.contains(on.getRelative(BlockFace.UP, j).getType())) canSpawn = false;
|
||||
if(!in.contains(on.getRelative(BlockFace.UP, j).getType())) canSpawn = false;
|
||||
|
||||
if(canSpawn) break;
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ public class SerializableBanner implements SerializableBlockState {
|
||||
|
||||
@Override
|
||||
public BlockState getState(BlockState orig) {
|
||||
if(! (orig instanceof Banner)) throw new IllegalArgumentException("Provided BlockState is not a banner.");
|
||||
if(!(orig instanceof Banner)) throw new IllegalArgumentException("Provided BlockState is not a banner.");
|
||||
Banner banner = (Banner) orig;
|
||||
banner.setBaseColor(base);
|
||||
for(Pattern pattern : patterns) {
|
||||
|
||||
+1
-1
@@ -26,7 +26,7 @@ public class SerializableMonsterCage implements SerializableBlockState {
|
||||
|
||||
@Override
|
||||
public BlockState getState(BlockState orig) {
|
||||
if(! (orig instanceof CreatureSpawner))
|
||||
if(!(orig instanceof CreatureSpawner))
|
||||
throw new IllegalArgumentException("BlockState is not a Monster Spawner!");
|
||||
CreatureSpawner spawner = (CreatureSpawner) orig;
|
||||
spawner.setSpawnedType(type);
|
||||
|
||||
@@ -15,7 +15,7 @@ public class SerializableSign implements SerializableBlockState {
|
||||
|
||||
@Override
|
||||
public BlockState getState(BlockState orig) {
|
||||
if(! (orig instanceof Sign)) throw new IllegalArgumentException("Provided BlockState is not a sign.");
|
||||
if(!(orig instanceof Sign)) throw new IllegalArgumentException("Provided BlockState is not a sign.");
|
||||
Sign sign = (Sign) orig;
|
||||
for(int i = 0; i < text.length; i++) {
|
||||
sign.setLine(i, text[i]);
|
||||
|
||||
@@ -10,7 +10,7 @@ import java.util.logging.Level;
|
||||
public final class PaperUtil {
|
||||
public static void checkPaper(JavaPlugin main) {
|
||||
Bukkit.getScheduler().scheduleSyncDelayedTask(main, () -> {
|
||||
if(! PaperLib.isPaper()) {
|
||||
if(!PaperLib.isPaper()) {
|
||||
LangUtil.log("use-paper", Level.WARNING);
|
||||
}
|
||||
}, 100L);
|
||||
|
||||
@@ -17,13 +17,13 @@ public final class RotationUtil {
|
||||
Vector2 copy = orig.clone();
|
||||
switch(r) {
|
||||
case CW_90:
|
||||
copy.setX(orig.getZ()).setZ(- orig.getX());
|
||||
copy.setX(orig.getZ()).setZ(-orig.getX());
|
||||
break;
|
||||
case CCW_90:
|
||||
copy.setX(- orig.getZ()).setZ(orig.getX());
|
||||
copy.setX(-orig.getZ()).setZ(orig.getX());
|
||||
break;
|
||||
case CW_180:
|
||||
copy.multiply(- 1);
|
||||
copy.multiply(-1);
|
||||
break;
|
||||
}
|
||||
return copy;
|
||||
@@ -184,7 +184,7 @@ public final class RotationUtil {
|
||||
case NORTH_NORTH_WEST:
|
||||
return 15;
|
||||
default:
|
||||
return - 1;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import org.polydev.gaea.math.FastNoiseLite;
|
||||
|
||||
public class DistributionTest {
|
||||
private static final double[] normalMap = new double[] {- 0.8408907651901245D, - 0.8200346231460571D, - 0.8070776462554932D, - 0.7970088720321655D, - 0.7890776991844177D, - 0.7819743156433105D, - 0.7759857773780823D, - 0.7706204056739807D, - 0.765608549118042D, - 0.7611993551254272D, - 0.7569039463996887D, - 0.7528656125068665D, - 0.7492497563362122D, - 0.7458332777023315D, - 0.7424643039703369D, - 0.7392163872718811D, - 0.736059844493866D, - 0.7332375049591064D, - 0.7305010557174683D, - 0.7277776598930359D, - 0.7251102924346924D, - 0.7227165699005127D, - 0.7203239798545837D, - 0.7179931998252869D, - 0.7157421112060547D, - 0.7135322690010071D, - 0.71131432056427D, - 0.7092097997665405D, - 0.7071162462234497D, - 0.7050217390060425D, - 0.703119695186615D, - 0.7011850476264954D, - 0.6992706060409546D, - 0.6974170207977295D, - 0.6955324411392212D, - 0.6937324404716492D, - 0.6919872760772705D, - 0.690233588218689D, - 0.6885692477226257D, - 0.6869722008705139D, - 0.6852975487709045D, - 0.683682382106781D, - 0.6821723580360413D, - 0.6806833744049072D, - 0.679179310798645D, - 0.6776503324508667D, - 0.676136314868927D, - 0.6746450662612915D, - 0.6731522083282471D, - 0.6717588305473328D, - 0.6702994704246521D, - 0.6689524054527283D, - 0.6675862073898315D, - 0.6662633419036865D, - 0.6649606823921204D, - 0.6636543273925781D, - 0.6623714566230774D, - 0.6610865592956543D, - 0.6598274111747742D, - 0.6585804224014282D, - 0.6573819518089294D, - 0.6561920642852783D, - 0.6549379825592041D, - 0.6537073254585266D, - 0.6525376439094543D, - 0.6513495445251465D, - 0.650168240070343D, - 0.649040162563324D, - 0.6479091048240662D, - 0.6467820405960083D, - 0.6456737518310547D, - 0.6445609331130981D, - 0.6434952020645142D, - 0.6424031257629395D, - 0.6413089632987976D, - 0.640256941318512D, - 0.6391684412956238D, - 0.638137936592102D, - 0.6371254324913025D, - 0.6361099481582642D, - 0.6350630521774292D, - 0.6339953541755676D, - 0.6330388188362122D, - 0.632024347782135D, - 0.6310704946517944D, - 0.6300620436668396D, - 0.6290494799613953D, - 0.6280747056007385D, - 0.6271024346351624D, - 0.6261362433433533D, - 0.6251688599586487D, - 0.6242944002151489D, - 0.6233505606651306D, - 0.622406542301178D, - 0.6214921474456787D, - 0.6205630302429199D, - 0.619683563709259D, - 0.6187522411346436D, - 0.6178513169288635D, - 0.6170046925544739D, - 0.6161392331123352D, - 0.615269660949707D, - 0.6144152879714966D, - 0.6135557293891907D, - 0.6127009391784668D, - 0.6117991209030151D, - 0.6109536290168762D, - 0.6101033091545105D, - 0.6092590689659119D, - 0.6084139347076416D, - 0.6075553894042969D, - 0.6067432165145874D, - 0.6058894991874695D, - 0.6050370335578918D, - 0.6042441725730896D, - 0.6034530401229858D, - 0.6026210784912109D, - 0.6018084287643433D, - 0.6010326743125916D, - 0.6002528071403503D, - 0.5994450449943542D, - 0.5986629128456116D, - 0.5978666543960571D, - 0.5971032977104187D, - 0.5963031649589539D, - 0.5955566167831421D, - 0.5947844982147217D, - 0.5940142869949341D, - 0.5932715535163879D, - 0.5925368666648865D, - 0.5917928218841553D, - 0.591031014919281D, - 0.5903055667877197D, - 0.5895851850509644D, - 0.5888315439224243D, - 0.5880893468856812D, - 0.5873630046844482D, - 0.5866444110870361D, - 0.5859208106994629D, - 0.5852057933807373D, - 0.5844889879226685D, - 0.5837893486022949D, - 0.5830587148666382D, - 0.582359254360199D, - 0.5816157460212708D, - 0.5809139013290405D, - 0.5802302956581116D, - 0.5795474052429199D, - 0.5788565874099731D, - 0.5781614184379578D, - 0.5774743556976318D, - 0.5767905712127686D, - 0.5760961771011353D, - 0.5754467248916626D, - 0.5747898817062378D, - 0.5741211175918579D, - 0.5734619498252869D, - 0.5728112459182739D, - 0.5721414089202881D, - 0.5714717507362366D, - 0.5708272457122803D, - 0.5701769590377808D, - 0.5695428252220154D, - 0.568885087966919D, - 0.5682525038719177D, - 0.5675948262214661D, - 0.5669249296188354D, - 0.5663014054298401D, - 0.5656630992889404D, - 0.5650165677070618D, - 0.5643728971481323D, - 0.5637710094451904D, - 0.5631371736526489D, - 0.562507152557373D, - 0.5618733167648315D, - 0.5612503290176392D, - 0.560631513595581D, - 0.5600159168243408D, - 0.559416651725769D, - 0.5587995052337646D, - 0.5581864714622498D, - 0.5575871467590332D, - 0.556957483291626D, - 0.5563494563102722D, - 0.555757999420166D, - 0.5551457405090332D, - 0.5545571446418762D, - 0.5539442300796509D, - 0.5533522367477417D, - 0.5527352094650269D, - 0.5521476864814758D, - 0.5515644550323486D, - 0.5509964823722839D, - 0.550428032875061D, - 0.5498668551445007D, - 0.5492658615112305D, - 0.5486577749252319D, - 0.5480945110321045D, - 0.5475296378135681D, - 0.5469772815704346D, - 0.5463858246803284D, - 0.5458088517189026D, - 0.545259952545166D, - 0.5447098016738892D, - 0.5441542863845825D, - 0.5436179041862488D, - 0.5430275201797485D, - 0.5424584746360779D, - 0.5419116616249084D, - 0.5413541197776794D, - 0.5408090353012085D, - 0.5402546525001526D, - 0.5396901369094849D, - 0.539120078086853D, - 0.5385692715644836D, - 0.5380025506019592D,Line truncated
|
||||
private static final double[] normalMap = new double[] {-0.8408907651901245D, -0.8200346231460571D, -0.8070776462554932D, -0.7970088720321655D, -0.7890776991844177D, -0.7819743156433105D, -0.7759857773780823D, -0.7706204056739807D, -0.765608549118042D, -0.7611993551254272D, -0.7569039463996887D, -0.7528656125068665D, -0.7492497563362122D, -0.7458332777023315D, -0.7424643039703369D, -0.7392163872718811D, -0.736059844493866D, -0.7332375049591064D, -0.7305010557174683D, -0.7277776598930359D, -0.7251102924346924D, -0.7227165699005127D, -0.7203239798545837D, -0.7179931998252869D, -0.7157421112060547D, -0.7135322690010071D, -0.71131432056427D, -0.7092097997665405D, -0.7071162462234497D, -0.7050217390060425D, -0.703119695186615D, -0.7011850476264954D, -0.6992706060409546D, -0.6974170207977295D, -0.6955324411392212D, -0.6937324404716492D, -0.6919872760772705D, -0.690233588218689D, -0.6885692477226257D, -0.6869722008705139D, -0.6852975487709045D, -0.683682382106781D, -0.6821723580360413D, -0.6806833744049072D, -0.679179310798645D, -0.6776503324508667D, -0.676136314868927D, -0.6746450662612915D, -0.6731522083282471D, -0.6717588305473328D, -0.6702994704246521D, -0.6689524054527283D, -0.6675862073898315D, -0.6662633419036865D, -0.6649606823921204D, -0.6636543273925781D, -0.6623714566230774D, -0.6610865592956543D, -0.6598274111747742D, -0.6585804224014282D, -0.6573819518089294D, -0.6561920642852783D, -0.6549379825592041D, -0.6537073254585266D, -0.6525376439094543D, -0.6513495445251465D, -0.650168240070343D, -0.649040162563324D, -0.6479091048240662D, -0.6467820405960083D, -0.6456737518310547D, -0.6445609331130981D, -0.6434952020645142D, -0.6424031257629395D, -0.6413089632987976D, -0.640256941318512D, -0.6391684412956238D, -0.638137936592102D, -0.6371254324913025D, -0.6361099481582642D, -0.6350630521774292D, -0.6339953541755676D, -0.6330388188362122D, -0.632024347782135D, -0.6310704946517944D, -0.6300620436668396D, -0.6290494799613953D, -0.6280747056007385D, -0.6271024346351624D, -0.6261362433433533D, -0.6251688599586487D, -0.6242944002151489D, -0.6233505606651306D, -0.622406542301178D, -0.6214921474456787D, -0.6205630302429199D, -0.619683563709259D, -0.6187522411346436D, -0.6178513169288635D, -0.6170046925544739D, -0.6161392331123352D, -0.615269660949707D, -0.6144152879714966D, -0.6135557293891907D, -0.6127009391784668D, -0.6117991209030151D, -0.6109536290168762D, -0.6101033091545105D, -0.6092590689659119D, -0.6084139347076416D, -0.6075553894042969D, -0.6067432165145874D, -0.6058894991874695D, -0.6050370335578918D, -0.6042441725730896D, -0.6034530401229858D, -0.6026210784912109D, -0.6018084287643433D, -0.6010326743125916D, -0.6002528071403503D, -0.5994450449943542D, -0.5986629128456116D, -0.5978666543960571D, -0.5971032977104187D, -0.5963031649589539D, -0.5955566167831421D, -0.5947844982147217D, -0.5940142869949341D, -0.5932715535163879D, -0.5925368666648865D, -0.5917928218841553D, -0.591031014919281D, -0.5903055667877197D, -0.5895851850509644D, -0.5888315439224243D, -0.5880893468856812D, -0.5873630046844482D, -0.5866444110870361D, -0.5859208106994629D, -0.5852057933807373D, -0.5844889879226685D, -0.5837893486022949D, -0.5830587148666382D, -0.582359254360199D, -0.5816157460212708D, -0.5809139013290405D, -0.5802302956581116D, -0.5795474052429199D, -0.5788565874099731D, -0.5781614184379578D, -0.5774743556976318D, -0.5767905712127686D, -0.5760961771011353D, -0.5754467248916626D, -0.5747898817062378D, -0.5741211175918579D, -0.5734619498252869D, -0.5728112459182739D, -0.5721414089202881D, -0.5714717507362366D, -0.5708272457122803D, -0.5701769590377808D, -0.5695428252220154D, -0.568885087966919D, -0.5682525038719177D, -0.5675948262214661D, -0.5669249296188354D, -0.5663014054298401D, -0.5656630992889404D, -0.5650165677070618D, -0.5643728971481323D, -0.5637710094451904D, -0.5631371736526489D, -0.562507152557373D, -0.5618733167648315D, -0.5612503290176392D, -0.560631513595581D, -0.5600159168243408D, -0.559416651725769D, -0.5587995052337646D, -0.5581864714622498D, -0.5575871467590332D, -0.556957483291626D, -0.5563494563102722D, -0.555757999420166D, -0.5551457405090332D, -0.5545571446418762D, -0.5539442300796509D, -0.5533522367477417D, -0.5527352094650269D, -0.5521476864814758D, -0.5515644550323486D, -0.5509964823722839D, -0.550428032875061D, -0.5498668551445007D, -0.5492658615112305D, -0.5486577749252319D, -0.5480945110321045D, -0.5475296378135681D, -0.5469772815704346D, -0.5463858246803284D, -0.5458088517189026D, -0.545259952545166D, -0.5447098016738892D, -0.5441542863845825D, -0.5436179041862488D, -0.5430275201797485D, -0.5424584746360779D, -0.5419116616249084D, -0.5413541197776794D, -0.5408090353012085D, -0.5402546525001526D, -0.5396901369094849D, -0.539120078086853D, -0.5385692715644836D, -0.5380025506019592D, -0.5374376773834229D, -0.5369035601615906D, -0.5363785624504089D, -0.5358348488807678D, -0.5352905988693237D, -0.5347356796264648D, -0.5341591238975525D, -0.5336212515830994D, -0.5330695509910583D, -0.53253978490829Line truncated
|
||||
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
@@ -91,7 +91,7 @@ public class LookupGenerator {
|
||||
|
||||
public static int normalize(double i, int n) {
|
||||
i *= 1.42; // Magic simplex value (sqrt(2) plus a little)
|
||||
i = Math.min(Math.max(i, - 1), 1);
|
||||
i = Math.min(Math.max(i, -1), 1);
|
||||
return Math.min((int) Math.floor((i + 1) * ((double) n / 2)), n - 1);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user