当前位置: 首页>>代码示例>>Java>>正文


Java Difficulty类代码示例

本文整理汇总了Java中org.spacehq.mc.protocol.data.game.values.setting.Difficulty的典型用法代码示例。如果您正苦于以下问题:Java Difficulty类的具体用法?Java Difficulty怎么用?Java Difficulty使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Difficulty类属于org.spacehq.mc.protocol.data.game.values.setting包,在下文中一共展示了Difficulty类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: transformDifficulty

import org.spacehq.mc.protocol.data.game.values.setting.Difficulty; //导入依赖的package包/类
public static Difficulty transformDifficulty(Byte value) {
    if (value == 0) {
        return Difficulty.PEACEFUL;
    } else if (value == 1) {
        return Difficulty.EASY;
    } else if (value == 3) {
        return Difficulty.HARD;
    }
    return Difficulty.NORMAL;
}
 
开发者ID:BeYkeRYkt,项目名称:CyanWool,代码行数:11,代码来源:Transform.java

示例2: getDifficulty

import org.spacehq.mc.protocol.data.game.values.setting.Difficulty; //导入依赖的package包/类
@Override
public Difficulty getDifficulty() {
    return difficulty;
}
 
开发者ID:BeYkeRYkt,项目名称:CyanWool,代码行数:5,代码来源:CyanWorld.java

示例3: setDifficulty

import org.spacehq.mc.protocol.data.game.values.setting.Difficulty; //导入依赖的package包/类
@Override
public void setDifficulty(Difficulty diff) {
    this.difficulty = diff;
}
 
开发者ID:BeYkeRYkt,项目名称:CyanWool,代码行数:5,代码来源:CyanWorld.java

示例4: loginPlayer

import org.spacehq.mc.protocol.data.game.values.setting.Difficulty; //导入依赖的package包/类
public synchronized Player loginPlayer(Session session) {
    GameProfile profile = session.getFlag(ProtocolConstants.PROFILE_KEY);
    World world = server.getWorldManager().getWorld("world");
    Location location = world.getSpawnLocation();
    CyanPlayer player = new CyanPlayer(server, profile, location);
    player.setPlayerNetwork(new CyanPlayerNetwork(server, session, player));
    // world.getPlayerService().readPlayer(player);
    player.loadData();

    // player.load();
    ServerJoinGamePacket packet = new ServerJoinGamePacket(player.getEntityID(), world.isHardcore(), player.getGameMode(), world.getDimension().getId(), world.getDifficulty(), server.getMaxPlayers(), WorldType.DEFAULT, false);
    session.send(packet);
    players.add(player);

    // Send spawn packet
    ServerPlayerPositionRotationPacket ppacket = new ServerPlayerPositionRotationPacket(player.getLocation().getX(), player.getLocation().getY(), player.getLocation().getZ(), player.getLocation().getYaw(), player.getLocation().getPitch());
    session.send(ppacket);

    Position position = new Position(player.getLocation().getBlockX(), player.getLocation().getBlockY(), player.getLocation().getBlockZ());
    ServerSpawnPositionPacket spawnPacket = new ServerSpawnPositionPacket(position);
    session.send(spawnPacket);

    // set time
    player.setTime(0);// TODO

    // Send health
    ServerUpdateHealthPacket healthPacket = new ServerUpdateHealthPacket(20, 20, 1);
    session.send(healthPacket);

    // Send Difficulty
    ServerDifficultyPacket diffPacket = new ServerDifficultyPacket(Difficulty.NORMAL);
    session.send(diffPacket);
    world.getPlayerService().savePlayer(player);

    // Send packets for all players
    for (Packet packets : player.getSpawnPackets()) {
        server.getNetworkServer().sendPacketForAll(packets);
    }

    player.chat("Hello! This test message for CyanWool!");
    player.setMoveable(true);

    // Test sounds
    player.damage(5);
    return player;
}
 
开发者ID:BeYkeRYkt,项目名称:CyanWool,代码行数:47,代码来源:PlayerManager.java

示例5: getDifficulty

import org.spacehq.mc.protocol.data.game.values.setting.Difficulty; //导入依赖的package包/类
public Difficulty getDifficulty(); 
开发者ID:BeYkeRYkt,项目名称:CyanWool,代码行数:2,代码来源:World.java

示例6: setDifficulty

import org.spacehq.mc.protocol.data.game.values.setting.Difficulty; //导入依赖的package包/类
public void setDifficulty(Difficulty diff); 
开发者ID:BeYkeRYkt,项目名称:CyanWool,代码行数:2,代码来源:World.java


注:本文中的org.spacehq.mc.protocol.data.game.values.setting.Difficulty类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。