mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2025-06-30 10:36:41 +00:00
Plenty of changes to core block behavior to become more compatible with upstream WorldEdit (still more to be done!)
This commit is contained in:
@ -190,7 +190,7 @@ public final class Spigot_v1_13_R2 extends CachedBukkitAdapter implements Bukkit
|
||||
|
||||
@Override
|
||||
public BlockMaterial getMaterial(BlockState state) {
|
||||
BlockTypes type = state.getBlockType();
|
||||
BlockType type = state.getBlockType();
|
||||
IBlockData bs = ((CraftBlockData) Bukkit.createBlockData(state.getAsString())).getState();
|
||||
return new BlockMaterial_1_13(bs.getBlock(), bs);
|
||||
}
|
||||
@ -233,7 +233,7 @@ public final class Spigot_v1_13_R2 extends CachedBukkitAdapter implements Bukkit
|
||||
if (te != null) {
|
||||
NBTTagCompound tag = new NBTTagCompound();
|
||||
readTileEntityIntoTag(te, tag); // Load data
|
||||
return new BaseBlock(state, (CompoundTag) toNative(tag));
|
||||
return new BaseBlock(state, (CompoundTag) toNative(tag)).toImmutableState();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -232,12 +232,12 @@ public class BukkitChunk_All extends IntFaweChunk<Chunk, BukkitQueue_All> {
|
||||
if (combined == 0) continue;
|
||||
int xx = bx + x;
|
||||
|
||||
BlockTypes type = BlockTypes.getFromStateId(combined);
|
||||
BlockType type = BlockTypes.getFromStateId(combined);
|
||||
if (type == BlockTypes.__RESERVED__) continue;
|
||||
switch (type) {
|
||||
case AIR:
|
||||
case CAVE_AIR:
|
||||
case VOID_AIR:
|
||||
switch (type.getResource().toUpperCase()) {
|
||||
case "AIR":
|
||||
case "CAVE_AIR":
|
||||
case "VOID_AIR":
|
||||
if (!place) {
|
||||
mutableLoc.setX(xx);
|
||||
mutableLoc.setY(yy);
|
||||
@ -277,12 +277,12 @@ public class BukkitChunk_All extends IntFaweChunk<Chunk, BukkitQueue_All> {
|
||||
for (;index < 4096; index++) {
|
||||
int j = place ? index : 4095 - index;
|
||||
int combined = newArray[j];
|
||||
BlockTypes type = BlockTypes.getFromStateId(combined);
|
||||
BlockType type = BlockTypes.getFromStateId(combined);
|
||||
if (type == BlockTypes.__RESERVED__) continue;
|
||||
switch (type) {
|
||||
case AIR:
|
||||
case CAVE_AIR:
|
||||
case VOID_AIR:
|
||||
switch (type.getResource().toUpperCase()) {
|
||||
case "AIR":
|
||||
case "CAVE_AIR":
|
||||
case "VOID_AIR":
|
||||
if (!place) {
|
||||
int x = cacheX[j];
|
||||
int z = cacheZ[j];
|
||||
|
@ -9,6 +9,7 @@ import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import com.sk89q.worldedit.bukkit.BukkitAdapter;
|
||||
import com.sk89q.worldedit.world.block.BlockType;
|
||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||
|
||||
import org.bukkit.FluidCollisionMode;
|
||||
@ -214,10 +215,10 @@ public class AsyncBlock implements Block {
|
||||
@Override
|
||||
public AsyncBlockState getState() {
|
||||
int combined = queue.getCombinedId4Data(x, y, z, 0);
|
||||
BlockTypes type = BlockTypes.getFromStateId(combined);
|
||||
switch (type) {
|
||||
case SIGN:
|
||||
case WALL_SIGN:
|
||||
BlockType type = BlockTypes.getFromStateId(combined);
|
||||
switch (type.getResource().toUpperCase()) {
|
||||
case "SIGN":
|
||||
case "WALL_SIGN":
|
||||
return new AsyncSign(this, combined);
|
||||
}
|
||||
return new AsyncBlockState(this, combined);
|
||||
@ -284,7 +285,7 @@ public class AsyncBlock implements Block {
|
||||
@Override
|
||||
public boolean isLiquid() {
|
||||
int combined = queue.getCombinedId4Data(x, y, z, 0);
|
||||
BlockTypes type = BlockTypes.getFromStateId(combined);
|
||||
BlockType type = BlockTypes.getFromStateId(combined);
|
||||
return type.getMaterial().isLiquid();
|
||||
}
|
||||
|
||||
|
@ -22,6 +22,7 @@ import java.util.concurrent.CompletableFuture;
|
||||
import java.util.function.Predicate;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import com.sk89q.worldedit.world.block.BlockType;
|
||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||
import org.bukkit.*;
|
||||
import org.bukkit.block.Biome;
|
||||
@ -272,7 +273,7 @@ public class AsyncWorld extends DelegateFaweQueue implements World, HasFaweQueue
|
||||
public int getHighestBlockYAt(int x, int z) {
|
||||
for (int y = getMaxHeight() - 1; y >= 0; y--) {
|
||||
int stateId = queue.getCachedCombinedId4Data(x, y, z, BlockTypes.AIR.getInternalId());
|
||||
BlockTypes type = BlockTypes.getFromStateId(stateId);
|
||||
BlockType type = BlockTypes.getFromStateId(stateId);
|
||||
if (!type.getMaterial().isAir()) return y;
|
||||
}
|
||||
return 0;
|
||||
|
Reference in New Issue
Block a user