Look up resource templates at loot time instead of caching them on ResourceType
ResourceType.template was filled in the enum constructor, which can run before ItemTemplate.templates is loaded, leaving it null. lootBuilding was its only reader and threw on the first non-gold resource. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
ef6fe4aa5b
commit
875809efe0
2 files changed
+6
-4
No files matched your search
@@ -218,7 +218,12 @@ public enum BuildingManager {
|
||||
|
||||
for (mbEnums.ResourceType resourceType : EnumSet.allOf(mbEnums.ResourceType.class)) {
|
||||
|
||||
if (!player.charItemManager.hasRoomInventory(resourceType.template.item_wt)) {
|
||||
ItemTemplate resourceTemplate = ItemTemplate.templates.get(resourceType.templateID);
|
||||
|
||||
if (resourceTemplate == null)
|
||||
continue;
|
||||
|
||||
if (!player.charItemManager.hasRoomInventory(resourceTemplate.item_wt)) {
|
||||
ChatManager.chatSystemInfo(player, "You can not carry any more of that item.");
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user