无人直播——我的世界弹幕互动游戏直播之铁傀儡VS僵尸(挂机直播与弹幕抓取)
兄弟们,因为创作不易,想了解的人也多,有米分享了,想要的可以私信我后续有想法做不同的游戏模式的,也可以找我做或者一起探讨哦!
·
一、引言
无人直播想必大家已经见的不少了吧,之前涌现出一堆自制弹幕游戏的无人直播,点点赞评论
和刷礼物就可以参与游戏的整蛊,当此类型的直播与我的世界这款游戏结合起来,就很容易联想到
斗蛐蛐、角斗场这样的无人直播游戏模式,让游戏原本中立的生物进行PK,这样就很容易有画面
感出现,也能获得直播效果。下图则是刷视频时看到的直播画面
二、步骤
此步骤和我上一篇的我的世界TNT填格子弹幕直播一样
1、首先获取直播间数据:
以下为示例图
2、其次建立我的世界服务器
使用paper.jar:
首先去官网下载 https://papermc.io/software/paper
开服教程可以借鉴其他的博主
记住要有JDK
点击脚本会自动下载,出现以下画面就可以
4、关键环节——代码逻辑的构建
僵尸和铁傀儡的生成函数
//生成僵尸函数
public void spawnZombie(int num,String name,String gift,String func_name,String sound_name,boolean flag) {
World world = areaLocation.getWorld();
int x = areaLocation.getBlockX();
int y = areaLocation.getBlockY();
int z = areaLocation.getBlockZ();
int quantity = num;
if(flag == true){
String title = "§d"+func_name+"!";
String subtitle = "§e"+name+"§7送出§6"+gift+": §9僵尸×§9"+num+"§9!";
player.sendTitle(title, subtitle, 10, 20, 10);
player.sendMessage(subtitle);
System.out.println(name+" 送出 "+gift);
}
else {
String title = "§d"+name+"点赞了!";
player.sendMessage(title);
System.out.println(name+" 点赞了! ");
}
// System.out.println(name+"送出 "+gift+" : TNT×"+num+"!");
for (int i = 0; i < quantity; i++) {
int spawnX = x + 6 ;
int spawnZ = z + 5 ;
int spawnY = y + 4; // Spawn the TNT 20 blocks above the area
player.playSound(player.getLocation(),sound_name,1.0f,1.0f);
Location zombieLocation = new Location(world, spawnX, spawnY, spawnZ);
player.getWorld().spawnEntity(zombieLocation, EntityType.ZOMBIE);
// tnt.setFuseTicks(80); // Adjust fuse ticks as needed
}
}
//生成铁傀儡函数
public void spawnIPZ(int num,String name,String gift,String func_name,String sound_name,boolean flag) {
World world = areaLocation.getWorld();
int x = areaLocation.getBlockX();
int y = areaLocation.getBlockY();
int z = areaLocation.getBlockZ();
int quantity = num;
if(flag == true){
String title = "§d"+func_name+"!";
String subtitle = "§e"+name+"§7送出§6"+gift+": §9铁傀儡×§9"+num+"§9!";
player.sendTitle(title, subtitle, 10, 20, 10);
player.sendMessage(subtitle);
System.out.println(name+" 送出 "+gift);
}
else {
String title = "§d"+name+"大声发!";
player.sendMessage(title);
System.out.println(name+" 大声发! ");
}
for (int i = 0; i < quantity; i++) {
int spawnX = x + 4 ;
int spawnZ = z + 5 ;
int spawnY = y + 4; // Spawn the TNT 20 blocks above the area
player.playSound(player.getLocation(),sound_name,1.0f,1.0f);
Location zombieLocation = new Location(world, spawnX, spawnY, spawnZ);
player.getWorld().spawnEntity(zombieLocation, EntityType.IRON_GOLEM);
// tnt.setFuseTicks(80); // Adjust fuse ticks as needed
}
}
三、效果展示
四、结语
兄弟们,因为创作不易,想了解的人也多,有米分享了,想要的可以私信我
谢谢大家!后续有想法做不同的游戏模式的,也可以找我做或者一起探讨哦!
更多推荐
所有评论(0)