mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2025-07-03 08:25:31 +00:00
Fix formatting issues
Signed-off-by: solonovamax <solonovamax@12oclockpoint.com>
This commit is contained in:
parent
c0e0dad100
commit
56671ac6a1
@ -179,7 +179,7 @@ ij_java_space_before_for_left_brace = true
|
|||||||
ij_java_space_before_for_parentheses = false
|
ij_java_space_before_for_parentheses = false
|
||||||
ij_java_space_before_for_semicolon = false
|
ij_java_space_before_for_semicolon = false
|
||||||
ij_java_space_before_if_left_brace = true
|
ij_java_space_before_if_left_brace = true
|
||||||
ij_java_space_before_if_parentheses = true
|
ij_java_space_before_if_parentheses = false
|
||||||
ij_java_space_before_method_call_parentheses = false
|
ij_java_space_before_method_call_parentheses = false
|
||||||
ij_java_space_before_method_left_brace = true
|
ij_java_space_before_method_left_brace = true
|
||||||
ij_java_space_before_method_parentheses = false
|
ij_java_space_before_method_parentheses = false
|
||||||
@ -340,7 +340,7 @@ ij_json_wrap_long_lines = false
|
|||||||
|
|
||||||
[{*.yaml,*.yml}]
|
[{*.yaml,*.yml}]
|
||||||
indent_size = 2
|
indent_size = 2
|
||||||
ij_yaml_keep_indents_on_empty_lines = false
|
ij_yaml_keep_indents_on_empty_lines = true
|
||||||
ij_yaml_keep_line_breaks = true
|
ij_yaml_keep_line_breaks = true
|
||||||
ij_yaml_space_before_colon = true
|
ij_yaml_space_before_colon = true
|
||||||
ij_yaml_spaces_within_braces = true
|
ij_yaml_spaces_within_braces = true
|
||||||
|
3
.idea/misc.xml
generated
3
.idea/misc.xml
generated
@ -1,6 +1,9 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<project version="4">
|
<project version="4">
|
||||||
<component name="EntryPointsManager">
|
<component name="EntryPointsManager">
|
||||||
|
<entry_points version="2.0">
|
||||||
|
<entry_point TYPE="field" FQNAME="com.dfsek.terra.util.StructureTypeEnum NETHER_FORTRESS" />
|
||||||
|
</entry_points>
|
||||||
<list size="1">
|
<list size="1">
|
||||||
<item index="0" class="java.lang.String" itemvalue="org.bukkit.event.EventHandler" />
|
<item index="0" class="java.lang.String" itemvalue="org.bukkit.event.EventHandler" />
|
||||||
</list>
|
</list>
|
||||||
|
17
Terra.iml
Normal file
17
Terra.iml
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<module version="4">
|
||||||
|
<component name="CheckStyle-IDEA-Module">
|
||||||
|
<option name="configuration">
|
||||||
|
<map />
|
||||||
|
</option>
|
||||||
|
</component>
|
||||||
|
<component name="FacetManager">
|
||||||
|
<facet type="minecraft" name="Minecraft">
|
||||||
|
<configuration>
|
||||||
|
<autoDetectTypes>
|
||||||
|
<platformType>SPIGOT</platformType>
|
||||||
|
</autoDetectTypes>
|
||||||
|
</configuration>
|
||||||
|
</facet>
|
||||||
|
</component>
|
||||||
|
</module>
|
@ -158,6 +158,22 @@ public class ConfigPack extends YamlConfiguration {
|
|||||||
LangUtil.log("config-pack.loaded", Level.INFO, getID(), String.valueOf((System.nanoTime() - l) / 1000000D));
|
LangUtil.log("config-pack.loaded", Level.INFO, getID(), String.valueOf((System.nanoTime() - l) / 1000000D));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getID() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Map<String, BiomeConfig> getBiomes() {
|
||||||
|
return biomes;
|
||||||
|
}
|
||||||
|
|
||||||
|
public StructureConfig getStructure(String id) {
|
||||||
|
return structures.get(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
public BiomeGridConfig getBiomeGrid(String id) {
|
||||||
|
return grids.get(id);
|
||||||
|
}
|
||||||
|
|
||||||
public static synchronized void loadAll(JavaPlugin main) {
|
public static synchronized void loadAll(JavaPlugin main) {
|
||||||
configs.clear();
|
configs.clear();
|
||||||
File file = new File(main.getDataFolder(), "packs");
|
File file = new File(main.getDataFolder(), "packs");
|
||||||
@ -188,22 +204,6 @@ public class ConfigPack extends YamlConfiguration {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getID() {
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Map<String, BiomeConfig> getBiomes() {
|
|
||||||
return biomes;
|
|
||||||
}
|
|
||||||
|
|
||||||
public StructureConfig getStructure(String id) {
|
|
||||||
return structures.get(id);
|
|
||||||
}
|
|
||||||
|
|
||||||
public BiomeGridConfig getBiomeGrid(String id) {
|
|
||||||
return grids.get(id);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static synchronized ConfigPack fromID(String id) {
|
public static synchronized ConfigPack fromID(String id) {
|
||||||
return configs.get(id);
|
return configs.get(id);
|
||||||
}
|
}
|
||||||
|
@ -15,9 +15,9 @@ import java.io.File;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
public class ImageLoader {
|
public class ImageLoader {
|
||||||
|
private static final double INVERSE_ROOT_2 = 0.7071067811865475;
|
||||||
private final BufferedImage image;
|
private final BufferedImage image;
|
||||||
private final Align align;
|
private final Align align;
|
||||||
private static final double INVERSE_ROOT_2 = 0.7071067811865475;
|
|
||||||
|
|
||||||
public ImageLoader(File file, Align align) throws IOException {
|
public ImageLoader(File file, Align align) throws IOException {
|
||||||
image = ImageIO.read(file);
|
image = ImageIO.read(file);
|
||||||
@ -90,20 +90,6 @@ public class ImageLoader {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void debug(boolean genStep, World w) {
|
|
||||||
if(!ConfigUtil.debug) return;
|
|
||||||
BufferedImage newImg = copyImage(image);
|
|
||||||
if(genStep) {
|
|
||||||
newImg = redrawStepped(image, w, align);
|
|
||||||
}
|
|
||||||
DebugGUI debugGUI = new DebugGUI(newImg);
|
|
||||||
debugGUI.start();
|
|
||||||
}
|
|
||||||
|
|
||||||
public double getNoiseVal(int x, int y, Channel channel) {
|
|
||||||
return ((double) (getChannel(x, y, channel) - 128) / 128) * inverseRoot2;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Align getAlign() {
|
public Align getAlign() {
|
||||||
return align;
|
return align;
|
||||||
}
|
}
|
||||||
|
@ -44,7 +44,7 @@ public class OrePopulator extends GaeaBlockPopulator {
|
|||||||
Bukkit.getPluginManager().callEvent(event);
|
Bukkit.getPluginManager().callEvent(event);
|
||||||
if(!event.isCancelled()) {
|
if(!event.isCancelled()) {
|
||||||
if(ore.crossChunks()) ore.doVein(v, chunk, random);
|
if(ore.crossChunks()) ore.doVein(v, chunk, random);
|
||||||
else ore.doVeinSingle(new Vector(x, y, z), chunk, random);
|
else ore.doVeinSingleChunk(new Vector(x, y, z), chunk, random);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -145,15 +145,6 @@ public class Vector2 implements Cloneable {
|
|||||||
return dx * dx + dz * dz;
|
return dx * dx + dz * dz;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean equals(Object obj) {
|
|
||||||
if(!(obj instanceof Vector2)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
Vector2 other = (Vector2) obj;
|
|
||||||
return other.x == this.x && other.z == this.z;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
int hash = 17;
|
int hash = 17;
|
||||||
|
@ -177,33 +177,13 @@ public class Structure implements Serializable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Paste structure at an origin location, confined to a single chunk.
|
* Get GaeaStructureInfo object
|
||||||
*
|
*
|
||||||
* @param origin Origin location
|
* @return Structure Info
|
||||||
* @param chunk Chunk to confine pasting to
|
|
||||||
* @param r Rotation
|
|
||||||
*/
|
*/
|
||||||
public void paste(Location origin, Chunk chunk, Rotation r) {
|
@NotNull
|
||||||
int xOr = (chunk.getX() << 4);
|
public StructureInfo getStructureInfo() {
|
||||||
int zOr = (chunk.getZ() << 4);
|
return structureInfo;
|
||||||
Range intersectX = new Range(xOr, xOr + 16).sub(origin.getBlockX() - structureInfo.getCenterX());
|
|
||||||
Range intersectZ = new Range(zOr, zOr + 16).sub(origin.getBlockZ() - structureInfo.getCenterZ());
|
|
||||||
if (intersectX == null || intersectZ == null) return;
|
|
||||||
executeForBlocksInRange(intersectX, getRange(Axis.Y, r), intersectZ, block -> pasteBlock(block, origin, r), r);
|
|
||||||
Debug.info(intersectX.toString() + " : " + intersectZ.toString());
|
|
||||||
}
|
|
||||||
|
|
||||||
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()))
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public HashSet<StructureContainedInventory> getInventories() {
|
|
||||||
return inventories;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -223,18 +203,6 @@ public class Structure implements Serializable {
|
|||||||
Debug.info(intersectX.toString() + " : " + intersectZ.toString());
|
Debug.info(intersectX.toString() + " : " + intersectZ.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Test whether a set of coordinates is within the current structure
|
|
||||||
*
|
|
||||||
* @param x X coordinate
|
|
||||||
* @param y Y coordinate
|
|
||||||
* @param z Z coordinate
|
|
||||||
* @return True if coordinate set is in structure, false if it is not.
|
|
||||||
*/
|
|
||||||
private boolean isInStructure(int x, int y, int z) {
|
|
||||||
return x < structureInfo.getSizeX() && y < structureInfo.getSizeY() && z < structureInfo.getSizeZ() && x >= 0 && y >= 0 && z >= 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Paste a single StructureDefinedBlock at an origin location, offset by its coordinates.
|
* Paste a single StructureDefinedBlock at an origin location, offset by its coordinates.
|
||||||
*
|
*
|
||||||
@ -306,20 +274,6 @@ public class Structure implements Serializable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
|
||||||
private Range getRawRange(@NotNull Axis a) {
|
|
||||||
switch(a) {
|
|
||||||
case X:
|
|
||||||
return new Range(0, structureInfo.getSizeX());
|
|
||||||
case Y:
|
|
||||||
return new Range(0, structureInfo.getSizeY());
|
|
||||||
case Z:
|
|
||||||
return new Range(0, structureInfo.getSizeZ());
|
|
||||||
default:
|
|
||||||
throw new IllegalArgumentException();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Execute a Consumer for all blocks in a cuboid region defined by 3 Ranges, accounting for rotation.
|
* Execute a Consumer for all blocks in a cuboid region defined by 3 Ranges, accounting for rotation.
|
||||||
*
|
*
|
||||||
@ -345,13 +299,15 @@ public class Structure implements Serializable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get GaeaStructureInfo object
|
* Test whether a set of coordinates is within the current structure
|
||||||
*
|
*
|
||||||
* @return Structure Info
|
* @param x X coordinate
|
||||||
|
* @param y Y coordinate
|
||||||
|
* @param z Z coordinate
|
||||||
|
* @return True if coordinate set is in structure, false if it is not.
|
||||||
*/
|
*/
|
||||||
@NotNull
|
private boolean isInStructure(int x, int y, int z) {
|
||||||
public StructureInfo getStructureInfo() {
|
return x < structureInfo.getSizeX() && y < structureInfo.getSizeY() && z < structureInfo.getSizeZ() && x >= 0 && y >= 0 && z >= 0;
|
||||||
return structureInfo;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
@ -369,6 +325,20 @@ public class Structure implements Serializable {
|
|||||||
return new Range((int) Math.floor(Math.min(min.getZ(), max.getZ())), (int) Math.ceil(Math.max(min.getZ(), max.getZ())) + 1);
|
return new Range((int) Math.floor(Math.min(min.getZ(), max.getZ())), (int) Math.ceil(Math.max(min.getZ(), max.getZ())) + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
private Range getRawRange(@NotNull Axis a) {
|
||||||
|
switch(a) {
|
||||||
|
case X:
|
||||||
|
return new Range(0, structureInfo.getSizeX());
|
||||||
|
case Y:
|
||||||
|
return new Range(0, structureInfo.getSizeY());
|
||||||
|
case Z:
|
||||||
|
return new Range(0, structureInfo.getSizeZ());
|
||||||
|
default:
|
||||||
|
throw new IllegalArgumentException();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* From an origin location (First bound) fetch the second bound.
|
* From an origin location (First bound) fetch the second bound.
|
||||||
*
|
*
|
||||||
|
@ -231,94 +231,4 @@ public final class RotationUtil {
|
|||||||
}
|
}
|
||||||
return orig;
|
return orig;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Get an integer representation of a BlockFace, to perform math on.
|
|
||||||
*
|
|
||||||
* @param f BlockFace to get integer for
|
|
||||||
* @return integer representation of BlockFace
|
|
||||||
*/
|
|
||||||
public static int faceRotation(BlockFace f) {
|
|
||||||
switch(f) {
|
|
||||||
case NORTH:
|
|
||||||
return 0;
|
|
||||||
case NORTH_NORTH_EAST:
|
|
||||||
return 1;
|
|
||||||
case NORTH_EAST:
|
|
||||||
return 2;
|
|
||||||
case EAST_NORTH_EAST:
|
|
||||||
return 3;
|
|
||||||
case EAST:
|
|
||||||
return 4;
|
|
||||||
case EAST_SOUTH_EAST:
|
|
||||||
return 5;
|
|
||||||
case SOUTH_EAST:
|
|
||||||
return 6;
|
|
||||||
case SOUTH_SOUTH_EAST:
|
|
||||||
return 7;
|
|
||||||
case SOUTH:
|
|
||||||
return 8;
|
|
||||||
case SOUTH_SOUTH_WEST:
|
|
||||||
return 9;
|
|
||||||
case SOUTH_WEST:
|
|
||||||
return 10;
|
|
||||||
case WEST_SOUTH_WEST:
|
|
||||||
return 11;
|
|
||||||
case WEST:
|
|
||||||
return 12;
|
|
||||||
case WEST_NORTH_WEST:
|
|
||||||
return 13;
|
|
||||||
case NORTH_WEST:
|
|
||||||
return 14;
|
|
||||||
case NORTH_NORTH_WEST:
|
|
||||||
return 15;
|
|
||||||
default:
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Convert integer to BlockFace representation
|
|
||||||
*
|
|
||||||
* @param r integer to get BlockFace for
|
|
||||||
* @return BlockFace represented by integer.
|
|
||||||
*/
|
|
||||||
public static BlockFace fromRotation(int r) {
|
|
||||||
switch(Math.floorMod(r, 16)) {
|
|
||||||
case 0:
|
|
||||||
return BlockFace.NORTH;
|
|
||||||
case 1:
|
|
||||||
return BlockFace.NORTH_NORTH_EAST;
|
|
||||||
case 2:
|
|
||||||
return BlockFace.NORTH_EAST;
|
|
||||||
case 3:
|
|
||||||
return BlockFace.EAST_NORTH_EAST;
|
|
||||||
case 4:
|
|
||||||
return BlockFace.EAST;
|
|
||||||
case 5:
|
|
||||||
return BlockFace.EAST_SOUTH_EAST;
|
|
||||||
case 6:
|
|
||||||
return BlockFace.SOUTH_EAST;
|
|
||||||
case 7:
|
|
||||||
return BlockFace.SOUTH_SOUTH_EAST;
|
|
||||||
case 8:
|
|
||||||
return BlockFace.SOUTH;
|
|
||||||
case 9:
|
|
||||||
return BlockFace.SOUTH_SOUTH_WEST;
|
|
||||||
case 10:
|
|
||||||
return BlockFace.SOUTH_WEST;
|
|
||||||
case 11:
|
|
||||||
return BlockFace.WEST_SOUTH_WEST;
|
|
||||||
case 12:
|
|
||||||
return BlockFace.WEST;
|
|
||||||
case 13:
|
|
||||||
return BlockFace.WEST_NORTH_WEST;
|
|
||||||
case 14:
|
|
||||||
return BlockFace.NORTH_WEST;
|
|
||||||
case 15:
|
|
||||||
return BlockFace.NORTH_NORTH_WEST;
|
|
||||||
default:
|
|
||||||
throw new IllegalArgumentException();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -36,13 +36,6 @@ public final class WorldEditUtil {
|
|||||||
return new Location[] {l1, l2};
|
return new Location[] {l1, l2};
|
||||||
}
|
}
|
||||||
|
|
||||||
public static WorldEditPlugin getWorldEdit() {
|
|
||||||
Plugin p = Bukkit.getServer().getPluginManager().getPlugin("WorldEdit");
|
|
||||||
if (p instanceof WorldEditPlugin) return (WorldEditPlugin) p;
|
|
||||||
Bukkit.getLogger().severe("[Terra] a command requiring WorldEdit was executed, but WorldEdit was not detected!");
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Location[] getSelectionPositions(Player sender) {
|
public static Location[] getSelectionPositions(Player sender) {
|
||||||
WorldEditPlugin we = WorldEditUtil.getWorldEdit();
|
WorldEditPlugin we = WorldEditUtil.getWorldEdit();
|
||||||
if(we == null) {
|
if(we == null) {
|
||||||
@ -66,4 +59,11 @@ public final class WorldEditUtil {
|
|||||||
Location l2 = new Location(sender.getWorld(), max.getBlockX(), max.getBlockY(), max.getBlockZ());
|
Location l2 = new Location(sender.getWorld(), max.getBlockX(), max.getBlockY(), max.getBlockZ());
|
||||||
return new Location[] {l1, l2};
|
return new Location[] {l1, l2};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static WorldEditPlugin getWorldEdit() {
|
||||||
|
Plugin p = Bukkit.getServer().getPluginManager().getPlugin("WorldEdit");
|
||||||
|
if(p instanceof WorldEditPlugin) return (WorldEditPlugin) p;
|
||||||
|
Bukkit.getLogger().severe("[Terra] a command requiring WorldEdit was executed, but WorldEdit was not detected!");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user