mirror of
https://github.com/Minestom/Minestom.git
synced 2024-10-01 07:57:41 +02:00
Rename #getBatchThread
This commit is contained in:
parent
555cdb66de
commit
3035b3257d
@ -61,7 +61,7 @@ public class AcquirableEntity {
|
||||
*/
|
||||
public void acquire(@NotNull EntityConsumer consumer) {
|
||||
final Thread currentThread = Thread.currentThread();
|
||||
final TickThread elementThread = getHandler().getBatchThread();
|
||||
final TickThread elementThread = getHandler().getTickThread();
|
||||
Acquisition.acquire(currentThread, elementThread, () -> consumer.accept(unwrap()));
|
||||
}
|
||||
|
||||
@ -75,7 +75,7 @@ public class AcquirableEntity {
|
||||
*/
|
||||
public boolean tryAcquire(@NotNull EntityConsumer consumer) {
|
||||
final Thread currentThread = Thread.currentThread();
|
||||
final TickThread elementThread = getHandler().getBatchThread();
|
||||
final TickThread elementThread = getHandler().getTickThread();
|
||||
if (Objects.equals(currentThread, elementThread)) {
|
||||
consumer.accept(unwrap());
|
||||
return true;
|
||||
@ -91,7 +91,7 @@ public class AcquirableEntity {
|
||||
*/
|
||||
public @Nullable Entity tryAcquire() {
|
||||
final Thread currentThread = Thread.currentThread();
|
||||
final TickThread elementThread = getHandler().getBatchThread();
|
||||
final TickThread elementThread = getHandler().getTickThread();
|
||||
if (Objects.equals(currentThread, elementThread)) {
|
||||
return unwrap();
|
||||
}
|
||||
@ -143,7 +143,7 @@ public class AcquirableEntity {
|
||||
this.chunkEntry = chunkEntry;
|
||||
}
|
||||
|
||||
public TickThread getBatchThread() {
|
||||
public TickThread getTickThread() {
|
||||
return chunkEntry != null ? chunkEntry.getThread() : null;
|
||||
}
|
||||
}
|
||||
|
@ -155,7 +155,7 @@ public final class Acquisition {
|
||||
for (AcquirableEntity element : collection) {
|
||||
final Entity value = element.unwrap();
|
||||
|
||||
final TickThread elementThread = element.getHandler().getBatchThread();
|
||||
final TickThread elementThread = element.getHandler().getTickThread();
|
||||
if (currentThread == elementThread) {
|
||||
// The element is managed in the current thread, consumer can be immediately called
|
||||
consumer.accept(value);
|
||||
@ -175,7 +175,7 @@ public final class Acquisition {
|
||||
Map<TickThread, List<Entity>> threadCacheMap = new HashMap<>();
|
||||
for (AcquirableEntity acquirableEntity : collection) {
|
||||
final Entity entity = acquirableEntity.unwrap();
|
||||
final TickThread elementThread = acquirableEntity.getHandler().getBatchThread();
|
||||
final TickThread elementThread = acquirableEntity.getHandler().getTickThread();
|
||||
|
||||
List<Entity> threadCacheList = threadCacheMap.computeIfAbsent(elementThread, tickThread -> new ArrayList<>());
|
||||
threadCacheList.add(entity);
|
||||
|
Loading…
Reference in New Issue
Block a user