9
0
mirror of https://github.com/Xiao-MoMi/craft-engine.git synced 2025-12-30 04:19:27 +00:00

fix: interceptor never work

This commit is contained in:
iqtester
2025-08-22 22:18:05 -04:00
parent f8bbe9011a
commit db003d6c67
4 changed files with 6 additions and 7 deletions

View File

@@ -189,7 +189,7 @@ public class PressurePlateBlockBehavior extends BukkitBlockBehavior {
Object pos = args[2];
Object newState = args[3];
boolean movedByPiston = (boolean) args[4];
if (!movedByPiston && !FastNMS.INSTANCE.method$BlockStateBase$is(state, FastNMS.INSTANCE.method$BlockState$getBlock(newState))) {
if (!movedByPiston && !FastNMS.INSTANCE.method$BlockStateBase$isBlock(state, FastNMS.INSTANCE.method$BlockState$getBlock(newState))) {
if (this.getSignalForState(state) > 0) {
this.updateNeighbours(level, pos, thisBlock);
}

View File

@@ -185,11 +185,11 @@ public final class BlockGenerator {
.method(ElementMatchers.is(CoreReflections.method$BlockBehaviour$spawnAfterBreak))
.intercept(MethodDelegation.to(SpawnAfterBreakInterceptor.INSTANCE));
if (CoreReflections.method$BlockBehaviour$affectNeighborsAfterRemoval != null) {
builder.method(ElementMatchers.is(CoreReflections.method$BlockBehaviour$affectNeighborsAfterRemoval))
builder = builder.method(ElementMatchers.is(CoreReflections.method$BlockBehaviour$affectNeighborsAfterRemoval))
.intercept(MethodDelegation.to(AffectNeighborsAfterRemovalInterceptor.INSTANCE));
}
if (CoreReflections.method$BlockBehaviour$onRemove != null) {
builder.method(ElementMatchers.is(CoreReflections.method$BlockBehaviour$onRemove))
builder = builder.method(ElementMatchers.is(CoreReflections.method$BlockBehaviour$onRemove))
.intercept(MethodDelegation.to(OnRemoveInterceptor.INSTANCE));
}

View File

@@ -4011,12 +4011,11 @@ public final class CoreReflections {
);
// 1.20~1.21.4
public static final Method method$BlockBehaviour$onRemove = MiscUtils.requireNonNullIf(
public static final Method method$BlockBehaviour$onRemove = VersionHelper.isOrAbove1_21_5() ? null :
ReflectionUtils.getDeclaredMethod(
clazz$BlockBehaviour, void.class, clazz$BlockState, clazz$Level, clazz$BlockPos, clazz$BlockState, boolean.class
),
!VersionHelper.isOrAbove1_21_5()
);
public static final Object instance$CollisionContext$empty;
static {