/** * Registers some server properties (gametype,hardcore-mode,terraintype,difficulty,player limit), creates a new * WorldClient and sets the player initial dimension */ public void handleJoinGame(S01PacketJoinGame packetIn) { PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController); this.gameController.playerController = new PlayerControllerMP(this.gameController, this); this.clientWorldController = new WorldClient(this, new WorldSettings(0L, packetIn.getGameType(), false, packetIn.isHardcoreMode(), packetIn.getWorldType()), packetIn.getDimension(), packetIn.getDifficulty(), this.gameController.mcProfiler); this.gameController.gameSettings.difficulty = packetIn.getDifficulty(); this.gameController.loadWorld(this.clientWorldController); this.gameController.thePlayer.dimension = packetIn.getDimension(); this.gameController.displayGuiScreen(new GuiDownloadTerrain(this)); this.gameController.thePlayer.setEntityId(packetIn.getEntityId()); this.currentServerMaxPlayers = packetIn.getMaxPlayers(); this.gameController.thePlayer.setReducedDebug(packetIn.isReducedDebugInfo()); this.gameController.playerController.setGameType(packetIn.getGameType()); this.gameController.gameSettings.sendSettingsToServer(); this.netManager.sendPacket(new C17PacketCustomPayload("MC|Brand", (new PacketBuffer(Unpooled.buffer())).writeString(ClientBrandRetriever.getClientModName()))); }
/** * Registers some server properties * (gametype,hardcore-mode,terraintype,difficulty,player limit), creates a new * WorldClient and sets the player initial dimension */ public void handleJoinGame(S01PacketJoinGame packetIn) { PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController); this.gameController.playerController = new PlayerControllerMP(this.gameController, this); this.clientWorldController = new WorldClient(this, new WorldSettings(0L, packetIn.getGameType(), false, packetIn.isHardcoreMode(), packetIn.getWorldType()), packetIn.getDimension(), packetIn.getDifficulty(), this.gameController.mcProfiler); this.gameController.gameSettings.difficulty = packetIn.getDifficulty(); this.gameController.loadWorld(this.clientWorldController); this.gameController.thePlayer.dimension = packetIn.getDimension(); this.gameController.displayGuiScreen(new GuiDownloadTerrain(this)); this.gameController.thePlayer.setEntityId(packetIn.getEntityId()); this.currentServerMaxPlayers = packetIn.getMaxPlayers(); this.gameController.thePlayer.setReducedDebug(packetIn.isReducedDebugInfo()); this.gameController.playerController.setGameType(packetIn.getGameType()); this.gameController.gameSettings.sendSettingsToServer(); this.netManager.sendPacket(new C17PacketCustomPayload("MC|Brand", (new PacketBuffer(Unpooled.buffer())).writeString(ClientBrandRetriever.getClientModName()))); }
/** * Registers some server properties (gametype,hardcore-mode,terraintype,difficulty,player limit), creates a new * WorldClient and sets the player initial dimension */ public void handleJoinGame(SPacketJoinGame packetIn) { PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController); this.gameController.playerController = new PlayerControllerMP(this.gameController, this); this.clientWorldController = new WorldClient(this, new WorldSettings(0L, packetIn.getGameType(), false, packetIn.isHardcoreMode(), packetIn.getWorldType()), packetIn.getDimension(), packetIn.getDifficulty(), this.gameController.mcProfiler); this.gameController.gameSettings.difficulty = packetIn.getDifficulty(); this.gameController.loadWorld(this.clientWorldController); this.gameController.player.dimension = packetIn.getDimension(); this.gameController.displayGuiScreen(new GuiDownloadTerrain(this)); this.gameController.player.setEntityId(packetIn.getPlayerId()); this.currentServerMaxPlayers = packetIn.getMaxPlayers(); this.gameController.player.setReducedDebug(packetIn.isReducedDebugInfo()); this.gameController.playerController.setGameType(packetIn.getGameType()); this.gameController.gameSettings.sendSettingsToServer(); this.netManager.sendPacket(new CPacketCustomPayload("MC|Brand", (new PacketBuffer(Unpooled.buffer())).writeString(ClientBrandRetriever.getClientModName()))); }
/** * Registers some server properties (gametype,hardcore-mode,terraintype,difficulty,player limit), creates a new * WorldClient and sets the player initial dimension */ public void handleJoinGame(SPacketJoinGame packetIn) { PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController); this.gameController.playerController = new PlayerControllerMP(this.gameController, this); this.clientWorldController = new WorldClient(this, new WorldSettings(0L, packetIn.getGameType(), false, packetIn.isHardcoreMode(), packetIn.getWorldType()), net.minecraftforge.fml.common.network.handshake.NetworkDispatcher.get(getNetworkManager()).getOverrideDimension(packetIn), packetIn.getDifficulty(), this.gameController.mcProfiler); this.gameController.gameSettings.difficulty = packetIn.getDifficulty(); this.gameController.loadWorld(this.clientWorldController); this.gameController.thePlayer.dimension = packetIn.getDimension(); this.gameController.displayGuiScreen(new GuiDownloadTerrain(this)); this.gameController.thePlayer.setEntityId(packetIn.getPlayerId()); this.currentServerMaxPlayers = packetIn.getMaxPlayers(); this.gameController.thePlayer.setReducedDebug(packetIn.isReducedDebugInfo()); this.gameController.playerController.setGameType(packetIn.getGameType()); this.gameController.gameSettings.sendSettingsToServer(); this.netManager.sendPacket(new CPacketCustomPayload("MC|Brand", (new PacketBuffer(Unpooled.buffer())).writeString(ClientBrandRetriever.getClientModName()))); }
/** * INSPIRED by universallp * * This function was is part of VanillaAutomation which is licenced under the MOZILLA PUBLIC LICENCE 2.0 - mozilla.org/en-US/MPL/2.0/ github.com/UniversalLP/VanillaAutomation */ public void setPlayerReach(EntityPlayer player, int currentReach) { super.setPlayerReach(player, currentReach); Minecraft mc = Minecraft.getMinecraft(); try { if (player == mc.player && !(mc.playerController instanceof ReachPlayerController)) { GameType type = ReflectionHelper.getPrivateValue(PlayerControllerMP.class, mc.playerController, CURRENT_GAME_TYPE); NetHandlerPlayClient netHandler = ReflectionHelper.getPrivateValue(PlayerControllerMP.class, mc.playerController, NET_CLIENT_HANDLER); ReachPlayerController controller = new ReachPlayerController(mc, netHandler); boolean isFlying = player.capabilities.isFlying; boolean allowFlying = player.capabilities.allowFlying; controller.setGameType(type); player.capabilities.isFlying = isFlying; player.capabilities.allowFlying = allowFlying; mc.playerController = controller; } ((ReachPlayerController) mc.playerController).setReachDistance(currentReach); } catch (Exception e) { //sometimes it crashes just AS the world is loading, but then it works after everythings set up //does not affect functionality, its working before the player can ever make use of this. ModCyclic.logger.error("Error setting reach : " + e.getMessage()); } }
@PaneEventHandler public void onDisplay(PaneDisplayEvent e) { oldRenderDistance = mc.gameSettings.renderDistanceChunks; mc.gameSettings.renderDistanceChunks = 3; fakeWorld = new WorldClient(new NetHandlerPlayClient(Minecraft.getMinecraft(), null, new NetworkManager(true)), new WorldSettings(new WorldInfo(new NBTTagCompound())), 0, EnumDifficulty.EASY, Minecraft.getMinecraft().mcProfiler); for (int x = -1; x <= 1; x++) { for (int z = -1; z <= 1; z++) { fakeWorld.getChunkProvider().loadChunk(x, z); } } fakeWorld.setBlock(0, 64, 0, Blocks.lit_furnace); fakeWorld.getGameRules().setOrCreateGameRule("doDaylightCycle", "false"); fakeWorld.setWorldTime(6000); mc.thePlayer = new EntityClientPlayerMP(mc, fakeWorld, new FakeSession(), new FakeNetHandler(mc, null, new FakeNetManager(true)), new FakeStatFileWriter()); mc.thePlayer.sendQueue.getNetworkManager().setNetHandler(mc.thePlayer.sendQueue); mc.thePlayer.movementInput = new MovementInput(); mc.playerController = new PlayerControllerMP(mc, mc.thePlayer.sendQueue); mc.renderViewEntity = mc.thePlayer; mc.theWorld = fakeWorld; mc.renderGlobal.setWorldAndLoadRenderers(fakeWorld); MinecraftForge.EVENT_BUS.register(this); }
public RenderHandler(Minecraft mc) { this.mc = mc; this.width = mc.displayWidth; this.height = mc.displayHeight; this.renderPlayer = new RenderPlayer(); this.renderEntity = new RenderEntity(); this.itemRender = new RenderItem(); this.curBlockDamage = null; try { for (Field field : PlayerControllerMP.class.getDeclaredFields()) if (field.getName().equals("field_78770_f") || field.getName().equals("curBlockDamageMP")) { this.curBlockDamage = PlayerControllerMP.class.getDeclaredField(field.getName()); curBlockDamage.setAccessible(true); } } catch (Exception exception) { System.err.println(exception); } }
@Override public void onRender() { if (Minecraft.getMinecraft().objectMouseOver == null || Minecraft.getMinecraft().objectMouseOver.typeOfHit != MovingObjectType.BLOCK) { return; } BlockPos pos = Minecraft.getMinecraft().objectMouseOver.getBlockPos(); Block mouseOverBlock = Minecraft.getMinecraft().theWorld.getBlockState(Minecraft.getMinecraft().objectMouseOver.getBlockPos()) .getBlock(); if (Block.getIdFromBlock(mouseOverBlock) != 0) RenderUtils.nukerBox(pos, PlayerControllerMP.curBlockDamageMP); }
public void handleJoinGame(S01PacketJoinGame p_147282_1_) { this.gameController.playerController = new PlayerControllerMP(this.gameController, this); this.clientWorldController = new WorldClient(this, new WorldSettings(0L, p_147282_1_.func_149198_e(), false, p_147282_1_.func_149195_d(), p_147282_1_.func_149196_i()), p_147282_1_.func_149194_f(), p_147282_1_.func_149192_g(), this.gameController.mcProfiler); this.clientWorldController.isRemote = true; this.gameController.loadWorld(this.clientWorldController); this.gameController.thePlayer.dimension = p_147282_1_.func_149194_f(); this.gameController.displayGuiScreen(new GuiDownloadTerrain(this)); this.gameController.thePlayer.setEntityId(p_147282_1_.func_149197_c()); this.currentServerMaxPlayers = p_147282_1_.func_149193_h(); this.gameController.playerController.setGameType(p_147282_1_.func_149198_e()); this.gameController.gameSettings.sendSettingsToServer(); this.netManager.scheduleOutboundPacket(new C17PacketCustomPayload("MC|Brand", ClientBrandRetriever.getClientModName().getBytes(Charsets.UTF_8)), new GenericFutureListener[0]); }
public void func_72455_a(Packet1Login p_72455_1_) { this.field_72563_h.field_71442_b = new PlayerControllerMP(this.field_72563_h, this); this.field_72563_h.field_71413_E.func_77450_a(StatList.field_75950_i, 1); this.field_72564_i = new WorldClient(this, new WorldSettings(0L, p_72455_1_.field_73557_d, false, p_72455_1_.field_73560_c, p_72455_1_.field_73559_b), p_72455_1_.field_73558_e, p_72455_1_.field_73555_f, this.field_72563_h.field_71424_I, this.field_72563_h.func_98033_al()); this.field_72564_i.field_72995_K = true; this.field_72563_h.func_71403_a(this.field_72564_i); this.field_72563_h.field_71439_g.field_71093_bK = p_72455_1_.field_73558_e; this.field_72563_h.func_71373_a(new GuiDownloadTerrain(this)); this.field_72563_h.field_71439_g.field_70157_k = p_72455_1_.field_73561_a; this.field_72556_d = p_72455_1_.field_73562_h; this.field_72563_h.field_71442_b.func_78746_a(p_72455_1_.field_73557_d); this.field_72563_h.field_71474_y.func_82879_c(); this.field_72555_g.func_74429_a(new Packet250CustomPayload("MC|Brand", ClientBrandRetriever.getClientModName().getBytes(Charsets.UTF_8))); }
public static PlayerControllerMP playerController() { return getMinecraft().field_71442_b; }
private static PlayerControllerMP getPlayerController() { return Minecraft.getMinecraft().playerController; }
public static PlayerControllerMP getPlayerController() { return getMinecraft().playerController; }
public static void syncCurrentItem(PlayerControllerMP controller) { controller.syncCurrentItem(); }
@SuppressWarnings("deprecation") public void drawBlockDamageTexture(Tessellator tessellatorIn, VertexBuffer vertexBuffer, Entity entityIn, float partialTicks, World world, List<BlockPos> blocks) { double d0 = entityIn.lastTickPosX + (entityIn.posX - entityIn.lastTickPosX) * partialTicks; double d1 = entityIn.lastTickPosY + (entityIn.posY - entityIn.lastTickPosY) * partialTicks; double d2 = entityIn.lastTickPosZ + (entityIn.posZ - entityIn.lastTickPosZ) * partialTicks; TextureManager renderEngine = Minecraft.getMinecraft().renderEngine; float curBlockDamageMP = ObfuscationReflectionHelper.getPrivateValue(PlayerControllerMP.class, Minecraft.getMinecraft().playerController, 4); int progress = (int) (curBlockDamageMP * 10f) - 1; // 0-10 if(progress < 0) { return; } renderEngine.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE); //preRenderDamagedBlocks BEGIN GlStateManager.tryBlendFuncSeparate(774, 768, 1, 0); GlStateManager.enableBlend(); GlStateManager.color(1.0F, 1.0F, 1.0F, 0.5F); GlStateManager.doPolygonOffset(-3.0F, -3.0F); GlStateManager.enablePolygonOffset(); GlStateManager.alphaFunc(516, 0.1F); GlStateManager.enableAlpha(); GlStateManager.pushMatrix(); //preRenderDamagedBlocks END vertexBuffer.begin(GL11.GL_QUADS, DefaultVertexFormats.BLOCK); vertexBuffer.setTranslation(-d0, -d1, -d2); vertexBuffer.noColor(); for(BlockPos blockpos : blocks) { blockpos.getX(); blockpos.getY(); blockpos.getZ(); Block block = world.getBlockState(blockpos).getBlock(); TileEntity te = world.getTileEntity(blockpos); boolean hasBreak = block instanceof BlockChest || block instanceof BlockEnderChest || block instanceof BlockSign || block instanceof BlockSkull; if(!hasBreak) { hasBreak = te != null && te.canRenderBreaking(); } if(!hasBreak) { IBlockState iblockstate = world.getBlockState(blockpos); if(iblockstate.getBlock().getMaterial(iblockstate) != Material.AIR) { TextureAtlasSprite textureatlassprite = RenderUtil.getSprite("minecraft:blocks/destroy_stage_"+progress)/*ClientProxy.destroyBlockIcons[progress]*/; BlockRendererDispatcher blockrendererdispatcher = Minecraft.getMinecraft().getBlockRendererDispatcher(); blockrendererdispatcher.renderBlockDamage(iblockstate, blockpos, textureatlassprite, world); } } } tessellatorIn.draw(); vertexBuffer.setTranslation(0.0D, 0.0D, 0.0D); // postRenderDamagedBlocks BEGIN GlStateManager.disableAlpha(); GlStateManager.doPolygonOffset(0.0F, 0.0F); GlStateManager.disablePolygonOffset(); GlStateManager.enableAlpha(); GlStateManager.depthMask(true); GlStateManager.popMatrix(); // postRenderDamagedBlocks END }
public PlayerControllerMP getPlayerController(){ return getMinecraft().playerController; }
private EnumGameType getGameMode() { return ObfuscationReflectionHelper.getPrivateValue(PlayerControllerMP.class, this, "currentGameType", "field_78779_k"); }