9
0
mirror of https://github.com/Xiao-MoMi/craft-engine.git synced 2025-12-30 20:39:10 +00:00

修改参数名名

This commit is contained in:
XiaoMoMi
2025-05-23 19:10:36 +08:00
parent ce55fceb16
commit 2cf856028c
10 changed files with 67 additions and 78 deletions

View File

@@ -168,7 +168,7 @@ public class BlockEventListener implements Listener {
Cancellable cancellable = Cancellable.of(event::isCancelled, event::setCancelled);
PlayerOptionalContext context = PlayerOptionalContext.of(serverPlayer, ContextHolder.builder()
.withParameter(DirectContextParameters.BLOCK, new BukkitBlockInWorld(block))
.withParameter(DirectContextParameters.BLOCK_STATE, state)
.withParameter(DirectContextParameters.CUSTOM_BLOCK_STATE, state)
.withParameter(DirectContextParameters.EVENT, cancellable)
.withParameter(DirectContextParameters.POSITION, position)
.withOptionalParameter(DirectContextParameters.ITEM_IN_HAND, itemInHand)
@@ -304,7 +304,7 @@ public class BlockEventListener implements Listener {
.withParameter(DirectContextParameters.EVENT, cancellable)
.withParameter(DirectContextParameters.POSITION, new WorldPosition(new BukkitWorld(event.getWorld()), LocationUtils.toVec3d(location)))
.withParameter(DirectContextParameters.BLOCK, new BukkitBlockInWorld(block))
.withParameter(DirectContextParameters.BLOCK_STATE, state)
.withParameter(DirectContextParameters.CUSTOM_BLOCK_STATE, state)
), EventTrigger.STEP);
if (cancellable.isCancelled()) {
event.setCancelled(true);

View File

@@ -149,7 +149,7 @@ public class CropBlockBehavior extends BushBlockBehavior {
int i = this.getAge(immutableBlockState) + this.boneMealBonus.getInt(
SimpleContext.of(
ContextHolder.builder()
.withParameter(DirectContextParameters.BLOCK_STATE, immutableBlockState)
.withParameter(DirectContextParameters.CUSTOM_BLOCK_STATE, immutableBlockState)
.withParameter(DirectContextParameters.POSITION, new WorldPosition(new BukkitWorld(world), Vec3d.atCenterOf(new Vec3i(x, y, z))))
.build()
)

View File

@@ -101,7 +101,7 @@ public class ItemEventListener implements Listener {
CustomBlock customBlock = immutableBlockState.owner().value();
PlayerOptionalContext context = PlayerOptionalContext.of(serverPlayer, ContextHolder.builder()
.withParameter(DirectContextParameters.BLOCK, new BukkitBlockInWorld(block))
.withParameter(DirectContextParameters.BLOCK_STATE, immutableBlockState)
.withParameter(DirectContextParameters.CUSTOM_BLOCK_STATE, immutableBlockState)
.withParameter(DirectContextParameters.HAND, hand)
.withParameter(DirectContextParameters.EVENT, dummy)
.withParameter(DirectContextParameters.POSITION, LocationUtils.toWorldPosition(block.getLocation()))
@@ -175,7 +175,7 @@ public class ItemEventListener implements Listener {
Cancellable dummy = Cancellable.dummy();
PlayerOptionalContext context = PlayerOptionalContext.of(serverPlayer, ContextHolder.builder()
.withParameter(DirectContextParameters.BLOCK, new BukkitBlockInWorld(block))
.withOptionalParameter(DirectContextParameters.BLOCK_STATE, immutableBlockState)
.withOptionalParameter(DirectContextParameters.CUSTOM_BLOCK_STATE, immutableBlockState)
.withOptionalParameter(DirectContextParameters.ITEM_IN_HAND, itemInHand)
.withParameter(DirectContextParameters.POSITION, LocationUtils.toWorldPosition(block.getLocation()))
.withParameter(DirectContextParameters.HAND, hand)
@@ -219,7 +219,7 @@ public class ItemEventListener implements Listener {
Cancellable dummy = Cancellable.dummy();
PlayerOptionalContext context = PlayerOptionalContext.of(serverPlayer, ContextHolder.builder()
.withParameter(DirectContextParameters.BLOCK, new BukkitBlockInWorld(block))
.withOptionalParameter(DirectContextParameters.BLOCK_STATE, immutableBlockState)
.withOptionalParameter(DirectContextParameters.CUSTOM_BLOCK_STATE, immutableBlockState)
.withOptionalParameter(DirectContextParameters.ITEM_IN_HAND, itemInHand)
.withParameter(DirectContextParameters.POSITION, LocationUtils.toWorldPosition(block.getLocation()))
.withParameter(DirectContextParameters.HAND, hand)