mirror of
https://github.com/boy0001/FastAsyncWorldedit.git
synced 2024-11-15 07:05:53 +01:00
Fix regen issues
This commit is contained in:
parent
671dc29c94
commit
b2252a1cf6
@ -148,21 +148,17 @@ public class FaweBukkit implements IFawe, Listener {
|
||||
@Override
|
||||
public CUI getCUI(FawePlayer player) {
|
||||
if (Settings.IMP.EXPERIMENTAL.VANILLA_CUI) {
|
||||
switch (getVersion()) {
|
||||
case v1_12_R1: {
|
||||
if (listeningCui && cuiListener == null) return null;
|
||||
listeningCui = true;
|
||||
if (cuiListener == null) {
|
||||
Plugin protocolLib = Bukkit.getPluginManager().getPlugin("ProtocolLib");
|
||||
if (protocolLib != null && protocolLib.isEnabled()) {
|
||||
cuiListener = new CUIListener(plugin);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
return new StructureCUI(player);
|
||||
if (listeningCui && cuiListener == null) return null;
|
||||
listeningCui = true;
|
||||
if (cuiListener == null) {
|
||||
Plugin protocolLib = Bukkit.getPluginManager().getPlugin("ProtocolLib");
|
||||
if (protocolLib != null && protocolLib.isEnabled()) {
|
||||
cuiListener = new CUIListener(plugin);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
return new StructureCUI(player);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
@ -8,6 +8,7 @@ import com.comphenix.protocol.PacketType;
|
||||
import com.comphenix.protocol.ProtocolLibrary;
|
||||
import com.comphenix.protocol.ProtocolManager;
|
||||
import com.comphenix.protocol.events.PacketContainer;
|
||||
import com.comphenix.protocol.injector.PacketConstructor;
|
||||
import com.comphenix.protocol.wrappers.BlockPosition;
|
||||
import com.comphenix.protocol.wrappers.nbt.NbtBase;
|
||||
import com.comphenix.protocol.wrappers.nbt.NbtCompound;
|
||||
@ -105,16 +106,32 @@ public class StructureCUI extends CUI {
|
||||
return NbtFactory.fromNMSCompound(nmsTag);
|
||||
}
|
||||
|
||||
private void sendNbt(Vector pos, NbtCompound compound) {
|
||||
ProtocolManager manager = ProtocolLibrary.getProtocolManager();
|
||||
PacketContainer containter = new PacketContainer(PacketType.Play.Server.TILE_ENTITY_DATA);
|
||||
containter.getBlockPositionModifier().write(0, new BlockPosition(pos.getBlockX(), pos.getBlockY(), pos.getBlockZ()));
|
||||
containter.getIntegers().write(0, 7);
|
||||
containter.getNbtModifier().write(0, compound);
|
||||
|
||||
private void sendOp() {
|
||||
Player player = this.<Player>getPlayer().parent;
|
||||
ProtocolManager manager = ProtocolLibrary.getProtocolManager();
|
||||
|
||||
PacketConstructor statusCtr = manager.createPacketConstructor(PacketType.Play.Server.ENTITY_STATUS, player, (byte) 28);
|
||||
PacketContainer status = statusCtr.createPacket(player, (byte) 28);
|
||||
|
||||
try {
|
||||
manager.sendServerPacket(player, containter);
|
||||
manager.sendServerPacket(player, status);
|
||||
} catch (InvocationTargetException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private void sendNbt(Vector pos, NbtCompound compound) {
|
||||
Player player = this.<Player>getPlayer().parent;
|
||||
ProtocolManager manager = ProtocolLibrary.getProtocolManager();
|
||||
|
||||
PacketContainer blockNbt = new PacketContainer(PacketType.Play.Server.TILE_ENTITY_DATA);
|
||||
blockNbt.getBlockPositionModifier().write(0, new BlockPosition(pos.getBlockX(), pos.getBlockY(), pos.getBlockZ()));
|
||||
blockNbt.getIntegers().write(0, 7);
|
||||
blockNbt.getNbtModifier().write(0, compound);
|
||||
|
||||
|
||||
try {
|
||||
manager.sendServerPacket(player, blockNbt);
|
||||
} catch (InvocationTargetException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
@ -123,6 +140,7 @@ public class StructureCUI extends CUI {
|
||||
public synchronized void update() {
|
||||
Player player = this.<Player>getPlayer().parent;
|
||||
Location playerLoc = player.getLocation();
|
||||
boolean setOp = remove == null && !player.isOp();
|
||||
if (remove != null) {
|
||||
int cx = playerLoc.getBlockX() >> 4;
|
||||
int cz = playerLoc.getBlockZ() >> 4;
|
||||
@ -172,6 +190,7 @@ public class StructureCUI extends CUI {
|
||||
|
||||
Location blockLoc = new Location(player.getWorld(), x, y, z);
|
||||
player.sendBlockChange(blockLoc, Material.STRUCTURE_BLOCK, (byte) 0);
|
||||
if (setOp) sendOp();
|
||||
sendNbt(remove, compound);
|
||||
}
|
||||
}
|
||||
|
@ -233,10 +233,11 @@ public abstract class BukkitQueue_0<CHUNK, CHUNKSECTIONS, SECTION> extends NMSMa
|
||||
|
||||
@Override
|
||||
public boolean regenerateChunk(World world, int x, int z, BaseBiome biome, Long seed) {
|
||||
return world.regenerateChunk(x, z);
|
||||
if (!keepLoaded.isEmpty()) keepLoaded.remove(MathMan.pairInt(x, z));
|
||||
boolean result = world.regenerateChunk(x, z);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public CharFaweChunk getPrevious(CharFaweChunk fs, CHUNKSECTIONS sections, Map<?, ?> tiles, Collection<?>[] entities, Set<UUID> createdEntities, boolean all) throws Exception {
|
||||
return fs;
|
||||
|
@ -52,7 +52,7 @@ public class MCAQueue extends NMSMappedFaweQueue<FaweQueue, FaweChunk, FaweChunk
|
||||
}
|
||||
|
||||
public MCAQueue(FaweQueue parent) {
|
||||
super(parent.getWEWorld(), new MCAQueueMap());
|
||||
super(parent.getWorldName(), new MCAQueueMap());
|
||||
this.parent = parent;
|
||||
if (parent instanceof NMSMappedFaweQueue) {
|
||||
parentNMS = (NMSMappedFaweQueue) parent;
|
||||
|
@ -61,7 +61,6 @@ import com.boydti.fawe.object.mask.ResettableMask;
|
||||
import com.boydti.fawe.object.pattern.ExistingPattern;
|
||||
import com.boydti.fawe.object.progress.ChatProgressTracker;
|
||||
import com.boydti.fawe.object.progress.DefaultProgressTracker;
|
||||
import com.boydti.fawe.object.visitor.FastChunkIterator;
|
||||
import com.boydti.fawe.util.ExtentTraverser;
|
||||
import com.boydti.fawe.util.MaskTraverser;
|
||||
import com.boydti.fawe.util.MathMan;
|
||||
@ -3408,7 +3407,7 @@ public class EditSession extends AbstractWorld implements HasFaweQueue, Lighting
|
||||
final Set<Vector2D> chunks = region.getChunks();
|
||||
MutableBlockVector mutable = new MutableBlockVector();
|
||||
MutableBlockVector2D mutable2D = new MutableBlockVector2D();
|
||||
for (Vector2D chunk : new FastChunkIterator(chunks, this)) {
|
||||
for (Vector2D chunk : chunks) {
|
||||
final int cx = chunk.getBlockX();
|
||||
final int cz = chunk.getBlockZ();
|
||||
final int bx = cx << 4;
|
||||
|
Loading…
Reference in New Issue
Block a user