コード例 #1
0
        public Protocol18Handler(TcpClient Client, int protocolVersion, IMinecraftComHandler handler, ForgeInfo forgeInfo, Player player)
        {
            this.player = player;

            ConsoleIO.SetAutoCompleteEngine(this);
            ChatParser.InitTranslations();

            connectionInfo       = new ConnectionInfo(new SocketWrapper(Client), 0);
            this.dataTypes       = new DataTypes(protocolVersion);
            this.protocolversion = protocolVersion;
            this.handler         = handler;
            this.pForge          = new Protocol18Forge(forgeInfo, protocolVersion, dataTypes, this, handler);
            this.pTerrain        = new Protocol18Terrain(protocolVersion, dataTypes, handler);

            if (protocolversion > (int)McVersion.V1142)
            {
                ConsoleIO.WriteLineFormatted("§8Terrain & Movements currently not handled for that MC version.");
                //Modify client pool for terrain?
            }

            if (player.GetInventoryEnabled() && protocolversion > (int)McVersion.V114)
            {
                ConsoleIO.WriteLineFormatted("§8Inventories are currently not handled for that MC version.");
                player.SetInventoryEnabled(false);
            }

            if (protocolversion >= (int)McVersion.V18)
            {
                if (protocolVersion >= (int)McVersion.V114)
                {
                    Block.Palette = new Palette114();
                }
                else
                {
                    Block.Palette = new Palette113();
                }
            }
            else
            {
                Block.Palette = new Palette112();
            }

            packetReadWriter = new Protocol18PacketReadWriter(connectionInfo, dataTypes, protocolVersion);
            packetHandler    = new Protocol18PacketHandler(protocolVersion, dataTypes, handler, packetReadWriter, pTerrain, pForge, worldInfo, this, player);

            pForge.packetReadWriter = packetReadWriter;
        }
コード例 #2
0
        public Protocol18Handler(TcpClient Client, int protocolVersion, IMinecraftComHandler handler, ForgeInfo forgeInfo)
        {
            ConsoleIO.SetAutoCompleteEngine(this);
            ChatParser.InitTranslations();
            this.socketWrapper   = new SocketWrapper(Client);
            this.dataTypes       = new DataTypes(protocolVersion);
            this.protocolversion = protocolVersion;
            this.handler         = handler;
            this.pForge          = new Protocol18Forge(forgeInfo, protocolVersion, dataTypes, this, handler);
            this.pTerrain        = new Protocol18Terrain(protocolVersion, dataTypes, handler);

            if (handler.GetTerrainEnabled() && protocolversion > MC1142Version)
            {
                ConsoleIO.WriteLineFormatted("§8Terrain & Movements currently not handled for that MC version.");
                handler.SetTerrainEnabled(false);
            }

            if (handler.GetInventoryEnabled() && protocolversion > MC114Version)
            {
                ConsoleIO.WriteLineFormatted("§8Inventories are currently not handled for that MC version.");
                handler.SetInventoryEnabled(false);
            }

            if (protocolversion >= MC113Version)
            {
                if (protocolVersion > MC1142Version && handler.GetTerrainEnabled())
                {
                    throw new NotImplementedException("Please update block types handling for this Minecraft version. See Material.cs");
                }
                if (protocolVersion >= MC114Version)
                {
                    Block.Palette = new Palette114();
                }
                else
                {
                    Block.Palette = new Palette113();
                }
            }
            else
            {
                Block.Palette = new Palette112();
            }
        }