Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ArrayIndexOutOfBoundsException in ModifyVariable case #684

Open
gabizou opened this issue Nov 14, 2024 · 0 comments
Open

ArrayIndexOutOfBoundsException in ModifyVariable case #684

gabizou opened this issue Nov 14, 2024 · 0 comments

Comments

@gabizou
Copy link
Member

gabizou commented Nov 14, 2024

During the update for SpongeVanilla to 24w45a, I'm running across an interesting AIOOB with the following stacktrace:

The case in particular is with a heavily modified method in LivingEntityMixin:

    @ModifyVariable(method = "hurtServer", ordinal = 1,
        at = @At(value = "INVOKE",
            target = "Lnet/minecraft/advancements/critereon/EntityHurtPlayerTrigger;trigger(Lnet/minecraft/server/level/ServerPlayer;Lnet/minecraft/world/damagesource/DamageSource;FFZ)V",
            shift = At.Shift.AFTER
        ),
        slice = @Slice(
            from = @At(value = "FIELD", target = "Lnet/minecraft/advancements/CriteriaTriggers;ENTITY_HURT_PLAYER:Lnet/minecraft/advancements/critereon/EntityHurtPlayerTrigger;"),
            to = @At(value = "FIELD", target = "Lnet/minecraft/stats/Stats;DAMAGE_BLOCKED_BY_SHIELD:Lnet/minecraft/resources/ResourceLocation;")
        ))
    private float attackImpl$modifyBlockedDamage(float damageBlocked) {
        return this.attackImpl$actuallyHurtBlockedDamage;
    }

The following is the bytecode output of the failing mixin:

Bytecode in export debug mode
  // access flags 0x1
  public hurtServer(Lnet/minecraft/server/level/ServerLevel;Lnet/minecraft/world/damagesource/DamageSource;F)Z
   L0
    LINENUMBER 1089 L0
    ALOAD 0
    ALOAD 1
    ALOAD 2
    INVOKEVIRTUAL net/minecraft/world/entity/LivingEntity.isInvulnerableTo (Lnet/minecraft/server/level/ServerLevel;Lnet/minecraft/world/damagesource/DamageSource;)Z
    IFEQ L1
   L2
    LINENUMBER 1090 L2
    ICONST_0
    IRETURN
   L1
    LINENUMBER 1091 L1
   FRAME SAME
    ALOAD 0
    INVOKEVIRTUAL net/minecraft/world/entity/LivingEntity.isDeadOrDying ()Z
    IFEQ L3
   L4
    LINENUMBER 1092 L4
    ICONST_0
    IRETURN
   L3
    LINENUMBER 1093 L3
   FRAME SAME
    ALOAD 2
    GETSTATIC net/minecraft/tags/DamageTypeTags.IS_FIRE : Lnet/minecraft/tags/TagKey;
    INVOKEVIRTUAL net/minecraft/world/damagesource/DamageSource.is (Lnet/minecraft/tags/TagKey;)Z
    IFEQ L5
    ALOAD 0
    GETSTATIC net/minecraft/world/effect/MobEffects.FIRE_RESISTANCE : Lnet/minecraft/core/Holder;
    INVOKEVIRTUAL net/minecraft/world/entity/LivingEntity.hasEffect (Lnet/minecraft/core/Holder;)Z
    IFEQ L5
   L6
    LINENUMBER 1094 L6
    ICONST_0
    IRETURN
   L5
    LINENUMBER 1096 L5
   FRAME SAME
    ALOAD 0
    INVOKEVIRTUAL net/minecraft/world/entity/LivingEntity.isSleeping ()Z
    IFEQ L7
   L8
    LINENUMBER 1097 L8
    ALOAD 0
    INVOKEVIRTUAL net/minecraft/world/entity/LivingEntity.stopSleeping ()V
   L7
    LINENUMBER 1100 L7
   FRAME SAME
    ALOAD 0
    ICONST_0
    PUTFIELD net/minecraft/world/entity/LivingEntity.noActionTime : I
   L9
    LINENUMBER 1101 L9
    FLOAD 3
    FCONST_0
    FCMPG
    IFGE L10
   L11
    LINENUMBER 1102 L11
    FCONST_0
    FSTORE 3
   L10
    LINENUMBER 1105 L10
   FRAME SAME
    FLOAD 3
    FSTORE 4
   L12
    LINENUMBER 1106 L12
    ICONST_0
    ISTORE 5
   L13
    LINENUMBER 1107 L13
    FCONST_0
    FSTORE 6
   L14
    LINENUMBER 1108 L14
    FLOAD 3
    FCONST_0
    FCMPL
    IFLE L15
    ALOAD 0
    ALOAD 2
    INVOKEVIRTUAL net/minecraft/world/entity/LivingEntity.isDamageSourceBlocked (Lnet/minecraft/world/damagesource/DamageSource;)Z
    IFEQ L15
   L16
    LINENUMBER 1109 L16
    ALOAD 0
    FLOAD 3
    INVOKEVIRTUAL net/minecraft/world/entity/LivingEntity.hurtCurrentlyUsedShield (F)V
   L17
    LINENUMBER 1110 L17
    FLOAD 3
    FSTORE 6
   L18
    LINENUMBER 1111 L18
    FCONST_0
    FSTORE 3
   L19
    LINENUMBER 1112 L19
    ALOAD 2
    GETSTATIC net/minecraft/tags/DamageTypeTags.IS_PROJECTILE : Lnet/minecraft/tags/TagKey;
    INVOKEVIRTUAL net/minecraft/world/damagesource/DamageSource.is (Lnet/minecraft/tags/TagKey;)Z
    IFNE L20
   L21
    LINENUMBER 1112 L21
    ALOAD 2
    INVOKEVIRTUAL net/minecraft/world/damagesource/DamageSource.getDirectEntity ()Lnet/minecraft/world/entity/Entity;
    ASTORE 7
   L22
    LINENUMBER 1112 L22
    ALOAD 7
    INSTANCEOF net/minecraft/world/entity/LivingEntity
    IFEQ L20
    ALOAD 7
    CHECKCAST net/minecraft/world/entity/LivingEntity
    ASTORE 8
   L23
    LINENUMBER 1113 L23
    ALOAD 0
    ALOAD 8
    INVOKEVIRTUAL net/minecraft/world/entity/LivingEntity.blockUsingShield (Lnet/minecraft/world/entity/LivingEntity;)V
   L20
    LINENUMBER 1116 L20
   FRAME APPEND [F I F]
    ICONST_1
    ISTORE 5
   L15
    LINENUMBER 1119 L15
   FRAME SAME
    ALOAD 2
    GETSTATIC net/minecraft/tags/DamageTypeTags.IS_FREEZING : Lnet/minecraft/tags/TagKey;
    INVOKEVIRTUAL net/minecraft/world/damagesource/DamageSource.is (Lnet/minecraft/tags/TagKey;)Z
    IFEQ L24
    ALOAD 0
    INVOKEVIRTUAL net/minecraft/world/entity/LivingEntity.getType ()Lnet/minecraft/world/entity/EntityType;
    GETSTATIC net/minecraft/tags/EntityTypeTags.FREEZE_HURTS_EXTRA_TYPES : Lnet/minecraft/tags/TagKey;
    INVOKEVIRTUAL net/minecraft/world/entity/EntityType.is (Lnet/minecraft/tags/TagKey;)Z
    IFEQ L24
   L25
    LINENUMBER 1120 L25
    FLOAD 3
    LDC 5.0
    FMUL
    FSTORE 3
   L24
    LINENUMBER 1123 L24
   FRAME SAME
    ALOAD 2
    GETSTATIC net/minecraft/tags/DamageTypeTags.DAMAGES_HELMET : Lnet/minecraft/tags/TagKey;
    INVOKEVIRTUAL net/minecraft/world/damagesource/DamageSource.is (Lnet/minecraft/tags/TagKey;)Z
    IFEQ L26
    ALOAD 0
    GETSTATIC net/minecraft/world/entity/EquipmentSlot.HEAD : Lnet/minecraft/world/entity/EquipmentSlot;
    INVOKEVIRTUAL net/minecraft/world/entity/LivingEntity.getItemBySlot (Lnet/minecraft/world/entity/EquipmentSlot;)Lnet/minecraft/world/item/ItemStack;
    INVOKEVIRTUAL net/minecraft/world/item/ItemStack.isEmpty ()Z
    IFNE L26
   L27
    LINENUMBER 1124 L27
    ALOAD 0
    ALOAD 2
    FLOAD 3
    INVOKEVIRTUAL net/minecraft/world/entity/LivingEntity.hurtHelmet (Lnet/minecraft/world/damagesource/DamageSource;F)V
   L28
    LINENUMBER 1125 L28
    FLOAD 3
    LDC 0.75
    FMUL
    FSTORE 3
   L26
    LINENUMBER 1128 L26
   FRAME SAME
    ALOAD 0
    GETFIELD net/minecraft/world/entity/LivingEntity.walkAnimation : Lnet/minecraft/world/entity/WalkAnimationState;
    LDC 1.5
    INVOKEVIRTUAL net/minecraft/world/entity/WalkAnimationState.setSpeed (F)V
   L29
    LINENUMBER 1129 L29
    FLOAD 3
    INVOKESTATIC java/lang/Float.isNaN (F)Z
    IFNE L30
    FLOAD 3
    INVOKESTATIC java/lang/Float.isInfinite (F)Z
    IFEQ L31
   L30
    LINENUMBER 1130 L30
   FRAME SAME
    LDC 3.4028235E38
    FSTORE 3
   L31
    LINENUMBER 1133 L31
   FRAME SAME
    ICONST_1
    ISTORE 7
   L32
    LINENUMBER 1134 L32
    ALOAD 0
    GETFIELD net/minecraft/world/entity/LivingEntity.invulnerableTime : I
    I2F
    LDC 10.0
    FCMPL
    IFLE L33
    ALOAD 2
    GETSTATIC net/minecraft/tags/DamageTypeTags.BYPASSES_COOLDOWN : Lnet/minecraft/tags/TagKey;
    INVOKEVIRTUAL net/minecraft/world/damagesource/DamageSource.is (Lnet/minecraft/tags/TagKey;)Z
    IFNE L33
   L34
    LINENUMBER 1135 L34
    FLOAD 3
    ALOAD 0
    GETFIELD net/minecraft/world/entity/LivingEntity.lastHurt : F
    FCMPG
    IFGT L35
   L36
    LINENUMBER 1136 L36
    ICONST_0
    IRETURN
   L35
    LINENUMBER 1139 L35
   FRAME APPEND [I]
    ALOAD 0
    ALOAD 1
    ALOAD 2
    FLOAD 3
    ALOAD 0
    GETFIELD net/minecraft/world/entity/LivingEntity.lastHurt : F
    FSUB
    INVOKEVIRTUAL net/minecraft/world/entity/LivingEntity.actuallyHurt (Lnet/minecraft/server/level/ServerLevel;Lnet/minecraft/world/damagesource/DamageSource;F)V
   L37
    LINENUMBER 1140 L37
    ALOAD 0
    FLOAD 3
    PUTFIELD net/minecraft/world/entity/LivingEntity.lastHurt : F
   L38
    LINENUMBER 1141 L38
    ICONST_0
    ISTORE 7
    GOTO L39
   L33
    LINENUMBER 1143 L33
   FRAME SAME
    ALOAD 0
    FLOAD 3
    PUTFIELD net/minecraft/world/entity/LivingEntity.lastHurt : F
   L40
    LINENUMBER 1144 L40
    ALOAD 0
    BIPUSH 20
    PUTFIELD net/minecraft/world/entity/LivingEntity.invulnerableTime : I
   L41
    LINENUMBER 1145 L41
    ALOAD 0
    ALOAD 1
    ALOAD 2
    FLOAD 3
    INVOKEVIRTUAL net/minecraft/world/entity/LivingEntity.actuallyHurt (Lnet/minecraft/server/level/ServerLevel;Lnet/minecraft/world/damagesource/DamageSource;F)V
   L42
    LINENUMBER 1146 L42
    ALOAD 0
    BIPUSH 10
    PUTFIELD net/minecraft/world/entity/LivingEntity.hurtDuration : I
   L43
    LINENUMBER 1147 L43
    ALOAD 0
    ALOAD 0
    GETFIELD net/minecraft/world/entity/LivingEntity.hurtDuration : I
    PUTFIELD net/minecraft/world/entity/LivingEntity.hurtTime : I
   L39
    LINENUMBER 1150 L39
   FRAME SAME
    ALOAD 0
    ALOAD 2
    INVOKEVIRTUAL net/minecraft/world/entity/LivingEntity.resolveMobResponsibleForDamage (Lnet/minecraft/world/damagesource/DamageSource;)V
   L44
    LINENUMBER 1151 L44
    ALOAD 0
    ALOAD 2
    INVOKEVIRTUAL net/minecraft/world/entity/LivingEntity.resolvePlayerResponsibleForDamage (Lnet/minecraft/world/damagesource/DamageSource;)Lnet/minecraft/world/entity/player/Player;
    POP
   L45
    LINENUMBER 1152 L45
    ILOAD 7
    IFEQ L46
   L47
    LINENUMBER 1153 L47
    ILOAD 5
    IFEQ L48
   L49
    LINENUMBER 1154 L49
    ALOAD 1
    ALOAD 0
    BIPUSH 29
    INVOKEVIRTUAL net/minecraft/server/level/ServerLevel.broadcastEntityEvent (Lnet/minecraft/world/entity/Entity;B)V
    GOTO L50
   L48
    LINENUMBER 1156 L48
   FRAME SAME
    ALOAD 1
    ALOAD 0
    ALOAD 2
    INVOKEVIRTUAL net/minecraft/server/level/ServerLevel.broadcastDamageEvent (Lnet/minecraft/world/entity/Entity;Lnet/minecraft/world/damagesource/DamageSource;)V
   L50
    LINENUMBER 1159 L50
   FRAME SAME
    ALOAD 2
    GETSTATIC net/minecraft/tags/DamageTypeTags.NO_IMPACT : Lnet/minecraft/tags/TagKey;
    INVOKEVIRTUAL net/minecraft/world/damagesource/DamageSource.is (Lnet/minecraft/tags/TagKey;)Z
    IFNE L51
    ILOAD 5
    IFEQ L52
    FLOAD 3
    FCONST_0
    FCMPL
    IFLE L51
   L52
    LINENUMBER 1160 L52
   FRAME SAME
    ALOAD 0
    INVOKEVIRTUAL net/minecraft/world/entity/LivingEntity.markHurt ()V
   L51
    LINENUMBER 1163 L51
   FRAME SAME
    ALOAD 2
    GETSTATIC net/minecraft/tags/DamageTypeTags.NO_KNOCKBACK : Lnet/minecraft/tags/TagKey;
    INVOKEVIRTUAL net/minecraft/world/damagesource/DamageSource.is (Lnet/minecraft/tags/TagKey;)Z
    IFNE L46
   L53
    LINENUMBER 1164 L53
    DCONST_0
    DSTORE 8
   L54
    LINENUMBER 1165 L54
    DCONST_0
    DSTORE 10
   L55
    LINENUMBER 1166 L55
    ALOAD 2
    INVOKEVIRTUAL net/minecraft/world/damagesource/DamageSource.getDirectEntity ()Lnet/minecraft/world/entity/Entity;
    ASTORE 13
    ALOAD 13
    INSTANCEOF net/minecraft/world/entity/projectile/Projectile
    IFEQ L56
    ALOAD 13
    CHECKCAST net/minecraft/world/entity/projectile/Projectile
    ASTORE 12
   L57
    LINENUMBER 1167 L57
    ALOAD 12
    ALOAD 0
    ALOAD 2
    INVOKEVIRTUAL net/minecraft/world/entity/projectile/Projectile.calculateHorizontalHurtKnockbackDirection (Lnet/minecraft/world/entity/LivingEntity;Lnet/minecraft/world/damagesource/DamageSource;)Lit/unimi/dsi/fastutil/doubles/DoubleDoubleImmutablePair;
    ASTORE 13
   L58
    LINENUMBER 1168 L58
    ALOAD 13
    INVOKEVIRTUAL it/unimi/dsi/fastutil/doubles/DoubleDoubleImmutablePair.leftDouble ()D
    DNEG
    DSTORE 8
   L59
    LINENUMBER 1169 L59
    ALOAD 13
    INVOKEVIRTUAL it/unimi/dsi/fastutil/doubles/DoubleDoubleImmutablePair.rightDouble ()D
    DNEG
    DSTORE 10
   L60
    LINENUMBER 1170 L60
    GOTO L61
   L56
   FRAME FULL [net/minecraft/world/entity/LivingEntity net/minecraft/server/level/ServerLevel net/minecraft/world/damagesource/DamageSource F F I F I D D T net/minecraft/world/entity/Entity] []
    ALOAD 2
    INVOKEVIRTUAL net/minecraft/world/damagesource/DamageSource.getSourcePosition ()Lnet/minecraft/world/phys/Vec3;
    IFNULL L61
   L62
    LINENUMBER 1171 L62
    ALOAD 2
    INVOKEVIRTUAL net/minecraft/world/damagesource/DamageSource.getSourcePosition ()Lnet/minecraft/world/phys/Vec3;
    INVOKEVIRTUAL net/minecraft/world/phys/Vec3.x ()D
    ALOAD 0
    INVOKEVIRTUAL net/minecraft/world/entity/LivingEntity.getX ()D
    DSUB
    DSTORE 8
   L63
    LINENUMBER 1172 L63
    ALOAD 2
    INVOKEVIRTUAL net/minecraft/world/damagesource/DamageSource.getSourcePosition ()Lnet/minecraft/world/phys/Vec3;
    INVOKEVIRTUAL net/minecraft/world/phys/Vec3.z ()D
    ALOAD 0
    INVOKEVIRTUAL net/minecraft/world/entity/LivingEntity.getZ ()D
    DSUB
    DSTORE 10
   L61
    LINENUMBER 1175 L61
   FRAME FULL [net/minecraft/world/entity/LivingEntity net/minecraft/server/level/ServerLevel net/minecraft/world/damagesource/DamageSource F F I F I D D T java/lang/Object] []
    ALOAD 0
    LDC 0.4000000059604645
    DLOAD 8
    DLOAD 10
    INVOKEVIRTUAL net/minecraft/world/entity/LivingEntity.knockback (DDD)V
   L64
    LINENUMBER 1176 L64
    ILOAD 5
    IFNE L46
   L65
    LINENUMBER 1177 L65
    ALOAD 0
    DLOAD 8
    DLOAD 10
    INVOKEVIRTUAL net/minecraft/world/entity/LivingEntity.indicateDamage (DD)V
   L46
    LINENUMBER 1182 L46
   FRAME FULL [net/minecraft/world/entity/LivingEntity net/minecraft/server/level/ServerLevel net/minecraft/world/damagesource/DamageSource F F I F I] []
    ALOAD 0
    INVOKEVIRTUAL net/minecraft/world/entity/LivingEntity.isDeadOrDying ()Z
    IFEQ L66
   L67
    LINENUMBER 1183 L67
    ALOAD 0
    ALOAD 2
    INVOKEVIRTUAL net/minecraft/world/entity/LivingEntity.checkTotemDeathProtection (Lnet/minecraft/world/damagesource/DamageSource;)Z
    IFNE L68
   L69
    LINENUMBER 1184 L69
    ILOAD 7
    IFEQ L70
   L71
    LINENUMBER 1185 L71
    ALOAD 0
    ALOAD 0
    INVOKEVIRTUAL net/minecraft/world/entity/LivingEntity.getDeathSound ()Lnet/minecraft/sounds/SoundEvent;
    INVOKEVIRTUAL net/minecraft/world/entity/LivingEntity.makeSound (Lnet/minecraft/sounds/SoundEvent;)V
   L70
    LINENUMBER 1188 L70
   FRAME SAME
    ALOAD 0
    ALOAD 2
    INVOKEVIRTUAL net/minecraft/world/entity/LivingEntity.die (Lnet/minecraft/world/damagesource/DamageSource;)V
    GOTO L68
   L66
    LINENUMBER 1190 L66
   FRAME SAME
    ILOAD 7
    IFEQ L68
   L72
    LINENUMBER 1191 L72
    ALOAD 0
    ALOAD 2
    INVOKEVIRTUAL net/minecraft/world/entity/LivingEntity.playHurtSound (Lnet/minecraft/world/damagesource/DamageSource;)V
   L68
    LINENUMBER 1194 L68
   FRAME SAME
    ILOAD 5
    IFEQ L73
    FLOAD 3
    FCONST_0
    FCMPL
    IFLE L74
   L73
   FRAME SAME
    ICONST_1
    GOTO L75
   L74
   FRAME SAME
    ICONST_0
   L75
   FRAME SAME1 I
    ISTORE 8
   L76
    LINENUMBER 1195 L76
    ILOAD 8
    IFEQ L77
   L78
    LINENUMBER 1196 L78
    ALOAD 0
    ALOAD 2
    PUTFIELD net/minecraft/world/entity/LivingEntity.lastDamageSource : Lnet/minecraft/world/damagesource/DamageSource;
   L79
    LINENUMBER 1197 L79
    ALOAD 0
    ALOAD 0
    INVOKEVIRTUAL net/minecraft/world/entity/LivingEntity.level ()Lnet/minecraft/world/level/Level;
    INVOKEVIRTUAL net/minecraft/world/level/Level.getGameTime ()J
    PUTFIELD net/minecraft/world/entity/LivingEntity.lastDamageStamp : J
   L80
    LINENUMBER 1199 L80
    ALOAD 0
    INVOKEVIRTUAL net/minecraft/world/entity/LivingEntity.getActiveEffects ()Ljava/util/Collection;
    INVOKEINTERFACE java/util/Collection.iterator ()Ljava/util/Iterator; (itf)
    ASTORE 9
   L81
   FRAME APPEND [I java/util/Iterator]
    ALOAD 9
    INVOKEINTERFACE java/util/Iterator.hasNext ()Z (itf)
    IFEQ L77
    ALOAD 9
    INVOKEINTERFACE java/util/Iterator.next ()Ljava/lang/Object; (itf)
    CHECKCAST net/minecraft/world/effect/MobEffectInstance
    ASTORE 10
   L82
    LINENUMBER 1200 L82
    ALOAD 10
    ALOAD 1
    ALOAD 0
    ALOAD 2
    FLOAD 3
    INVOKEVIRTUAL net/minecraft/world/effect/MobEffectInstance.onMobHurt (Lnet/minecraft/server/level/ServerLevel;Lnet/minecraft/world/entity/LivingEntity;Lnet/minecraft/world/damagesource/DamageSource;F)V
   L83
    LINENUMBER 1204 L83
    GOTO L81
   L77
    LINENUMBER 1204 L77
   FRAME CHOP 1
    ALOAD 0
    ASTORE 10
    ALOAD 10
    INSTANCEOF net/minecraft/server/level/ServerPlayer
    IFEQ L84
    ALOAD 10
    CHECKCAST net/minecraft/server/level/ServerPlayer
    ASTORE 9
   L85
    LINENUMBER 1205 L85
    GETSTATIC net/minecraft/advancements/CriteriaTriggers.ENTITY_HURT_PLAYER : Lnet/minecraft/advancements/critereon/EntityHurtPlayerTrigger;
    ALOAD 9
    ALOAD 2
    FLOAD 4
    FLOAD 3
    ILOAD 5
    INVOKEVIRTUAL net/minecraft/advancements/critereon/EntityHurtPlayerTrigger.trigger (Lnet/minecraft/server/level/ServerPlayer;Lnet/minecraft/world/damagesource/DamageSource;FFZ)V
   L86
    LINENUMBER 1206 L86
    FLOAD 6
    FCONST_0
    FCMPL
    IFLE L84
    FLOAD 6
    LDC 3.4028235E37
    FCMPG
    IFGE L84
   L87
    LINENUMBER 1207 L87
    ALOAD 9
    GETSTATIC net/minecraft/stats/Stats.DAMAGE_BLOCKED_BY_SHIELD : Lnet/minecraft/resources/ResourceLocation;
    FLOAD 6
    LDC 10.0
    FMUL
    INVOKESTATIC java/lang/Math.round (F)I
    INVOKEVIRTUAL net/minecraft/server/level/ServerPlayer.awardStat (Lnet/minecraft/resources/ResourceLocation;I)V
   L84
    LINENUMBER 1211 L84
   FRAME APPEND [T net/minecraft/world/entity/LivingEntity]
    ALOAD 2
    INVOKEVIRTUAL net/minecraft/world/damagesource/DamageSource.getEntity ()Lnet/minecraft/world/entity/Entity;
    ASTORE 10
    ALOAD 10
    INSTANCEOF net/minecraft/server/level/ServerPlayer
    IFEQ L88
    ALOAD 10
    CHECKCAST net/minecraft/server/level/ServerPlayer
    ASTORE 9
   L89
    LINENUMBER 1212 L89
    GETSTATIC net/minecraft/advancements/CriteriaTriggers.PLAYER_HURT_ENTITY : Lnet/minecraft/advancements/critereon/PlayerHurtEntityTrigger;
    ALOAD 9
    ALOAD 0
    ALOAD 2
    FLOAD 4
    FLOAD 3
    ILOAD 5
    INVOKEVIRTUAL net/minecraft/advancements/critereon/PlayerHurtEntityTrigger.trigger (Lnet/minecraft/server/level/ServerPlayer;Lnet/minecraft/world/entity/Entity;Lnet/minecraft/world/damagesource/DamageSource;FFZ)V
   L88
    LINENUMBER 1215 L88
   FRAME FULL [net/minecraft/world/entity/LivingEntity net/minecraft/server/level/ServerLevel net/minecraft/world/damagesource/DamageSource F F I F I I T net/minecraft/world/entity/Entity] []
    ILOAD 8
    IRETURN
   L90
    LOCALVARIABLE this Lnet/minecraft/world/entity/LivingEntity; L0 L90 0
    LOCALVARIABLE $$0 Lnet/minecraft/server/level/ServerLevel; L0 L90 1
    LOCALVARIABLE $$1 Lnet/minecraft/world/damagesource/DamageSource; L0 L90 2
    LOCALVARIABLE $$2 F L0 L90 3
    LOCALVARIABLE $$3 F L12 L90 4
    LOCALVARIABLE $$4 Z L13 L90 5
    LOCALVARIABLE $$5 F L14 L90 6
    LOCALVARIABLE $$6 Lnet/minecraft/world/entity/Entity; L22 L20 7
    LOCALVARIABLE $$7 Lnet/minecraft/world/entity/LivingEntity; L23 L20 8
    LOCALVARIABLE $$8 Z L32 L90 7
    LOCALVARIABLE $$9 D L54 L46 8
    LOCALVARIABLE $$10 D L55 L46 10
    LOCALVARIABLE $$11 Lnet/minecraft/world/entity/projectile/Projectile; L57 L56 12
    LOCALVARIABLE $$12 Lit/unimi/dsi/fastutil/doubles/DoubleDoubleImmutablePair; L58 L60 13
    LOCALVARIABLE $$13 Z L76 L90 8
    LOCALVARIABLE $$14 Lnet/minecraft/world/effect/MobEffectInstance; L82 L83 10
    LOCALVARIABLE $$15 Lnet/minecraft/server/level/ServerPlayer; L85 L84 9
    LOCALVARIABLE $$16 Lnet/minecraft/server/level/ServerPlayer; L89 L88 9
    MAXSTACK = 7
    MAXLOCALS = 14

Provided Stacktrace

Stacktrace

Exception in thread "main" java.lang.reflect.InvocationTargetException
	at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:118)
	at java.base/java.lang.reflect.Method.invoke(Method.java:580)
	at net.minecraftforge.bootstrap.Bootstrap.start(Bootstrap.java:101)
	at net.minecraftforge.bootstrap.ForgeBootstrap.main(ForgeBootstrap.java:19)
Caused by: java.lang.reflect.InvocationTargetException
	at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:118)
	at java.base/java.lang.reflect.Method.invoke(Method.java:580)
	at CLEANED-BOOTSTRAP//net.minecraftforge.bootstrap.Bootstrap.bootstrapMain(Bootstrap.java:133)
	at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
	... 3 more
Caused by: java.lang.reflect.InvocationTargetException
	at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:118)
	at java.base/java.lang.reflect.Method.invoke(Method.java:580)
	at SECURE-BOOTSTRAP/applaunch/org.spongepowered.vanilla.applaunch.handler.dev.ClientDevLaunchHandler.launchSponge(ClientDevLaunchHandler.java:43)
	at SECURE-BOOTSTRAP/applaunch/org.spongepowered.vanilla.applaunch.handler.AbstractVanillaLaunchHandler.lambda$launchService$1(AbstractVanillaLaunchHandler.java:52)
	at SECURE-BOOTSTRAP/[email protected]/cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:77)
	at SECURE-BOOTSTRAP/[email protected]/cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:97)
	at SECURE-BOOTSTRAP/[email protected]/cpw.mods.modlauncher.Launcher.run(Launcher.java:116)
	at SECURE-BOOTSTRAP/[email protected]/cpw.mods.modlauncher.Launcher.main(Launcher.java:75)
	at SECURE-BOOTSTRAP/[email protected]/cpw.mods.modlauncher.BootstrapEntry.main(BootstrapEntry.java:17)
	at [email protected]/net.minecraftforge.bootstrap.Bootstrap.moduleMain(Bootstrap.java:188)
	at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
	... 6 more
Caused by: org.spongepowered.asm.mixin.transformer.throwables.MixinTransformerError: An unexpected critical error was encountered
	at SECURE-BOOTSTRAP/org.spongepowered.mixin/org.spongepowered.asm.mixin.transformer.MixinProcessor.applyMixins(MixinProcessor.java:392)
	at SECURE-BOOTSTRAP/org.spongepowered.mixin/org.spongepowered.asm.mixin.transformer.MixinTransformer.transformClass(MixinTransformer.java:250)
	at SECURE-BOOTSTRAP/org.spongepowered.mixin/org.spongepowered.asm.service.modlauncher.MixinTransformationHandler.processClass(MixinTransformationHandler.java:131)
	at SECURE-BOOTSTRAP/org.spongepowered.mixin/org.spongepowered.asm.launch.MixinLaunchPluginLegacy.processClass(MixinLaunchPluginLegacy.java:131)
	at SECURE-BOOTSTRAP/[email protected]/cpw.mods.modlauncher.serviceapi.ILaunchPluginService.processClassWithFlags(ILaunchPluginService.java:142)
	at SECURE-BOOTSTRAP/[email protected]/cpw.mods.modlauncher.LaunchPluginHandler.offerClassNodeToPlugins(LaunchPluginHandler.java:91)
	at SECURE-BOOTSTRAP/[email protected]/cpw.mods.modlauncher.ClassTransformer.transform(ClassTransformer.java:107)
	at SECURE-BOOTSTRAP/[email protected]/cpw.mods.modlauncher.TransformingClassLoader.maybeTransformClassBytes(TransformingClassLoader.java:44)
	at cpw.mods.securejarhandler/net.minecraftforge.securemodules.SecureModuleClassLoader.readerToClass(SecureModuleClassLoader.java:480)
	at cpw.mods.securejarhandler/net.minecraftforge.securemodules.SecureModuleClassLoader.findClass(SecureModuleClassLoader.java:406)
	at cpw.mods.securejarhandler/net.minecraftforge.securemodules.SecureModuleClassLoader.loadClass(SecureModuleClassLoader.java:422)
	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:526)
	at java.base/java.lang.ClassLoader.defineClass1(Native Method)
	at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1027)
	at java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:150)
	at cpw.mods.securejarhandler/net.minecraftforge.securemodules.SecureModuleClassLoader.readerToClass(SecureModuleClassLoader.java:491)
	at cpw.mods.securejarhandler/net.minecraftforge.securemodules.SecureModuleClassLoader.findClass(SecureModuleClassLoader.java:406)
	at cpw.mods.securejarhandler/net.minecraftforge.securemodules.SecureModuleClassLoader.loadClass(SecureModuleClassLoader.java:422)
	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:526)
	at java.base/java.lang.ClassLoader.defineClass1(Native Method)
	at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1027)
	at java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:150)
	at cpw.mods.securejarhandler/net.minecraftforge.securemodules.SecureModuleClassLoader.readerToClass(SecureModuleClassLoader.java:491)
	at cpw.mods.securejarhandler/net.minecraftforge.securemodules.SecureModuleClassLoader.findClass(SecureModuleClassLoader.java:406)
	at cpw.mods.securejarhandler/net.minecraftforge.securemodules.SecureModuleClassLoader.loadClass(SecureModuleClassLoader.java:422)
	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:526)
	at java.base/java.lang.ClassLoader.defineClass1(Native Method)
	at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1027)
	at java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:150)
	at cpw.mods.securejarhandler/net.minecraftforge.securemodules.SecureModuleClassLoader.readerToClass(SecureModuleClassLoader.java:491)
	at cpw.mods.securejarhandler/net.minecraftforge.securemodules.SecureModuleClassLoader.findClass(SecureModuleClassLoader.java:406)
	at cpw.mods.securejarhandler/net.minecraftforge.securemodules.SecureModuleClassLoader.loadClass(SecureModuleClassLoader.java:422)
	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:526)
	at java.base/java.lang.ClassLoader.defineClass1(Native Method)
	at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1027)
	at java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:150)
	at cpw.mods.securejarhandler/net.minecraftforge.securemodules.SecureModuleClassLoader.readerToClass(SecureModuleClassLoader.java:491)
	at cpw.mods.securejarhandler/net.minecraftforge.securemodules.SecureModuleClassLoader.findClass(SecureModuleClassLoader.java:406)
	at cpw.mods.securejarhandler/net.minecraftforge.securemodules.SecureModuleClassLoader.loadClass(SecureModuleClassLoader.java:422)
	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:526)
	at java.base/java.lang.ClassLoader.defineClass1(Native Method)
	at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1027)
	at java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:150)
	at cpw.mods.securejarhandler/net.minecraftforge.securemodules.SecureModuleClassLoader.readerToClass(SecureModuleClassLoader.java:491)
	at cpw.mods.securejarhandler/net.minecraftforge.securemodules.SecureModuleClassLoader.findClass(SecureModuleClassLoader.java:406)
	at cpw.mods.securejarhandler/net.minecraftforge.securemodules.SecureModuleClassLoader.loadClass(SecureModuleClassLoader.java:422)
	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:526)
	at TRANSFORMER/[email protected]/org.spongepowered.common.registry.SpongeBuilderProvider.registerDefaultBuilders(SpongeBuilderProvider.java:303)
	at TRANSFORMER/[email protected]/org.spongepowered.common.SpongeLifecycle.establishBuilders(SpongeLifecycle.java:99)
	at TRANSFORMER/[email protected]/org.spongepowered.vanilla.launch.VanillaBootstrap.perform(VanillaBootstrap.java:52)
	at TRANSFORMER/[email protected]/org.spongepowered.vanilla.launch.ClientLaunch.performBootstrap(ClientLaunch.java:51)
	at TRANSFORMER/[email protected]/org.spongepowered.vanilla.launch.VanillaLaunch.launchPlatform(VanillaLaunch.java:99)
	at TRANSFORMER/[email protected]/org.spongepowered.vanilla.launch.ClientLaunch.launch(ClientLaunch.java:41)
	at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
	... 16 more
Caused by: org.spongepowered.asm.mixin.throwables.MixinApplyError: Mixin [mixins.sponge.core.json:world.entity.LivingEntityMixin_Attack_Impl] from phase [DEFAULT] in config [mixins.sponge.core.json] FAILED during APPLY
	at SECURE-BOOTSTRAP/org.spongepowered.mixin/org.spongepowered.asm.mixin.transformer.MixinProcessor.handleMixinError(MixinProcessor.java:636)
	at SECURE-BOOTSTRAP/org.spongepowered.mixin/org.spongepowered.asm.mixin.transformer.MixinProcessor.handleMixinApplyError(MixinProcessor.java:588)
	at SECURE-BOOTSTRAP/org.spongepowered.mixin/org.spongepowered.asm.mixin.transformer.MixinProcessor.applyMixins(MixinProcessor.java:379)
	... 69 more
Caused by: org.spongepowered.asm.mixin.transformer.throwables.InvalidMixinException: Unexpecteded ArrayIndexOutOfBoundsException whilst transforming the mixin class: [INJECT_PREINJECT Applicator Phase -> mixins.sponge.core.json:world.entity.LivingEntityMixin_Attack_Impl -> Apply Injections -> PreInject -> mixins.sponge.core.json:world.entity.LivingEntityMixin_Attack_Impl->@ModifyVariable::attackImpl$modifyBlockedDamage(F)F]
	at SECURE-BOOTSTRAP/org.spongepowered.mixin/org.spongepowered.asm.mixin.transformer.MixinTargetContext.applyPreInjections(MixinTargetContext.java:1432)
	at SECURE-BOOTSTRAP/org.spongepowered.mixin/org.spongepowered.asm.mixin.transformer.MixinApplicatorStandard.applyPreInjections(MixinApplicatorStandard.java:739)
	at SECURE-BOOTSTRAP/org.spongepowered.mixin/org.spongepowered.asm.mixin.transformer.MixinApplicatorStandard.applyMixin(MixinApplicatorStandard.java:323)
	at SECURE-BOOTSTRAP/org.spongepowered.mixin/org.spongepowered.asm.mixin.transformer.MixinApplicatorStandard.apply(MixinApplicatorStandard.java:244)
	at SECURE-BOOTSTRAP/org.spongepowered.mixin/org.spongepowered.asm.mixin.transformer.TargetClassContext.apply(TargetClassContext.java:398)
	at SECURE-BOOTSTRAP/org.spongepowered.mixin/org.spongepowered.asm.mixin.transformer.TargetClassContext.applyMixins(TargetClassContext.java:380)
	at SECURE-BOOTSTRAP/org.spongepowered.mixin/org.spongepowered.asm.mixin.transformer.MixinProcessor.applyMixins(MixinProcessor.java:363)
	... 69 more
Caused by: java.lang.ArrayIndexOutOfBoundsException: Index 14 out of bounds for length 14
	at SECURE-BOOTSTRAP/org.spongepowered.mixin/org.spongepowered.asm.util.Locals.getLocalsAt(Locals.java:516)
	at SECURE-BOOTSTRAP/org.spongepowered.mixin/org.spongepowered.asm.util.Locals.getLocalsAt(Locals.java:335)
	at SECURE-BOOTSTRAP/org.spongepowered.mixin/org.spongepowered.asm.mixin.injection.modify.LocalVariableDiscriminator$Context.initLocals(LocalVariableDiscriminator.java:154)
	at SECURE-BOOTSTRAP/org.spongepowered.mixin/org.spongepowered.asm.mixin.injection.modify.LocalVariableDiscriminator$Context.<init>(LocalVariableDiscriminator.java:148)
	at SECURE-BOOTSTRAP/org.spongepowered.mixin/org.spongepowered.asm.mixin.injection.modify.ModifyVariableInjector$Context.<init>(ModifyVariableInjector.java:75)
	at SECURE-BOOTSTRAP/org.spongepowered.mixin/org.spongepowered.asm.mixin.injection.modify.ModifyVariableInjector.preInject(ModifyVariableInjector.java:180)
	at SECURE-BOOTSTRAP/org.spongepowered.mixin/org.spongepowered.asm.mixin.injection.code.Injector.preInject(Injector.java:266)
	at SECURE-BOOTSTRAP/org.spongepowered.mixin/org.spongepowered.asm.mixin.injection.struct.InjectionInfo.preInject(InjectionInfo.java:499)
	at SECURE-BOOTSTRAP/org.spongepowered.mixin/org.spongepowered.asm.mixin.transformer.MixinTargetContext.applyPreInjections(MixinTargetContext.java:1425)
	... 75 more
	```

</details>

The interesting thing about this is that this mixin works _fine_ on [1.21.3 ](https://github.com/SpongePowered/Sponge/blob/64bec579a52f098fda968e1c7356a5ed446b6c28/src/mixins/java/org/spongepowered/common/mixin/core/world/entity/LivingEntityMixin_Attack_Impl.java#L215-L225), but the mixin otherwise fails in 24w45a.

I know that this is a snapshot in development, but I'd expect this kind of bug be somewhat finicky to find in the first place.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant