mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-25 22:56:45 +01:00
Fixed casting issue in FastQueue_1_9
This commit is contained in:
parent
7bbd359be8
commit
75bf01c13f
@ -1,14 +1,20 @@
|
||||
package com.plotsquared.bukkit.util.block;
|
||||
|
||||
import static com.intellectualcrafters.plot.util.ReflectionUtils.getRefClass;
|
||||
|
||||
import com.intellectualcrafters.plot.object.ChunkLoc;
|
||||
import com.intellectualcrafters.plot.object.PseudoRandom;
|
||||
import com.intellectualcrafters.plot.util.*;
|
||||
import com.intellectualcrafters.plot.util.ChunkManager;
|
||||
import com.intellectualcrafters.plot.util.MainUtil;
|
||||
import com.intellectualcrafters.plot.util.PlotChunk;
|
||||
import com.intellectualcrafters.plot.util.ReflectionUtils.RefClass;
|
||||
import com.intellectualcrafters.plot.util.ReflectionUtils.RefConstructor;
|
||||
import com.intellectualcrafters.plot.util.ReflectionUtils.RefField;
|
||||
import com.intellectualcrafters.plot.util.ReflectionUtils.RefMethod;
|
||||
import com.intellectualcrafters.plot.util.ReflectionUtils.RefMethod.RefExecutor;
|
||||
import com.intellectualcrafters.plot.util.SetQueue;
|
||||
import com.intellectualcrafters.plot.util.SetQueue.ChunkWrapper;
|
||||
import com.intellectualcrafters.plot.util.TaskManager;
|
||||
import com.plotsquared.bukkit.util.BukkitUtil;
|
||||
import com.plotsquared.bukkit.util.SendChunk;
|
||||
import org.bukkit.Chunk;
|
||||
@ -20,13 +26,17 @@ import org.bukkit.block.Biome;
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.*;
|
||||
import java.util.AbstractSet;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import static com.intellectualcrafters.plot.util.ReflectionUtils.getRefClass;
|
||||
import java.util.Set;
|
||||
|
||||
public class FastQueue_1_9 extends SlowQueue {
|
||||
|
||||
final Object air;
|
||||
private final SendChunk chunksender;
|
||||
private final RefClass classEntityPlayer = getRefClass("{nms}.EntityPlayer");
|
||||
private final RefClass classMapChunk = getRefClass("{nms}.PacketPlayOutMapChunk");
|
||||
@ -41,25 +51,24 @@ public class FastQueue_1_9 extends SlowQueue {
|
||||
private final RefClass classChunkSection = getRefClass("{nms}.ChunkSection");
|
||||
private final RefClass classBlock = getRefClass("{nms}.Block");
|
||||
private final RefClass classIBlockData = getRefClass("{nms}.IBlockData");
|
||||
private HashMap<ChunkWrapper, Chunk> toUpdate = new HashMap<>();
|
||||
private RefMethod methodGetHandleChunk;
|
||||
private RefConstructor MapChunk;
|
||||
private RefMethod methodInitLighting;
|
||||
private RefConstructor classBlockPositionConstructor;
|
||||
private RefConstructor classChunkSectionConstructor;
|
||||
private RefMethod methodW;
|
||||
private RefMethod methodAreNeighborsLoaded;
|
||||
private RefField fieldSections;
|
||||
private RefField fieldWorld;
|
||||
private RefMethod methodGetBlocks;
|
||||
private RefMethod methodGetType;
|
||||
private RefMethod methodSetType;
|
||||
private RefMethod methodGetCombinedId;
|
||||
private RefMethod methodGetByCombinedId;
|
||||
final Object air;
|
||||
private final HashMap<ChunkWrapper, Chunk> toUpdate = new HashMap<>();
|
||||
private final RefMethod methodGetHandleChunk;
|
||||
private final RefConstructor MapChunk;
|
||||
private final RefMethod methodInitLighting;
|
||||
private final RefConstructor classBlockPositionConstructor;
|
||||
private final RefConstructor classChunkSectionConstructor;
|
||||
private final RefMethod methodW;
|
||||
private final RefMethod methodAreNeighborsLoaded;
|
||||
private final RefField fieldSections;
|
||||
private final RefField fieldWorld;
|
||||
private final RefMethod methodGetBlocks;
|
||||
private final RefMethod methodGetType;
|
||||
private final RefMethod methodSetType;
|
||||
private final RefMethod methodGetCombinedId;
|
||||
private final RefMethod methodGetByCombinedId;
|
||||
|
||||
|
||||
public FastQueue_1_9() throws NoSuchMethodException, RuntimeException {
|
||||
public FastQueue_1_9() throws RuntimeException {
|
||||
methodGetHandleChunk = classCraftChunk.getMethod("getHandle");
|
||||
methodInitLighting = classChunk.getMethod("initLighting");
|
||||
MapChunk = classMapChunk.getConstructor(classChunk.getRealClass(), boolean.class, int.class);
|
||||
@ -143,11 +152,11 @@ public class FastQueue_1_9 extends SlowQueue {
|
||||
final Field sf = clazz.getDeclaredField("sections");
|
||||
sf.setAccessible(true);
|
||||
final Field tf = clazz.getDeclaredField("tileEntities");
|
||||
final Field ef = clazz.getDeclaredField("entitySlices");
|
||||
final Field entitySlices = clazz.getDeclaredField("entitySlices");
|
||||
|
||||
final Object[] sections = (Object[]) sf.get(c);
|
||||
final HashMap<?, ?> tiles = (HashMap<?, ?>) tf.get(c);
|
||||
final List<?>[] entities = (List<?>[]) ef.get(c);
|
||||
final AbstractSet<?>[] entities = (AbstractSet<?>[]) entitySlices.get(c);
|
||||
|
||||
Method xm = null;
|
||||
Method ym = null;
|
||||
@ -228,7 +237,7 @@ public class FastQueue_1_9 extends SlowQueue {
|
||||
int x = MainUtil.x_loc[j][k];
|
||||
int y = MainUtil.y_loc[j][k];
|
||||
int z = MainUtil.z_loc[j][k];
|
||||
int id = (int) n;
|
||||
int id = n;
|
||||
Object iblock = methodGetByCombinedId.call((int) n);
|
||||
setType.call(x, y & 15, z, iblock);
|
||||
continue;
|
||||
|
Loading…
Reference in New Issue
Block a user