RightClickBlock会成双成对的被调用

纪华裕


版本信息
Forge版本: 1.15.2-31.1.0
Minecraft版本: 1.15.2

错误情况简述
RightClickBlock会成双成对的被调用
报错日志

[09:16:51] [Server thread/INFO] [STDOUT/]: [com.example.examplemod.handler.PlayerHandler:onRightClickBlock:16]: 999
[09:16:51] [Server thread/INFO] [STDOUT/]: [com.example.examplemod.handler.PlayerHandler:onRightClickBlock:16]: 999
[09:16:51] [Render thread/INFO] [minecraft/NewChatGui]: [CHAT] 你右键了花岗岩
[09:16:51] [Render thread/INFO] [minecraft/NewChatGui]: [CHAT] 你右键了花岗岩

相关代码
PlayerHandler.java

@Mod.EventBusSubscriber
public class PlayerHandler
{
    @SubscribeEvent
    public static void onRightClickBlock(PlayerInteractEvent.RightClickBlock event){
        if(event.getWorld() instanceof ServerWorld){
            System.out.println(999);
            ITextComponent text =  event.getWorld().getBlockState(event.getPos()).getBlock().getNameTextComponent();
            event.getPlayer().sendMessage(new StringTextComponent("你右键了").appendSibling(text));
        }
    }
}

FledgeXu


「主手一次,副手一次。」—Seraph_Jack


system


该主题在最后一个回复创建后7天后自动关闭。不再允许新的回复。