mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-26 15:16:45 +01:00
Merge branch '3.4.5' of https://github.com/IntellectualSites/PlotSquared into 3.5.0
This commit is contained in:
commit
2b9c2959cf
@ -5,7 +5,6 @@ import com.intellectualcrafters.plot.generator.AugmentedUtils;
|
|||||||
import com.intellectualcrafters.plot.object.PlotBlock;
|
import com.intellectualcrafters.plot.object.PlotBlock;
|
||||||
import com.intellectualcrafters.plot.util.block.DelegateLocalBlockQueue;
|
import com.intellectualcrafters.plot.util.block.DelegateLocalBlockQueue;
|
||||||
import com.plotsquared.sponge.util.SpongeUtil;
|
import com.plotsquared.sponge.util.SpongeUtil;
|
||||||
import java.util.List;
|
|
||||||
import org.spongepowered.api.block.BlockState;
|
import org.spongepowered.api.block.BlockState;
|
||||||
import org.spongepowered.api.world.World;
|
import org.spongepowered.api.world.World;
|
||||||
import org.spongepowered.api.world.extent.ImmutableBiomeArea;
|
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.GenerationPopulator;
|
||||||
import org.spongepowered.api.world.gen.WorldGenerator;
|
import org.spongepowered.api.world.gen.WorldGenerator;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class SpongeAugmentedGenerator implements GenerationPopulator {
|
public class SpongeAugmentedGenerator implements GenerationPopulator {
|
||||||
|
|
||||||
private static SpongeAugmentedGenerator generator;
|
private static SpongeAugmentedGenerator generator;
|
||||||
@ -44,14 +45,14 @@ public class SpongeAugmentedGenerator implements GenerationPopulator {
|
|||||||
AugmentedUtils.generate(world.getName(), cx, cz, new DelegateLocalBlockQueue(null) {
|
AugmentedUtils.generate(world.getName(), cx, cz, new DelegateLocalBlockQueue(null) {
|
||||||
@Override
|
@Override
|
||||||
public boolean setBlock(int x, int y, int z, int id, int data) {
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PlotBlock getBlock(int x, int y, int z) {
|
public PlotBlock getBlock(int x, int y, int z) {
|
||||||
BlockState block = terrain.getBlock(bx + x, y, bz + 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
|
@Override
|
||||||
|
@ -35,6 +35,7 @@ import org.spongepowered.api.event.cause.NamedCause;
|
|||||||
import org.spongepowered.api.text.Text;
|
import org.spongepowered.api.text.Text;
|
||||||
import org.spongepowered.api.text.serializer.TextSerializers;
|
import org.spongepowered.api.text.serializer.TextSerializers;
|
||||||
import org.spongepowered.api.text.translation.Translation;
|
import org.spongepowered.api.text.translation.Translation;
|
||||||
|
import org.spongepowered.api.world.BlockChangeFlag;
|
||||||
import org.spongepowered.api.world.World;
|
import org.spongepowered.api.world.World;
|
||||||
import org.spongepowered.api.world.biome.BiomeType;
|
import org.spongepowered.api.world.biome.BiomeType;
|
||||||
import org.spongepowered.api.world.biome.BiomeTypes;
|
import org.spongepowered.api.world.biome.BiomeTypes;
|
||||||
@ -303,7 +304,8 @@ public class SpongeUtil extends WorldUtil {
|
|||||||
StringComparison<PlotBlock> outer = new StringComparison<PlotBlock>();
|
StringComparison<PlotBlock> outer = new StringComparison<PlotBlock>();
|
||||||
return outer.new ComparisonResult(match, block);
|
return outer.new ComparisonResult(match, block);
|
||||||
|
|
||||||
} catch (NumberFormatException ignored) {}
|
} catch (NumberFormatException ignored) {
|
||||||
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -429,7 +431,7 @@ public class SpongeUtil extends WorldUtil {
|
|||||||
@Override
|
@Override
|
||||||
public void setSign(String worldName, int x, int y, int z, String[] lines) {
|
public void setSign(String worldName, int x, int y, int z, String[] lines) {
|
||||||
World world = SpongeUtil.getWorld(worldName);
|
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);
|
Optional<TileEntity> block = world.getTileEntity(x, y, z);
|
||||||
if (!block.isPresent()) {
|
if (!block.isPresent()) {
|
||||||
return;
|
return;
|
||||||
|
@ -52,7 +52,7 @@ public class GenChunk extends ScopedLocalBlockQueue {
|
|||||||
@Override
|
@Override
|
||||||
public boolean setBlock(int x, int y, int z, int id, int data) {
|
public boolean setBlock(int x, int y, int z, int id, int data) {
|
||||||
modified = true;
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7,9 +7,6 @@ import com.intellectualcrafters.plot.util.StringMan;
|
|||||||
import com.intellectualcrafters.plot.util.TaskManager;
|
import com.intellectualcrafters.plot.util.TaskManager;
|
||||||
import com.intellectualcrafters.plot.util.block.BasicLocalBlockQueue;
|
import com.intellectualcrafters.plot.util.block.BasicLocalBlockQueue;
|
||||||
import com.plotsquared.sponge.util.SpongeUtil;
|
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.Block;
|
||||||
import net.minecraft.block.state.IBlockState;
|
import net.minecraft.block.state.IBlockState;
|
||||||
import net.minecraft.entity.Entity;
|
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.MutableBlockVolumeWorker;
|
||||||
import org.spongepowered.api.world.extent.worker.procedure.BlockVolumeMapper;
|
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 class SpongeLocalQueue extends BasicLocalBlockQueue<char[]> {
|
||||||
|
|
||||||
public SpongeLocalQueue(String world) {
|
public SpongeLocalQueue(String world) {
|
||||||
@ -441,7 +442,7 @@ public class SpongeLocalQueue extends BasicLocalBlockQueue<char[]> {
|
|||||||
World worldObj = getSpongeWorld();
|
World worldObj = getSpongeWorld();
|
||||||
org.spongepowered.api.world.Chunk spongeChunk = (org.spongepowered.api.world.Chunk) getChunk(worldObj, lc.getX(), lc.getZ());
|
org.spongepowered.api.world.Chunk spongeChunk = (org.spongepowered.api.world.Chunk) getChunk(worldObj, lc.getX(), lc.getZ());
|
||||||
char[][] ids = ((CharLocalChunk) lc).blocks;
|
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() {
|
blockWorker.map(new BlockVolumeMapper() {
|
||||||
@Override
|
@Override
|
||||||
public BlockState map(UnmodifiableBlockVolume volume, int xx, int y, int zz) {
|
public BlockState map(UnmodifiableBlockVolume volume, int xx, int y, int zz) {
|
||||||
|
Loading…
Reference in New Issue
Block a user