Skip to content

Commit

Permalink
Rewrite how mob/item/block metadata is tracked/retrieved
Browse files Browse the repository at this point in the history
Fixes #4720
  • Loading branch information
nossr50 committed Jan 17, 2022
1 parent 74ced18 commit 3be15d3
Show file tree
Hide file tree
Showing 19 changed files with 477 additions and 600 deletions.
5 changes: 5 additions & 0 deletions Changelog.txt
@@ -1,4 +1,9 @@
Version 2.1.210
Fixed a memory leak involving mob metadata

NOTES:
There was a big rewrite in this update relating to how various types of metadata were being tracked/stored/retrieved
If you run into issues with this version of mcMMO, please post about it on GitHub

Version 2.1.209
Fixed a bug where some config files did not get trimmed completely
Expand Down
@@ -1,6 +1,6 @@
package com.gmail.nossr50.config;

import com.gmail.nossr50.util.compat.layers.persistentdata.MobMetaFlagType;
import com.gmail.nossr50.metadata.MobMetaFlagType;

public class PersistentDataConfig extends BukkitConfig {
private static PersistentDataConfig instance;
Expand Down
28 changes: 14 additions & 14 deletions src/main/java/com/gmail/nossr50/listeners/EntityListener.java
Expand Up @@ -10,6 +10,8 @@
import com.gmail.nossr50.events.fake.FakeEntityTameEvent;
import com.gmail.nossr50.events.skills.rupture.McMMOEntityDamageByRuptureEvent;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.metadata.MobMetaFlagType;
import com.gmail.nossr50.metadata.MobMetadataService;
import com.gmail.nossr50.party.PartyManager;
import com.gmail.nossr50.runnables.TravelingBlockMetaCleanup;
import com.gmail.nossr50.skills.archery.Archery;
Expand All @@ -19,8 +21,6 @@
import com.gmail.nossr50.skills.taming.TamingManager;
import com.gmail.nossr50.skills.unarmed.UnarmedManager;
import com.gmail.nossr50.util.*;
import com.gmail.nossr50.util.compat.layers.persistentdata.AbstractPersistentDataLayer;
import com.gmail.nossr50.util.compat.layers.persistentdata.MobMetaFlagType;
import com.gmail.nossr50.util.player.NotificationManager;
import com.gmail.nossr50.util.player.UserManager;
import com.gmail.nossr50.util.random.RandomChanceUtil;
Expand Down Expand Up @@ -51,7 +51,7 @@

public class EntityListener implements Listener {
private final mcMMO pluginRef;
private final @NotNull AbstractPersistentDataLayer persistentDataLayer;
private final @NotNull MobMetadataService mobMetadataService;

/**
* We can use this {@link NamespacedKey} for {@link Enchantment} comparisons to
Expand All @@ -61,7 +61,7 @@ public class EntityListener implements Listener {

public EntityListener(final mcMMO pluginRef) {
this.pluginRef = pluginRef;
persistentDataLayer = mcMMO.getCompatibilityManager().getPersistentDataLayer();
mobMetadataService = mcMMO.getMetadataService().getMobMetadataService();
}

// @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
Expand Down Expand Up @@ -94,11 +94,11 @@ public void onEntityTransform(EntityTransformEvent event) {
LivingEntity livingEntity = (LivingEntity) event.getEntity();

//Transfer metadata keys from mob-spawned mobs to new mobs
if(persistentDataLayer.hasMobFlags(livingEntity)) {
if(mobMetadataService.hasMobFlags(livingEntity)) {
for(Entity entity : event.getTransformedEntities()) {
if(entity instanceof LivingEntity) {
LivingEntity transformedEntity = (LivingEntity) entity;
persistentDataLayer.addMobFlags(livingEntity, transformedEntity);
mobMetadataService.addMobFlags(livingEntity, transformedEntity);
}
}
}
Expand All @@ -122,8 +122,8 @@ public void onEntityTargetEntity(EntityTargetLivingEntityEvent event) {
if(event.getEntity() instanceof Enderman) {
Enderman enderman = (Enderman) event.getEntity();

if(!persistentDataLayer.hasMobFlag(MobMetaFlagType.EXPLOITED_ENDERMEN, enderman)) {
persistentDataLayer.flagMetadata(MobMetaFlagType.EXPLOITED_ENDERMEN, enderman);
if(!mobMetadataService.hasMobFlag(MobMetaFlagType.EXPLOITED_ENDERMEN, enderman)) {
mobMetadataService.flagMetadata(MobMetaFlagType.EXPLOITED_ENDERMEN, enderman);
}
}
}
Expand Down Expand Up @@ -729,19 +729,19 @@ public void onCreatureSpawn(CreatureSpawnEvent event) {
}

private void trackSpawnedAndPassengers(LivingEntity livingEntity, MobMetaFlagType mobMetaFlagType) {
persistentDataLayer.flagMetadata(mobMetaFlagType, livingEntity);
mobMetadataService.flagMetadata(mobMetaFlagType, livingEntity);

for(Entity passenger : livingEntity.getPassengers()) {
if(passenger != null) {
persistentDataLayer.flagMetadata(mobMetaFlagType, livingEntity);
mobMetadataService.flagMetadata(mobMetaFlagType, livingEntity);
}
}
}

@EventHandler(ignoreCancelled = true, priority = EventPriority.HIGHEST)
public void onEntityBreed(EntityBreedEvent event) {
if(ExperienceConfig.getInstance().isCOTWBreedingPrevented()) {
if(persistentDataLayer.hasMobFlag(MobMetaFlagType.COTW_SUMMONED_MOB, event.getFather()) || persistentDataLayer.hasMobFlag(MobMetaFlagType.COTW_SUMMONED_MOB, event.getMother())) {
if(mobMetadataService.hasMobFlag(MobMetaFlagType.COTW_SUMMONED_MOB, event.getFather()) || mobMetadataService.hasMobFlag(MobMetaFlagType.COTW_SUMMONED_MOB, event.getMother())) {
event.setCancelled(true);
Animals mom = (Animals) event.getMother();
Animals father = (Animals) event.getFather();
Expand Down Expand Up @@ -1007,12 +1007,12 @@ public void onEntityTame(EntityTameEvent event) {

if (!UserManager.hasPlayerDataKey(player)
|| (ExperienceConfig.getInstance().isNPCInteractionPrevented() && Misc.isNPCEntityExcludingVillagers(livingEntity))
|| persistentDataLayer.hasMobFlag(MobMetaFlagType.EGG_MOB, livingEntity)
|| persistentDataLayer.hasMobFlag(MobMetaFlagType.MOB_SPAWNER_MOB, livingEntity)) {
|| mobMetadataService.hasMobFlag(MobMetaFlagType.EGG_MOB, livingEntity)
|| mobMetadataService.hasMobFlag(MobMetaFlagType.MOB_SPAWNER_MOB, livingEntity)) {
return;
}

persistentDataLayer.flagMetadata(MobMetaFlagType.PLAYER_TAMED_MOB, livingEntity);
mobMetadataService.flagMetadata(MobMetaFlagType.PLAYER_TAMED_MOB, livingEntity);

//Profile not loaded
if(UserManager.getPlayer(player) == null)
Expand Down
11 changes: 10 additions & 1 deletion src/main/java/com/gmail/nossr50/mcMMO.java
Expand Up @@ -18,6 +18,7 @@
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
import com.gmail.nossr50.datatypes.skills.subskills.acrobatics.Roll;
import com.gmail.nossr50.listeners.*;
import com.gmail.nossr50.metadata.MetadataService;
import com.gmail.nossr50.party.PartyManager;
import com.gmail.nossr50.runnables.SaveTimerTask;
import com.gmail.nossr50.runnables.backups.CleanBackupsTask;
Expand Down Expand Up @@ -77,8 +78,9 @@
public class mcMMO extends JavaPlugin {


/* Managers */
/* Managers & Services */
private static PlatformManager platformManager;
private static MetadataService metadataService;
private static ChunkManager placeStore;
private static RepairableManager repairableManager;
private static SalvageableManager salvageableManager;
Expand Down Expand Up @@ -175,6 +177,9 @@ public void onEnable() {
//Platform Manager
platformManager = new PlatformManager();

//metadata service
metadataService = new MetadataService(this);

//Filter out any debug messages (if debug/verbose logging is not enabled)
getLogger().setFilter(new LogFilter(this));

Expand Down Expand Up @@ -466,6 +471,10 @@ public static UpgradeManager getUpgradeManager() {
return platformManager.getCompatibilityManager();
}

public static MetadataService getMetadataService() {
return metadataService;
}

@Deprecated
public static void setDatabaseManager(DatabaseManager databaseManager) {
mcMMO.databaseManager = databaseManager;
Expand Down
49 changes: 49 additions & 0 deletions src/main/java/com/gmail/nossr50/metadata/BlockMetadataService.java
@@ -0,0 +1,49 @@
package com.gmail.nossr50.metadata;

import com.gmail.nossr50.mcMMO;
import org.bukkit.block.Furnace;
import org.bukkit.persistence.PersistentDataContainer;
import org.bukkit.persistence.PersistentDataHolder;
import org.bukkit.persistence.PersistentDataType;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import java.util.UUID;

import static com.gmail.nossr50.metadata.MetadataService.NSK_FURNACE_UUID_LEAST_SIG;
import static com.gmail.nossr50.metadata.MetadataService.NSK_FURNACE_UUID_MOST_SIG;

public class BlockMetadataService {

private final @NotNull mcMMO pluginRef;

public BlockMetadataService(@NotNull mcMMO pluginRef) {
this.pluginRef = pluginRef;
}

public @Nullable UUID getFurnaceOwner(@NotNull Furnace furnace) {
//Get container from entity
PersistentDataContainer dataContainer = ((PersistentDataHolder) furnace).getPersistentDataContainer();

//Too lazy to make a custom data type for this stuff
Long mostSigBits = dataContainer.get(NSK_FURNACE_UUID_MOST_SIG, PersistentDataType.LONG);
Long leastSigBits = dataContainer.get(NSK_FURNACE_UUID_LEAST_SIG, PersistentDataType.LONG);

if (mostSigBits != null && leastSigBits != null) {
return new UUID(mostSigBits, leastSigBits);
} else {
return null;
}
}

public void setFurnaceOwner(@NotNull Furnace furnace, @NotNull UUID uuid) {
PersistentDataContainer dataContainer = ((PersistentDataHolder) furnace).getPersistentDataContainer();

dataContainer.set(NSK_FURNACE_UUID_MOST_SIG, PersistentDataType.LONG, uuid.getMostSignificantBits());
dataContainer.set(NSK_FURNACE_UUID_LEAST_SIG, PersistentDataType.LONG, uuid.getLeastSignificantBits());

furnace.update();
}


}
110 changes: 110 additions & 0 deletions src/main/java/com/gmail/nossr50/metadata/ItemMetadataService.java
@@ -0,0 +1,110 @@
package com.gmail.nossr50.metadata;

import com.gmail.nossr50.mcMMO;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import org.bukkit.persistence.PersistentDataContainer;
import org.bukkit.persistence.PersistentDataType;
import org.jetbrains.annotations.NotNull;

import java.util.List;

import static com.gmail.nossr50.metadata.MetadataService.NSK_SUPER_ABILITY_BOOSTED_ITEM;

public class ItemMetadataService {

public final @NotNull String LEGACY_ABILITY_TOOL_LORE = "mcMMO Ability Tool";
public final @NotNull mcMMO pluginRef;

public ItemMetadataService(@NotNull mcMMO pluginRef) {
this.pluginRef = pluginRef;
}

public void setSuperAbilityBoostedItem(@NotNull ItemStack itemStack, int originalDigSpeed) {
if (itemStack.getItemMeta() == null) {
mcMMO.p.getLogger().severe("Can not assign persistent data to an item with null item metadata");
return;
}

ItemMeta itemMeta = itemStack.getItemMeta();
PersistentDataContainer dataContainer = itemMeta.getPersistentDataContainer();

dataContainer.set(NSK_SUPER_ABILITY_BOOSTED_ITEM, PersistentDataType.INTEGER, originalDigSpeed);

itemStack.setItemMeta(itemMeta);
}

public boolean isSuperAbilityBoosted(@NotNull ItemStack itemStack) {
if (itemStack.getItemMeta() == null)
return false;

ItemMeta itemMeta = itemStack.getItemMeta();
//Get container from entity
PersistentDataContainer dataContainer = itemMeta.getPersistentDataContainer();

//If this value isn't null, then the tool can be considered dig speed boosted
Integer boostValue = dataContainer.get(NSK_SUPER_ABILITY_BOOSTED_ITEM, PersistentDataType.INTEGER);

return boostValue != null;
}

public int getSuperAbilityToolOriginalDigSpeed(@NotNull ItemStack itemStack) {
//Get container from entity
ItemMeta itemMeta = itemStack.getItemMeta();

if (itemMeta == null)
return 0;

PersistentDataContainer dataContainer = itemMeta.getPersistentDataContainer();

if (dataContainer.get(NSK_SUPER_ABILITY_BOOSTED_ITEM, PersistentDataType.INTEGER) == null) {
mcMMO.p.getLogger().severe("Value should never be null for a boosted item");
return 0;
} else {
//Too lazy to make a custom data type for this stuff
Integer boostValue = dataContainer.get(NSK_SUPER_ABILITY_BOOSTED_ITEM, PersistentDataType.INTEGER);
return Math.max(boostValue, 0);
}
}

public void removeBonusDigSpeedOnSuperAbilityTool(@NotNull ItemStack itemStack) {
int originalSpeed = getSuperAbilityToolOriginalDigSpeed(itemStack);
ItemMeta itemMeta = itemStack.getItemMeta();

if(itemMeta != null) {
//TODO: can be optimized
if (itemMeta.hasEnchant(Enchantment.DIG_SPEED)) {
itemMeta.removeEnchant(Enchantment.DIG_SPEED);
}

if (originalSpeed > 0) {
itemMeta.addEnchant(Enchantment.DIG_SPEED, originalSpeed, true);
}

PersistentDataContainer dataContainer = itemMeta.getPersistentDataContainer();
dataContainer.remove(NSK_SUPER_ABILITY_BOOSTED_ITEM); //Remove persistent data

//TODO: needed?
itemStack.setItemMeta(itemMeta);
}
}

public boolean isLegacyAbilityTool(@NotNull ItemStack itemStack) {
ItemMeta itemMeta = itemStack.getItemMeta();

if (itemMeta == null)
return false;

List<String> lore = itemMeta.getLore();

if (lore == null || lore.isEmpty())
return false;

return lore.contains(LEGACY_ABILITY_TOOL_LORE);
}

public @NotNull String getLegacyAbilityToolLore() {
return LEGACY_ABILITY_TOOL_LORE;
}
}
71 changes: 71 additions & 0 deletions src/main/java/com/gmail/nossr50/metadata/MetadataService.java
@@ -0,0 +1,71 @@
package com.gmail.nossr50.metadata;

import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.MetadataConstants;
import org.bukkit.NamespacedKey;
import org.jetbrains.annotations.NotNull;

public class MetadataService {
private final @NotNull mcMMO pluginRef;

protected static final @NotNull NamespacedKey NSK_SUPER_ABILITY_BOOSTED_ITEM;
protected static final @NotNull NamespacedKey NSK_MOB_SPAWNER_MOB;
protected static final @NotNull NamespacedKey NSK_EGG_MOB;
protected static final @NotNull NamespacedKey NSK_NETHER_GATE_MOB;
protected static final @NotNull NamespacedKey NSK_COTW_SUMMONED_MOB;
protected static final @NotNull NamespacedKey NSK_PLAYER_BRED_MOB;
protected static final @NotNull NamespacedKey NSK_PLAYER_TAMED_MOB;
protected static final @NotNull NamespacedKey NSK_VILLAGER_TRADE_ORIGIN_ITEM;
protected static final @NotNull NamespacedKey NSK_EXPLOITED_ENDERMEN;
protected static final @NotNull NamespacedKey NSK_FURNACE_UUID_MOST_SIG;
protected static final @NotNull NamespacedKey NSK_FURNACE_UUID_LEAST_SIG;

static {
NSK_SUPER_ABILITY_BOOSTED_ITEM = getNamespacedKey(MetadataConstants.METADATA_KEY_SUPER_ABILITY_BOOSTED_ITEM);
NSK_MOB_SPAWNER_MOB = getNamespacedKey(MetadataConstants.METADATA_KEY_MOB_SPAWNER_MOB);
NSK_EGG_MOB = getNamespacedKey(MetadataConstants.METADATA_KEY_EGG_MOB);
NSK_NETHER_GATE_MOB = getNamespacedKey(MetadataConstants.METADATA_KEY_NETHER_PORTAL_MOB);
NSK_COTW_SUMMONED_MOB = getNamespacedKey(MetadataConstants.METADATA_KEY_COTW_SUMMONED_MOB);
NSK_PLAYER_BRED_MOB = getNamespacedKey(MetadataConstants.METADATA_KEY_PLAYER_BRED_MOB);
NSK_PLAYER_TAMED_MOB = getNamespacedKey(MetadataConstants.METADATA_KEY_PLAYER_TAMED_MOB);
NSK_VILLAGER_TRADE_ORIGIN_ITEM = getNamespacedKey(MetadataConstants.METADATA_KEY_VILLAGER_TRADE_ORIGIN_ITEM);
NSK_EXPLOITED_ENDERMEN = getNamespacedKey(MetadataConstants.METADATA_KEY_EXPLOITED_ENDERMEN);
NSK_FURNACE_UUID_MOST_SIG = getNamespacedKey(MetadataConstants.METADATA_KEY_FURNACE_UUID_MOST_SIG);
NSK_FURNACE_UUID_LEAST_SIG = getNamespacedKey(MetadataConstants.METADATA_KEY_FURNACE_UUID_LEAST_SIG);
}

private final @NotNull ItemMetadataService itemMetadataService;
private final @NotNull MobMetadataService mobMetadataService;
private final @NotNull BlockMetadataService blockMetadataService;

public MetadataService(@NotNull mcMMO pluginRef) {
this.pluginRef = pluginRef;

blockMetadataService = new BlockMetadataService(pluginRef);
mobMetadataService = new MobMetadataService(pluginRef);
itemMetadataService = new ItemMetadataService(pluginRef);
}

/**
* Helper method to simplify generating namespaced keys
*
* @param key the {@link String} value of the key
*
* @return the generated {@link NamespacedKey}
*/
public static @NotNull NamespacedKey getNamespacedKey(@NotNull String key) {
return new NamespacedKey(mcMMO.p, key);
}

public @NotNull ItemMetadataService getItemMetadataService() {
return itemMetadataService;
}

public @NotNull MobMetadataService getMobMetadataService() {
return mobMetadataService;
}

public @NotNull BlockMetadataService getBlockMetadataService() {
return blockMetadataService;
}
}
@@ -1,4 +1,4 @@
package com.gmail.nossr50.util.compat.layers.persistentdata;
package com.gmail.nossr50.metadata;

public enum MobMetaFlagType {
MOB_SPAWNER_MOB,
Expand Down

5 comments on commit 3be15d3

@L4BORG
Copy link
Contributor

@L4BORG L4BORG commented on 3be15d3 Jan 18, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is causing some lag issues, compared to old mcmmo mcMMO::Event: c.g.n.l.WorldListener (ChunkUnloadEvent) is going crazy now...

Minecraft::Full Server Tick
count(1716) total(100.00% 216.13s, 251.90% of tick)
avg(125.95ms per - 125.95ms/1.00 per tick)
Minecraft::world - doTick
count(1664) total(92.66% 200.261s, 233.40% of tick)
avg(120.35ms per - 116.70ms/0.97 per tick)
Minecraft::world - Chunk provider tick
count(1664) total(63.99% 138.305s, 161.19% of tick)
avg(83.12ms per - 80.60ms/0.97 per tick)
Minecraft::Plugins
count(22209364) total(59.41% 128.394s, 149.64% of tick)
avg(0.01ms per - 74.82ms/12,942.52 per tick)
Minecraft::Distance Manager Tick
count(3026531) total(54.83% 118.511s, 138.12% of tick)
avg(0.04ms per - 69.06ms/1,763.71 per tick)
Minecraft::world - doChunkMap
count(1664) total(54.64% 118.087s, 137.63% of tick)
avg(70.97ms per - 68.82ms/0.97 per tick)
mcMMO::Combined Total
count(343859) total(54.59% 117.991s, 137.52% of tick)
avg(0.34ms per - 68.76ms/200.38 per tick)
mcMMO::Event: c.g.n.l.WorldListener (ChunkUnloadEvent)
count(6090) total(54.17% 117.072s, 136.45% of tick)
avg(19.22ms per - 68.22ms/3.55 per tick)
Minecraft::world - tickEntities
count(1664) total(18.66% 40.329s, 47.00% of tick)
avg(24.24ms per - 23.50ms/0.97 per tick)
Minecraft::world - entityTick
count(1664) total(18.52% 40.028s, 46.65% of tick)
avg(24.06ms per - 23.33ms/0.97 per tick)
Minecraft::tickEntity
count(6318086) total(16.37% 35.387s, 41.24% of tick)
avg(0.01ms per - 20.62ms/3,681.87 per tick)
Minecraft::world - Chunks
count(1664) total(9.32% 20.149s, 23.48% of tick)
avg(12.11ms per - 11.74ms/0.97 per tick)
Minecraft::world - tileEntityTick
count(1664) total(7.23% 15.618s, 18.20% of tick)
avg(9.39ms per - 9.10ms/0.97 per tick)
Minecraft::tickTileEntity
count(15520002) total(5.48% 11.841s, 13.80% of tick)
avg(0.00ms per - 6.90ms/9,044.29 per tick)
Minecraft::world - Chunk Ticks
count(1664) total(5.22% 11.286s, 13.15% of tick)
avg(6.78ms per - 6.58ms/0.97 per tick)
Minecraft::tickTileEntity - net.minecraft.world.level.block.entity.TileEntityHopper
count(7995442) total(3.40% 7.347s, 8.56% of tick)
avg(0.00ms per - 4.28ms/4,659.35 per tick)
Minecraft::tickEntity - villager - tick
count(178564) total(3.38% 7.298s, 8.51% of tick)
avg(0.04ms per - 4.25ms/104.06 per tick)
Minecraft::tickEntity - cow - tick
count(248399) total(2.45% 5.295s, 6.17% of tick)
avg(0.02ms per - 3.09ms/144.75 per tick)
Minecraft::world - Chunk Ticks - Blocks
count(5046077) total(2.18% 4.706s, 5.48% of tick)
avg(0.00ms per - 2.74ms/2,940.60 per tick)
Minecraft::world - tracker stage 2
count(1664) total(2.02% 4.364s, 5.09% of tick)
avg(2.62ms per - 2.54ms/0.97 per tick)
Minecraft::world - Scheduled Blocks
count(1664) total(1.96% 4.228s, 4.93% of tick)
avg(2.54ms per - 2.46ms/0.97 per tick)
Minecraft::Server Oversleep
count(1664) total(1.87% 4.049s, 4.72% of tick)
avg(2.43ms per - 2.36ms/0.97 per tick)
Minecraft::world - Scheduled Blocks - Ticking

@L4BORG
Copy link
Contributor

@L4BORG L4BORG commented on 3be15d3 Jan 18, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also saw some chatter about mobs from spawners giving mcmmo XP tho I didn't test that.

@WolverStones
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is causing some lag issues, compared to old mcmmo mcMMO::Event: c.g.n.l.WorldListener (ChunkUnloadEvent) is going crazy now...

Minecraft::Full Server Tick count(1716) total(100.00% 216.13s, 251.90% of tick) avg(125.95ms per - 125.95ms/1.00 per tick) Minecraft::world - doTick count(1664) total(92.66% 200.261s, 233.40% of tick) avg(120.35ms per - 116.70ms/0.97 per tick) Minecraft::world - Chunk provider tick count(1664) total(63.99% 138.305s, 161.19% of tick) avg(83.12ms per - 80.60ms/0.97 per tick) Minecraft::Plugins count(22209364) total(59.41% 128.394s, 149.64% of tick) avg(0.01ms per - 74.82ms/12,942.52 per tick) Minecraft::Distance Manager Tick count(3026531) total(54.83% 118.511s, 138.12% of tick) avg(0.04ms per - 69.06ms/1,763.71 per tick) Minecraft::world - doChunkMap count(1664) total(54.64% 118.087s, 137.63% of tick) avg(70.97ms per - 68.82ms/0.97 per tick) mcMMO::Combined Total count(343859) total(54.59% 117.991s, 137.52% of tick) avg(0.34ms per - 68.76ms/200.38 per tick) mcMMO::Event: c.g.n.l.WorldListener (ChunkUnloadEvent) count(6090) total(54.17% 117.072s, 136.45% of tick) avg(19.22ms per - 68.22ms/3.55 per tick) Minecraft::world - tickEntities count(1664) total(18.66% 40.329s, 47.00% of tick) avg(24.24ms per - 23.50ms/0.97 per tick) Minecraft::world - entityTick count(1664) total(18.52% 40.028s, 46.65% of tick) avg(24.06ms per - 23.33ms/0.97 per tick) Minecraft::tickEntity count(6318086) total(16.37% 35.387s, 41.24% of tick) avg(0.01ms per - 20.62ms/3,681.87 per tick) Minecraft::world - Chunks count(1664) total(9.32% 20.149s, 23.48% of tick) avg(12.11ms per - 11.74ms/0.97 per tick) Minecraft::world - tileEntityTick count(1664) total(7.23% 15.618s, 18.20% of tick) avg(9.39ms per - 9.10ms/0.97 per tick) Minecraft::tickTileEntity count(15520002) total(5.48% 11.841s, 13.80% of tick) avg(0.00ms per - 6.90ms/9,044.29 per tick) Minecraft::world - Chunk Ticks count(1664) total(5.22% 11.286s, 13.15% of tick) avg(6.78ms per - 6.58ms/0.97 per tick) Minecraft::tickTileEntity - net.minecraft.world.level.block.entity.TileEntityHopper count(7995442) total(3.40% 7.347s, 8.56% of tick) avg(0.00ms per - 4.28ms/4,659.35 per tick) Minecraft::tickEntity - villager - tick count(178564) total(3.38% 7.298s, 8.51% of tick) avg(0.04ms per - 4.25ms/104.06 per tick) Minecraft::tickEntity - cow - tick count(248399) total(2.45% 5.295s, 6.17% of tick) avg(0.02ms per - 3.09ms/144.75 per tick) Minecraft::world - Chunk Ticks - Blocks count(5046077) total(2.18% 4.706s, 5.48% of tick) avg(0.00ms per - 2.74ms/2,940.60 per tick) Minecraft::world - tracker stage 2 count(1664) total(2.02% 4.364s, 5.09% of tick) avg(2.62ms per - 2.54ms/0.97 per tick) Minecraft::world - Scheduled Blocks count(1664) total(1.96% 4.228s, 4.93% of tick) avg(2.54ms per - 2.46ms/0.97 per tick) Minecraft::Server Oversleep count(1664) total(1.87% 4.049s, 4.72% of tick) avg(2.43ms per - 2.36ms/0.97 per tick) Minecraft::world - Scheduled Blocks - Ticking

I have a same problem
https://i.imgur.com/5Un9rzC.png

@nossr50
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@L4BORG @WolverStones Could you provide a Spark dump? I'm not seeing any changes related to our ChunkUnlodEvent listener in WorldListener so I'm not sure why you would have a performance degradation. It would also be appreciated if you tagged me on Discord or made a new issue thread if you're having this problem with the latest build.

@L4BORG
Copy link
Contributor

@L4BORG L4BORG commented on 3be15d3 Mar 17, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After updating to latest mcMMO it's not an issue anymore. At least I can't replicate.

Please sign in to comment.