本文整理汇总了Java中net.minecraft.network.play.server.SPacketChangeGameState.getValue方法的典型用法代码示例。如果您正苦于以下问题:Java SPacketChangeGameState.getValue方法的具体用法?Java SPacketChangeGameState.getValue怎么用?Java SPacketChangeGameState.getValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraft.network.play.server.SPacketChangeGameState
的用法示例。
在下文中一共展示了SPacketChangeGameState.getValue方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: handleChangeGameState
import net.minecraft.network.play.server.SPacketChangeGameState; //导入方法依赖的package包/类
public void handleChangeGameState(SPacketChangeGameState packetIn)
{
PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);
EntityPlayer entityplayer = this.gameController.player;
int i = packetIn.getGameState();
float f = packetIn.getValue();
int j = MathHelper.floor(f + 0.5F);
if (i >= 0 && i < SPacketChangeGameState.MESSAGE_NAMES.length && SPacketChangeGameState.MESSAGE_NAMES[i] != null)
{
entityplayer.addChatComponentMessage(new TextComponentTranslation(SPacketChangeGameState.MESSAGE_NAMES[i], new Object[0]), false);
}
if (i == 1)
{
this.clientWorldController.getWorldInfo().setRaining(true);
this.clientWorldController.setRainStrength(0.0F);
}
else if (i == 2)
{
this.clientWorldController.getWorldInfo().setRaining(false);
this.clientWorldController.setRainStrength(1.0F);
}
else if (i == 3)
{
this.gameController.playerController.setGameType(GameType.getByID(j));
}
else if (i == 4)
{
if (j == 0)
{
this.gameController.player.connection.sendPacket(new CPacketClientStatus(CPacketClientStatus.State.PERFORM_RESPAWN));
this.gameController.displayGuiScreen(new GuiDownloadTerrain(this));
}
else if (j == 1)
{
this.gameController.displayGuiScreen(new GuiWinGame());
}
}
else if (i == 5)
{
GameSettings gamesettings = this.gameController.gameSettings;
if (f == 0.0F)
{
this.gameController.displayGuiScreen(new GuiScreenDemo());
}
else if (f == 101.0F)
{
this.gameController.ingameGUI.getChatGUI().printChatMessage(new TextComponentTranslation("demo.help.movement", new Object[] {GameSettings.getKeyDisplayString(gamesettings.keyBindForward.getKeyCode()), GameSettings.getKeyDisplayString(gamesettings.keyBindLeft.getKeyCode()), GameSettings.getKeyDisplayString(gamesettings.keyBindBack.getKeyCode()), GameSettings.getKeyDisplayString(gamesettings.keyBindRight.getKeyCode())}));
}
else if (f == 102.0F)
{
this.gameController.ingameGUI.getChatGUI().printChatMessage(new TextComponentTranslation("demo.help.jump", new Object[] {GameSettings.getKeyDisplayString(gamesettings.keyBindJump.getKeyCode())}));
}
else if (f == 103.0F)
{
this.gameController.ingameGUI.getChatGUI().printChatMessage(new TextComponentTranslation("demo.help.inventory", new Object[] {GameSettings.getKeyDisplayString(gamesettings.keyBindInventory.getKeyCode())}));
}
}
else if (i == 6)
{
this.clientWorldController.playSound(entityplayer, entityplayer.posX, entityplayer.posY + (double)entityplayer.getEyeHeight(), entityplayer.posZ, SoundEvents.ENTITY_ARROW_HIT_PLAYER, SoundCategory.PLAYERS, 0.18F, 0.45F);
}
else if (i == 7)
{
this.clientWorldController.setRainStrength(f);
}
else if (i == 8)
{
this.clientWorldController.setThunderStrength(f);
}
else if (i == 10)
{
this.clientWorldController.spawnParticle(EnumParticleTypes.MOB_APPEARANCE, entityplayer.posX, entityplayer.posY, entityplayer.posZ, 0.0D, 0.0D, 0.0D, new int[0]);
this.clientWorldController.playSound(entityplayer, entityplayer.posX, entityplayer.posY, entityplayer.posZ, SoundEvents.ENTITY_ELDER_GUARDIAN_CURSE, SoundCategory.HOSTILE, 1.0F, 1.0F);
}
}
示例2: handleChangeGameState
import net.minecraft.network.play.server.SPacketChangeGameState; //导入方法依赖的package包/类
public void handleChangeGameState(SPacketChangeGameState packetIn)
{
PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);
EntityPlayer entityplayer = this.gameController.thePlayer;
int i = packetIn.getGameState();
float f = packetIn.getValue();
int j = MathHelper.floor_float(f + 0.5F);
if (i >= 0 && i < SPacketChangeGameState.MESSAGE_NAMES.length && SPacketChangeGameState.MESSAGE_NAMES[i] != null)
{
entityplayer.addChatComponentMessage(new TextComponentTranslation(SPacketChangeGameState.MESSAGE_NAMES[i], new Object[0]));
}
if (i == 1)
{
this.clientWorldController.getWorldInfo().setRaining(true);
this.clientWorldController.setRainStrength(0.0F);
}
else if (i == 2)
{
this.clientWorldController.getWorldInfo().setRaining(false);
this.clientWorldController.setRainStrength(1.0F);
}
else if (i == 3)
{
this.gameController.playerController.setGameType(GameType.getByID(j));
}
else if (i == 4)
{
if (j == 0)
{
this.gameController.thePlayer.connection.sendPacket(new CPacketClientStatus(CPacketClientStatus.State.PERFORM_RESPAWN));
this.gameController.displayGuiScreen(new GuiDownloadTerrain(this));
}
else if (j == 1)
{
this.gameController.displayGuiScreen(new GuiWinGame());
}
}
else if (i == 5)
{
GameSettings gamesettings = this.gameController.gameSettings;
if (f == 0.0F)
{
this.gameController.displayGuiScreen(new GuiScreenDemo());
}
else if (f == 101.0F)
{
this.gameController.ingameGUI.getChatGUI().printChatMessage(new TextComponentTranslation("demo.help.movement", new Object[] {gamesettings.keyBindForward.getDisplayName(), gamesettings.keyBindLeft.getDisplayName(), gamesettings.keyBindBack.getDisplayName(), gamesettings.keyBindRight.getDisplayName()}));
}
else if (f == 102.0F)
{
this.gameController.ingameGUI.getChatGUI().printChatMessage(new TextComponentTranslation("demo.help.jump", new Object[] {gamesettings.keyBindJump.getDisplayName()}));
}
else if (f == 103.0F)
{
this.gameController.ingameGUI.getChatGUI().printChatMessage(new TextComponentTranslation("demo.help.inventory", new Object[] {gamesettings.keyBindInventory.getDisplayName()}));
}
}
else if (i == 6)
{
this.clientWorldController.playSound(entityplayer, entityplayer.posX, entityplayer.posY + (double)entityplayer.getEyeHeight(), entityplayer.posZ, SoundEvents.ENTITY_ARROW_HIT_PLAYER, SoundCategory.PLAYERS, 0.18F, 0.45F);
}
else if (i == 7)
{
this.clientWorldController.setRainStrength(f);
}
else if (i == 8)
{
this.clientWorldController.setThunderStrength(f);
}
else if (i == 10)
{
this.clientWorldController.spawnParticle(EnumParticleTypes.MOB_APPEARANCE, entityplayer.posX, entityplayer.posY, entityplayer.posZ, 0.0D, 0.0D, 0.0D, new int[0]);
this.clientWorldController.playSound(entityplayer, entityplayer.posX, entityplayer.posY, entityplayer.posZ, SoundEvents.ENTITY_ELDER_GUARDIAN_CURSE, SoundCategory.HOSTILE, 1.0F, 1.0F);
}
}