mirror of
https://github.com/boy0001/FastAsyncWorldedit.git
synced 2024-11-28 13:45:36 +01:00
Fix sendBlocks + lever rotation
This commit is contained in:
parent
aa27d01fc4
commit
6b0c2b9ef9
@ -237,21 +237,21 @@ public abstract class BukkitQueue_0<CHUNK, CHUNKSECTIONS, SECTION> extends NMSMa
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendBlockUpdate(Map<Long, Map<Short, Short>> blockMap, FawePlayer... players) {
|
||||
public void sendBlockUpdate(Map<Long, Map<Short, Character>> blockMap, FawePlayer... players) {
|
||||
for (FawePlayer player : players) {
|
||||
Player bukkitPlayer = ((BukkitPlayer) player).parent;
|
||||
World world = bukkitPlayer.getWorld();
|
||||
for (Map.Entry<Long, Map<Short, Short>> entry : blockMap.entrySet()) {
|
||||
for (Map.Entry<Long, Map<Short, Character>> entry : blockMap.entrySet()) {
|
||||
long chunkHash = entry.getKey();
|
||||
int cx = MathMan.unpairIntX(chunkHash);
|
||||
int cz = MathMan.unpairIntY(chunkHash);
|
||||
Map<Short, Short> blocks = entry.getValue();
|
||||
for (Map.Entry<Short, Short> blockEntry : blocks.entrySet()) {
|
||||
Map<Short, Character> blocks = entry.getValue();
|
||||
for (Map.Entry<Short, Character> blockEntry : blocks.entrySet()) {
|
||||
short blockHash = blockEntry.getKey();
|
||||
int x = (blockHash >> 12 & 0xF) + (cx << 4);
|
||||
int y = (blockHash & 0xFF);
|
||||
int z = (blockHash >> 8 & 0xF) + (cz << 4);
|
||||
short combined = blockEntry.getValue();
|
||||
char combined = blockEntry.getValue();
|
||||
int id = FaweCache.getId(combined);
|
||||
byte data = (byte) FaweCache.getData(combined);
|
||||
Location loc = new Location(world, x, y, z);
|
||||
|
@ -331,7 +331,7 @@ public class MCAQueue extends NMSMappedFaweQueue<FaweQueue, FaweChunk, FaweChunk
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendBlockUpdate(Map<Long, Map<Short, Short>> blockMap, FawePlayer... players) {
|
||||
public void sendBlockUpdate(Map<Long, Map<Short, Character>> blockMap, FawePlayer... players) {
|
||||
if (parent != null) {
|
||||
parentNMS.sendBlockUpdate(blockMap, players);
|
||||
}
|
||||
|
@ -245,7 +245,7 @@ public abstract class FaweQueue {
|
||||
return count;
|
||||
}
|
||||
|
||||
public abstract void sendBlockUpdate(Map<Long, Map<Short, Short>> blockMap, FawePlayer... players);
|
||||
public abstract void sendBlockUpdate(Map<Long, Map<Short, Character>> blockMap, FawePlayer... players);
|
||||
|
||||
@Deprecated
|
||||
public boolean next() {
|
||||
|
@ -169,7 +169,7 @@ public class DelegateFaweQueue extends FaweQueue {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendBlockUpdate(Map<Long, Map<Short, Short>> blockMap, FawePlayer... players) {
|
||||
public void sendBlockUpdate(Map<Long, Map<Short, Character>> blockMap, FawePlayer... players) {
|
||||
parent.sendBlockUpdate(blockMap, players);
|
||||
}
|
||||
|
||||
|
@ -140,6 +140,23 @@ public class BundledBlockData {
|
||||
valuesEntry.getValue().setDirection(dirs[index]);
|
||||
index += increment;
|
||||
}
|
||||
} else if (entry.legacyId == 69) {
|
||||
dir = entry.states.get("facing");
|
||||
Vector[] dirs = new Vector[]{
|
||||
new Vector(0, -1, 0),
|
||||
new Vector(1, 0, 0),
|
||||
new Vector(-1, 0, 0),
|
||||
new Vector(0, 0, 1),
|
||||
new Vector(0, 0, -1),
|
||||
new Vector(0, 1, 0),
|
||||
new Vector(0, 1, 0),
|
||||
new Vector(0, -1, 0)};
|
||||
int len = dir.values.size();
|
||||
int index = 0;
|
||||
for (Map.Entry<String, FaweStateValue> valuesEntry : dir.values.entrySet()) {
|
||||
valuesEntry.getValue().setDirection(dirs[index]);
|
||||
index ++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -104,11 +104,11 @@ public class ForgeQueue_All extends NMSMappedFaweQueue<World, Chunk, ExtendedBlo
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendBlockUpdate(Map<Long, Map<Short, Short>> blockMap, FawePlayer... players) {
|
||||
for (Map.Entry<Long, Map<Short, Short>> chunkEntry : blockMap.entrySet()) {
|
||||
public void sendBlockUpdate(Map<Long, Map<Short, Character>> blockMap, FawePlayer... players) {
|
||||
for (Map.Entry<Long, Map<Short, Character>> chunkEntry : blockMap.entrySet()) {
|
||||
try {
|
||||
long chunkHash = chunkEntry.getKey();
|
||||
Map<Short, Short> blocks = chunkEntry.getValue();
|
||||
Map<Short, Character> blocks = chunkEntry.getValue();
|
||||
SPacketMultiBlockChange packet = new SPacketMultiBlockChange();
|
||||
int cx = MathMan.unpairIntX(chunkHash);
|
||||
int cz = MathMan.unpairIntY(chunkHash);
|
||||
@ -117,7 +117,7 @@ public class ForgeQueue_All extends NMSMappedFaweQueue<World, Chunk, ExtendedBlo
|
||||
buffer.writeInt(cx);
|
||||
buffer.writeInt(cz);
|
||||
buffer.writeVarIntToBuffer(blocks.size());
|
||||
for (Map.Entry<Short, Short> blockEntry : blocks.entrySet()) {
|
||||
for (Map.Entry<Short, Character> blockEntry : blocks.entrySet()) {
|
||||
buffer.writeShort(blockEntry.getKey());
|
||||
buffer.writeVarIntToBuffer(blockEntry.getValue());
|
||||
}
|
||||
|
@ -89,11 +89,11 @@ public class ForgeQueue_All extends NMSMappedFaweQueue<World, Chunk, ExtendedBlo
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendBlockUpdate(Map<Long, Map<Short, Short>> blockMap, FawePlayer... players) {
|
||||
for (Map.Entry<Long, Map<Short, Short>> chunkEntry : blockMap.entrySet()) {
|
||||
public void sendBlockUpdate(Map<Long, Map<Short, Character>> blockMap, FawePlayer... players) {
|
||||
for (Map.Entry<Long, Map<Short, Character>> chunkEntry : blockMap.entrySet()) {
|
||||
try {
|
||||
long chunkHash = chunkEntry.getKey();
|
||||
Map<Short, Short> blocks = chunkEntry.getValue();
|
||||
Map<Short, Character> blocks = chunkEntry.getValue();
|
||||
SPacketMultiBlockChange packet = new SPacketMultiBlockChange();
|
||||
int cx = MathMan.unpairIntX(chunkHash);
|
||||
int cz = MathMan.unpairIntY(chunkHash);
|
||||
@ -102,7 +102,7 @@ public class ForgeQueue_All extends NMSMappedFaweQueue<World, Chunk, ExtendedBlo
|
||||
buffer.writeInt(cx);
|
||||
buffer.writeInt(cz);
|
||||
buffer.writeVarInt(blocks.size());
|
||||
for (Map.Entry<Short, Short> blockEntry : blocks.entrySet()) {
|
||||
for (Map.Entry<Short, Character> blockEntry : blocks.entrySet()) {
|
||||
buffer.writeShort(blockEntry.getKey());
|
||||
buffer.writeVarInt(blockEntry.getValue());
|
||||
}
|
||||
|
@ -290,11 +290,11 @@ public class ForgeQueue_All extends NMSMappedFaweQueue<World, Chunk, ExtendedBlo
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendBlockUpdate(Map<Long, Map<Short, Short>> blockMap, FawePlayer... players) {
|
||||
for (Map.Entry<Long, Map<Short, Short>> chunkEntry : blockMap.entrySet()) {
|
||||
public void sendBlockUpdate(Map<Long, Map<Short, Character>> blockMap, FawePlayer... players) {
|
||||
for (Map.Entry<Long, Map<Short, Character>> chunkEntry : blockMap.entrySet()) {
|
||||
try {
|
||||
long chunkHash = chunkEntry.getKey();
|
||||
Map<Short, Short> blocks = chunkEntry.getValue();
|
||||
Map<Short, Character> blocks = chunkEntry.getValue();
|
||||
S22PacketMultiBlockChange packet = new S22PacketMultiBlockChange();
|
||||
int cx = MathMan.unpairIntX(chunkHash);
|
||||
int cz = MathMan.unpairIntY(chunkHash);
|
||||
@ -303,7 +303,7 @@ public class ForgeQueue_All extends NMSMappedFaweQueue<World, Chunk, ExtendedBlo
|
||||
buffer.writeInt(cx);
|
||||
buffer.writeInt(cz);
|
||||
buffer.writeVarIntToBuffer(blocks.size());
|
||||
for (Map.Entry<Short, Short> blockEntry : blocks.entrySet()) {
|
||||
for (Map.Entry<Short, Character> blockEntry : blocks.entrySet()) {
|
||||
buffer.writeShort(blockEntry.getKey());
|
||||
buffer.writeVarIntToBuffer(blockEntry.getValue());
|
||||
}
|
||||
|
@ -204,11 +204,11 @@ public class ForgeQueue_All extends NMSMappedFaweQueue<World, Chunk, ExtendedBlo
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendBlockUpdate(Map<Long, Map<Short, Short>> blockMap, FawePlayer... players) {
|
||||
for (Map.Entry<Long, Map<Short, Short>> chunkEntry : blockMap.entrySet()) {
|
||||
public void sendBlockUpdate(Map<Long, Map<Short, Character>> blockMap, FawePlayer... players) {
|
||||
for (Map.Entry<Long, Map<Short, Character>> chunkEntry : blockMap.entrySet()) {
|
||||
try {
|
||||
long chunkHash = chunkEntry.getKey();
|
||||
Map<Short, Short> blocks = chunkEntry.getValue();
|
||||
Map<Short, Character> blocks = chunkEntry.getValue();
|
||||
S22PacketMultiBlockChange packet = new S22PacketMultiBlockChange();
|
||||
int cx = MathMan.unpairIntX(chunkHash);
|
||||
int cz = MathMan.unpairIntY(chunkHash);
|
||||
@ -217,7 +217,7 @@ public class ForgeQueue_All extends NMSMappedFaweQueue<World, Chunk, ExtendedBlo
|
||||
buffer.writeInt(cx);
|
||||
buffer.writeInt(cz);
|
||||
buffer.writeVarIntToBuffer(blocks.size());
|
||||
for (Map.Entry<Short, Short> blockEntry : blocks.entrySet()) {
|
||||
for (Map.Entry<Short, Character> blockEntry : blocks.entrySet()) {
|
||||
buffer.writeShort(blockEntry.getKey());
|
||||
buffer.writeVarIntToBuffer(blockEntry.getValue());
|
||||
}
|
||||
|
@ -242,11 +242,11 @@ public class ForgeQueue_All extends NMSMappedFaweQueue<World, Chunk, ExtendedBlo
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendBlockUpdate(Map<Long, Map<Short, Short>> blockMap, FawePlayer... players) {
|
||||
for (Map.Entry<Long, Map<Short, Short>> chunkEntry : blockMap.entrySet()) {
|
||||
public void sendBlockUpdate(Map<Long, Map<Short, Character>> blockMap, FawePlayer... players) {
|
||||
for (Map.Entry<Long, Map<Short, Character>> chunkEntry : blockMap.entrySet()) {
|
||||
try {
|
||||
long chunkHash = chunkEntry.getKey();
|
||||
Map<Short, Short> blocks = chunkEntry.getValue();
|
||||
Map<Short, Character> blocks = chunkEntry.getValue();
|
||||
SPacketMultiBlockChange packet = new SPacketMultiBlockChange();
|
||||
int cx = MathMan.unpairIntX(chunkHash);
|
||||
int cz = MathMan.unpairIntY(chunkHash);
|
||||
@ -255,7 +255,7 @@ public class ForgeQueue_All extends NMSMappedFaweQueue<World, Chunk, ExtendedBlo
|
||||
buffer.writeInt(cx);
|
||||
buffer.writeInt(cz);
|
||||
buffer.writeVarIntToBuffer(blocks.size());
|
||||
for (Map.Entry<Short, Short> blockEntry : blocks.entrySet()) {
|
||||
for (Map.Entry<Short, Character> blockEntry : blocks.entrySet()) {
|
||||
buffer.writeShort(blockEntry.getKey());
|
||||
buffer.writeVarIntToBuffer(blockEntry.getValue());
|
||||
}
|
||||
|
@ -124,15 +124,15 @@ public class NukkitQueue extends NMSMappedFaweQueue<Level, BaseFullChunk, BaseFu
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendBlockUpdate(Map<Long, Map<Short, Short>> blockMap, FawePlayer... players) {
|
||||
public void sendBlockUpdate(Map<Long, Map<Short, Character>> blockMap, FawePlayer... players) {
|
||||
ArrayList<Block> blocks = new ArrayList<Block>();
|
||||
for (Map.Entry<Long, Map<Short, Short>> entry : blockMap.entrySet()) {
|
||||
for (Map.Entry<Long, Map<Short, Character>> entry : blockMap.entrySet()) {
|
||||
long chunkHash = entry.getKey();
|
||||
int cx = MathMan.unpairIntX(chunkHash);
|
||||
int cz = MathMan.unpairIntY(chunkHash);
|
||||
Map<Short, Short> ids = entry.getValue();
|
||||
for (Map.Entry<Short, Short> blockEntry : ids.entrySet()) {
|
||||
short combined = blockEntry.getValue();
|
||||
Map<Short, Character> ids = entry.getValue();
|
||||
for (Map.Entry<Short, Character> blockEntry : ids.entrySet()) {
|
||||
char combined = blockEntry.getValue();
|
||||
int id = FaweCache.getId(combined);
|
||||
int data = FaweCache.getData(combined);
|
||||
Block block = Block.get(id, data);
|
||||
|
Loading…
Reference in New Issue
Block a user