Clean a fair bit of reflection calls, still some left over.. Performance boost. Also fixed /disguise not spacing the disguises you can use

This commit is contained in:
libraryaddict
2020-08-13 11:51:32 +12:00
parent 7a3f764581
commit 15b4a6e935
4 changed files with 273 additions and 317 deletions

View File

@@ -24,6 +24,7 @@ import me.libraryaddict.disguise.utilities.reflection.ReflectionManager;
import org.bukkit.Art;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.data.BlockData;
import org.bukkit.entity.Damageable;
import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;
@@ -305,13 +306,14 @@ public class PacketHandlerSpawn implements IPacketHandler {
if (disguise.getType() == DisguiseType.FALLING_BLOCK) {
if (NmsVersion.v1_13.isSupported()) {
BlockData block = ((FallingBlockWatcher) disguise.getWatcher()).getBlockData();
data = ReflectionManager.getCombinedIdByBlockData(block);
} else {
ItemStack block = ((FallingBlockWatcher) disguise.getWatcher()).getBlock();
data = ReflectionManager.getCombinedIdByItemStack(block);
}
if (((FallingBlockWatcher) disguise.getWatcher()).isGridLocked()) {
// Center the block
x = loc.getBlockX() + 0.5;