Closed StewStrong closed 6 months ago
Wrapping the first instruction in a method most likely does not make sense depending on what the instruction is. It’s certainly not a stable idea to target. If you want to wrap the entire method then that’d be different and might potentially be planned, i’ll have to see. If you have a specific scenario then just ask in the discord cause it’s probably possible right now anyway.
Can you link the discord? I can't find it.
Whatever discord your modloader uses, or the sponge powered discord if none of those fit.
If you want to wrap the entire method then that’d be different and might potentially be planned Yeah thats what I want.
Currently I have to do something like this
boolean isModifyingPathType = false;
@Inject(method = "getBlockPathTypeRaw", at = @At("RETURN"), cancellable = true)
private static void getBlockPathTypeForShips(final BlockGetter blockGetter, final BlockPos blockPos,
final CallbackInfoReturnable<BlockPathTypes> cir) {
if (isModifyingPathType) {
return;
}
isModifyingPathType = true;
// Reinvoke with different args
modified = getBlockPathTypeRaw(((PathNavigationRegionAccessor) blockGetter).getLevel(), groundPos);
isModifyingPathType = false;
It'd be better to write this using something like @WrapMethod.
Well no, you should just use a ModifyVariable
at HEAD
. If you want to modify multiple parameters at once then use mutable Local
s.
I can't seem to get it working. If not, this would be very useful!