SpongePowered / Mixin

Mixin is a trait/mixin and bytecode weaving framework for Java using ASM
MIT License
1.37k stars 185 forks source link

Redirect can not find its target. #660

Closed Speiger closed 5 months ago

Speiger commented 5 months ago

o/ I am using atm an Overwrite to fix a incompat between my redstone components and vanillas. The main issue is I want to avoid Overwrite as much as possible.

We are targeting minecrafts DiodeBlock#shouldPrioritize. The descriptor.

@Redirect(method = "shouldPrioritize", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/block/state/BlockState;getValue(Lnet/minecraft/world/level/block/state/properties/DirectionProperty;)Lnet/minecraft/core/Direction;")) 

The line of code we are targeting is this.

return isDiode(blockstate) && blockstate.getValue(FACING) != direction;
                              ^^^^^^^^^^^^^^^^^^^^^^^^^^

We want to replace the blockstate.getrValue(FACING) with our conditional check. But sadly redirect can not find the descriptor at all.

We have been trying a lot and so far we have found not much in luck what is going wrong.

The getValue is technically a generic function so that could be the problem.

Any ideas?

Earthcomputer commented 5 months ago
  1. The target is wrong
  2. The GitHub is not for support, use the mixin channel in the Sponge discord in future
  3. Do you use the mcdev plugin for intellij? It would have caught this and fixed it to the correct target for you.
  4. MixinExtras could probably do what you want in a more compatible way than Redirect
Speiger commented 5 months ago
gabizou commented 5 months ago

As mentioned, closing this issue as this is not a support forum. You’re more than welcome to join the discord and rely on the volunteered support (since everyone’s fairly international, it will take time).

Speiger commented 5 months ago

@gabizou then i am staying with Overwrite until someone has a solution :) have a nice day