net.minecraft.world.GameMode Java Examples
The following examples show how to use
net.minecraft.world.GameMode.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CmdCI.java From bleachhack-1.14 with GNU General Public License v3.0 | 5 votes |
@Override public void onCommand(String command, String[] args) throws Exception { for (int i = 0; i < 200; i++) { if (mc.interactionManager.getCurrentGameMode() == GameMode.CREATIVE) { mc.player.inventory.setInvStack(i, new ItemStack(null)); } else { BleachLogger.errorMessage("Bruh you're not in creative."); return; } } BleachLogger.infoMessage("Cleared all items"); }
Example #2
Source File: CmdGamemode.java From bleachhack-1.14 with GNU General Public License v3.0 | 5 votes |
@Override public void onCommand(String command, String[] args) throws Exception { int gm; try { gm = Integer.parseInt(args[0]); } catch (Exception e) { BleachLogger.errorMessage("Unable to parse gamemode."); return; } if (gm == 0) { mc.player.setGameMode(GameMode.SURVIVAL); mc.interactionManager.setGameMode(GameMode.SURVIVAL); BleachLogger.infoMessage("Set gamemode to survival."); } else if (gm == 1) { mc.player.setGameMode(GameMode.CREATIVE); mc.interactionManager.setGameMode(GameMode.CREATIVE); BleachLogger.infoMessage("Set gamemode to creative."); } else if (gm == 2) { mc.player.setGameMode(GameMode.ADVENTURE); mc.interactionManager.setGameMode(GameMode.ADVENTURE); BleachLogger.infoMessage("Set gamemode to adventure."); } else if (gm == 3) { mc.player.setGameMode(GameMode.SPECTATOR); mc.interactionManager.setGameMode(GameMode.SPECTATOR); BleachLogger.infoMessage("Set gamemode to spectator."); } else { BleachLogger.warningMessage("Unknown Gamemode Number."); } }
Example #3
Source File: CmdCI.java From bleachhack-1.14 with GNU General Public License v3.0 | 5 votes |
@Override public void onCommand(String command, String[] args) throws Exception { for (int i = 0; i < 200; i++) { if (mc.interactionManager.getCurrentGameMode() == GameMode.CREATIVE) { mc.player.inventory.setStack(i, new ItemStack(null)); } else { BleachLogger.errorMessage("Bruh you're not in creative."); return; } } BleachLogger.infoMessage("Cleared all items"); }
Example #4
Source File: CmdGamemode.java From bleachhack-1.14 with GNU General Public License v3.0 | 5 votes |
@Override public void onCommand(String command, String[] args) throws Exception { int gm; try { gm = Integer.parseInt(args[0]); } catch (Exception e) { BleachLogger.errorMessage("Unable to parse gamemode."); return; } if (gm == 0) { mc.player.setGameMode(GameMode.SURVIVAL); mc.interactionManager.setGameMode(GameMode.SURVIVAL); BleachLogger.infoMessage("Set gamemode to survival."); } else if (gm == 1) { mc.player.setGameMode(GameMode.CREATIVE); mc.interactionManager.setGameMode(GameMode.CREATIVE); BleachLogger.infoMessage("Set gamemode to creative."); } else if (gm == 2) { mc.player.setGameMode(GameMode.ADVENTURE); mc.interactionManager.setGameMode(GameMode.ADVENTURE); BleachLogger.infoMessage("Set gamemode to adventure."); } else if (gm == 3) { mc.player.setGameMode(GameMode.SPECTATOR); mc.interactionManager.setGameMode(GameMode.SPECTATOR); BleachLogger.infoMessage("Set gamemode to spectator."); } else { BleachLogger.warningMessage("Unknown Gamemode Number."); } }
Example #5
Source File: CmdCI.java From bleachhack-1.14 with GNU General Public License v3.0 | 5 votes |
@Override public void onCommand(String command, String[] args) throws Exception { for (int i = 0; i < 200; i++) { if (mc.interactionManager.getCurrentGameMode() == GameMode.CREATIVE) { mc.player.inventory.setInvStack(i, new ItemStack(null)); } else { BleachLogger.errorMessage("Bruh you're not in creative."); return; } } BleachLogger.infoMessage("Cleared all items"); }
Example #6
Source File: CmdGamemode.java From bleachhack-1.14 with GNU General Public License v3.0 | 5 votes |
@Override public void onCommand(String command, String[] args) throws Exception { int gm; try { gm = Integer.parseInt(args[0]); } catch (Exception e) { BleachLogger.errorMessage("Unable to parse gamemode."); return; } if (gm == 0) { mc.player.setGameMode(GameMode.SURVIVAL); mc.interactionManager.setGameMode(GameMode.SURVIVAL); BleachLogger.infoMessage("Set gamemode to survival."); } else if (gm == 1) { mc.player.setGameMode(GameMode.CREATIVE); mc.interactionManager.setGameMode(GameMode.CREATIVE); BleachLogger.infoMessage("Set gamemode to creative."); } else if (gm == 2) { mc.player.setGameMode(GameMode.ADVENTURE); mc.interactionManager.setGameMode(GameMode.ADVENTURE); BleachLogger.infoMessage("Set gamemode to adventure."); } else if (gm == 3) { mc.player.setGameMode(GameMode.SPECTATOR); mc.interactionManager.setGameMode(GameMode.SPECTATOR); BleachLogger.infoMessage("Set gamemode to spectator."); } else { BleachLogger.warningMessage("Unknown Gamemode Number."); } }
Example #7
Source File: CameraModeCommand.java From fabric-carpet with MIT License | 5 votes |
private static int cameraMode(ServerCommandSource source, ServerPlayerEntity player) { if (!(iCanHasPermissions(source, player))) return 0; player.setGameMode(GameMode.SPECTATOR); player.addVelocity(0,0.1,0); player.networkHandler.sendPacket(new EntityVelocityUpdateS2CPacket(player)); player.addStatusEffect(new StatusEffectInstance(StatusEffects.NIGHT_VISION, 999999, 0, false, false)); player.addStatusEffect(new StatusEffectInstance(StatusEffects.CONDUIT_POWER, 999999, 0, false, false)); return 1; }
Example #8
Source File: CameraModeCommand.java From fabric-carpet with MIT License | 5 votes |
private static int survivalMode(ServerCommandSource source, ServerPlayerEntity player) { if (!(iCanHasPermissions(source, player))) return 0; player.setGameMode(GameMode.SURVIVAL); player.networkHandler.sendPacket(new RemoveEntityStatusEffectS2CPacket(player.getEntityId(), StatusEffects.NIGHT_VISION)); player.removeStatusEffect(StatusEffects.NIGHT_VISION); player.networkHandler.sendPacket(new RemoveEntityStatusEffectS2CPacket(player.getEntityId(), StatusEffects.CONDUIT_POWER)); player.removeStatusEffect(StatusEffects.CONDUIT_POWER); return 1; }
Example #9
Source File: EntityPlayerMPFake.java From fabric-carpet with MIT License | 4 votes |
public static EntityPlayerMPFake createFake(String username, MinecraftServer server, double d0, double d1, double d2, double yaw, double pitch, DimensionType dimension, GameMode gamemode) { //prolly half of that crap is not necessary, but it works ServerWorld worldIn = server.getWorld(dimension); ServerPlayerInteractionManager interactionManagerIn = new ServerPlayerInteractionManager(worldIn); GameProfile gameprofile = server.getUserCache().findByName(username); if (gameprofile == null) { return null; } if (gameprofile.getProperties().containsKey("textures")) { gameprofile = SkullBlockEntity.loadProperties(gameprofile); } EntityPlayerMPFake instance = new EntityPlayerMPFake(server, worldIn, gameprofile, interactionManagerIn, false); instance.fixStartingPosition = () -> instance.refreshPositionAndAngles(d0, d1, d2, (float) yaw, (float) pitch); server.getPlayerManager().onPlayerConnect(new NetworkManagerFake(NetworkSide.SERVERBOUND), instance); if (instance.dimension != dimension) //player was logged in in a different dimension { ServerWorld old_world = server.getWorld(instance.dimension); instance.dimension = dimension; old_world.removePlayer(instance); instance.removed = false; //worldIn.spawnEntity(instance); instance.setWorld(worldIn); server.getPlayerManager().sendWorldInfo(instance, worldIn); instance.networkHandler.requestTeleport(d0, d1, d2, (float) yaw, (float) pitch); instance.interactionManager.setWorld(worldIn); worldIn.onPlayerChangeDimension(instance); } instance.setHealth(20.0F); instance.removed = false; instance.networkHandler.requestTeleport(d0, d1, d2, (float) yaw, (float) pitch); instance.stepHeight = 0.6F; interactionManagerIn.setGameMode(gamemode); server.getPlayerManager().sendToDimension(new EntitySetHeadYawS2CPacket(instance, (byte) (instance.headYaw * 256 / 360)), instance.dimension); server.getPlayerManager().sendToDimension(new EntityPositionS2CPacket(instance), instance.dimension); instance.getServerWorld().getChunkManager().updateCameraPosition(instance); instance.dataTracker.set(PLAYER_MODEL_PARTS, (byte) 0x7f); // show all model layers (incl. capes) return instance; }