Compare commits

...

4 Commits

Author SHA1 Message Date
nossr50
b12f86a04d update changelog 2025-07-09 14:24:43 -07:00
Techirion
c377544fa2
RepairManager: Fix unsafe enchantments being stripped, CombatUtils: Use instanceof for IronGolem (#5192)
* RepairManager: Fix unsafe enchantments being stripped

* CombatUtils: Use instanceof for IronGolem check to avoid cast exceptions for pets/npcs/...

---------

Co-authored-by: Dieu <info@l4b.org>
2025-07-09 14:23:34 -07:00
nossr50
e6c62beed9 update changelog 2025-07-09 14:21:12 -07:00
るんく君
0424a5dd12
When burnTime is less than or equal to 0, do not process (#5194) 2025-07-09 14:19:02 -07:00
5 changed files with 10 additions and 4 deletions

View File

@ -1,3 +1,8 @@
Version 2.2.041
Fixed buckets being consumed by furnaces (thanks RunqRun)
Fixed Repair stripping unsafe enchantments from items (thanks Techirion)
Fixed IronGolem causing cast exceptions in rare cases (thanks Techirion)
Version 2.2.040
Fixed hover component and action bar messages not working for 1.21.6 and 1.21.7
Fixed bug where entries of mctop could be duplicated when using FlatFile

View File

@ -68,7 +68,7 @@ public class InventoryListener implements Listener {
furnaceState instanceof Furnace ? ((Furnace) furnaceState).getInventory()
.getSmelting() : null;
if (!ItemUtils.isSmeltable(smelting)) {
if (!ItemUtils.isSmeltable(smelting) || event.getBurnTime() <= 0) {
return;
}

View File

@ -411,7 +411,7 @@ public class RepairManager extends SkillManager {
if (enchantLevel > enchant.getKey().getMaxLevel()) {
enchantLevel = enchant.getKey().getMaxLevel();
item.addEnchantment(enchant.getKey(), enchantLevel);
item.addUnsafeEnchantment(enchant.getKey(), enchantLevel);
}
}

View File

@ -34,6 +34,7 @@ public class SmeltingManager extends SkillManager {
* @param burnTime The initial burn time from the {@link FurnaceBurnEvent}
*/
public int fuelEfficiency(int burnTime) {
if (burnTime <= 0) return 0;
return Math.min(Short.MAX_VALUE, Math.max(1, burnTime * getFuelEfficiencyMultiplier()));
}

View File

@ -961,8 +961,8 @@ public final class CombatUtils {
EntityType type = target.getType();
if (ExperienceConfig.getInstance().hasCombatXP(type)) {
if (type == EntityType.IRON_GOLEM) {
if (!((IronGolem) target).isPlayerCreated()) {
if (type == EntityType.IRON_GOLEM && target instanceof IronGolem ironGolem) {
if (!ironGolem.isPlayerCreated()) {
baseXP = ExperienceConfig.getInstance().getCombatXP(type);
}
} else {