Skip to content

Commit

Permalink
- Removed custom List implementations for vUndo and replaced with Lis…
Browse files Browse the repository at this point in the history
…t's.

* Massive code cleanup in com.thevoxelbox.voxelsniper.brush
- Removed unused classes.
- Removed redundant/unused brushes.
  • Loading branch information
MikeMatrix committed Sep 3, 2012
1 parent f54d99b commit b370f0d
Show file tree
Hide file tree
Showing 114 changed files with 9,139 additions and 11,720 deletions.
193 changes: 96 additions & 97 deletions src/main/java/com/thevoxelbox/voxelsniper/brush/AntiFreeze.java
Original file line number Diff line number Diff line change
@@ -1,118 +1,96 @@
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package com.thevoxelbox.voxelsniper.brush;

import org.bukkit.ChatColor;

import com.thevoxelbox.voxelsniper.vData;
import com.thevoxelbox.voxelsniper.vMessage;
import org.bukkit.ChatColor;

/**
*
* @author
* Gavjenks
*
* @author Gavjenks
*/
public class AntiFreeze extends Brush {

boolean bool = true;

public AntiFreeze() {
name = "AntiFreeze";
}

@Override
protected void arrow(com.thevoxelbox.voxelsniper.vData v) {
bx = tb.getX();
by = tb.getY();
bz = tb.getZ();
AF(v);
}
boolean bool = true;

@Override
protected void powder(com.thevoxelbox.voxelsniper.vData v) {
bool = false;
arrow(v);
bool = true;
}
private static int timesUsed = 0;

@Override
public void info(vMessage vm) {
vm.brushMessage(ChatColor.GOLD + "Arrow overlays insible wood stairs, powder is cobble stairs. Use whichever one you have less of in your build for easier undoing later. This may ruin builds with ice as a structural component. DOES NOT UNDO DIRECTLY.");
vm.brushName(name);
vm.size();
public AntiFreeze() {
this.name = "AntiFreeze";
}

public void AF(vData v) {
int bsize = v.brushSize;
public final void AF(final vData v) {
final int bsize = v.brushSize;

double bpow = Math.pow(bsize + 0.5, 2);
final double bpow = Math.pow(bsize + 0.5, 2);
for (int x = bsize; x >= 0; x--) {
double xpow = Math.pow(x, 2);
final double xpow = Math.pow(x, 2);
for (int z = bsize; z >= 0; z--) {
double zpow = Math.pow(z, 2);
final double zpow = Math.pow(z, 2);
if (xpow + zpow <= bpow) {
for (int y = 1; y < 127; y++) {
if (getBlockIdAt(bx + x, y, bz + z) == 79 && getBlockIdAt(bx + x, y + 1, bz + z) == 0) {
if (bool) {
setBlockIdAt(53, bx + x, y + 1, bz + z);
if (getBlockIdAt(bx + x, y, bz + z) == 53) {
setBlockIdAt(9, bx + x, y, bz + z);
if (this.getBlockIdAt(this.bx + x, y, this.bz + z) == 79 && this.getBlockIdAt(this.bx + x, y + 1, this.bz + z) == 0) {
if (this.bool) {
this.setBlockIdAt(53, this.bx + x, y + 1, this.bz + z);
if (this.getBlockIdAt(this.bx + x, y, this.bz + z) == 53) {
this.setBlockIdAt(9, this.bx + x, y, this.bz + z);
}
setBlockIdAt(53, bx + x, y + 1, bz - z);
if (getBlockIdAt(bx + x, y, bz - z) == 53) {
setBlockIdAt(9, bx + x, y, bz - z);
this.setBlockIdAt(53, this.bx + x, y + 1, this.bz - z);
if (this.getBlockIdAt(this.bx + x, y, this.bz - z) == 53) {
this.setBlockIdAt(9, this.bx + x, y, this.bz - z);
}
setBlockIdAt(53, bx - x, y + 1, bz + z);
if (getBlockIdAt(bx - x, y, bz + z) == 53) {
setBlockIdAt(9, bx - x, y, bz + z);
this.setBlockIdAt(53, this.bx - x, y + 1, this.bz + z);
if (this.getBlockIdAt(this.bx - x, y, this.bz + z) == 53) {
this.setBlockIdAt(9, this.bx - x, y, this.bz + z);
}
setBlockIdAt(53, bx - x, y + 1, bz - z);
if (getBlockIdAt(bx - x, y, bz - z) == 53) {
setBlockIdAt(9, bx - x, y, bz - z);
this.setBlockIdAt(53, this.bx - x, y + 1, this.bz - z);
if (this.getBlockIdAt(this.bx - x, y, this.bz - z) == 53) {
this.setBlockIdAt(9, this.bx - x, y, this.bz - z);
}
w.getBlockAt(bx + x, y + 1, bz + z).setData((byte) 6);
w.getBlockAt(bx + x, y + 1, bz - z).setData((byte) 6);
w.getBlockAt(bx - x, y + 1, bz + z).setData((byte) 6);
w.getBlockAt(bx - x, y + 1, bz - z).setData((byte) 6);
setBlockIdAt(9, bx + x, y, bz + z);
setBlockIdAt(9, bx + x, y, bz - z);
setBlockIdAt(9, bx - x, y, bz + z);
setBlockIdAt(9, bx - x, y, bz - z);
setBlockIdAt(9, bx + x, y, bz + z);
setBlockIdAt(9, bx + x, y, bz - z);
setBlockIdAt(9, bx - x, y, bz + z);
setBlockIdAt(9, bx - x, y, bz - z);
this.w.getBlockAt(this.bx + x, y + 1, this.bz + z).setData((byte) 6);
this.w.getBlockAt(this.bx + x, y + 1, this.bz - z).setData((byte) 6);
this.w.getBlockAt(this.bx - x, y + 1, this.bz + z).setData((byte) 6);
this.w.getBlockAt(this.bx - x, y + 1, this.bz - z).setData((byte) 6);
this.setBlockIdAt(9, this.bx + x, y, this.bz + z);
this.setBlockIdAt(9, this.bx + x, y, this.bz - z);
this.setBlockIdAt(9, this.bx - x, y, this.bz + z);
this.setBlockIdAt(9, this.bx - x, y, this.bz - z);
this.setBlockIdAt(9, this.bx + x, y, this.bz + z);
this.setBlockIdAt(9, this.bx + x, y, this.bz - z);
this.setBlockIdAt(9, this.bx - x, y, this.bz + z);
this.setBlockIdAt(9, this.bx - x, y, this.bz - z);
} else {

setBlockIdAt(67, bx + x, y + 1, bz + z);
if (getBlockIdAt(bx + x, y, bz + z) == 67) {
setBlockIdAt(9, bx + x, y, bz + z);
this.setBlockIdAt(67, this.bx + x, y + 1, this.bz + z);
if (this.getBlockIdAt(this.bx + x, y, this.bz + z) == 67) {
this.setBlockIdAt(9, this.bx + x, y, this.bz + z);
}
setBlockIdAt(67, bx + x, y + 1, bz - z);
if (getBlockIdAt(bx + x, y, bz - z) == 67) {
setBlockIdAt(9, bx + x, y, bz - z);
this.setBlockIdAt(67, this.bx + x, y + 1, this.bz - z);
if (this.getBlockIdAt(this.bx + x, y, this.bz - z) == 67) {
this.setBlockIdAt(9, this.bx + x, y, this.bz - z);
}
setBlockIdAt(67, bx - x, y + 1, bz + z);
if (getBlockIdAt(bx - x, y, bz + z) == 67) {
setBlockIdAt(9, bx - x, y, bz + z);
this.setBlockIdAt(67, this.bx - x, y + 1, this.bz + z);
if (this.getBlockIdAt(this.bx - x, y, this.bz + z) == 67) {
this.setBlockIdAt(9, this.bx - x, y, this.bz + z);
}
setBlockIdAt(67, bx - x, y + 1, bz - z);
if (getBlockIdAt(bx - x, y, bz - z) == 67) {
setBlockIdAt(9, bx - x, y, bz - z);
this.setBlockIdAt(67, this.bx - x, y + 1, this.bz - z);
if (this.getBlockIdAt(this.bx - x, y, this.bz - z) == 67) {
this.setBlockIdAt(9, this.bx - x, y, this.bz - z);
}
w.getBlockAt(bx + x, y + 1, bz + z).setData((byte) 6);
w.getBlockAt(bx + x, y + 1, bz - z).setData((byte) 6);
w.getBlockAt(bx - x, y + 1, bz + z).setData((byte) 6);
w.getBlockAt(bx - x, y + 1, bz - z).setData((byte) 6);
setBlockIdAt(9, bx + x, y, bz + z);
setBlockIdAt(9, bx + x, y, bz - z);
setBlockIdAt(9, bx - x, y, bz + z);
setBlockIdAt(9, bx - x, y, bz - z);
setBlockIdAt(9, bx + x, y, bz + z); //double set, in case it tries to do wonky stuff just because it'w ice and it is a paint in the ass.
setBlockIdAt(9, bx + x, y, bz - z);
setBlockIdAt(9, bx - x, y, bz + z);
setBlockIdAt(9, bx - x, y, bz - z);
this.w.getBlockAt(this.bx + x, y + 1, this.bz + z).setData((byte) 6);
this.w.getBlockAt(this.bx + x, y + 1, this.bz - z).setData((byte) 6);
this.w.getBlockAt(this.bx - x, y + 1, this.bz + z).setData((byte) 6);
this.w.getBlockAt(this.bx - x, y + 1, this.bz - z).setData((byte) 6);
this.setBlockIdAt(9, this.bx + x, y, this.bz + z);
this.setBlockIdAt(9, this.bx + x, y, this.bz - z);
this.setBlockIdAt(9, this.bx - x, y, this.bz + z);
this.setBlockIdAt(9, this.bx - x, y, this.bz - z);
this.setBlockIdAt(9, this.bx + x, y, this.bz + z); // double set, in case it tries to do wonky stuff just because it'w ice and
// it is a paint in
// the ass.
this.setBlockIdAt(9, this.bx + x, y, this.bz - z);
this.setBlockIdAt(9, this.bx - x, y, this.bz + z);
this.setBlockIdAt(9, this.bx - x, y, this.bz - z);

}
}
Expand All @@ -121,16 +99,37 @@ public void AF(vData v) {
}
}
}

private static int timesUsed = 0;


@Override
public final int getTimesUsed() {
return AntiFreeze.timesUsed;
}

@Override
public final void info(final vMessage vm) {
vm.brushMessage(ChatColor.GOLD
+ "Arrow overlays insible wood stairs, powder is cobble stairs. Use whichever one you have less of in your build for easier undoing later. This may ruin builds with ice as a structural component. DOES NOT UNDO DIRECTLY.");
vm.brushName(this.name);
vm.size();
}

@Override
public final void setTimesUsed(final int tUsed) {
AntiFreeze.timesUsed = tUsed;
}

@Override
public int getTimesUsed() {
return timesUsed;
}
protected final void arrow(final com.thevoxelbox.voxelsniper.vData v) {
this.bx = this.tb.getX();
this.by = this.tb.getY();
this.bz = this.tb.getZ();
this.AF(v);
}

@Override
public void setTimesUsed(int tUsed) {
timesUsed = tUsed;
}
@Override
protected final void powder(final com.thevoxelbox.voxelsniper.vData v) {
this.bool = false;
this.arrow(v);
this.bool = true;
}
}
Loading

0 comments on commit b370f0d

Please sign in to comment.