mirror of
https://github.com/Auxilor/EcoEnchants.git
synced 2025-01-07 22:27:34 +01:00
Fixed rare crash with LootPopulator
This commit is contained in:
parent
513b6d9c14
commit
3ba3d43344
@ -67,7 +67,7 @@ public class LootPopulator extends BlockPopulator {
|
|||||||
if (!(entity instanceof StorageMinecart minecart)) {
|
if (!(entity instanceof StorageMinecart minecart)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
modifyInventory(minecart.getInventory());
|
modifyInventory(minecart.getInventory(), chunk);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (BlockState state : chunk.getTileEntities()) {
|
for (BlockState state : chunk.getTileEntities()) {
|
||||||
@ -76,7 +76,7 @@ public class LootPopulator extends BlockPopulator {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
Inventory inventory = chestState.getBlockInventory();
|
Inventory inventory = chestState.getBlockInventory();
|
||||||
modifyInventory(inventory);
|
modifyInventory(inventory, chunk);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -194,14 +194,19 @@ public class LootPopulator extends BlockPopulator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Modify given inventory with EcoEnchants enchantments
|
* Modify given inventory with EcoEnchants enchantments.
|
||||||
*
|
*
|
||||||
* @param inventory The target inventory
|
* @param inventory The target inventory.
|
||||||
|
* @param chunk The chunk.
|
||||||
*/
|
*/
|
||||||
public void modifyInventory(@NotNull final Inventory inventory) {
|
public void modifyInventory(@NotNull final Inventory inventory,
|
||||||
for (ItemStack item : inventory) {
|
@NotNull final Chunk chunk) {
|
||||||
this.plugin.getScheduler().runLater(1, () -> modifyItem(item));
|
this.plugin.getScheduler().runLater(1, () -> {
|
||||||
}
|
if (chunk.isLoaded()) {
|
||||||
|
for (ItemStack item : inventory) {
|
||||||
|
modifyItem(item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user