You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I don't know if this is maybe my fault for trying to be smart, but I'me trying to write a mixin that injects the same injection point into methods on two classes (code below), but no matter what I try I can't seem to get it to work outside of my IDE.
I've tried replacing target methods with equivalent @Desc annotations, which worked in dev, but causes a crash when trying to run it on a production version of minecraft (I assume because the names don't go through obfuscation ;-;)
Going back to string descriptors, I've tried both with or without the owner class (i.e. processBlockBreakingAction(Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/network/packet/c2s/play/PlayerActionC2SPacket$Action;Lnet/minecraft/util/math/Direction;II)V) and without parameters (i.e. processBlockBreakingAction ) and it always seems to fail to build with the error Multi-target reference conflict for @Redirect target.
For now I'm going to just copy the handler into two separate mixin classes, however it would be nice if this kind of thing could be supported better in the future.
@Mixin(value = {
ServerPlayerInteractionManager.class,
ServerPlayNetworkHandler.class
})
abstract class MixinReachDistanceFix {
@Redirect(
method = {
"net/minecraft/server/network/ServerPlayerInteractionManager.processBlockBreakingAction(Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/network/packet/c2s/play/PlayerActionC2SPacket$Action;Lnet/minecraft/util/math/Direction;II)V",
"net/minecraft/server/network/ServerPlayNetworkHandler.onPlayerInteractBlock(Lnet/minecraft/network/packet/c2s/play/PlayerInteractBlockC2SPacket;)V",
"net/minecraft/server/network/ServerPlayNetworkHandler.onPlayerInteractEntity(Lnet/minecraft/network/packet/c2s/play/PlayerInteractEntityC2SPacket;)V"
},
at = @At(
value = "FIELD",
target = "net/minecraft/server/network/ServerPlayNetworkHandler.MAX_BREAK_SQUARED_DISTANCE:D",
opcode = Opcodes.GETSTATIC
),
require = 0
)
private double bgetMaxBreakSquaredDistance() {
Object o = this;
ServerPlayerEntity player = o instanceof ServerPlayNetworkHandler s ? s.getPlayer() : ((MixinServerPlayerInteractionManager)o).getPlayer();
double reach = 6 + Pony.of(player).getExtendedReach();
return reach * reach;
}
}
The text was updated successfully, but these errors were encountered:
I don't know if this is maybe my fault for trying to be smart, but I'me trying to write a mixin that injects the same injection point into methods on two classes (code below), but no matter what I try I can't seem to get it to work outside of my IDE.
I've tried replacing target methods with equivalent
@Desc
annotations, which worked in dev, but causes a crash when trying to run it on a production version of minecraft (I assume because the names don't go through obfuscation ;-;)Going back to string descriptors, I've tried both with or without the owner class (i.e.
processBlockBreakingAction(Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/network/packet/c2s/play/PlayerActionC2SPacket$Action;Lnet/minecraft/util/math/Direction;II)V
) and without parameters (i.e.processBlockBreakingAction
) and it always seems to fail to build with the errorMulti-target reference conflict for @Redirect target
.For now I'm going to just copy the handler into two separate mixin classes, however it would be nice if this kind of thing could be supported better in the future.
The text was updated successfully, but these errors were encountered: