Potentially fix #1113

This commit is contained in:
Jesse Boyd 2018-09-13 02:00:02 +10:00
parent ee9467b5e4
commit e3172e08b8
No known key found for this signature in database
GPG Key ID: 59F1DE6293AF6E1F
14 changed files with 86 additions and 130 deletions

View File

@ -2,6 +2,7 @@ package com.thevoxelbox.voxelsniper.brush;
import com.boydti.fawe.bukkit.wrapper.AsyncBlock; import com.boydti.fawe.bukkit.wrapper.AsyncBlock;
import com.boydti.fawe.bukkit.wrapper.AsyncWorld; import com.boydti.fawe.bukkit.wrapper.AsyncWorld;
import com.sk89q.worldedit.world.registry.LegacyMapper;
import com.thevoxelbox.voxelsniper.Message; import com.thevoxelbox.voxelsniper.Message;
import com.thevoxelbox.voxelsniper.RangeBlockHelper; import com.thevoxelbox.voxelsniper.RangeBlockHelper;
import com.thevoxelbox.voxelsniper.SnipeAction; import com.thevoxelbox.voxelsniper.SnipeAction;
@ -308,4 +309,19 @@ public abstract class Brush implements IBrush
{ {
this.getWorld().getBlockAt(x, y, z).setTypeIdAndPropertyId(id, data, true); this.getWorld().getBlockAt(x, y, z).setTypeIdAndPropertyId(id, data, true);
} }
/**
* Sets the id and data value of the block at the passed coordinate.
*
* @param x X coordinate
* @param y Y coordinate
* @param z Z coordinate
* @param id The id the block will be set to
* @param data The data value the block will be set to
*/
@SuppressWarnings("deprecation")
protected final void setBlockLegacy(int x, int y, int z, int id, int data)
{
this.getWorld().getBlockAt(x, y, z).setCombinedId(LegacyMapper.getInstance().getBlockFromLegacy(id, data).getInternalId());
}
} }

View File

@ -45,7 +45,7 @@ public class CleanSnowBrush extends Brush
if ((this.clampY(this.getTargetBlock().getX() + x - brushSize, this.getTargetBlock().getY() + z - brushSize, this.getTargetBlock().getZ() + y - brushSize).getType() == Material.SNOW) && ((this.clampY(this.getTargetBlock().getX() + x - brushSize, this.getTargetBlock().getY() + z - brushSize - 1, this.getTargetBlock().getZ() + y - brushSize).getType() == Material.SNOW) || (this.clampY(this.getTargetBlock().getX() + x - brushSize, this.getTargetBlock().getY() + z - brushSize - 1, this.getTargetBlock().getZ() + y - brushSize).isEmpty()))) if ((this.clampY(this.getTargetBlock().getX() + x - brushSize, this.getTargetBlock().getY() + z - brushSize, this.getTargetBlock().getZ() + y - brushSize).getType() == Material.SNOW) && ((this.clampY(this.getTargetBlock().getX() + x - brushSize, this.getTargetBlock().getY() + z - brushSize - 1, this.getTargetBlock().getZ() + y - brushSize).getType() == Material.SNOW) || (this.clampY(this.getTargetBlock().getX() + x - brushSize, this.getTargetBlock().getY() + z - brushSize - 1, this.getTargetBlock().getZ() + y - brushSize).isEmpty())))
{ {
undo.put(this.clampY(this.getTargetBlock().getX() + x, this.getTargetBlock().getY() + z, this.getTargetBlock().getZ() + y)); undo.put(this.clampY(this.getTargetBlock().getX() + x, this.getTargetBlock().getY() + z, this.getTargetBlock().getZ() + y));
this.setBlockIdAt(this.getTargetBlock().getZ() + y - brushSize, this.getTargetBlock().getX() + x - brushSize, this.getTargetBlock().getY() + z - brushSize, 0); this.setBlockIdAt(this.getTargetBlock().getZ() + y - brushSize, this.getTargetBlock().getX() + x - brushSize, this.getTargetBlock().getY() + z - brushSize, BlockTypes.AIR.getInternalId());
} }
} }

View File

@ -8,6 +8,7 @@ import com.martiansoftware.jsap.JSAPException;
import com.martiansoftware.jsap.JSAPResult; import com.martiansoftware.jsap.JSAPResult;
import com.martiansoftware.jsap.UnflaggedOption; import com.martiansoftware.jsap.UnflaggedOption;
import com.martiansoftware.jsap.stringparsers.EnumeratedStringParser; import com.martiansoftware.jsap.stringparsers.EnumeratedStringParser;
import com.sk89q.worldedit.bukkit.BukkitAdapter;
import com.thevoxelbox.voxelsniper.Message; import com.thevoxelbox.voxelsniper.Message;
import com.thevoxelbox.voxelsniper.SnipeData; import com.thevoxelbox.voxelsniper.SnipeData;
import com.thevoxelbox.voxelsniper.Undo; import com.thevoxelbox.voxelsniper.Undo;
@ -105,7 +106,7 @@ public class ErodeBrush extends Brush
for (final BlockWrapper blockWrapper : blockChangeTracker.getAll()) for (final BlockWrapper blockWrapper : blockChangeTracker.getAll())
{ {
undo.put(blockWrapper.getBlock()); undo.put(blockWrapper.getBlock());
blockWrapper.getBlock().setTypeIdAndPropertyId(blockWrapper.getMaterial().getId(), blockWrapper.getPropertyId(), true); blockWrapper.getBlock().setTypeIdAndPropertyId(BukkitAdapter.adapt(blockWrapper.getMaterial()).getInternalId(), blockWrapper.getPropertyId(), true);
} }
v.owner().storeUndo(undo); v.owner().storeUndo(undo);

View File

@ -1,6 +1,7 @@
package com.thevoxelbox.voxelsniper.brush; package com.thevoxelbox.voxelsniper.brush;
import com.boydti.fawe.bukkit.wrapper.AsyncBlock; import com.boydti.fawe.bukkit.wrapper.AsyncBlock;
import com.sk89q.worldedit.world.block.BlockTypes;
import com.thevoxelbox.voxelsniper.Message; import com.thevoxelbox.voxelsniper.Message;
import com.thevoxelbox.voxelsniper.SnipeData; import com.thevoxelbox.voxelsniper.SnipeData;
import com.thevoxelbox.voxelsniper.brush.perform.PerformBrush; import com.thevoxelbox.voxelsniper.brush.perform.PerformBrush;
@ -126,7 +127,7 @@ public class FillDownBrush extends PerformBrush
else if (par[i].equalsIgnoreCase("some")) else if (par[i].equalsIgnoreCase("some"))
{ {
this.fillLiquid = false; this.fillLiquid = false;
v.setReplaceId(0); v.setReplaceId(BlockTypes.AIR.getInternalId());
v.sendMessage(ChatColor.AQUA + "Now only filling air."); v.sendMessage(ChatColor.AQUA + "Now only filling air.");
} }
else if (par[i].equalsIgnoreCase("-e")) else if (par[i].equalsIgnoreCase("-e"))

View File

@ -115,9 +115,9 @@ public class OverlayBrush extends PerformBrush
{ // if haven't already found the surface in this column { // if haven't already found the surface in this column
if ((Math.pow(x, 2) + Math.pow(z, 2)) <= brushSizeSquared) if ((Math.pow(x, 2) + Math.pow(z, 2)) <= brushSizeSquared)
{ // if inside of the column... { // if inside of the column...
if (this.getBlockIdAt(this.getTargetBlock().getX() + x, y - 1, this.getTargetBlock().getZ() + z) != 0) if (!this.getBlockAt(this.getTargetBlock().getX() + x, y - 1, this.getTargetBlock().getZ() + z).isEmpty())
{ // if not a floating block (like one of Notch'world pools) { // if not a floating block (like one of Notch'world pools)
if (this.getBlockIdAt(this.getTargetBlock().getX() + x, y + 1, this.getTargetBlock().getZ() + z) == 0) if (this.getBlockAt(this.getTargetBlock().getX() + x, y + 1, this.getTargetBlock().getZ() + z).isEmpty())
{ // must start at surface... this prevents it filling stuff in if { // must start at surface... this prevents it filling stuff in if
// you click in a wall and it starts out below surface. // you click in a wall and it starts out below surface.
if (!this.allBlocks) if (!this.allBlocks)

View File

@ -1,6 +1,7 @@
package com.thevoxelbox.voxelsniper.brush; package com.thevoxelbox.voxelsniper.brush;
import com.boydti.fawe.bukkit.wrapper.AsyncBlock; import com.boydti.fawe.bukkit.wrapper.AsyncBlock;
import com.sk89q.worldedit.world.block.BlockTypes;
import com.thevoxelbox.voxelsniper.Message; import com.thevoxelbox.voxelsniper.Message;
import com.thevoxelbox.voxelsniper.SnipeData; import com.thevoxelbox.voxelsniper.SnipeData;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
@ -101,7 +102,7 @@ public class PullBrush extends Brush
*/ */
private boolean isSurface(final int x, final int y, final int z) private boolean isSurface(final int x, final int y, final int z)
{ {
return this.getBlockIdAt(x, y, z) != 0 && ((this.getBlockIdAt(x, y - 1, z) == 0) || (this.getBlockIdAt(x, y + 1, z) == 0) || (this.getBlockIdAt(x + 1, y, z) == 0) || (this.getBlockIdAt(x - 1, y, z) == 0) || (this.getBlockIdAt(x, y, z + 1) == 0) || (this.getBlockIdAt(x, y, z - 1) == 0)); return !this.getBlockAt(x, y, z).isEmpty() && ((this.getBlockAt(x, y - 1, z).isEmpty()) || (this.getBlockAt(x, y + 1, z).isEmpty()) || (this.getBlockAt(x + 1, y, z).isEmpty()) || (this.getBlockAt(x - 1, y, z).isEmpty()) || (this.getBlockAt(x, y, z + 1).isEmpty()) || (this.getBlockAt(x, y, z - 1).isEmpty()));
} }
@ -109,13 +110,13 @@ public class PullBrush extends Brush
private void setBlock(final BlockWrapper block) private void setBlock(final BlockWrapper block)
{ {
final AsyncBlock currentBlock = this.clampY(block.getX(), block.getY() + (int) (this.vh * block.getStr()), block.getZ()); final AsyncBlock currentBlock = this.clampY(block.getX(), block.getY() + (int) (this.vh * block.getStr()), block.getZ());
if (this.getBlockIdAt(block.getX(), block.getY() - 1, block.getZ()) == 0) if (this.getBlockAt(block.getX(), block.getY() - 1, block.getZ()).isEmpty())
{ {
currentBlock.setTypeId(block.getId()); currentBlock.setTypeId(block.getId());
currentBlock.setPropertyId(block.getD()); currentBlock.setPropertyId(block.getD());
for (int y = block.getY(); y < currentBlock.getY(); y++) for (int y = block.getY(); y < currentBlock.getY(); y++)
{ {
this.setBlockIdAt(block.getZ(), block.getX(), y, 0); this.setBlockIdAt(block.getZ(), block.getX(), y, BlockTypes.AIR.getInternalId());
} }
} }
else else
@ -139,7 +140,7 @@ public class PullBrush extends Brush
currentBlock.setPropertyId(block.getD()); currentBlock.setPropertyId(block.getD());
for (int y = block.getY(); y > currentBlock.getY(); y--) for (int y = block.getY(); y > currentBlock.getY(); y--)
{ {
this.setBlockIdAt(block.getZ(), block.getX(), y, 0); this.setBlockIdAt(block.getZ(), block.getX(), y, BlockTypes.AIR.getInternalId());
} }
// } // }
} }

View File

@ -1,6 +1,7 @@
package com.thevoxelbox.voxelsniper.brush; package com.thevoxelbox.voxelsniper.brush;
import com.boydti.fawe.bukkit.wrapper.AsyncBlock; import com.boydti.fawe.bukkit.wrapper.AsyncBlock;
import com.sk89q.worldedit.world.block.BlockTypes;
import com.thevoxelbox.voxelsniper.Message; import com.thevoxelbox.voxelsniper.Message;
import com.thevoxelbox.voxelsniper.SnipeData; import com.thevoxelbox.voxelsniper.SnipeData;
import com.thevoxelbox.voxelsniper.Undo; import com.thevoxelbox.voxelsniper.Undo;
@ -198,7 +199,7 @@ public class RandomErodeBrush extends Brush
{ {
if (this.erode(x, y, z)) if (this.erode(x, y, z))
{ {
this.snap[x][y][z].getNativeBlock().setTypeId(0); this.snap[x][y][z].getNativeBlock().setTypeId(BlockTypes.AIR.getInternalId());
} }
} }
} }
@ -311,7 +312,7 @@ public class RandomErodeBrush extends Brush
{ {
if (this.erode(x, y, z)) if (this.erode(x, y, z))
{ {
this.snap[x][y][z].getNativeBlock().setTypeId(0); this.snap[x][y][z].getNativeBlock().setTypeId(BlockTypes.AIR.getInternalId());
} }
} }
} }

View File

@ -1,6 +1,7 @@
package com.thevoxelbox.voxelsniper.brush; package com.thevoxelbox.voxelsniper.brush;
import com.boydti.fawe.bukkit.wrapper.AsyncBlock; import com.boydti.fawe.bukkit.wrapper.AsyncBlock;
import com.sk89q.worldedit.world.block.BlockTypes;
import com.thevoxelbox.voxelsniper.Message; import com.thevoxelbox.voxelsniper.Message;
import com.thevoxelbox.voxelsniper.SnipeData; import com.thevoxelbox.voxelsniper.SnipeData;
import com.thevoxelbox.voxelsniper.util.BlockWrapper; import com.thevoxelbox.voxelsniper.util.BlockWrapper;
@ -51,7 +52,7 @@ public class Rot2DBrush extends Brush
{ {
final AsyncBlock block = this.clampY(sx, sy, sz); // why is this not sx + x, sy + y sz + z? final AsyncBlock block = this.clampY(sx, sy, sz); // why is this not sx + x, sy + y sz + z?
this.snap[x][z][y] = new BlockWrapper(block); this.snap[x][z][y] = new BlockWrapper(block);
block.setTypeId(0); block.setTypeId(BlockTypes.AIR.getInternalId());
sy++; sy++;
} }
} }
@ -92,7 +93,7 @@ public class Rot2DBrush extends Brush
final int yy = currentY - this.bSize; final int yy = currentY - this.bSize;
final BlockWrapper block = this.snap[x][currentY][y]; final BlockWrapper block = this.snap[x][currentY][y];
if (block.getId() == 0) if (BlockTypes.get(block.getId()).getMaterial().isAir())
{ {
continue; continue;
} }

View File

@ -1,6 +1,7 @@
package com.thevoxelbox.voxelsniper.brush; package com.thevoxelbox.voxelsniper.brush;
import com.boydti.fawe.bukkit.wrapper.AsyncBlock; import com.boydti.fawe.bukkit.wrapper.AsyncBlock;
import com.sk89q.worldedit.world.block.BlockTypes;
import com.thevoxelbox.voxelsniper.Message; import com.thevoxelbox.voxelsniper.Message;
import com.thevoxelbox.voxelsniper.SnipeData; import com.thevoxelbox.voxelsniper.SnipeData;
import com.thevoxelbox.voxelsniper.util.BlockWrapper; import com.thevoxelbox.voxelsniper.util.BlockWrapper;
@ -52,7 +53,7 @@ public class Rot2DvertBrush extends Brush
{ {
final AsyncBlock block = this.clampY(sx, sy, sz); // why is this not sx + x, sy + y sz + z? final AsyncBlock block = this.clampY(sx, sy, sz); // why is this not sx + x, sy + y sz + z?
this.snap[x][y][z] = new BlockWrapper(block); this.snap[x][y][z] = new BlockWrapper(block);
block.setTypeId(0); block.setTypeId(BlockTypes.AIR.getInternalId());
sy++; sy++;
} }
@ -93,7 +94,7 @@ public class Rot2DvertBrush extends Brush
final int yy = y - this.bSize; final int yy = y - this.bSize;
final BlockWrapper block = this.snap[y][x][z]; final BlockWrapper block = this.snap[y][x][z];
if (block.getId() == 0) if (BlockTypes.get(block.getId()).getMaterial().isAir())
{ {
continue; continue;
} }

View File

@ -1,6 +1,7 @@
package com.thevoxelbox.voxelsniper.brush; package com.thevoxelbox.voxelsniper.brush;
import com.boydti.fawe.bukkit.wrapper.AsyncBlock; import com.boydti.fawe.bukkit.wrapper.AsyncBlock;
import com.sk89q.worldedit.world.block.BlockTypes;
import com.thevoxelbox.voxelsniper.Message; import com.thevoxelbox.voxelsniper.Message;
import com.thevoxelbox.voxelsniper.SnipeData; import com.thevoxelbox.voxelsniper.SnipeData;
import com.thevoxelbox.voxelsniper.Undo; import com.thevoxelbox.voxelsniper.Undo;
@ -114,7 +115,7 @@ public class Rot3DBrush extends Brush
{ {
final AsyncBlock block = this.clampY(sx, sz, sz); final AsyncBlock block = this.clampY(sx, sz, sz);
this.snap[x][y][z] = new BlockWrapper(block); this.snap[x][y][z] = new BlockWrapper(block);
block.setTypeId(0); block.setTypeId(BlockTypes.AIR.getInternalId());
sz++; sz++;
} }
} }
@ -176,7 +177,7 @@ public class Rot3DBrush extends Brush
// after all three, though. // after all three, though.
final BlockWrapper block = this.snap[x][y][z]; final BlockWrapper block = this.snap[x][y][z];
if (block.getId() == 0) if (BlockTypes.get(block.getId()).getMaterial().isAir())
{ {
continue; continue;
} }

View File

@ -50,7 +50,7 @@ public class SnowConeBrush extends Brush
{ // overlay { // overlay
if (flag) if (flag)
{ {
if ((this.getBlockIdAt(blockPositionX - brushSize + x, blockPositionY - i, blockPositionZ - brushSize + z) == 0 || this.getBlockIdAt(blockPositionX - brushSize + x, blockPositionY - i, blockPositionZ - brushSize + z) == BlockTypes.SNOW.getInternalId()) && !this.getBlockAt(blockPositionX - brushSize + x, blockPositionY - i - 1, blockPositionZ - brushSize + z).isEmpty() && this.getBlockIdAt(blockPositionX - brushSize + x, blockPositionY - i - 1, blockPositionZ - brushSize + z) != Material.SNOW.getId()) if ((this.getBlockAt(blockPositionX - brushSize + x, blockPositionY - i, blockPositionZ - brushSize + z).isEmpty() || this.getBlockIdAt(blockPositionX - brushSize + x, blockPositionY - i, blockPositionZ - brushSize + z) == BlockTypes.SNOW.getInternalId()) && !this.getBlockAt(blockPositionX - brushSize + x, blockPositionY - i - 1, blockPositionZ - brushSize + z).isEmpty() && this.getBlockIdAt(blockPositionX - brushSize + x, blockPositionY - i - 1, blockPositionZ - brushSize + z) != BlockTypes.SNOW.getInternalId())
{ {
flag = false; flag = false;
yOffset[x][z] = i; yOffset[x][z] = i;

View File

@ -1,9 +1,14 @@
package com.thevoxelbox.voxelsniper.brush; package com.thevoxelbox.voxelsniper.brush;
import com.sk89q.worldedit.bukkit.BukkitAdapter;
import com.sk89q.worldedit.extension.input.InputParseException;
import com.sk89q.worldedit.world.block.BlockTypes;
import com.sk89q.worldedit.world.registry.LegacyMapper;
import com.thevoxelbox.voxelsniper.Message; import com.thevoxelbox.voxelsniper.Message;
import com.thevoxelbox.voxelsniper.SnipeData; import com.thevoxelbox.voxelsniper.SnipeData;
import com.thevoxelbox.voxelsniper.Undo; import com.thevoxelbox.voxelsniper.Undo;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.block.Block; import org.bukkit.block.Block;
/** /**
@ -296,48 +301,30 @@ public class SpiralStaircaseBrush extends Brush
{ {
if (!((this.stairtype.equalsIgnoreCase("woodstair") || this.stairtype.equalsIgnoreCase("cobblestair")) && spiral[x][i + 1][z] == 1)) if (!((this.stairtype.equalsIgnoreCase("woodstair") || this.stairtype.equalsIgnoreCase("cobblestair")) && spiral[x][i + 1][z] == 1))
{ {
if (this.getBlockIdAt(blockPositionX - v.getBrushSize() + x, blockPositionY + i, blockPositionZ - v.getBrushSize() + z) != 0) this.setBlockIdAt(blockPositionZ - v.getBrushSize() + z, blockPositionX - v.getBrushSize() + x, blockPositionY + i, BlockTypes.AIR.getInternalId());
{
undo.put(this.clampY(blockPositionX - v.getBrushSize() + x, blockPositionY + i, blockPositionZ - v.getBrushSize() + z));
}
this.setBlockIdAt(blockPositionZ - v.getBrushSize() + z, blockPositionX - v.getBrushSize() + x, blockPositionY + i, 0);
} }
} }
else else
{ {
if (this.getBlockIdAt(blockPositionX - v.getBrushSize() + x, blockPositionY + i, blockPositionZ - v.getBrushSize() + z) != 0) this.setBlockIdAt(blockPositionZ - v.getBrushSize() + z, blockPositionX - v.getBrushSize() + x, blockPositionY + i, BlockTypes.AIR.getInternalId());
{
undo.put(this.clampY(blockPositionX - v.getBrushSize() + x, blockPositionY + i, blockPositionZ - v.getBrushSize() + z));
}
this.setBlockIdAt(blockPositionZ - v.getBrushSize() + z, blockPositionX - v.getBrushSize() + x, blockPositionY + i, 0);
} }
break; break;
case 1: case 1:
switch (stairtype) {
}
if (this.stairtype.equalsIgnoreCase("block")) if (this.stairtype.equalsIgnoreCase("block"))
{ {
if (this.getBlockIdAt(blockPositionX - v.getBrushSize() + x, blockPositionY + i, blockPositionZ - v.getBrushSize() + z) != v.getVoxelId())
{
undo.put(this.clampY(blockPositionX - v.getBrushSize() + x, blockPositionY + i, blockPositionZ - v.getBrushSize() + z));
}
this.setBlockIdAt(blockPositionZ - v.getBrushSize() + z, blockPositionX - v.getBrushSize() + x, blockPositionY + i, v.getVoxelId()); this.setBlockIdAt(blockPositionZ - v.getBrushSize() + z, blockPositionX - v.getBrushSize() + x, blockPositionY + i, v.getVoxelId());
} }
else if (this.stairtype.equalsIgnoreCase("step")) else if (this.stairtype.equalsIgnoreCase("step"))
{ {
if (this.getBlockIdAt(blockPositionX - v.getBrushSize() + x, blockPositionY + i, blockPositionZ - v.getBrushSize() + z) != 44) this.setBlockLegacy(blockPositionX - v.getBrushSize() + x, blockPositionY + i, blockPositionZ - v.getBrushSize() + z, 44, v.getPropertyId());
{
undo.put(this.clampY(blockPositionX - v.getBrushSize() + x, blockPositionY + i, blockPositionZ - v.getBrushSize() + z));
}
this.setBlockIdAt(blockPositionZ - v.getBrushSize() + z, blockPositionX - v.getBrushSize() + x, blockPositionY + i, 44);
this.clampY(blockPositionX - v.getBrushSize() + x, blockPositionY + i, blockPositionZ - v.getBrushSize() + z).setPropertyId(v.getPropertyId());
} }
else if (this.stairtype.equalsIgnoreCase("woodstair") || this.stairtype.equalsIgnoreCase("cobblestair")) else if (this.stairtype.equalsIgnoreCase("woodstair") || this.stairtype.equalsIgnoreCase("cobblestair"))
{ {
if (this.getBlockIdAt(blockPositionX - v.getBrushSize() + x, blockPositionY + i - 1, blockPositionZ - v.getBrushSize() + z) != v.getVoxelId())
{
undo.put(this.clampY(blockPositionX - v.getBrushSize() + x, blockPositionY + i - 1, blockPositionZ - v.getBrushSize() + z));
}
this.setBlockIdAt(blockPositionZ - v.getBrushSize() + z, blockPositionX - v.getBrushSize() + x, blockPositionY + i - 1, v.getVoxelId()); this.setBlockIdAt(blockPositionZ - v.getBrushSize() + z, blockPositionX - v.getBrushSize() + x, blockPositionY + i - 1, v.getVoxelId());
} }
@ -345,50 +332,25 @@ public class SpiralStaircaseBrush extends Brush
case 2: case 2:
if (this.stairtype.equalsIgnoreCase("step")) if (this.stairtype.equalsIgnoreCase("step"))
{ {
if (this.getBlockIdAt(blockPositionX - v.getBrushSize() + x, blockPositionY + i, blockPositionZ - v.getBrushSize() + z) != 43) this.setBlockLegacy(blockPositionX - v.getBrushSize() + x, blockPositionY + i, blockPositionZ - v.getBrushSize() + z, 43, v.getPropertyId());
{
undo.put(this.clampY(blockPositionX - v.getBrushSize() + x, blockPositionY + i, blockPositionZ - v.getBrushSize() + z));
}
this.setBlockIdAt(blockPositionZ - v.getBrushSize() + z, blockPositionX - v.getBrushSize() + x, blockPositionY + i, 43);
this.clampY(blockPositionX - v.getBrushSize() + x, blockPositionY + i, blockPositionZ - v.getBrushSize() + z).setPropertyId(v.getPropertyId());
} }
else if (this.stairtype.equalsIgnoreCase("woodstair")) else if (this.stairtype.equalsIgnoreCase("woodstair"))
{ {
if (this.getBlockIdAt(blockPositionX - v.getBrushSize() + x, blockPositionY + i, blockPositionZ - v.getBrushSize() + z) != 53) this.setBlockLegacy(blockPositionX - v.getBrushSize() + x, blockPositionY + i, blockPositionZ - v.getBrushSize() + z, 53, 0);
{
undo.put(this.clampY(blockPositionX - v.getBrushSize() + x, blockPositionY + i, blockPositionZ - v.getBrushSize() + z));
}
this.setBlockIdAt(blockPositionZ - v.getBrushSize() + z, blockPositionX - v.getBrushSize() + x, blockPositionY + i, 53);
this.clampY(blockPositionX - v.getBrushSize() + x, blockPositionY + i, blockPositionZ - v.getBrushSize() + z).setPropertyId( 0);
} }
else if (this.stairtype.equalsIgnoreCase("cobblestair")) else if (this.stairtype.equalsIgnoreCase("cobblestair"))
{ {
if (this.getBlockIdAt(blockPositionX - v.getBrushSize() + x, blockPositionY + i, blockPositionZ - v.getBrushSize() + z) != 67) this.setBlockLegacy(blockPositionX - v.getBrushSize() + x, blockPositionY + i, blockPositionZ - v.getBrushSize() + z, 67, 0);
{
undo.put(this.clampY(blockPositionX - v.getBrushSize() + x, blockPositionY + i, blockPositionZ - v.getBrushSize() + z));
}
this.setBlockIdAt(blockPositionZ - v.getBrushSize() + z, blockPositionX - v.getBrushSize() + x, blockPositionY + i, 67);
this.clampY(blockPositionX - v.getBrushSize() + x, blockPositionY + i, blockPositionZ - v.getBrushSize() + z).setPropertyId( 0);
} }
break; break;
default: default:
if (this.stairtype.equalsIgnoreCase("woodstair")) if (this.stairtype.equalsIgnoreCase("woodstair"))
{ {
if (this.getBlockIdAt(blockPositionX - v.getBrushSize() + x, blockPositionY + i, blockPositionZ - v.getBrushSize() + z) != 53) this.setBlockLegacy(blockPositionX - v.getBrushSize() + x, blockPositionY + i, blockPositionZ - v.getBrushSize() + z, 53, (spiral[x][i][z] - 2));
{
undo.put(this.clampY(blockPositionX - v.getBrushSize() + x, blockPositionY + i, blockPositionZ - v.getBrushSize() + z));
}
this.setBlockIdAt(blockPositionZ - v.getBrushSize() + z, blockPositionX - v.getBrushSize() + x, blockPositionY + i, 53);
this.clampY(blockPositionX - v.getBrushSize() + x, blockPositionY + i, blockPositionZ - v.getBrushSize() + z).setPropertyId((spiral[x][i][z] - 2));
} }
else if (this.stairtype.equalsIgnoreCase("cobblestair")) else if (this.stairtype.equalsIgnoreCase("cobblestair"))
{ {
if (this.getBlockIdAt(blockPositionX - v.getBrushSize() + x, blockPositionY + i, blockPositionZ - v.getBrushSize() + z) != 67) this.setBlockLegacy(blockPositionX - v.getBrushSize() + x, blockPositionY + i, blockPositionZ - v.getBrushSize() + z, 67, (spiral[x][i][z] - 2));
{
undo.put(this.clampY(blockPositionX - v.getBrushSize() + x, blockPositionY + i, blockPositionZ - v.getBrushSize() + z));
}
this.setBlockIdAt(blockPositionZ - v.getBrushSize() + z, blockPositionX - v.getBrushSize() + x, blockPositionY + i, 67);
this.clampY(blockPositionX - v.getBrushSize() + x, blockPositionY + i, blockPositionZ - v.getBrushSize() + z).setPropertyId((spiral[x][i][z] - 2));
} }
break; break;
} }
@ -672,86 +634,44 @@ public class SpiralStaircaseBrush extends Brush
switch (spiral[x][i][z]) switch (spiral[x][i][z])
{ {
case 0: case 0:
if (this.getBlockIdAt(blockPositionX - v.getBrushSize() + x, blockPositionY - i, blockPositionZ - v.getBrushSize() + z) != 0) this.setBlockIdAt(blockPositionZ - v.getBrushSize() + z, blockPositionX - v.getBrushSize() + x, blockPositionY - i, BlockTypes.AIR.getInternalId());
{
undo.put(this.clampY(blockPositionX - v.getBrushSize() + x, blockPositionY - i, blockPositionZ - v.getBrushSize() + z));
}
this.setBlockIdAt(blockPositionZ - v.getBrushSize() + z, blockPositionX - v.getBrushSize() + x, blockPositionY - i, 0);
break; break;
case 1: case 1:
if (this.stairtype.equalsIgnoreCase("block")) if (this.stairtype.equalsIgnoreCase("block"))
{ {
if (this.getBlockIdAt(blockPositionX - v.getBrushSize() + x, blockPositionY - i, blockPositionZ - v.getBrushSize() + z) != v.getVoxelId())
{
undo.put(this.clampY(blockPositionX - v.getBrushSize() + x, blockPositionY - i, blockPositionZ - v.getBrushSize() + z));
}
this.setBlockIdAt(blockPositionZ - v.getBrushSize() + z, blockPositionX - v.getBrushSize() + x, blockPositionY - i, v.getVoxelId()); this.setBlockIdAt(blockPositionZ - v.getBrushSize() + z, blockPositionX - v.getBrushSize() + x, blockPositionY - i, v.getVoxelId());
} }
else if (this.stairtype.equalsIgnoreCase("step")) else if (this.stairtype.equalsIgnoreCase("step"))
{ {
if (this.getBlockIdAt(blockPositionX - v.getBrushSize() + x, blockPositionY - i, blockPositionZ - v.getBrushSize() + z) != 44) this.setBlockLegacy(blockPositionX - v.getBrushSize() + x, blockPositionY - i, blockPositionZ - v.getBrushSize() + z, 44, v.getPropertyId());
{
undo.put(this.clampY(blockPositionX - v.getBrushSize() + x, blockPositionY - i, blockPositionZ - v.getBrushSize() + z));
}
this.setBlockIdAt(blockPositionZ - v.getBrushSize() + z, blockPositionX - v.getBrushSize() + x, blockPositionY - i, 44);
this.clampY(blockPositionX - v.getBrushSize() + x, blockPositionY - i, blockPositionZ - v.getBrushSize() + z).setPropertyId(v.getPropertyId());
} }
else if (this.stairtype.equalsIgnoreCase("woodstair") || this.stairtype.equalsIgnoreCase("cobblestair")) else if (this.stairtype.equalsIgnoreCase("woodstair") || this.stairtype.equalsIgnoreCase("cobblestair"))
{ {
if (this.getBlockIdAt(blockPositionX - v.getBrushSize() + x, blockPositionY - i, blockPositionZ - v.getBrushSize() + z) != v.getVoxelId())
{
undo.put(this.clampY(blockPositionX - v.getBrushSize() + x, blockPositionY - i, blockPositionZ - v.getBrushSize() + z));
}
this.setBlockIdAt(blockPositionZ - v.getBrushSize() + z, blockPositionX - v.getBrushSize() + x, blockPositionY - i, v.getVoxelId()); this.setBlockIdAt(blockPositionZ - v.getBrushSize() + z, blockPositionX - v.getBrushSize() + x, blockPositionY - i, v.getVoxelId());
} }
break; break;
case 2: case 2:
if (this.stairtype.equalsIgnoreCase("step")) if (this.stairtype.equalsIgnoreCase("step"))
{ {
if (this.getBlockIdAt(blockPositionX - v.getBrushSize() + x, blockPositionY - i, blockPositionZ - v.getBrushSize() + z) != 43) this.setBlockLegacy(blockPositionX - v.getBrushSize() + x, blockPositionY - i, blockPositionZ - v.getBrushSize() + z, 43, v.getPropertyId());
{
undo.put(this.clampY(blockPositionX - v.getBrushSize() + x, blockPositionY - i, blockPositionZ - v.getBrushSize() + z));
}
this.setBlockIdAt(blockPositionZ - v.getBrushSize() + z, blockPositionX - v.getBrushSize() + x, blockPositionY - i, 43);
this.clampY(blockPositionX - v.getBrushSize() + x, blockPositionY - i, blockPositionZ - v.getBrushSize() + z).setPropertyId(v.getPropertyId());
} }
else if (this.stairtype.equalsIgnoreCase("woodstair")) else if (this.stairtype.equalsIgnoreCase("woodstair"))
{ {
if (this.getBlockIdAt(blockPositionX - v.getBrushSize() + x, blockPositionY - i, blockPositionZ - v.getBrushSize() + z) != 53) this.setBlockLegacy(blockPositionX - v.getBrushSize() + x, blockPositionY - i, blockPositionZ - v.getBrushSize() + z, 53, 0);
{
undo.put(this.clampY(blockPositionX - v.getBrushSize() - x, blockPositionY + i, blockPositionZ - v.getBrushSize() + z));
}
this.setBlockIdAt(blockPositionZ - v.getBrushSize() + z, blockPositionX - v.getBrushSize() + x, blockPositionY - i, 53);
this.clampY(blockPositionX - v.getBrushSize() + x, blockPositionY - i, blockPositionZ - v.getBrushSize() + z).setPropertyId( 0);
} }
else if (this.stairtype.equalsIgnoreCase("cobblestair")) else if (this.stairtype.equalsIgnoreCase("cobblestair"))
{ {
if (this.getBlockIdAt(blockPositionX - v.getBrushSize() + x, blockPositionY - i, blockPositionZ - v.getBrushSize() + z) != 67) this.setBlockLegacy(blockPositionX - v.getBrushSize() + x, blockPositionY - i, blockPositionZ - v.getBrushSize() + z, 67, 0);
{
undo.put(this.clampY(blockPositionX - v.getBrushSize() + x, blockPositionY - i, blockPositionZ - v.getBrushSize() + z));
}
this.setBlockIdAt(blockPositionZ - v.getBrushSize() + z, blockPositionX - v.getBrushSize() + x, blockPositionY - i, 67);
this.clampY(blockPositionX - v.getBrushSize() + x, blockPositionY - i, blockPositionZ - v.getBrushSize() + z).setPropertyId( 0);
} }
break; break;
default: default:
if (this.stairtype.equalsIgnoreCase("woodstair")) if (this.stairtype.equalsIgnoreCase("woodstair"))
{ {
if (this.getBlockIdAt(blockPositionX - v.getBrushSize() + x, blockPositionY - i, blockPositionZ - v.getBrushSize() + z) != 53) this.setBlockLegacy(blockPositionX - v.getBrushSize() + x, blockPositionY - i, blockPositionZ - v.getBrushSize() + z, 53, (spiral[x][i][z] - 2));
{
undo.put(this.clampY(blockPositionX - v.getBrushSize() + x, blockPositionY - i, blockPositionZ - v.getBrushSize() + z));
}
this.setBlockIdAt(blockPositionZ - v.getBrushSize() + z, blockPositionX - v.getBrushSize() + x, blockPositionY - i, 53);
this.clampY(blockPositionX - v.getBrushSize() + x, blockPositionY - i, blockPositionZ - v.getBrushSize() + z).setPropertyId((spiral[x][i][z] - 2));
} }
else if (this.stairtype.equalsIgnoreCase("cobblestair")) else if (this.stairtype.equalsIgnoreCase("cobblestair"))
{ {
if (this.getBlockIdAt(blockPositionX - v.getBrushSize() + x, blockPositionY - i, blockPositionZ - v.getBrushSize() + z) != 67) this.setBlockLegacy(blockPositionZ - v.getBrushSize() + z, blockPositionX - v.getBrushSize() + x, blockPositionY - i, 67, (spiral[x][i][z] - 2));
{
undo.put(this.clampY(blockPositionX - v.getBrushSize() + x, blockPositionY - i, blockPositionZ - v.getBrushSize() + z));
}
this.setBlockIdAt(blockPositionZ - v.getBrushSize() + z, blockPositionX - v.getBrushSize() + x, blockPositionY - i, 67);
this.clampY(blockPositionX - v.getBrushSize() + x, blockPositionY - i, blockPositionZ - v.getBrushSize() + z).setPropertyId((spiral[x][i][z] - 2));
} }
break; break;
} }
@ -792,7 +712,7 @@ public class SpiralStaircaseBrush extends Brush
if (par[1].equalsIgnoreCase("info")) if (par[1].equalsIgnoreCase("info"))
{ {
v.sendMessage(ChatColor.GOLD + "Spiral Staircase Parameters:"); v.sendMessage(ChatColor.GOLD + "Spiral Staircase Parameters:");
v.sendMessage(ChatColor.AQUA + "/b sstair 'block' (default) | 'step' | 'woodstair' | 'cobblestair' -- set the type of staircase"); v.sendMessage(ChatColor.AQUA + "/b sstair 'block' (default) | step' | 'woodstair' | 'cobblestair' -- set the type of staircase");
v.sendMessage(ChatColor.AQUA + "/b sstair 'c' (default) | 'cc' -- set the turning direction of staircase"); v.sendMessage(ChatColor.AQUA + "/b sstair 'c' (default) | 'cc' -- set the turning direction of staircase");
v.sendMessage(ChatColor.AQUA + "/b sstair 'n' (default) | 'e' | 's' | 'world' -- set the opening direction of staircase"); v.sendMessage(ChatColor.AQUA + "/b sstair 'n' (default) | 'e' | 's' | 'world' -- set the opening direction of staircase");
return; return;
@ -800,9 +720,22 @@ public class SpiralStaircaseBrush extends Brush
for (int i = 1; i < par.length; i++) for (int i = 1; i < par.length; i++)
{ {
// stairs
// step/slab
try {
BlockTypes type = BlockTypes.parse(par[i]);
this.stairtype = par[i].toLowerCase().intern();
v.sendMessage(ChatColor.BLUE + "Staircase type: " + this.stairtype);
return;
} catch (InputParseException ignore) {}
switch (par[i].toLowerCase()) {
case "block":
}
if (par[i].equalsIgnoreCase("block") || par[i].equalsIgnoreCase("step") || par[i].equalsIgnoreCase("woodstair") || par[i].equalsIgnoreCase("cobblestair")) if (par[i].equalsIgnoreCase("block") || par[i].equalsIgnoreCase("step") || par[i].equalsIgnoreCase("woodstair") || par[i].equalsIgnoreCase("cobblestair"))
{ {
this.stairtype = par[i]; this.stairtype = par[i].toLowerCase().intern();
v.sendMessage(ChatColor.BLUE + "Staircase type: " + this.stairtype); v.sendMessage(ChatColor.BLUE + "Staircase type: " + this.stairtype);
} }
else if (par[i].equalsIgnoreCase("c") || par[i].equalsIgnoreCase("cc")) else if (par[i].equalsIgnoreCase("c") || par[i].equalsIgnoreCase("cc"))

View File

@ -141,7 +141,7 @@ public class SplatterOverlayBrush extends PerformBrush
final int depth = randomizeHeight ? generator.nextInt(this.depth) : this.depth; final int depth = randomizeHeight ? generator.nextInt(this.depth) : this.depth;
for (int d = this.depth - 1; ((this.depth - d) <= depth); d--) { for (int d = this.depth - 1; ((this.depth - d) <= depth); d--) {
if (this.clampY(this.getTargetBlock().getX() + x, y - d, this.getTargetBlock().getZ() + z).getTypeId() != 0) { if (!this.clampY(this.getTargetBlock().getX() + x, y - d, this.getTargetBlock().getZ() + z).isEmpty()) {
// fills down as many layers as you specify in parameters // fills down as many layers as you specify in parameters
this.current.perform(this.clampY(this.getTargetBlock().getX() + x, y - d + yOffset, this.getTargetBlock().getZ() + z)); this.current.perform(this.clampY(this.getTargetBlock().getX() + x, y - d + yOffset, this.getTargetBlock().getZ() + z));
// stop it from checking any other blocks in this vertical 1x1 column. // stop it from checking any other blocks in this vertical 1x1 column.
@ -158,7 +158,7 @@ public class SplatterOverlayBrush extends PerformBrush
final int depth = randomizeHeight ? generator.nextInt(this.depth) : this.depth; final int depth = randomizeHeight ? generator.nextInt(this.depth) : this.depth;
for (int d = this.depth - 1; ((this.depth - d) <= depth); d--) for (int d = this.depth - 1; ((this.depth - d) <= depth); d--)
{ {
if (this.clampY(this.getTargetBlock().getX() + x, y - d, this.getTargetBlock().getZ() + z).getTypeId() != 0) if (!this.clampY(this.getTargetBlock().getX() + x, y - d, this.getTargetBlock().getZ() + z).isEmpty())
{ {
// fills down as many layers as you specify in parameters // fills down as many layers as you specify in parameters
this.current.perform(this.clampY(this.getTargetBlock().getX() + x, y - d + yOffset, this.getTargetBlock().getZ() + z)); this.current.perform(this.clampY(this.getTargetBlock().getX() + x, y - d + yOffset, this.getTargetBlock().getZ() + z));
@ -260,9 +260,9 @@ public class SplatterOverlayBrush extends PerformBrush
{ // if haven't already found the surface in this column { // if haven't already found the surface in this column
if ((Math.pow(x, 2) + Math.pow(z, 2)) <= brushSizeSquared && splat[x + v.getBrushSize()][z + v.getBrushSize()] == 1) if ((Math.pow(x, 2) + Math.pow(z, 2)) <= brushSizeSquared && splat[x + v.getBrushSize()][z + v.getBrushSize()] == 1)
{ // if inside of the column...&& if to be splattered { // if inside of the column...&& if to be splattered
if (this.getBlockIdAt(this.getTargetBlock().getX() + x, y - 1, this.getTargetBlock().getZ() + z) != 0) if (!this.getBlockAt(this.getTargetBlock().getX() + x, y - 1, this.getTargetBlock().getZ() + z).isEmpty())
{ // if not a floating block (like one of Notch'world pools) { // if not a floating block (like one of Notch'world pools)
if (this.getBlockIdAt(this.getTargetBlock().getX() + x, y + 1, this.getTargetBlock().getZ() + z) == 0) if (this.getBlockAt(this.getTargetBlock().getX() + x, y + 1, this.getTargetBlock().getZ() + z).isEmpty())
{ // must start at surface... this prevents it filling stuff in if { // must start at surface... this prevents it filling stuff in if
// you click in a wall and it starts out below surface. // you click in a wall and it starts out below surface.
if (!this.allBlocks) if (!this.allBlocks)

View File

@ -49,7 +49,7 @@ public class UnderlayBrush extends PerformBrush
BlockMaterial mat = BlockTypes.get(id).getMaterial(); BlockMaterial mat = BlockTypes.get(id).getMaterial();
if (!mat.isReplacedDuringPlacement() && mat.isFullCube()) { if (!mat.isReplacedDuringPlacement() && mat.isFullCube()) {
for (int d = 0; (d < this.depth); d++) { for (int d = 0; (d < this.depth); d++) {
if (this.clampY(this.getTargetBlock().getX() + x, y + d, this.getTargetBlock().getZ() + z).getTypeId() != 0) { if (!this.clampY(this.getTargetBlock().getX() + x, y + d, this.getTargetBlock().getZ() + z).isEmpty()) {
this.current.perform(this.clampY(this.getTargetBlock().getX() + x, y + d, this.getTargetBlock().getZ() + z)); // fills down as many layers as you specify in this.current.perform(this.clampY(this.getTargetBlock().getX() + x, y + d, this.getTargetBlock().getZ() + z)); // fills down as many layers as you specify in
// parameters // parameters
memory[x + v.getBrushSize()][z + v.getBrushSize()] = 1; // stop it from checking any other blocks in this vertical 1x1 column. memory[x + v.getBrushSize()][z + v.getBrushSize()] = 1; // stop it from checking any other blocks in this vertical 1x1 column.
@ -65,7 +65,7 @@ public class UnderlayBrush extends PerformBrush
{ {
for (int d = 0; (d < this.depth); d++) for (int d = 0; (d < this.depth); d++)
{ {
if (this.clampY(this.getTargetBlock().getX() + x, y + d, this.getTargetBlock().getZ() + z).getTypeId() != 0) if (!this.clampY(this.getTargetBlock().getX() + x, y + d, this.getTargetBlock().getZ() + z).isEmpty()
{ {
this.current.perform(this.clampY(this.getTargetBlock().getX() + x, y + d, this.getTargetBlock().getZ() + z)); // fills down as many layers as you specify in this.current.perform(this.clampY(this.getTargetBlock().getX() + x, y + d, this.getTargetBlock().getZ() + z)); // fills down as many layers as you specify in
// parameters // parameters