This commit is contained in:
MattBDev 2016-07-24 17:45:34 -04:00
commit 2b9c2959cf
4 changed files with 14 additions and 10 deletions

View File

@ -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

View File

@ -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<PlotBlock> outer = new StringComparison<PlotBlock>();
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<TileEntity> block = world.getTileEntity(x, y, z);
if (!block.isPresent()) {
return;

View File

@ -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;
}

View File

@ -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<char[]> {
public SpongeLocalQueue(String world) {
@ -441,7 +442,7 @@ public class SpongeLocalQueue extends BasicLocalBlockQueue<char[]> {
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<? extends org.spongepowered.api.world.Chunk> blockWorker = spongeChunk.getBlockWorker();
MutableBlockVolumeWorker<? extends org.spongepowered.api.world.Chunk> blockWorker = spongeChunk.getBlockWorker(SpongeUtil.CAUSE);
blockWorker.map(new BlockVolumeMapper() {
@Override
public BlockState map(UnmodifiableBlockVolume volume, int xx, int y, int zz) {