From dda684941221d8f794ff6b7448d981c9f2dd0b01 Mon Sep 17 00:00:00 2001 From: MattBDev Date: Sun, 24 Jul 2016 17:42:03 -0400 Subject: [PATCH] Fix sponge compile --- .../sponge/generator/SpongeAugmentedGenerator.java | 7 ++++--- .../java/com/plotsquared/sponge/util/SpongeUtil.java | 6 ++++-- .../java/com/plotsquared/sponge/util/block/GenChunk.java | 2 +- .../plotsquared/sponge/util/block/SpongeLocalQueue.java | 9 +++++---- 4 files changed, 14 insertions(+), 10 deletions(-) diff --git a/Sponge/src/main/java/com/plotsquared/sponge/generator/SpongeAugmentedGenerator.java b/Sponge/src/main/java/com/plotsquared/sponge/generator/SpongeAugmentedGenerator.java index f71317949..aaa4e65a8 100644 --- a/Sponge/src/main/java/com/plotsquared/sponge/generator/SpongeAugmentedGenerator.java +++ b/Sponge/src/main/java/com/plotsquared/sponge/generator/SpongeAugmentedGenerator.java @@ -5,7 +5,6 @@ import com.intellectualcrafters.plot.generator.AugmentedUtils; import com.intellectualcrafters.plot.object.PlotBlock; import com.intellectualcrafters.plot.util.block.DelegateLocalBlockQueue; import com.plotsquared.sponge.util.SpongeUtil; -import java.util.List; import org.spongepowered.api.block.BlockState; import org.spongepowered.api.world.World; import org.spongepowered.api.world.extent.ImmutableBiomeArea; @@ -13,6 +12,8 @@ import org.spongepowered.api.world.extent.MutableBlockVolume; import org.spongepowered.api.world.gen.GenerationPopulator; import org.spongepowered.api.world.gen.WorldGenerator; +import java.util.List; + public class SpongeAugmentedGenerator implements GenerationPopulator { private static SpongeAugmentedGenerator generator; @@ -44,14 +45,14 @@ public class SpongeAugmentedGenerator implements GenerationPopulator { AugmentedUtils.generate(world.getName(), cx, cz, new DelegateLocalBlockQueue(null) { @Override public boolean setBlock(int x, int y, int z, int id, int data) { - terrain.setBlock(bx + x, y, bz + z, SpongeUtil.getBlockState(id, data)); + terrain.setBlock(bx + x, y, bz + z, SpongeUtil.getBlockState(id, data), SpongeUtil.CAUSE); return true; } @Override public PlotBlock getBlock(int x, int y, int z) { BlockState block = terrain.getBlock(bx + x, y, bz + z); - return block == null ? PlotBlock.get(0, 0) : SpongeUtil.getPlotBlock(block); + return SpongeUtil.getPlotBlock(block); } @Override diff --git a/Sponge/src/main/java/com/plotsquared/sponge/util/SpongeUtil.java b/Sponge/src/main/java/com/plotsquared/sponge/util/SpongeUtil.java index e84d5f89a..ae0bb2e0a 100644 --- a/Sponge/src/main/java/com/plotsquared/sponge/util/SpongeUtil.java +++ b/Sponge/src/main/java/com/plotsquared/sponge/util/SpongeUtil.java @@ -35,6 +35,7 @@ import org.spongepowered.api.event.cause.NamedCause; import org.spongepowered.api.text.Text; import org.spongepowered.api.text.serializer.TextSerializers; import org.spongepowered.api.text.translation.Translation; +import org.spongepowered.api.world.BlockChangeFlag; import org.spongepowered.api.world.World; import org.spongepowered.api.world.biome.BiomeType; import org.spongepowered.api.world.biome.BiomeTypes; @@ -303,7 +304,8 @@ public class SpongeUtil extends WorldUtil { StringComparison outer = new StringComparison(); return outer.new ComparisonResult(match, block); - } catch (NumberFormatException ignored) {} + } catch (NumberFormatException ignored) { + } return null; } @@ -429,7 +431,7 @@ public class SpongeUtil extends WorldUtil { @Override public void setSign(String worldName, int x, int y, int z, String[] lines) { World world = SpongeUtil.getWorld(worldName); - world.setBlock(x, y, z, BlockTypes.WALL_SIGN.getDefaultState()); + world.setBlock(x, y, z, BlockTypes.WALL_SIGN.getDefaultState(), BlockChangeFlag.NONE, CAUSE); Optional block = world.getTileEntity(x, y, z); if (!block.isPresent()) { return; diff --git a/Sponge/src/main/java/com/plotsquared/sponge/util/block/GenChunk.java b/Sponge/src/main/java/com/plotsquared/sponge/util/block/GenChunk.java index 361258217..f69d19217 100644 --- a/Sponge/src/main/java/com/plotsquared/sponge/util/block/GenChunk.java +++ b/Sponge/src/main/java/com/plotsquared/sponge/util/block/GenChunk.java @@ -52,7 +52,7 @@ public class GenChunk extends ScopedLocalBlockQueue { @Override public boolean setBlock(int x, int y, int z, int id, int data) { modified = true; - this.terrain.setBlock(this.bx + x, y, this.bz + z, SpongeUtil.getBlockState(id, data)); + this.terrain.setBlock(this.bx + x, y, this.bz + z, SpongeUtil.getBlockState(id, data),SpongeUtil.CAUSE); return true; } diff --git a/Sponge/src/main/java/com/plotsquared/sponge/util/block/SpongeLocalQueue.java b/Sponge/src/main/java/com/plotsquared/sponge/util/block/SpongeLocalQueue.java index 52aed64b9..60cce20a3 100644 --- a/Sponge/src/main/java/com/plotsquared/sponge/util/block/SpongeLocalQueue.java +++ b/Sponge/src/main/java/com/plotsquared/sponge/util/block/SpongeLocalQueue.java @@ -7,9 +7,6 @@ import com.intellectualcrafters.plot.util.StringMan; import com.intellectualcrafters.plot.util.TaskManager; import com.intellectualcrafters.plot.util.block.BasicLocalBlockQueue; import com.plotsquared.sponge.util.SpongeUtil; -import java.lang.reflect.Field; -import java.util.Arrays; -import java.util.HashSet; import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.Entity; @@ -35,6 +32,10 @@ import org.spongepowered.api.world.extent.UnmodifiableBlockVolume; import org.spongepowered.api.world.extent.worker.MutableBlockVolumeWorker; import org.spongepowered.api.world.extent.worker.procedure.BlockVolumeMapper; +import java.lang.reflect.Field; +import java.util.Arrays; +import java.util.HashSet; + public class SpongeLocalQueue extends BasicLocalBlockQueue { public SpongeLocalQueue(String world) { @@ -441,7 +442,7 @@ public class SpongeLocalQueue extends BasicLocalBlockQueue { World worldObj = getSpongeWorld(); org.spongepowered.api.world.Chunk spongeChunk = (org.spongepowered.api.world.Chunk) getChunk(worldObj, lc.getX(), lc.getZ()); char[][] ids = ((CharLocalChunk) lc).blocks; - MutableBlockVolumeWorker blockWorker = spongeChunk.getBlockWorker(); + MutableBlockVolumeWorker blockWorker = spongeChunk.getBlockWorker(SpongeUtil.CAUSE); blockWorker.map(new BlockVolumeMapper() { @Override public BlockState map(UnmodifiableBlockVolume volume, int xx, int y, int zz) {