3
0
Mirror von https://github.com/IntellectualSites/FastAsyncWorldEdit.git synchronisiert 2024-11-20 09:50:06 +01:00

Improve block tracing performance

Dieser Commit ist enthalten in:
SirYwell 2023-03-08 20:04:29 +01:00 committet von Phillipp Glanz
Ursprung de92aee8f7
Commit 1fc2f90ad5
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
2 geänderte Dateien mit 6 neuen und 11 gelöschten Zeilen

Datei anzeigen

@ -3,7 +3,6 @@ package com.fastasyncworldedit.bukkit.util;
import com.fastasyncworldedit.core.util.TaskManager;
import com.sk89q.worldedit.bukkit.BukkitAdapter;
import com.sk89q.worldedit.bukkit.WorldEditPlugin;
import com.sk89q.worldedit.entity.Entity;
import com.sk89q.worldedit.entity.Player;
import com.sk89q.worldedit.util.Location;
import org.bukkit.Bukkit;

Datei anzeigen

@ -10,6 +10,7 @@ import com.sk89q.worldedit.WorldEdit;
import com.sk89q.worldedit.entity.Player;
import com.sk89q.worldedit.extension.platform.PlayerProxy;
import com.sk89q.worldedit.extent.Extent;
import com.sk89q.worldedit.function.mask.Mask;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.math.Vector3;
import com.sk89q.worldedit.util.Direction;
@ -17,6 +18,7 @@ import com.sk89q.worldedit.util.Location;
import com.sk89q.worldedit.util.TargetBlock;
import com.sk89q.worldedit.world.World;
import com.sk89q.worldedit.world.block.BlockTypes;
import org.jetbrains.annotations.Nullable;
public class AsyncPlayer extends PlayerProxy {
@ -177,19 +179,13 @@ public class AsyncPlayer extends PlayerProxy {
}
@Override
public Location getBlockTrace(int range, boolean useLastBlock) {
return TaskManager.taskManager().sync(() -> {
TargetBlock tb = new TargetBlock(AsyncPlayer.this, range, 0.2D);
return useLastBlock ? tb.getAnyTargetBlock() : tb.getTargetBlock();
});
public Location getBlockTrace(final int range, final boolean useLastBlock, @Nullable final Mask stopMask) {
return TaskManager.taskManager().syncAt(() -> super.getBlockTrace(range, useLastBlock, stopMask), getLocation());
}
@Override
public Location getBlockTraceFace(int range, boolean useLastBlock) {
return TaskManager.taskManager().sync(() -> {
TargetBlock tb = new TargetBlock(AsyncPlayer.this, range, 0.2D);
return useLastBlock ? tb.getAnyTargetBlockFace() : tb.getTargetBlockFace();
});
public Location getBlockTraceFace(final int range, final boolean useLastBlock, @Nullable final Mask stopMask) {
return TaskManager.taskManager().syncAt(() -> super.getBlockTraceFace(range, useLastBlock, stopMask), getLocation());
}
@Override