Plenty of changes to core block behavior to become more compatible with upstream WorldEdit (still more to be done!)

This commit is contained in:
IronApollo
2019-01-31 10:08:58 -05:00
parent 271b45f3ba
commit e53535319d
116 changed files with 3666 additions and 3774 deletions

View File

@ -1,5 +1,6 @@
package com.thevoxelbox.voxelsniper.brush;
import com.sk89q.worldedit.world.block.BlockType;
import com.sk89q.worldedit.world.block.BlockTypes;
import com.thevoxelbox.voxelsniper.SnipeData;
import com.thevoxelbox.voxelsniper.Undo;
@ -82,7 +83,7 @@ public class BlendBallBrush extends BlendBrushBase
}
// Find most common neighboring material.
for (BlockTypes type : BlockTypes.values)
for (BlockType type : BlockTypes.values)
{
int i = type.getInternalId();
if (materialFrequency[i] > modeMatCount && !(this.excludeAir && type.getMaterial().isAir()) && !(this.excludeWater && (type == BlockTypes.WATER)))
@ -94,7 +95,7 @@ public class BlendBallBrush extends BlendBrushBase
// Make sure there'world not a tie for most common
for (int i = 0; i < modeMatId; i++)
{
BlockTypes type = BlockTypes.get(i);
BlockType type = BlockTypes.get(i);
if (materialFrequency[i] == modeMatCount && !(this.excludeAir && type.getMaterial().isAir()) && !(this.excludeWater && (type == BlockTypes.WATER)))
{
tiecheck = false;

View File

@ -1,5 +1,6 @@
package com.thevoxelbox.voxelsniper.brush;
import com.sk89q.worldedit.world.block.BlockType;
import com.sk89q.worldedit.world.block.BlockTypes;
import com.thevoxelbox.voxelsniper.SnipeData;
import com.thevoxelbox.voxelsniper.Undo;
@ -69,7 +70,7 @@ public class BlendDiscBrush extends BlendBrushBase
}
// Find most common neighboring material.
for (BlockTypes type : BlockTypes.values)
for (BlockType type : BlockTypes.values)
{
int i = type.getInternalId();
if (materialFrequency[i] > modeMatCount && !(this.excludeAir && type.getMaterial().isAir()) && !(this.excludeWater && (type == BlockTypes.WATER)))
@ -81,7 +82,7 @@ public class BlendDiscBrush extends BlendBrushBase
// Make sure there'world not a tie for most common
for (int i = 0; i < modeMatId; i++)
{
BlockTypes type = BlockTypes.get(i);
BlockType type = BlockTypes.get(i);
if (materialFrequency[i] == modeMatCount && !(this.excludeAir && type.getMaterial().isAir()) && !(this.excludeWater && (type == BlockTypes.WATER)))
{
tiecheck = false;

View File

@ -1,5 +1,6 @@
package com.thevoxelbox.voxelsniper.brush;
import com.sk89q.worldedit.world.block.BlockType;
import com.sk89q.worldedit.world.block.BlockTypes;
import com.thevoxelbox.voxelsniper.SnipeData;
import com.thevoxelbox.voxelsniper.Undo;
@ -82,7 +83,7 @@ public class BlendVoxelBrush extends BlendBrushBase
}
// Find most common neighboring material.
for (BlockTypes type : BlockTypes.values)
for (BlockType type : BlockTypes.values)
{
int i = type.getInternalId();
if (materialFrequency[i] > modeMatCount && !(this.excludeAir && type.getMaterial().isAir()) && !(this.excludeWater && (type == BlockTypes.WATER)))
@ -94,7 +95,7 @@ public class BlendVoxelBrush extends BlendBrushBase
// Make sure there'world not a tie for most common
for (int i = 0; i < modeMatId; i++)
{
BlockTypes type = BlockTypes.get(i);
BlockType type = BlockTypes.get(i);
if (materialFrequency[i] == modeMatCount && !(this.excludeAir && type.getMaterial().isAir()) && !(this.excludeWater && (type == BlockTypes.WATER)))
{
tiecheck = false;

View File

@ -1,5 +1,6 @@
package com.thevoxelbox.voxelsniper.brush;
import com.sk89q.worldedit.world.block.BlockType;
import com.sk89q.worldedit.world.block.BlockTypes;
import com.thevoxelbox.voxelsniper.SnipeData;
import com.thevoxelbox.voxelsniper.Undo;
@ -69,7 +70,7 @@ public class BlendVoxelDiscBrush extends BlendBrushBase
}
// Find most common neighboring material.
for (BlockTypes type : BlockTypes.values)
for (BlockType type : BlockTypes.values)
{
int i = type.getInternalId();
if (materialFrequency[i] > modeMatCount && !(this.excludeAir && type.getMaterial().isAir()) && !(this.excludeWater && (type == BlockTypes.WATER)))
@ -81,7 +82,7 @@ public class BlendVoxelDiscBrush extends BlendBrushBase
// Make sure there'world not a tie for most common
for (int i = 0; i < modeMatId; i++)
{
BlockTypes type = BlockTypes.get(i);
BlockType type = BlockTypes.get(i);
if (materialFrequency[i] == modeMatCount && !(this.excludeAir && type.getMaterial().isAir()) && !(this.excludeWater && (type == BlockTypes.WATER)))
{
tiecheck = false;

View File

@ -1,5 +1,6 @@
package com.thevoxelbox.voxelsniper.brush;
import com.sk89q.worldedit.world.block.BlockType;
import com.sk89q.worldedit.world.block.BlockTypes;
import com.sk89q.worldedit.world.registry.BlockMaterial;
import com.thevoxelbox.voxelsniper.Message;
@ -72,11 +73,11 @@ public class OverlayBrush extends PerformBrush
@SuppressWarnings("deprecation")
private boolean isIgnoredBlock(int materialId)
{
BlockTypes type = BlockTypes.get(materialId);
switch (type) {
case WATER:
case LAVA:
case CACTUS:
BlockType type = BlockTypes.get(materialId);
switch (type.getResource().toUpperCase()) {
case "WATER":
case "LAVA":
case "CACTUS":
return true;
}
BlockMaterial mat = type.getMaterial();
@ -123,7 +124,7 @@ public class OverlayBrush extends PerformBrush
if (!this.allBlocks)
{ // if the override parameter has not been activated, go to the switch that filters out manmade stuff.
BlockTypes type = BlockTypes.get(this.getBlockIdAt(this.getTargetBlock().getX() + x, y, this.getTargetBlock().getZ() + z));
BlockType type = BlockTypes.get(this.getBlockIdAt(this.getTargetBlock().getX() + x, y, this.getTargetBlock().getZ() + z));
BlockMaterial mat = type.getMaterial();
if (mat.isSolid() && mat.isFullCube() && !mat.hasContainer()) {
for (int d = 1; (d < this.depth + 1); d++) {

View File

@ -95,14 +95,14 @@ public class SnowConeBrush extends Brush
if (snowData > snowconeData[x][z])
{
switch (BlockTypes.get(snowcone[x][z]))
switch (BlockTypes.get(snowcone[x][z]).getResource().toUpperCase())
{
case AIR:
case CAVE_AIR:
case VOID_AIR:
case "AIR":
case "CAVE_AIR":
case "VOID_AIR":
snowconeData[x][z] = snowData;
snowcone[x][z] = BlockTypes.SNOW.getInternalId();
case SNOW_BLOCK:
case "SNOW_BLOCK":
snowconeData[x][z] = snowData;
break;
default:

View File

@ -2,6 +2,7 @@ package com.thevoxelbox.voxelsniper.brush;
import com.sk89q.worldedit.bukkit.BukkitAdapter;
import com.sk89q.worldedit.extension.input.InputParseException;
import com.sk89q.worldedit.world.block.BlockType;
import com.sk89q.worldedit.world.block.BlockTypes;
import com.sk89q.worldedit.world.registry.LegacyMapper;
import com.thevoxelbox.voxelsniper.Message;
@ -724,7 +725,7 @@ public class SpiralStaircaseBrush extends Brush
// step/slab
try {
BlockTypes type = BlockTypes.parse(par[i]);
BlockType type = BlockTypes.parse(par[i]);
this.stairtype = par[i].toLowerCase().intern();
v.sendMessage(ChatColor.BLUE + "Staircase type: " + this.stairtype);
return;

View File

@ -1,5 +1,6 @@
package com.thevoxelbox.voxelsniper.brush;
import com.sk89q.worldedit.world.block.BlockType;
import com.sk89q.worldedit.world.block.BlockTypes;
import com.sk89q.worldedit.world.registry.BlockMaterial;
import com.thevoxelbox.voxelsniper.Message;
@ -135,7 +136,7 @@ public class SplatterOverlayBrush extends PerformBrush
if (!this.allBlocks)
{
// if the override parameter has not been activated, go to the switch that filters out manmade stuff.
BlockTypes type = BlockTypes.get(this.getBlockIdAt(this.getTargetBlock().getX() + x, y, this.getTargetBlock().getZ() + z));
BlockType type = BlockTypes.get(this.getBlockIdAt(this.getTargetBlock().getX() + x, y, this.getTargetBlock().getZ() + z));
BlockMaterial mat = type.getMaterial();
if (mat.isSolid() && mat.isFullCube() && !mat.hasContainer()) {
final int depth = randomizeHeight ? generator.nextInt(this.depth) : this.depth;
@ -268,7 +269,7 @@ public class SplatterOverlayBrush extends PerformBrush
if (!this.allBlocks)
{ // if the override parameter has not been activated, go to the switch that filters out manmade stuff.
BlockTypes type = BlockTypes.get(this.getBlockIdAt(this.getTargetBlock().getX() + x, y, this.getTargetBlock().getZ() + z));
BlockType type = BlockTypes.get(this.getBlockIdAt(this.getTargetBlock().getX() + x, y, this.getTargetBlock().getZ() + z));
BlockMaterial mat = type.getMaterial();
if (mat.isSolid() && mat.isFullCube() && !mat.hasContainer())
{

View File

@ -2,6 +2,7 @@ package com.thevoxelbox.voxelsniper.command;
import com.bekvon.bukkit.residence.commands.material;
import com.boydti.fawe.bukkit.wrapper.AsyncBlock;
import com.sk89q.worldedit.world.block.BlockType;
import com.sk89q.worldedit.world.block.BlockTypes;
import com.thevoxelbox.voxelsniper.RangeBlockHelper;
import com.thevoxelbox.voxelsniper.SnipeData;
@ -39,7 +40,7 @@ public class VoxelReplaceCommand extends VoxelCommand
return true;
}
BlockTypes weType = BlockTypes.parse(args[0]);
BlockType weType = BlockTypes.parse(args[0]);
if (weType != null)
{
snipeData.setReplaceId(weType.getInternalId());

View File

@ -29,6 +29,7 @@ import com.bekvon.bukkit.residence.commands.material;
import com.boydti.fawe.bukkit.favs.PatternUtil;
import com.sk89q.worldedit.WorldEdit;
import com.sk89q.worldedit.bukkit.BukkitAdapter;
import com.sk89q.worldedit.world.block.BlockType;
import com.sk89q.worldedit.world.block.BlockTypes;
import com.thevoxelbox.voxelsniper.RangeBlockHelper;
import com.thevoxelbox.voxelsniper.SnipeData;
@ -53,7 +54,7 @@ public class VoxelVoxelCommand extends VoxelCommand {
Block block = (new RangeBlockHelper(player, sniper.getWorld())).getTargetBlock();
Material blockType = block.getType();
BlockTypes weType = BukkitAdapter.adapt(blockType);
BlockType weType = BukkitAdapter.adapt(blockType);
if(!player.hasPermission("voxelsniper.ignorelimitations") && WorldEdit.getInstance().getConfiguration().disallowedBlocks.contains(weType)) {
player.sendMessage("You are not allowed to use " + blockType.name() + ". (WorldEdit config.yml)");
return true;
@ -65,7 +66,7 @@ public class VoxelVoxelCommand extends VoxelCommand {
return true;
} else {
BlockTypes weType = BlockTypes.parse(args[0]);
BlockType weType = BlockTypes.parse(args[0]);
if(weType != null) {
if(!player.hasPermission("voxelsniper.ignorelimitations") && WorldEdit.getInstance().getConfiguration().disallowedBlocks.contains(weType)) {
player.sendMessage("You are not allowed to use " + weType + ".");