mirror of
https://github.com/Xiao-MoMi/craft-engine.git
synced 2025-12-25 09:59:20 +00:00
修正低版本onPlace onRemove
This commit is contained in:
@@ -105,7 +105,6 @@ public class PressurePlateBlockBehavior extends BukkitBlockBehavior {
|
||||
if (signalForState == 0) {
|
||||
this.checkPressed(args[3], args[1], args[2], state, signalForState, thisBlock);
|
||||
} else {
|
||||
// todo 为什么
|
||||
FastNMS.INSTANCE.method$ScheduledTickAccess$scheduleBlockTick(args[1], args[2], thisBlock, this.pressedTime);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -106,14 +106,7 @@ public final class BlockGenerator {
|
||||
.method(ElementMatchers.is(CoreReflections.method$BlockBehaviour$randomTick))
|
||||
.intercept(MethodDelegation.to(RandomTickInterceptor.INSTANCE))
|
||||
// onPlace
|
||||
.method(ElementMatchers.takesArguments(5)
|
||||
.and(ElementMatchers.takesArgument(0, CoreReflections.clazz$BlockState))
|
||||
.and(ElementMatchers.takesArgument(1, CoreReflections.clazz$Level))
|
||||
.and(ElementMatchers.takesArgument(2, CoreReflections.clazz$BlockPos))
|
||||
.and(ElementMatchers.takesArgument(3, CoreReflections.clazz$BlockState))
|
||||
.and(ElementMatchers.takesArgument(4, boolean.class))
|
||||
.and(ElementMatchers.named("onPlace").or(ElementMatchers.named("a")))
|
||||
)
|
||||
.method(ElementMatchers.is(CoreReflections.method$BlockBehaviour$onPlace))
|
||||
.intercept(MethodDelegation.to(OnPlaceInterceptor.INSTANCE))
|
||||
// onBrokenAfterFall
|
||||
.method(ElementMatchers.takesArguments(3)
|
||||
|
||||
@@ -3458,6 +3458,11 @@ public final class CoreReflections {
|
||||
ReflectionUtils.getDeclaredMethod(clazz$BlockBehaviour, void.class, new String[]{"randomTick", "b"}, clazz$BlockState, clazz$ServerLevel, clazz$BlockPos, clazz$RandomSource)
|
||||
);
|
||||
|
||||
public static final Method method$BlockBehaviour$onPlace = requireNonNull(
|
||||
ReflectionUtils.getDeclaredMethod(clazz$BlockBehaviour, void.class, new String[]{"onPlace", VersionHelper.isOrAbove1_21_5() ? "a" : "b"},
|
||||
clazz$BlockState, clazz$Level, clazz$BlockPos, clazz$BlockState, boolean.class)
|
||||
);
|
||||
|
||||
public static final Class<?> clazz$InsideBlockEffectApplier = BukkitReflectionUtils.findReobfOrMojmapClass(
|
||||
"world.entity.InsideBlockEffectApplier",
|
||||
"world.entity.InsideBlockEffectApplier"
|
||||
@@ -4005,15 +4010,13 @@ public final class CoreReflections {
|
||||
ReflectionUtils.getStaticMethod(clazz$ArmorTrim, Optional.class, clazz$RegistryAccess, clazz$ItemStack);
|
||||
|
||||
public static final Method method$BlockBehaviour$spawnAfterBreak = requireNonNull(
|
||||
ReflectionUtils.getDeclaredMethod(
|
||||
clazz$BlockBehaviour, void.class, clazz$BlockState, clazz$ServerLevel, clazz$BlockPos, clazz$ItemStack, boolean.class
|
||||
)
|
||||
ReflectionUtils.getDeclaredMethod(clazz$BlockBehaviour, void.class, clazz$BlockState, clazz$ServerLevel, clazz$BlockPos, clazz$ItemStack, boolean.class)
|
||||
);
|
||||
|
||||
// 1.20~1.21.4
|
||||
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
|
||||
public static final Method method$BlockBehaviour$onRemove = MiscUtils.requireNonNullIf(
|
||||
ReflectionUtils.getDeclaredMethod(clazz$BlockBehaviour, void.class, new String[]{"a", "onRemove"}, clazz$BlockState, clazz$Level, clazz$BlockPos, clazz$BlockState, boolean.class),
|
||||
!VersionHelper.isOrAbove1_21_5()
|
||||
);
|
||||
|
||||
public static final Object instance$CollisionContext$empty;
|
||||
|
||||
Reference in New Issue
Block a user