mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2025-08-16 16:35:41 +00:00
Reformat again
This commit is contained in:
parent
4f40550465
commit
a362ed47ce
@ -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) {
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
File diff suppressed because one or more lines are too long
@ -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);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user