mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2025-07-04 20:16:41 +00:00
Simplifications to VoxelSniper
Signed-off-by: MattBDev <4009945+MattBDev@users.noreply.github.com>
This commit is contained in:
@ -15,21 +15,25 @@ public class BlockResetBrush extends Brush {
|
||||
|
||||
static {
|
||||
BlockResetBrush.DENIED_UPDATES.add(Material.SIGN);
|
||||
BlockResetBrush.DENIED_UPDATES.add(Material.LEGACY_SIGN_POST);
|
||||
BlockResetBrush.DENIED_UPDATES.add(Material.WALL_SIGN);
|
||||
BlockResetBrush.DENIED_UPDATES.add(Material.CHEST);
|
||||
BlockResetBrush.DENIED_UPDATES.add(Material.FURNACE);
|
||||
BlockResetBrush.DENIED_UPDATES.add(Material.LEGACY_BURNING_FURNACE);
|
||||
BlockResetBrush.DENIED_UPDATES.add(Material.LEGACY_REDSTONE_TORCH_OFF);
|
||||
BlockResetBrush.DENIED_UPDATES.add(Material.LEGACY_REDSTONE_TORCH_ON);
|
||||
BlockResetBrush.DENIED_UPDATES.add(Material.REDSTONE_TORCH);
|
||||
BlockResetBrush.DENIED_UPDATES.add(Material.REDSTONE_WALL_TORCH);
|
||||
BlockResetBrush.DENIED_UPDATES.add(Material.REDSTONE_WIRE);
|
||||
BlockResetBrush.DENIED_UPDATES.add(Material.LEGACY_DIODE_BLOCK_OFF);
|
||||
BlockResetBrush.DENIED_UPDATES.add(Material.LEGACY_DIODE_BLOCK_ON);
|
||||
BlockResetBrush.DENIED_UPDATES.add(Material.LEGACY_WOODEN_DOOR);
|
||||
BlockResetBrush.DENIED_UPDATES.add(Material.LEGACY_WOOD_DOOR);
|
||||
BlockResetBrush.DENIED_UPDATES.add(Material.OAK_DOOR);
|
||||
BlockResetBrush.DENIED_UPDATES.add(Material.DARK_OAK_DOOR);
|
||||
BlockResetBrush.DENIED_UPDATES.add(Material.BIRCH_DOOR);
|
||||
BlockResetBrush.DENIED_UPDATES.add(Material.ACACIA_DOOR);
|
||||
BlockResetBrush.DENIED_UPDATES.add(Material.SPRUCE_DOOR);
|
||||
BlockResetBrush.DENIED_UPDATES.add(Material.JUNGLE_DOOR);
|
||||
BlockResetBrush.DENIED_UPDATES.add(Material.IRON_DOOR);
|
||||
BlockResetBrush.DENIED_UPDATES.add(Material.LEGACY_IRON_DOOR_BLOCK);
|
||||
BlockResetBrush.DENIED_UPDATES.add(Material.LEGACY_FENCE_GATE);
|
||||
BlockResetBrush.DENIED_UPDATES.add(Material.DARK_OAK_FENCE_GATE);
|
||||
BlockResetBrush.DENIED_UPDATES.add(Material.ACACIA_FENCE_GATE);
|
||||
BlockResetBrush.DENIED_UPDATES.add(Material.BIRCH_FENCE_GATE);
|
||||
BlockResetBrush.DENIED_UPDATES.add(Material.SPRUCE_FENCE_GATE);
|
||||
BlockResetBrush.DENIED_UPDATES.add(Material.JUNGLE_FENCE_GATE);
|
||||
BlockResetBrush.DENIED_UPDATES.add(Material.OAK_FENCE_GATE);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -39,7 +43,6 @@ public class BlockResetBrush extends Brush {
|
||||
this.setName("Block Reset Brush");
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
private void applyBrush(final SnipeData v) {
|
||||
for (int z = -v.getBrushSize(); z <= v.getBrushSize(); z++) {
|
||||
for (int x = -v.getBrushSize(); x <= v.getBrushSize(); x++) {
|
||||
|
@ -84,7 +84,7 @@ public class HeatRayBrush extends Brush {
|
||||
|
||||
if (currentLocation.toVector().isInSphere(targetLocation, v.getBrushSize())) {
|
||||
currentBlock = currentLocation.getBlock();
|
||||
if (currentBlock == null || currentBlock.getType() == Material.CHEST) {
|
||||
if (currentBlock.getType() == Material.CHEST) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -168,13 +168,13 @@ public class HeatRayBrush extends Brush {
|
||||
v.sendMessage(ChatColor.AQUA + "/b hr freq[float] -- Frequency parameter for the noise generator.");
|
||||
}
|
||||
if (parameter.startsWith("oct")) {
|
||||
this.octaves = Integer.valueOf(parameter.replace("oct", ""));
|
||||
this.octaves = Integer.parseInt(parameter.replace("oct", ""));
|
||||
v.getVoxelMessage().custom(ChatColor.GREEN + "Octaves: " + this.octaves);
|
||||
} else if (parameter.startsWith("amp")) {
|
||||
this.amplitude = Double.valueOf(parameter.replace("amp", ""));
|
||||
this.amplitude = Double.parseDouble(parameter.replace("amp", ""));
|
||||
v.getVoxelMessage().custom(ChatColor.GREEN + "Amplitude: " + this.amplitude);
|
||||
} else if (parameter.startsWith("freq")) {
|
||||
this.frequency = Double.valueOf(parameter.replace("freq", ""));
|
||||
this.frequency = Double.parseDouble(parameter.replace("freq", ""));
|
||||
v.getVoxelMessage().custom(ChatColor.GREEN + "Frequency: " + this.frequency);
|
||||
}
|
||||
}
|
||||
|
@ -151,13 +151,13 @@ public class MoveBrush extends Brush {
|
||||
v.getVoxelMessage().custom(ChatColor.AQUA + "Z direction set to: " + this.moveDirections[2]);
|
||||
}
|
||||
if (par[i].toLowerCase().startsWith("x")) {
|
||||
this.moveDirections[0] = Integer.valueOf(par[i].substring(1));
|
||||
this.moveDirections[0] = Integer.parseInt(par[i].substring(1));
|
||||
v.getVoxelMessage().custom(ChatColor.AQUA + "X direction set to: " + this.moveDirections[0]);
|
||||
} else if (par[i].toLowerCase().startsWith("y")) {
|
||||
this.moveDirections[1] = Integer.valueOf(par[i].substring(1));
|
||||
this.moveDirections[1] = Integer.parseInt(par[i].substring(1));
|
||||
v.getVoxelMessage().custom(ChatColor.AQUA + "Y direction set to: " + this.moveDirections[1]);
|
||||
} else if (par[i].toLowerCase().startsWith("z")) {
|
||||
this.moveDirections[2] = Integer.valueOf(par[i].substring(1));
|
||||
this.moveDirections[2] = Integer.parseInt(par[i].substring(1));
|
||||
v.getVoxelMessage().custom(ChatColor.AQUA + "Z direction set to: " + this.moveDirections[2]);
|
||||
}
|
||||
}
|
||||
@ -200,12 +200,12 @@ public class MoveBrush extends Brush {
|
||||
public boolean calculateRegion() throws Exception {
|
||||
if (this.location1 != null && this.location2 != null) {
|
||||
if (this.location1.getWorld().equals(this.location2.getWorld())) {
|
||||
final int lowX = ((this.location1.getBlockX() <= this.location2.getBlockX()) ? this.location1.getBlockX() : this.location2.getBlockX());
|
||||
final int lowY = (this.location1.getBlockY() <= this.location2.getBlockY()) ? this.location1.getBlockY() : this.location2.getBlockY();
|
||||
final int lowZ = (this.location1.getBlockZ() <= this.location2.getBlockZ()) ? this.location1.getBlockZ() : this.location2.getBlockZ();
|
||||
final int highX = (this.location1.getBlockX() >= this.location2.getBlockX()) ? this.location1.getBlockX() : this.location2.getBlockX();
|
||||
final int highY = (this.location1.getBlockY() >= this.location2.getBlockY()) ? this.location1.getBlockY() : this.location2.getBlockY();
|
||||
final int highZ = (this.location1.getBlockZ() >= this.location2.getBlockZ()) ? this.location1.getBlockZ() : this.location2.getBlockZ();
|
||||
final int lowX = Math.min(this.location1.getBlockX(), this.location2.getBlockX());
|
||||
final int lowY = Math.min(this.location1.getBlockY(), this.location2.getBlockY());
|
||||
final int lowZ = Math.min(this.location1.getBlockZ(), this.location2.getBlockZ());
|
||||
final int highX = Math.max(this.location1.getBlockX(), this.location2.getBlockX());
|
||||
final int highY = Math.max(this.location1.getBlockY(), this.location2.getBlockY());
|
||||
final int highZ = Math.max(this.location1.getBlockZ(), this.location2.getBlockZ());
|
||||
if (Math.abs(highX - lowX) * Math.abs(highZ - lowZ) * Math.abs(highY - lowY) > Selection.MAX_BLOCK_COUNT) {
|
||||
throw new Exception(ChatColor.RED + "Selection size above hardcoded limit, please use a smaller selection.");
|
||||
}
|
||||
|
@ -39,10 +39,6 @@ public class OceanBrush extends Brush {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param v
|
||||
* @param undo
|
||||
*/
|
||||
protected final void oceanator(final SnipeData v, final Undo undo) {
|
||||
final AsyncWorld world = this.getWorld();
|
||||
|
||||
@ -55,7 +51,7 @@ public class OceanBrush extends Brush {
|
||||
for (int z = minZ; z <= maxZ; z++) {
|
||||
final int currentHeight = getHeight(x, z);
|
||||
final int wLevelDiff = currentHeight - (this.waterLevel - 1);
|
||||
final int newSeaFloorLevel = ((this.waterLevel - wLevelDiff) >= LOW_CUT_LEVEL) ? this.waterLevel - wLevelDiff : LOW_CUT_LEVEL;
|
||||
final int newSeaFloorLevel = Math.max((this.waterLevel - wLevelDiff), LOW_CUT_LEVEL);
|
||||
|
||||
final int highestY = this.getWorld().getHighestBlockYAt(x, z);
|
||||
|
||||
|
@ -29,10 +29,8 @@ public class ScannerBrush extends Brush {
|
||||
private int clamp(final int value, final int min, final int max) {
|
||||
if (value < min) {
|
||||
return min;
|
||||
} else if (value > max) {
|
||||
return max;
|
||||
} else {
|
||||
return value;
|
||||
return Math.min(value, max);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -32,12 +32,12 @@ public class SetBrush extends PerformBrush {
|
||||
this.block = null;
|
||||
return true;
|
||||
}
|
||||
final int lowX = (this.block.getX() <= bl.getX()) ? this.block.getX() : bl.getX();
|
||||
final int lowY = (this.block.getY() <= bl.getY()) ? this.block.getY() : bl.getY();
|
||||
final int lowZ = (this.block.getZ() <= bl.getZ()) ? this.block.getZ() : bl.getZ();
|
||||
final int highX = (this.block.getX() >= bl.getX()) ? this.block.getX() : bl.getX();
|
||||
final int highY = (this.block.getY() >= bl.getY()) ? this.block.getY() : bl.getY();
|
||||
final int highZ = (this.block.getZ() >= bl.getZ()) ? this.block.getZ() : bl.getZ();
|
||||
final int lowX = Math.min(this.block.getX(), bl.getX());
|
||||
final int lowY = Math.min(this.block.getY(), bl.getY());
|
||||
final int lowZ = Math.min(this.block.getZ(), bl.getZ());
|
||||
final int highX = Math.max(this.block.getX(), bl.getX());
|
||||
final int highY = Math.max(this.block.getY(), bl.getY());
|
||||
final int highZ = Math.max(this.block.getZ(), bl.getZ());
|
||||
|
||||
if (Math.abs(highX - lowX) * Math.abs(highZ - lowZ) * Math.abs(highY - lowY) > SELECTION_SIZE_MAX) {
|
||||
v.sendMessage(ChatColor.RED + "Selection size above hardcoded limit, please use a smaller selection.");
|
||||
|
@ -29,12 +29,12 @@ public class SetRedstoneFlipBrush extends Brush {
|
||||
return true;
|
||||
} else {
|
||||
this.undo = new Undo();
|
||||
final int lowX = (this.block.getX() <= bl.getX()) ? this.block.getX() : bl.getX();
|
||||
final int lowY = (this.block.getY() <= bl.getY()) ? this.block.getY() : bl.getY();
|
||||
final int lowZ = (this.block.getZ() <= bl.getZ()) ? this.block.getZ() : bl.getZ();
|
||||
final int highX = (this.block.getX() >= bl.getX()) ? this.block.getX() : bl.getX();
|
||||
final int highY = (this.block.getY() >= bl.getY()) ? this.block.getY() : bl.getY();
|
||||
final int highZ = (this.block.getZ() >= bl.getZ()) ? this.block.getZ() : bl.getZ();
|
||||
final int lowX = Math.min(this.block.getX(), bl.getX());
|
||||
final int lowY = Math.min(this.block.getY(), bl.getY());
|
||||
final int lowZ = Math.min(this.block.getZ(), bl.getZ());
|
||||
final int highX = Math.max(this.block.getX(), bl.getX());
|
||||
final int highY = Math.max(this.block.getY(), bl.getY());
|
||||
final int highZ = Math.max(this.block.getZ(), bl.getZ());
|
||||
|
||||
for (int y = lowY; y <= highY; y++) {
|
||||
for (int x = lowX; x <= highX; x++) {
|
||||
|
@ -28,12 +28,12 @@ public class SetRedstoneRotateBrush extends Brush {
|
||||
return true;
|
||||
} else {
|
||||
this.undo = new Undo();
|
||||
final int lowX = (this.block.getX() <= bl.getX()) ? this.block.getX() : bl.getX();
|
||||
final int lowY = (this.block.getY() <= bl.getY()) ? this.block.getY() : bl.getY();
|
||||
final int lowZ = (this.block.getZ() <= bl.getZ()) ? this.block.getZ() : bl.getZ();
|
||||
final int highX = (this.block.getX() >= bl.getX()) ? this.block.getX() : bl.getX();
|
||||
final int highY = (this.block.getY() >= bl.getY()) ? this.block.getY() : bl.getY();
|
||||
final int highZ = (this.block.getZ() >= bl.getZ()) ? this.block.getZ() : bl.getZ();
|
||||
final int lowX = Math.min(this.block.getX(), bl.getX());
|
||||
final int lowY = Math.min(this.block.getY(), bl.getY());
|
||||
final int lowZ = Math.min(this.block.getZ(), bl.getZ());
|
||||
final int highX = Math.max(this.block.getX(), bl.getX());
|
||||
final int highY = Math.max(this.block.getY(), bl.getY());
|
||||
final int highZ = Math.max(this.block.getZ(), bl.getZ());
|
||||
|
||||
for (int y = lowY; y <= highY; y++) {
|
||||
for (int x = lowX; x <= highX; x++) {
|
||||
|
@ -37,18 +37,18 @@ public class ShellSetBrush extends Brush {
|
||||
return true;
|
||||
}
|
||||
|
||||
final int lowX = (this.block.getX() <= bl.getX()) ? this.block.getX() : bl.getX();
|
||||
final int lowY = (this.block.getY() <= bl.getY()) ? this.block.getY() : bl.getY();
|
||||
final int lowZ = (this.block.getZ() <= bl.getZ()) ? this.block.getZ() : bl.getZ();
|
||||
final int highX = (this.block.getX() >= bl.getX()) ? this.block.getX() : bl.getX();
|
||||
final int highY = (this.block.getY() >= bl.getY()) ? this.block.getY() : bl.getY();
|
||||
final int highZ = (this.block.getZ() >= bl.getZ()) ? this.block.getZ() : bl.getZ();
|
||||
final int lowX = Math.min(this.block.getX(), bl.getX());
|
||||
final int lowY = Math.min(this.block.getY(), bl.getY());
|
||||
final int lowZ = Math.min(this.block.getZ(), bl.getZ());
|
||||
final int highX = Math.max(this.block.getX(), bl.getX());
|
||||
final int highY = Math.max(this.block.getY(), bl.getY());
|
||||
final int highZ = Math.max(this.block.getZ(), bl.getZ());
|
||||
|
||||
if (Math.abs(highX - lowX) * Math.abs(highZ - lowZ) * Math.abs(highY - lowY) > MAX_SIZE) {
|
||||
int selectionSize = Math.abs(highX - lowX) * Math.abs(highZ - lowZ) * Math.abs(highY - lowY);
|
||||
if (selectionSize > MAX_SIZE) {
|
||||
v.sendMessage(ChatColor.RED + "Selection size above hardcoded limit, please use a smaller selection.");
|
||||
} else {
|
||||
final ArrayList<AsyncBlock> blocks = new ArrayList<>(
|
||||
((Math.abs(highX - lowX) * Math.abs(highZ - lowZ) * Math.abs(highY - lowY)) / 2));
|
||||
final ArrayList<AsyncBlock> blocks = new ArrayList<>(selectionSize / 2);
|
||||
for (int y = lowY; y <= highY; y++) {
|
||||
for (int x = lowX; x <= highX; x++) {
|
||||
for (int z = lowZ; z <= highZ; z++) {
|
||||
|
@ -8,6 +8,7 @@ import org.bukkit.block.BlockState;
|
||||
import org.bukkit.block.Sign;
|
||||
|
||||
import java.io.*;
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* Overwrites signs. (Wiki:
|
||||
@ -240,7 +241,7 @@ public class SignOverwriteBrush extends Brush {
|
||||
return i;
|
||||
}
|
||||
|
||||
String newText = "";
|
||||
StringBuilder newText = new StringBuilder();
|
||||
|
||||
// go through the array until the next top level parameter is found
|
||||
for (i++; i < params.length; i++) {
|
||||
@ -250,16 +251,16 @@ public class SignOverwriteBrush extends Brush {
|
||||
i--;
|
||||
break;
|
||||
} else {
|
||||
newText += currentParameter + " ";
|
||||
newText.append(currentParameter).append(" ");
|
||||
}
|
||||
}
|
||||
|
||||
newText = ChatColor.translateAlternateColorCodes('&', newText);
|
||||
newText = new StringBuilder(ChatColor.translateAlternateColorCodes('&', newText.toString()));
|
||||
|
||||
// remove last space or return if the string is empty and the user just wanted to set the status
|
||||
if (!newText.isEmpty() && newText.endsWith(" ")) {
|
||||
newText = newText.substring(0, newText.length() - 1);
|
||||
} else if (newText.isEmpty()) {
|
||||
if ((newText.length() > 0) && newText.toString().endsWith(" ")) {
|
||||
newText = new StringBuilder(newText.substring(0, newText.length() - 1));
|
||||
} else if (newText.length() == 0) {
|
||||
if (statusSet) {
|
||||
return i;
|
||||
}
|
||||
@ -269,10 +270,10 @@ public class SignOverwriteBrush extends Brush {
|
||||
// check the line length and cut the text if needed
|
||||
if (newText.length() > MAX_SIGN_LINE_LENGTH) {
|
||||
v.sendMessage(ChatColor.RED + "Warning: Text on line " + lineNumber + " exceeds the maximum line length of " + MAX_SIGN_LINE_LENGTH + " characters. Your text will be cut.");
|
||||
newText = newText.substring(0, MAX_SIGN_LINE_LENGTH);
|
||||
newText = new StringBuilder(newText.substring(0, MAX_SIGN_LINE_LENGTH));
|
||||
}
|
||||
|
||||
this.signTextLines[lineIndex] = newText;
|
||||
this.signTextLines[lineIndex] = newText.toString();
|
||||
return i;
|
||||
}
|
||||
|
||||
@ -298,17 +299,13 @@ public class SignOverwriteBrush extends Brush {
|
||||
|
||||
try {
|
||||
store.createNewFile();
|
||||
FileWriter outFile = new FileWriter(store);
|
||||
BufferedWriter outStream = new BufferedWriter(outFile);
|
||||
|
||||
for (int i = 0; i < this.signTextLines.length; i++) {
|
||||
outStream.write(this.signLinesEnabled[i] + "\n");
|
||||
outStream.write(this.signTextLines[i] + "\n");
|
||||
try (FileWriter outFile = new FileWriter(store); BufferedWriter outStream = new BufferedWriter(outFile)) {
|
||||
for (int i = 0; i < this.signTextLines.length; i++) {
|
||||
outStream.write(this.signLinesEnabled[i] + "\n");
|
||||
outStream.write(this.signTextLines[i] + "\n");
|
||||
}
|
||||
}
|
||||
|
||||
outStream.close();
|
||||
outFile.close();
|
||||
|
||||
v.sendMessage(ChatColor.BLUE + "File saved successfully.");
|
||||
} catch (IOException exception) {
|
||||
v.sendMessage(ChatColor.RED + "Failed to save file. " + exception.getMessage());
|
||||
@ -330,17 +327,12 @@ public class SignOverwriteBrush extends Brush {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
FileReader inFile = new FileReader(store);
|
||||
BufferedReader inStream = new BufferedReader(inFile);
|
||||
try (FileReader inFile = new FileReader(store); BufferedReader inStream = new BufferedReader(inFile)) {
|
||||
|
||||
for (int i = 0; i < this.signTextLines.length; i++) {
|
||||
this.signLinesEnabled[i] = Boolean.valueOf(inStream.readLine());
|
||||
this.signTextLines[i] = inStream.readLine();
|
||||
}
|
||||
|
||||
inStream.close();
|
||||
inFile.close();
|
||||
for (int i = 0; i < this.signTextLines.length; i++) {
|
||||
this.signLinesEnabled[i] = Boolean.parseBoolean(inStream.readLine());
|
||||
this.signTextLines[i] = inStream.readLine();
|
||||
}
|
||||
|
||||
v.sendMessage(ChatColor.BLUE + "File loaded successfully.");
|
||||
} catch (IOException exception) {
|
||||
@ -353,18 +345,14 @@ public class SignOverwriteBrush extends Brush {
|
||||
* Clears the internal text buffer. (Sets it to empty strings)
|
||||
*/
|
||||
private void clearBuffer() {
|
||||
for (int i = 0; i < this.signTextLines.length; i++) {
|
||||
this.signTextLines[i] = "";
|
||||
}
|
||||
Arrays.fill(this.signTextLines, "");
|
||||
}
|
||||
|
||||
/**
|
||||
* Resets line enabled states to enabled.
|
||||
*/
|
||||
private void resetStates() {
|
||||
for (int i = 0; i < this.signLinesEnabled.length; i++) {
|
||||
this.signLinesEnabled[i] = true;
|
||||
}
|
||||
Arrays.fill(this.signLinesEnabled, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -203,7 +203,7 @@ public class StencilBrush extends Brush {
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@SuppressWarnings("UnstableApiUsage")
|
||||
private void stencilSave(final SnipeData v) {
|
||||
|
||||
final File file = new File("plugins/VoxelSniper/stencils/" + this.filename + ".vstencil");
|
||||
@ -223,9 +223,9 @@ public class StencilBrush extends Brush {
|
||||
Files.createParentDirs(file);
|
||||
file.createNewFile();
|
||||
final FaweOutputStream out = new FaweOutputStream(new DataOutputStream(new PGZIPOutputStream(new BufferedOutputStream(new FileOutputStream(file)))));
|
||||
int blockPositionX = (this.firstPoint[0] > this.secondPoint[0]) ? this.secondPoint[0] : this.firstPoint[0];
|
||||
int blockPositionZ = (this.firstPoint[1] > this.secondPoint[1]) ? this.secondPoint[1] : this.firstPoint[1];
|
||||
int blockPositionY = (this.firstPoint[2] > this.secondPoint[2]) ? this.secondPoint[2] : this.firstPoint[2];
|
||||
int blockPositionX = Math.min(this.firstPoint[0], this.secondPoint[0]);
|
||||
int blockPositionZ = Math.min(this.firstPoint[1], this.secondPoint[1]);
|
||||
int blockPositionY = Math.min(this.firstPoint[2], this.secondPoint[2]);
|
||||
out.writeShort(this.x);
|
||||
out.writeShort(this.z);
|
||||
out.writeShort(this.y);
|
||||
|
@ -62,10 +62,10 @@ public class TriangleBrush extends PerformBrush {
|
||||
}
|
||||
|
||||
private void triangleP(final SnipeData v) {
|
||||
double lengthOne = 0;
|
||||
double lengthTwo = 0;
|
||||
double lengthThree = 0;
|
||||
double heronBig = 0;
|
||||
double lengthOne;
|
||||
double lengthTwo;
|
||||
double lengthThree;
|
||||
double heronBig;
|
||||
|
||||
// Calculate slope vectors
|
||||
for (int i = 0; i < 3; i++) {
|
||||
@ -85,7 +85,7 @@ public class TriangleBrush extends PerformBrush {
|
||||
lengthThree = Math.pow(Math.pow(this.vectorThree[0], 2) + Math.pow(this.vectorThree[1], 2) + Math.pow(this.vectorThree[2], 2), .5);
|
||||
|
||||
// Bigger vector determines brush size
|
||||
final int brushSize = (int) Math.ceil((lengthOne > lengthTwo) ? lengthOne : lengthTwo);
|
||||
final int brushSize = (int) Math.ceil(Math.max(lengthOne, lengthTwo));
|
||||
|
||||
// Calculate constant term
|
||||
final double planeConstant = this.normalVector[0] * this.coordsOne[0] + this.normalVector[1] * this.coordsOne[1] + this.normalVector[2] * this.coordsOne[2];
|
||||
|
Reference in New Issue
Block a user