mirror of
https://github.com/Xiao-MoMi/craft-engine.git
synced 2026-01-06 15:52:03 +00:00
修复1.21.5骨粉
This commit is contained in:
@@ -157,7 +157,7 @@ public class CropBlockBehavior extends BushBlockBehavior {
|
|||||||
if (i > maxAge) {
|
if (i > maxAge) {
|
||||||
i = maxAge;
|
i = maxAge;
|
||||||
}
|
}
|
||||||
FastNMS.INSTANCE.method$LevelWriter$setBlock(level, pos, immutableBlockState.with(this.ageProperty, i).customBlockState().handle(), UpdateOption.UPDATE_NONE.flags());
|
FastNMS.INSTANCE.method$LevelWriter$setBlock(level, pos, immutableBlockState.with(this.ageProperty, i).customBlockState().handle(), UpdateOption.UPDATE_ALL.flags());
|
||||||
if (sendParticles) {
|
if (sendParticles) {
|
||||||
world.spawnParticle(ParticleUtils.getParticle("HAPPY_VILLAGER"), x + 0.5, y + 0.5, z + 0.5, 15, 0.25, 0.25, 0.25);
|
world.spawnParticle(ParticleUtils.getParticle("HAPPY_VILLAGER"), x + 0.5, y + 0.5, z + 0.5, 15, 0.25, 0.25, 0.25);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4962,10 +4962,10 @@ public class Reflections {
|
|||||||
|
|
||||||
public static final Method method$BonemealableBlock$isValidBonemealTarget = requireNonNull(
|
public static final Method method$BonemealableBlock$isValidBonemealTarget = requireNonNull(
|
||||||
VersionHelper.isOrAbove1_20_2() ?
|
VersionHelper.isOrAbove1_20_2() ?
|
||||||
ReflectionUtils.getMethod(
|
ReflectionUtils.getInstanceMethod(
|
||||||
clazz$BonemealableBlock, boolean.class, clazz$LevelReader, clazz$BlockPos, clazz$BlockState
|
clazz$BonemealableBlock, boolean.class, clazz$LevelReader, clazz$BlockPos, clazz$BlockState
|
||||||
) :
|
) :
|
||||||
ReflectionUtils.getMethod(
|
ReflectionUtils.getInstanceMethod(
|
||||||
clazz$BonemealableBlock, boolean.class, clazz$LevelReader, clazz$BlockPos, clazz$BlockState, boolean.class
|
clazz$BonemealableBlock, boolean.class, clazz$LevelReader, clazz$BlockPos, clazz$BlockState, boolean.class
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -14,6 +14,10 @@ public class UpdateOption {
|
|||||||
return flags;
|
return flags;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Builder builder() {
|
||||||
|
return new Builder();
|
||||||
|
}
|
||||||
|
|
||||||
public static class Builder {
|
public static class Builder {
|
||||||
private int flags;
|
private int flags;
|
||||||
|
|
||||||
|
|||||||
@@ -246,6 +246,27 @@ public class ReflectionUtils {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
public static Method getInstanceMethod(final Class<?> clazz, Class<?> returnType, final Class<?>... parameterTypes) {
|
||||||
|
outer:
|
||||||
|
for (Method method : clazz.getMethods()) {
|
||||||
|
if (method.getParameterCount() != parameterTypes.length) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (Modifier.isStatic(method.getModifiers())) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
Class<?>[] types = method.getParameterTypes();
|
||||||
|
for (int i = 0; i < types.length; i++) {
|
||||||
|
if (types[i] != parameterTypes[i]) {
|
||||||
|
continue outer;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (returnType.isAssignableFrom(method.getReturnType())) return method;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
public static Method getDeclaredMethod(final Class<?> clazz, Class<?> returnType, final String[] possibleMethodNames, final Class<?>... parameterTypes) {
|
public static Method getDeclaredMethod(final Class<?> clazz, Class<?> returnType, final String[] possibleMethodNames, final Class<?>... parameterTypes) {
|
||||||
outer:
|
outer:
|
||||||
|
|||||||
Reference in New Issue
Block a user