Skip to content

Commit

Permalink
Added a workaround to temporarily fix crashes when holding a hoe. Add…
Browse files Browse the repository at this point in the history
…ed debug information to fix this bug in the future for real
  • Loading branch information
hannibal002 committed Mar 19, 2023
1 parent 7e3ba7e commit 0c3467f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,12 @@ class CropMoneyDisplay {
for ((internalName, amount) in multipliers) {
val price = NEUItems.getPrice(internalName)
val cropName = cropNames[internalName]!!
val speed = GardenAPI.getCropsPerSecond(cropName)!!
val speed = GardenAPI.getCropsPerSecond(cropName)
if (speed == null) {
println("calculateMoneyPerHour: Speed is null for crop name '$cropName' ($internalName)")
LorenzUtils.debug("calculateMoneyPerHour: Speed is null!")
continue
}

// No speed data for item in hand
if (speed == -1) continue
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,14 @@ class GardenCropMilestoneDisplay {
if (cultivatingData.containsKey(crop)) {
val old = cultivatingData[crop]!!
val diff = counter - old
GardenCropMilestones.cropCounter[crop] = GardenCropMilestones.cropCounter[crop]!! + diff
try {
GardenCropMilestones.cropCounter[crop] = GardenCropMilestones.cropCounter[crop]!! + diff
} catch (e: NullPointerException) {
println("crop: '$crop'")
println("GardenCropMilestones.cropCounter: '${GardenCropMilestones.cropCounter.keys}'")
LorenzUtils.debug("NPE at OwnInventorItemUpdateEvent with GardenCropMilestones.cropCounter")
e.printStackTrace()
}
EliteFarmingWeight.addCrop(crop, diff)
if (currentCrop == crop) {
calculateSpeed(diff)
Expand Down

0 comments on commit 0c3467f

Please sign in to comment.