Fix tiles for BukkitQueue_All

This commit is contained in:
Jesse Boyd 2016-08-14 21:38:53 +10:00
parent eb62377c0f
commit efcb7b90e8
3 changed files with 20 additions and 3 deletions

View File

@ -5,8 +5,10 @@ import com.boydti.fawe.config.Settings;
import com.boydti.fawe.example.CharFaweChunk;
import com.boydti.fawe.object.FaweQueue;
import com.boydti.fawe.util.MainUtil;
import com.sk89q.jnbt.CompoundTag;
import com.sk89q.worldedit.LocalWorld;
import com.sk89q.worldedit.Vector2D;
import com.sk89q.worldedit.blocks.BaseBlock;
import com.sk89q.worldedit.bukkit.BukkitUtil;
import com.sk89q.worldedit.world.biome.BaseBiome;
import java.util.ArrayList;
@ -186,6 +188,14 @@ public class BukkitChunk_All extends CharFaweChunk<Chunk> {
int z = cacheZ[j];
int y = cacheY[j];
Block block = chunk.getBlock(x, y, z);
if (FaweCache.hasNBT(id) && parent.adapter != null) {
CompoundTag tile = getTile(x, y, z);
if (tile != null) {
BaseBlock baseBlock = new BaseBlock(id, data, tile);
parent.adapter.setBlock(block.getLocation(), baseBlock, false);
break;
}
}
setBlock(block, id, (byte) data);
if (light) {
parent.disableLighting(disableResult);

View File

@ -29,7 +29,7 @@ import org.bukkit.event.world.WorldInitEvent;
public abstract class BukkitQueue_0<CHUNK, CHUNKSECTIONS, SECTION> extends NMSMappedFaweQueue<World, CHUNK, CHUNKSECTIONS, SECTION> implements Listener {
public static Object adapter;
public static BukkitImplAdapter adapter;
public static Method methodToNative;
public static Method methodFromNative;
@ -119,7 +119,7 @@ public abstract class BukkitQueue_0<CHUNK, CHUNKSECTIONS, SECTION> extends NMSMa
if ((this.adapter = adapter) != null) {
fieldAdapter.set(instance, adapter);
} else {
this.adapter = fieldAdapter.get(instance);
this.adapter = (BukkitImplAdapter) fieldAdapter.get(instance);
}
for (Method method : this.adapter.getClass().getDeclaredMethods()) {
switch (method.getName()) {

View File

@ -7,9 +7,11 @@ import com.boydti.fawe.object.FaweChunk;
import com.boydti.fawe.object.RunnableVal;
import com.boydti.fawe.util.TaskManager;
import com.sk89q.jnbt.CompoundTag;
import com.sk89q.worldedit.blocks.BaseBlock;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import org.bukkit.Chunk;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.block.Block;
@ -92,7 +94,12 @@ public class BukkitQueue_All extends BukkitQueue_0<Chunk, Chunk, Chunk> {
@Override
public CompoundTag getTileEntity(Chunk chunk, int x, int y, int z) {
return null;
if (adapter == null) {
return null;
}
Location loc = new Location(getWorld(), x, y, z);
BaseBlock block = adapter.getBlock(loc);
return block != null ? block.getNbtData() : null;
}
@Override