From 79079e200a932a7b34aa9dceb360bcf4468aeedc Mon Sep 17 00:00:00 2001 From: MagicBot Date: Mon, 22 Apr 2024 12:48:03 -0400 Subject: [PATCH] Bitvectors use int not long for mb --- src/engine/mbEnums.java | 4 ++-- src/engine/objects/ItemTemplate.java | 4 ++-- src/engine/objects/Mob.java | 4 ++-- src/engine/objects/MobBase.java | 6 +++--- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/engine/mbEnums.java b/src/engine/mbEnums.java index 720ede75..98f5b8dc 100644 --- a/src/engine/mbEnums.java +++ b/src/engine/mbEnums.java @@ -44,7 +44,7 @@ public class mbEnums { return bitvector; } - public static > EnumSet fromLong(long bitVector, Class enumClass) { + public static > EnumSet fromInt(int bitVector, Class enumClass) { // Bitvector -> EnumSet without the EnumBitvector dependency @@ -56,7 +56,7 @@ public class mbEnums { return enumSet; for (E enumValue : enumClass.getEnumConstants()) { - if ((bitVector & (1L << enumValue.ordinal())) != 0) { + if ((bitVector & (1 << enumValue.ordinal())) != 0) { enumSet.add(enumValue); } } diff --git a/src/engine/objects/ItemTemplate.java b/src/engine/objects/ItemTemplate.java index 3df9b590..b6a6392b 100644 --- a/src/engine/objects/ItemTemplate.java +++ b/src/engine/objects/ItemTemplate.java @@ -502,11 +502,11 @@ public class ItemTemplate { int group_tactics_bitvector = jsonObject.getInt("rune_group_tactics"); - rune_group_tactics.addAll(mbEnums.fromLong(group_tactics_bitvector, mbEnums.MobBehaviourType.class)); + rune_group_tactics.addAll(mbEnums.fromInt(group_tactics_bitvector, mbEnums.MobBehaviourType.class)); int group_role_bitvector = jsonObject.getInt("rune_group_role_set"); - rune_group_role_set.addAll(mbEnums.fromLong(group_role_bitvector, mbEnums.MobBehaviourType.class)); + rune_group_role_set.addAll(mbEnums.fromInt(group_role_bitvector, mbEnums.MobBehaviourType.class)); JSONArray enemy_types_json = jsonObject.getJSONArray("rune_enemy_monster_types"); diff --git a/src/engine/objects/Mob.java b/src/engine/objects/Mob.java index 3c68ddc9..025a57b1 100644 --- a/src/engine/objects/Mob.java +++ b/src/engine/objects/Mob.java @@ -143,8 +143,8 @@ public class Mob extends AbstractIntelligenceAgent implements Delayed { this.runeSet = rs.getInt("runeSet"); this.bootySet = rs.getInt("bootySet"); - this.notEnemy = mbEnums.fromLong(rs.getLong("notEnemy"), mbEnums.MonsterType.class); - this.enemy = mbEnums.fromLong(rs.getLong("enemy"), mbEnums.MonsterType.class); + this.notEnemy = mbEnums.fromInt(rs.getInt("notEnemy"), mbEnums.MonsterType.class); + this.enemy = mbEnums.fromInt(rs.getInt("enemy"), mbEnums.MonsterType.class); this.firstName = rs.getString("mob_name"); if (rs.getString("fsm").length() > 1) diff --git a/src/engine/objects/MobBase.java b/src/engine/objects/MobBase.java index ee54309b..c7c3669c 100644 --- a/src/engine/objects/MobBase.java +++ b/src/engine/objects/MobBase.java @@ -77,9 +77,9 @@ public class MobBase extends AbstractGameObject { this.fsm = mbEnums.MobBehaviourType.valueOf(rs.getString("fsm")); - this.flags = mbEnums.fromLong(rs.getLong("flags"), mbEnums.MobFlagType.class); - this.notEnemy = mbEnums.fromLong(rs.getLong("notEnemy"), mbEnums.MonsterType.class); - this.enemy = mbEnums.fromLong(rs.getLong("enemy"), mbEnums.MonsterType.class); + this.flags = mbEnums.fromInt(rs.getInt("flags"), mbEnums.MobFlagType.class); + this.notEnemy = mbEnums.fromInt(rs.getInt("notEnemy"), mbEnums.MonsterType.class); + this.enemy = mbEnums.fromInt(rs.getInt("enemy"), mbEnums.MonsterType.class); this.seeInvis = rs.getInt("seeInvis"); this.scale = rs.getFloat("scale");