mirror of
https://github.com/Xiao-MoMi/craft-engine.git
synced 2025-12-25 18:09:27 +00:00
refactor(bukkit): 优化门行为并更新反射代码
This commit is contained in:
@@ -135,7 +135,7 @@ public class DoorBlockBehavior extends AbstractCanSurviveBlockBehavior {
|
||||
org.bukkit.entity.Player bukkitPlayer = FastNMS.INSTANCE.method$ServerPlayer$getBukkitEntity(player);
|
||||
BukkitServerPlayer cePlayer = BukkitCraftEngine.instance().adapt(bukkitPlayer);
|
||||
Item<ItemStack> item = cePlayer.getItemInHand(InteractionHand.MAIN_HAND);
|
||||
if (preventsBlockDrops(cePlayer) || !BlockStateUtils.isCorrectTool(blockState, item)) {
|
||||
if (cePlayer.canInstabuild() || !BlockStateUtils.isCorrectTool(blockState, item)) {
|
||||
preventDropFromBottomPart(level, pos, blockState, player);
|
||||
}
|
||||
return superMethod.call();
|
||||
@@ -155,10 +155,6 @@ public class DoorBlockBehavior extends AbstractCanSurviveBlockBehavior {
|
||||
}
|
||||
}
|
||||
|
||||
private boolean preventsBlockDrops(BukkitServerPlayer cePlayer) {
|
||||
return VersionHelper.isOrAbove1_21_5() ? cePlayer.canInstabuild() : cePlayer.isCreativeMode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onExplosionHit(Object thisBlock, Object[] args, Callable<Object> superMethod) {
|
||||
if (this.canOpenByWindCharge && FastNMS.INSTANCE.method$Explosion$canTriggerBlocks(args[3])) {
|
||||
|
||||
@@ -1824,20 +1824,10 @@ public final class CoreReflections {
|
||||
ReflectionUtils.getInstanceDeclaredField(clazz$Abilities, boolean.class, 2)
|
||||
);
|
||||
|
||||
@Deprecated
|
||||
public static final Field field$Abilities$instabuild = requireNonNull(
|
||||
ReflectionUtils.getInstanceDeclaredField(clazz$Abilities, boolean.class, 3)
|
||||
);
|
||||
|
||||
public static final Field field$Abilities$mayBuild = requireNonNull(
|
||||
ReflectionUtils.getInstanceDeclaredField(clazz$Abilities, boolean.class, 4)
|
||||
);
|
||||
|
||||
@Deprecated
|
||||
public static final Field field$Player$abilities = requireNonNull(
|
||||
ReflectionUtils.getInstanceDeclaredField(clazz$Player, clazz$Abilities, 0)
|
||||
);
|
||||
|
||||
public static final Class<?> clazz$FlowingFluid = requireNonNull(
|
||||
BukkitReflectionUtils.findReobfOrMojmapClass(
|
||||
"world.level.material.FluidTypeFlowing",
|
||||
|
||||
Reference in New Issue
Block a user