Fixed shared instances tick being called 2 times

This commit is contained in:
themode 2020-10-31 02:55:55 +01:00
parent 4375a8734d
commit 00ce2be258
4 changed files with 16 additions and 4 deletions

View File

@ -52,9 +52,9 @@ public abstract class EntityCreature extends LivingEntity {
private ItemStack leggings;
private ItemStack boots;
// TODO all pathfinding requests should be process in another thread
private final ReentrantLock pathLock = new ReentrantLock();
public EntityCreature(@NotNull EntityType entityType, @NotNull Position spawnPosition) {
super(entityType, spawnPosition);

View File

@ -1987,6 +1987,7 @@ public class Player extends LivingEntity implements CommandSender {
*
* @return the modifiable statistic map
*/
@NotNull
public Map<PlayerStatistic, Integer> getStatisticValueMap() {
return statisticValueMap;
}
@ -1996,6 +1997,7 @@ public class Player extends LivingEntity implements CommandSender {
*
* @return the player vehicle information
*/
@NotNull
public PlayerVehicleInformation getVehicleInformation() {
return vehicleInformation;
}

View File

@ -1,19 +1,28 @@
package net.minestom.server.stat;
import net.minestom.server.entity.Player;
import org.jetbrains.annotations.NotNull;
/**
* Represents a single statistic in the "statistics" game menu.
* <p>
* You can retrieve the statistics map with {@link Player#getStatisticValueMap()} and modify it with your own values.
*/
public class PlayerStatistic {
private final StatisticCategory category;
private final int statisticId;
public PlayerStatistic(StatisticCategory category, int statisticId) {
public PlayerStatistic(@NotNull StatisticCategory category, int statisticId) {
this.category = category;
this.statisticId = statisticId;
}
public PlayerStatistic(StatisticType type) {
public PlayerStatistic(@NotNull StatisticType type) {
this(StatisticCategory.CUSTOM, type.getId());
}
@NotNull
public StatisticCategory getCategory() {
return category;
}

View File

@ -19,6 +19,8 @@ import java.util.function.Function;
/**
* Used to link chunks into multiple groups.
* Then executed into a thread pool.
* <p>
* You can change the current thread provider by calling {@link net.minestom.server.UpdateManager#setThreadProvider(ThreadProvider)}.
*/
public abstract class ThreadProvider {
@ -130,7 +132,6 @@ public abstract class ThreadProvider {
protected void updateInstance(Instance instance, long time) {
// The instance
instance.tick(time);
updateSharedInstances(instance, sharedInstance -> updateInstance(sharedInstance, time));
}
/**