• 用Python操控Minecraft我的世界 1.安装Spigot服务器并添加RaspberryJuice插件


    这次,我们要学习如何用Python程序,连接并操控自己的服务器

    前几篇文章,我们创建的服务器都是从mcversions.net获取的,是原汁原味的服务端,这一次,我们要创建另外一种服务器——Spigot,Spigot服务器有一个小小的缺点,就是没办法装模组,但是它比原版服务端好的地方就是它可以安装插件,这次我们要让python来操控我的世界,就需要用到一个插件——RaspberryJuice

    让我们开始吧!


    首先,我们先下载服务器的jar文件,来到getBukkit网站

    Get Bukkit | Download CraftBukkit 1.19.1 | Download Spigot 1.19.1Download the latest version of CraftBukkit and Spigot for your Minecraft server!https://getbukkit.org/这次,我们还是以1.16.3的版本为例,点击右上角download中的spigot,或者直接进入下方链接直达

    SpigotDownload the latest version of Spigot for your Minecraft server!https://getbukkit.org/download/spigot

    点击对应版本的download按键 

    然后点击Spigot-1.16.3.jar这个文字(注意不是Create a Server)进行下载

    然后把jar放入一个文件夹中

    创建一个bat文件,写入以下内容

    1. @echo off
    2. java -jar spigot-1.16.3.jar
    3. pause

    第一次运行,服务器自动终止(正常)

    将eula.txt的eula=false改为true

    再次运行

    输出以下内容就是成功运行啦!

    1. *** Error, this build is outdated ***
    2. *** Please download a new build as per instructions from https://www.spigotmc.org/go/outdated-spigot ***
    3. *** Server will start in 20 seconds ***
    4. Loading libraries, please wait...
    5. [14:04:00] [main/INFO]: Environment: authHost='https://authserver.mojang.com', accountsHost='https://api.mojang.com', sessionHost='https://sessionserver.mojang.com', name='PROD'
    6. [14:04:00] [main/INFO]: Found new data pack file/bukkit, loading it automatically
    7. [14:04:01] [main/INFO]: Reloading ResourceManager: Default, bukkit
    8. [14:04:01] [Worker-Main-12/INFO]: Loaded 7 recipes
    9. [14:04:00] [main/INFO]: Environment: authHost='https://authserver.mojang.com', accountsHost='https://api.mojang.com', sessionHost='https://sessionserver.mojang.com', name='PROD'
    10. [14:04:00] [main/INFO]: Found new data pack file/bukkit, loading it automatically
    11. [14:04:01] [main/INFO]: Reloading ResourceManager: Default, bukkit
    12. [14:04:01] [Worker-Main-12/INFO]: Loaded 7 recipes
    13. [14:04:01] [Server thread/INFO]: Starting minecraft server version 1.16.3
    14. [14:04:01] [Server thread/INFO]: Loading properties
    15. [14:04:02] [Server thread/INFO]: This server is running CraftBukkit version git-Spigot-2740d5a-890130b (MC: 1.16.3) (Implementing API version 1.16.3-R0.1-SNAPSHOT)
    16. [14:04:02] [Server thread/INFO]: Debug logging is disabled
    17. [14:04:02] [Server thread/INFO]: Server Ping Player Sample Count: 12
    18. [14:04:02] [Server thread/INFO]: Using 4 threads for Netty based IO
    19. [14:04:02] [Server thread/INFO]: Default game type: SURVIVAL
    20. [14:04:02] [Server thread/INFO]: Generating keypair
    21. [14:04:02] [Server thread/INFO]: Starting Minecraft server on *:25565
    22. [14:04:02] [Server thread/INFO]: Using default channel type
    23. [14:04:02] [Server thread/INFO]: Preparing level "world"
    24. [14:04:02] [Server thread/INFO]: -------- World Settings For [world] --------
    25. [14:04:02] [Server thread/INFO]: Arrow Despawn Rate: 1200 Trident Respawn Rate:1200
    26. [14:04:02] [Server thread/INFO]: Entity Tracking Range: Pl 48 / An 48 / Mo 48 / Mi 32 / Other 64
    27. [14:04:02] [Server thread/INFO]: Allow Zombie Pigmen to spawn from portal blocks: true
    28. [14:04:02] [Server thread/INFO]: Item Despawn Rate: 6000
    29. [14:04:02] [Server thread/INFO]: Item Merge Radius: 2.5
    30. [14:04:02] [Server thread/INFO]: View Distance: 10
    31. [14:04:02] [Server thread/INFO]: Zombie Aggressive Towards Villager: true
    32. [14:04:02] [Server thread/INFO]: Cactus Growth Modifier: 100%
    33. [14:04:02] [Server thread/INFO]: Cane Growth Modifier: 100%
    34. [14:04:02] [Server thread/INFO]: Melon Growth Modifier: 100%
    35. [14:04:02] [Server thread/INFO]: Mushroom Growth Modifier: 100%
    36. [14:04:02] [Server thread/INFO]: Pumpkin Growth Modifier: 100%
    37. [14:04:02] [Server thread/INFO]: Sapling Growth Modifier: 100%
    38. [14:04:02] [Server thread/INFO]: Beetroot Growth Modifier: 100%
    39. [14:04:02] [Server thread/INFO]: Carrot Growth Modifier: 100%
    40. [14:04:02] [Server thread/INFO]: Potato Growth Modifier: 100%
    41. [14:04:02] [Server thread/INFO]: Wheat Growth Modifier: 100%
    42. [14:04:02] [Server thread/INFO]: NetherWart Growth Modifier: 100%
    43. [14:04:02] [Server thread/INFO]: Vine Growth Modifier: 100%
    44. [14:04:02] [Server thread/INFO]: Cocoa Growth Modifier: 100%
    45. [14:04:02] [Server thread/INFO]: Bamboo Growth Modifier: 100%
    46. [14:04:02] [Server thread/INFO]: SweetBerry Growth Modifier: 100%
    47. [14:04:02] [Server thread/INFO]: Kelp Growth Modifier: 100%
    48. [14:04:02] [Server thread/INFO]: Entity Activation Range: An 32 / Mo 32 / Ra 48 / Mi 16 / Tiv true
    49. [14:04:02] [Server thread/INFO]: Hopper Transfer: 8 Hopper Check: 1 Hopper Amount: 1
    50. [14:04:02] [Server thread/INFO]: Experience Merge Radius: 3.0
    51. [14:04:02] [Server thread/INFO]: Mob Spawn Range: 6
    52. [14:04:02] [Server thread/INFO]: Nerfing mobs spawned from spawners: false
    53. [14:04:02] [Server thread/INFO]: Custom Map Seeds: Village: 10387312 Desert: 14357617 Igloo: 14357618 Jungle: 14357619 Swamp: 14357620 Monument: 10387313 Ocean: 14357621 Shipwreck: 165745295 End City: 10387313 Slime: 987234911 Bastion: 30084232 Fortress: 30084232 Mansion: 10387319 Fossil: 14357921 Portal: 34222645
    54. [14:04:02] [Server thread/INFO]: Tile Max Tick Time: 50ms Entity max Tick Time: 50ms
    55. [14:04:02] [Server thread/INFO]: Max TNT Explosions: 100
    56. [14:04:04] [Server thread/INFO]: -------- World Settings For [world_nether] --------
    57. [14:04:04] [Server thread/INFO]: Arrow Despawn Rate: 1200 Trident Respawn Rate:1200
    58. [14:04:04] [Server thread/INFO]: Entity Tracking Range: Pl 48 / An 48 / Mo 48 / Mi 32 / Other 64
    59. [14:04:04] [Server thread/INFO]: Allow Zombie Pigmen to spawn from portal blocks: true
    60. [14:04:04] [Server thread/INFO]: Item Despawn Rate: 6000
    61. [14:04:04] [Server thread/INFO]: Item Merge Radius: 2.5
    62. [14:04:04] [Server thread/INFO]: View Distance: 10
    63. [14:04:04] [Server thread/INFO]: Zombie Aggressive Towards Villager: true
    64. [14:04:04] [Server thread/INFO]: Cactus Growth Modifier: 100%
    65. [14:04:04] [Server thread/INFO]: Cane Growth Modifier: 100%
    66. [14:04:04] [Server thread/INFO]: Melon Growth Modifier: 100%
    67. [14:04:04] [Server thread/INFO]: Mushroom Growth Modifier: 100%
    68. [14:04:04] [Server thread/INFO]: Pumpkin Growth Modifier: 100%
    69. [14:04:04] [Server thread/INFO]: Sapling Growth Modifier: 100%
    70. [14:04:04] [Server thread/INFO]: Beetroot Growth Modifier: 100%
    71. [14:04:04] [Server thread/INFO]: Carrot Growth Modifier: 100%
    72. [14:04:04] [Server thread/INFO]: Potato Growth Modifier: 100%
    73. [14:04:04] [Server thread/INFO]: Wheat Growth Modifier: 100%
    74. [14:04:04] [Server thread/INFO]: NetherWart Growth Modifier: 100%
    75. [14:04:04] [Server thread/INFO]: Vine Growth Modifier: 100%
    76. [14:04:04] [Server thread/INFO]: Cocoa Growth Modifier: 100%
    77. [14:04:04] [Server thread/INFO]: Bamboo Growth Modifier: 100%
    78. [14:04:04] [Server thread/INFO]: SweetBerry Growth Modifier: 100%
    79. [14:04:04] [Server thread/INFO]: Kelp Growth Modifier: 100%
    80. [14:04:04] [Server thread/INFO]: Entity Activation Range: An 32 / Mo 32 / Ra 48 / Mi 16 / Tiv true
    81. [14:04:04] [Server thread/INFO]: Hopper Transfer: 8 Hopper Check: 1 Hopper Amount: 1
    82. [14:04:04] [Server thread/INFO]: Experience Merge Radius: 3.0
    83. [14:04:04] [Server thread/INFO]: Mob Spawn Range: 6
    84. [14:04:04] [Server thread/INFO]: Nerfing mobs spawned from spawners: false
    85. [14:04:04] [Server thread/INFO]: Custom Map Seeds: Village: 10387312 Desert: 14357617 Igloo: 14357618 Jungle: 14357619 Swamp: 14357620 Monument: 10387313 Ocean: 14357621 Shipwreck: 165745295 End City: 10387313 Slime: 987234911 Bastion: 30084232 Fortress: 30084232 Mansion: 10387319 Fossil: 14357921 Portal: 34222645
    86. [14:04:04] [Server thread/INFO]: Tile Max Tick Time: 50ms Entity max Tick Time: 50ms
    87. [14:04:04] [Server thread/INFO]: Max TNT Explosions: 100
    88. [14:04:04] [Server thread/WARN]: Unable to find spawn biome
    89. [14:04:05] [Server thread/INFO]: -------- World Settings For [world_the_end] --------
    90. [14:04:05] [Server thread/INFO]: Arrow Despawn Rate: 1200 Trident Respawn Rate:1200
    91. [14:04:05] [Server thread/INFO]: Entity Tracking Range: Pl 48 / An 48 / Mo 48 / Mi 32 / Other 64
    92. [14:04:05] [Server thread/INFO]: Allow Zombie Pigmen to spawn from portal blocks: true
    93. [14:04:05] [Server thread/INFO]: Item Despawn Rate: 6000
    94. [14:04:05] [Server thread/INFO]: Item Merge Radius: 2.5
    95. [14:04:05] [Server thread/INFO]: View Distance: 10
    96. [14:04:05] [Server thread/INFO]: Zombie Aggressive Towards Villager: true
    97. [14:04:05] [Server thread/INFO]: Cactus Growth Modifier: 100%
    98. [14:04:05] [Server thread/INFO]: Cane Growth Modifier: 100%
    99. [14:04:05] [Server thread/INFO]: Melon Growth Modifier: 100%
    100. [14:04:05] [Server thread/INFO]: Mushroom Growth Modifier: 100%
    101. [14:04:05] [Server thread/INFO]: Pumpkin Growth Modifier: 100%
    102. [14:04:05] [Server thread/INFO]: Sapling Growth Modifier: 100%
    103. [14:04:05] [Server thread/INFO]: Beetroot Growth Modifier: 100%
    104. [14:04:05] [Server thread/INFO]: Carrot Growth Modifier: 100%
    105. [14:04:05] [Server thread/INFO]: Potato Growth Modifier: 100%
    106. [14:04:05] [Server thread/INFO]: Wheat Growth Modifier: 100%
    107. [14:04:05] [Server thread/INFO]: NetherWart Growth Modifier: 100%
    108. [14:04:05] [Server thread/INFO]: Vine Growth Modifier: 100%
    109. [14:04:05] [Server thread/INFO]: Cocoa Growth Modifier: 100%
    110. [14:04:05] [Server thread/INFO]: Bamboo Growth Modifier: 100%
    111. [14:04:05] [Server thread/INFO]: SweetBerry Growth Modifier: 100%
    112. [14:04:05] [Server thread/INFO]: Kelp Growth Modifier: 100%
    113. [14:04:05] [Server thread/INFO]: Entity Activation Range: An 32 / Mo 32 / Ra 48 / Mi 16 / Tiv true
    114. [14:04:05] [Server thread/INFO]: Hopper Transfer: 8 Hopper Check: 1 Hopper Amount: 1
    115. [14:04:05] [Server thread/INFO]: Experience Merge Radius: 3.0
    116. [14:04:05] [Server thread/INFO]: Mob Spawn Range: 6
    117. [14:04:05] [Server thread/INFO]: Nerfing mobs spawned from spawners: false
    118. [14:04:05] [Server thread/INFO]: Custom Map Seeds: Village: 10387312 Desert: 14357617 Igloo: 14357618 Jungle: 14357619 Swamp: 14357620 Monument: 10387313 Ocean: 14357621 Shipwreck: 165745295 End City: 10387313 Slime: 987234911 Bastion: 30084232 Fortress: 30084232 Mansion: 10387319 Fossil: 14357921 Portal: 34222645
    119. [14:04:05] [Server thread/INFO]: Tile Max Tick Time: 50ms Entity max Tick Time: 50ms
    120. [14:04:05] [Server thread/INFO]: Max TNT Explosions: 100
    121. [14:04:05] [Server thread/WARN]: Unable to find spawn biome
    122. [14:04:05] [Server thread/INFO]: Preparing start region for dimension minecraft:overworld
    123. [14:04:05] [Worker-Main-11/INFO]: Preparing spawn area: 0%
    124. [14:04:05] [Worker-Main-11/INFO]: Preparing spawn area: 4%
    125. [14:04:06] [Worker-Main-10/INFO]: Preparing spawn area: 15%
    126. [14:04:06] [Worker-Main-11/INFO]: Preparing spawn area: 24%
    127. [14:04:07] [Worker-Main-13/INFO]: Preparing spawn area: 44%
    128. [14:04:07] [Worker-Main-9/INFO]: Preparing spawn area: 57%
    129. [14:04:08] [Worker-Main-12/INFO]: Preparing spawn area: 69%
    130. [14:04:08] [Worker-Main-11/INFO]: Preparing spawn area: 89%
    131. [14:04:09] [Server thread/INFO]: Time elapsed: 3837 ms
    132. [14:04:09] [Server thread/INFO]: Preparing start region for dimension minecraft:the_nether
    133. [14:04:09] [Worker-Main-10/INFO]: Preparing spawn area: 0%
    134. [14:04:09] [Worker-Main-10/INFO]: Preparing spawn area: 5%
    135. [14:04:10] [Worker-Main-14/INFO]: Preparing spawn area: 17%
    136. [14:04:10] [Worker-Main-14/INFO]: Preparing spawn area: 30%
    137. [14:04:11] [Worker-Main-14/INFO]: Preparing spawn area: 43%
    138. [14:04:11] [Worker-Main-9/INFO]: Preparing spawn area: 58%
    139. [14:04:12] [Worker-Main-8/INFO]: Preparing spawn area: 75%
    140. [14:04:12] [Worker-Main-12/INFO]: Preparing spawn area: 90%
    141. [14:04:12] [Server thread/INFO]: Time elapsed: 3751 ms
    142. [14:04:12] [Server thread/INFO]: Preparing start region for dimension minecraft:the_end
    143. [14:04:12] [Worker-Main-12/INFO]: Preparing spawn area: 0%
    144. [14:04:13] [Worker-Main-12/INFO]: Preparing spawn area: 66%
    145. [14:04:13] [Server thread/INFO]: Time elapsed: 684 ms
    146. [14:04:13] [Server thread/INFO]: Done (10.612s)! For help, type "help"
    147. >

    但是这样还不够,输入stop并回车,终止服务器 


     为了将python和服务器关联起来,我们需要用到一个插件RaspberryJuice

    进入这个网站,看到如下页面

    点击Download Now开始下载,这里不推荐大家使用迅雷,因为文件太小,迅雷一直卡在连接资源,所以浏览器有迅雷扩展程序的话把它先关了然后才下载,这样用了不到1秒就能成功下载啦!

    下载完毕后,将jar文件复制到服务器目录下的plugins文件夹中

     然后启动服务器即可

    从输出中不难发现,RaspberryJuice已经成功被我们添加进去啦!

    好了,安装Spigot服务器并添加RaspberryJuice的教程就到这里!

    下一篇文章我们就来详细了解如何用Python的第三方库对Minecraft进行编程~

    喜欢的话就点赞关注吧!

  • 相关阅读:
    「C#」WPF学习笔记-基础类及继承关系
    开源WAF--Safeline(雷池)测试手册
    特征工程-主成分分析PCA
    基于python flask的疾病数据采集与可视化大屏,实现关联规则算法的治疗方法分析
    基于时空RBF-NN的混沌时间序列预测(Matlab代码实现)
    VMware无法启动虚拟机里面没网络解决方法
    做题(1)
    RocketMQ消息生产者是如何选择Broker的
    基于SSM实现的儿童疫苗信息管理系统设计与实现毕业设计源码311930
    meson和pkg-config
  • 原文地址:https://blog.csdn.net/leleprogrammer/article/details/126120844