├── .github
└── ISSUE_TEMPLATE
│ ├── bug_report_form.yaml
│ └── feature_request_form.yaml
├── .gitignore
├── .idea
└── .gitignore
├── DebugTools
├── MinecraftClientProxy.sln
├── MinecraftClientProxy
│ ├── .gitignore
│ ├── Compression
│ │ ├── CRC32.cs
│ │ ├── Deflate.cs
│ │ ├── GZipStream.cs
│ │ ├── InfTree.cs
│ │ ├── Inflate.cs
│ │ ├── Tree.cs
│ │ ├── Zlib.cs
│ │ ├── ZlibBaseStream.cs
│ │ ├── ZlibCodec.cs
│ │ ├── ZlibConstants.cs
│ │ └── ZlibStream.cs
│ ├── MinecraftClientProxy.csproj
│ ├── PacketProxy.cs
│ ├── Program.cs
│ ├── Properties
│ │ └── AssemblyInfo.cs
│ └── ZlibUtils.cs
└── README.txt
├── Docker
├── Dockerfile
├── docker-compose.yml
└── start-latest.sh
├── MinecraftClient.sln
├── MinecraftClient
├── .gitignore
├── AutoTimeout.cs
├── CSharpRunner.cs
├── ChatBot.cs
├── ChatBots
│ ├── Alerts.cs
│ ├── AntiAFK.cs
│ ├── AutoAttack.cs
│ ├── AutoCraft.cs
│ ├── AutoDrop.cs
│ ├── AutoEat.cs
│ ├── AutoFishing.cs
│ ├── AutoRelog.cs
│ ├── AutoRespond.cs
│ ├── ChatLog.cs
│ ├── HangmanGame.cs
│ ├── Mailer.cs
│ ├── PlayerListLogger.cs
│ ├── RemoteControl.cs
│ ├── ReplayCapture.cs
│ ├── Script.cs
│ ├── ScriptScheduler.cs
│ └── TestBot.cs
├── Command.cs
├── Commands
│ ├── Animation.cs
│ ├── ChangeSlot.cs
│ ├── Connect.cs
│ ├── Debug.cs
│ ├── Dig.cs
│ ├── DropItem.cs
│ ├── Entitycmd.cs
│ ├── Exit.cs
│ ├── Health.cs
│ ├── Inventory.cs
│ ├── List.cs
│ ├── Log.cs
│ ├── Look.cs
│ ├── Move.cs
│ ├── Reco.cs
│ ├── Respawn.cs
│ ├── Script.cs
│ ├── Send.cs
│ ├── Set.cs
│ ├── SetRnd.cs
│ ├── Sneak.cs
│ ├── Tps.cs
│ ├── UseItem.cs
│ └── Useblock.cs
├── ConsoleIO.cs
├── Crypto
│ ├── CryptoHandler.cs
│ ├── IAesStream.cs
│ └── Streams
│ │ ├── BouncyAes
│ │ ├── AesFastEngine.cs
│ │ ├── BufferedBlockCipher.cs
│ │ ├── BufferedCipherBase.cs
│ │ ├── CfbBlockCipher.cs
│ │ ├── Check.cs
│ │ ├── CipherStream.cs
│ │ ├── CryptoException.cs
│ │ ├── DataLengthException.cs
│ │ ├── IBlockCipher.cs
│ │ ├── IBufferedCipher.cs
│ │ ├── ICipherParameters.cs
│ │ ├── KeyParameter.cs
│ │ ├── OutputLengthException.cs
│ │ ├── Pack.cs
│ │ └── ParametersWithIV.cs
│ │ ├── MonoAesStream.cs
│ │ └── RegularAesStream.cs
├── DefaultConfigResource.Designer.cs
├── DefaultConfigResource.resx
├── FileMonitor.cs
├── INIFile.cs
├── Inventory
│ ├── Container.cs
│ ├── ContainerType.cs
│ ├── ContainerTypeExtensions.cs
│ ├── Effects.cs
│ ├── Hand.cs
│ ├── Item.cs
│ ├── ItemMovingHelper.cs
│ ├── ItemPalettes
│ │ ├── ItemPalette.cs
│ │ ├── ItemPalette115.cs
│ │ ├── ItemPalette1161.cs
│ │ ├── ItemPalette1162.cs
│ │ └── ItemPaletteGenerator.cs
│ ├── ItemType.cs
│ ├── ItemTypeExtensions.cs
│ ├── VillagerInfo.cs
│ ├── VillagerTrade.cs
│ └── WindowActionType.cs
├── Json.cs
├── Logger
│ ├── FileLogLogger.cs
│ ├── FilteredLogger.cs
│ ├── ILogger.cs
│ └── LoggerBase.cs
├── Mapping
│ ├── Block.cs
│ ├── BlockPalettes
│ │ ├── BlockPalette.cs
│ │ ├── BlockPaletteGenerator.cs
│ │ ├── Palette112.cs
│ │ ├── Palette113.cs
│ │ ├── Palette114.cs
│ │ ├── Palette115.cs
│ │ └── Palette116.cs
│ ├── Chunk.cs
│ ├── ChunkColumn.cs
│ ├── CommandBlockFlags.cs
│ ├── CommandBlockMode.cs
│ ├── CubeFromWorld.cs
│ ├── Direction.cs
│ ├── Entity.cs
│ ├── EntityPalettes
│ │ ├── EntityPalette.cs
│ │ ├── EntityPalette112.cs
│ │ ├── EntityPalette113.cs
│ │ ├── EntityPalette114.cs
│ │ ├── EntityPalette115.cs
│ │ ├── EntityPalette1161.cs
│ │ ├── EntityPalette1162.cs
│ │ └── EntityPaletteGenerator.cs
│ ├── EntityPose.cs
│ ├── EntityType.cs
│ ├── EntityTypeExtensions.cs
│ ├── Location.cs
│ ├── Material.cs
│ ├── Material2Tool.cs
│ ├── MaterialExtensions.cs
│ ├── Movement.cs
│ ├── VillagerInfo.cs
│ └── World.cs
├── McClient.cs
├── MinecraftClient.csproj
├── MinecraftClient.csproj.user
├── Program.cs
├── Properties
│ └── AssemblyInfo.cs
├── Protocol
│ ├── ChatParser.cs
│ ├── DataTypeGenerator.cs
│ ├── Dns
│ │ ├── Header.cs
│ │ ├── Question.cs
│ │ ├── RR.cs
│ │ ├── RecordReader.cs
│ │ ├── Records
│ │ │ ├── NotUsed
│ │ │ │ ├── RecordA6.cs
│ │ │ │ ├── RecordAPL.cs
│ │ │ │ ├── RecordATMA.cs
│ │ │ │ ├── RecordCERT.cs
│ │ │ │ ├── RecordDHCID.cs
│ │ │ │ ├── RecordDNSKEY.cs
│ │ │ │ ├── RecordEID.cs
│ │ │ │ ├── RecordGID.cs
│ │ │ │ ├── RecordHIP.cs
│ │ │ │ ├── RecordIPSECKEY.cs
│ │ │ │ ├── RecordNIMLOC.cs
│ │ │ │ ├── RecordNSEC.cs
│ │ │ │ ├── RecordNSEC3.cs
│ │ │ │ ├── RecordNSEC3PARAM.cs
│ │ │ │ ├── RecordOPT.cs
│ │ │ │ ├── RecordRRSIG.cs
│ │ │ │ ├── RecordSINK.cs
│ │ │ │ ├── RecordSPF.cs
│ │ │ │ ├── RecordSSHFP.cs
│ │ │ │ ├── RecordUID.cs
│ │ │ │ ├── RecordUINFO.cs
│ │ │ │ ├── RecordUNSPEC.cs
│ │ │ │ └── RecordUnknown.cs
│ │ │ ├── Obsolete
│ │ │ │ ├── RecordGPOS.cs
│ │ │ │ ├── RecordMD.cs
│ │ │ │ ├── RecordMF.cs
│ │ │ │ ├── RecordNSAPPTR.cs
│ │ │ │ └── RecordNXT.cs
│ │ │ ├── Record.cs
│ │ │ ├── RecordA.cs
│ │ │ ├── RecordAAAA.cs
│ │ │ ├── RecordAFSDB.cs
│ │ │ ├── RecordCNAME.cs
│ │ │ ├── RecordDNAME.cs
│ │ │ ├── RecordDS.cs
│ │ │ ├── RecordHINFO.cs
│ │ │ ├── RecordISDN.cs
│ │ │ ├── RecordKEY.cs
│ │ │ ├── RecordKX.cs
│ │ │ ├── RecordLOC.cs
│ │ │ ├── RecordMB.cs
│ │ │ ├── RecordMG.cs
│ │ │ ├── RecordMINFO.cs
│ │ │ ├── RecordMR.cs
│ │ │ ├── RecordMX.cs
│ │ │ ├── RecordNAPTR.cs
│ │ │ ├── RecordNS.cs
│ │ │ ├── RecordNSAP.cs
│ │ │ ├── RecordNULL.cs
│ │ │ ├── RecordPTR.cs
│ │ │ ├── RecordPX.cs
│ │ │ ├── RecordRP.cs
│ │ │ ├── RecordRT.cs
│ │ │ ├── RecordSIG.cs
│ │ │ ├── RecordSOA.cs
│ │ │ ├── RecordSRV.cs
│ │ │ ├── RecordTKEY.cs
│ │ │ ├── RecordTSIG.cs
│ │ │ ├── RecordTXT.cs
│ │ │ ├── RecordWKS.cs
│ │ │ ├── RecordX25.cs
│ │ │ └── totla.txt
│ │ ├── Request.cs
│ │ ├── Resolver.cs
│ │ ├── Response.cs
│ │ └── Structs.cs
│ ├── EntityActionType.cs
│ ├── GuidExtensions.cs
│ ├── Handlers
│ │ ├── Compression
│ │ │ ├── CRC32.cs
│ │ │ ├── Deflate.cs
│ │ │ ├── DeflateStream.cs
│ │ │ ├── GZipStream.cs
│ │ │ ├── InfTree.cs
│ │ │ ├── Inflate.cs
│ │ │ ├── ParallelDeflateOutputStream.cs
│ │ │ ├── Tree.cs
│ │ │ ├── Zip
│ │ │ │ ├── ComHelper.cs
│ │ │ │ ├── EncryptionAlgorithm.cs
│ │ │ │ ├── Events.cs
│ │ │ │ ├── Exceptions.cs
│ │ │ │ ├── ExtractExistingFileAction.cs
│ │ │ │ ├── FileSelector.cs
│ │ │ │ ├── OffsetStream.cs
│ │ │ │ ├── Shared.cs
│ │ │ │ ├── WinZipAes.cs
│ │ │ │ ├── ZipConstants.cs
│ │ │ │ ├── ZipCrypto.cs
│ │ │ │ ├── ZipDirEntry.cs
│ │ │ │ ├── ZipEntry.Extract.cs
│ │ │ │ ├── ZipEntry.Read.cs
│ │ │ │ ├── ZipEntry.Write.cs
│ │ │ │ ├── ZipEntry.cs
│ │ │ │ ├── ZipEntrySource.cs
│ │ │ │ ├── ZipErrorAction.cs
│ │ │ │ ├── ZipFile.AddUpdate.cs
│ │ │ │ ├── ZipFile.Check.cs
│ │ │ │ ├── ZipFile.Events.cs
│ │ │ │ ├── ZipFile.Extract.cs
│ │ │ │ ├── ZipFile.Read.cs
│ │ │ │ ├── ZipFile.Save.cs
│ │ │ │ ├── ZipFile.SaveSelfExtractor.cs
│ │ │ │ ├── ZipFile.Selector.cs
│ │ │ │ ├── ZipFile.cs
│ │ │ │ ├── ZipFile.x-IEnumerable.cs
│ │ │ │ ├── ZipInputStream.cs
│ │ │ │ ├── ZipOutputStream.cs
│ │ │ │ └── ZipSegmentedStream.cs
│ │ │ ├── Zlib.cs
│ │ │ ├── ZlibBaseStream.cs
│ │ │ ├── ZlibCodec.cs
│ │ │ ├── ZlibConstants.cs
│ │ │ └── ZlibStream.cs
│ │ ├── DataTypes.cs
│ │ ├── Forge
│ │ │ ├── FMLHandshakeClientState.cs
│ │ │ ├── FMLHandshakeDiscriminator.cs
│ │ │ ├── FMLVersion.cs
│ │ │ └── ForgeInfo.cs
│ │ ├── PacketPalettes
│ │ │ ├── PacketPalette110.cs
│ │ │ ├── PacketPalette112.cs
│ │ │ ├── PacketPalette1122.cs
│ │ │ ├── PacketPalette113.cs
│ │ │ ├── PacketPalette114.cs
│ │ │ ├── PacketPalette115.cs
│ │ │ ├── PacketPalette116.cs
│ │ │ ├── PacketPalette1162.cs
│ │ │ ├── PacketPalette117.cs
│ │ │ ├── PacketPalette118.cs
│ │ │ ├── PacketPalette17.cs
│ │ │ ├── PacketPaletteHelper.cs
│ │ │ └── PacketTypePalette.cs
│ │ ├── PacketType18Handler.cs
│ │ ├── PacketTypesIn.cs
│ │ ├── PacketTypesOut.cs
│ │ ├── Protocol16.cs
│ │ ├── Protocol18.cs
│ │ ├── Protocol18Forge.cs
│ │ ├── Protocol18Terrain.cs
│ │ ├── SocketWrapper.cs
│ │ └── ZlibUtils.cs
│ ├── IMinecraftCom.cs
│ ├── IMinecraftComHandler.cs
│ ├── JwtPayloadDecode.cs
│ ├── MicrosoftAuthentication.cs
│ ├── MojangAPI.cs
│ ├── ProtocolHandler.cs
│ ├── ProxiedWebRequest.cs
│ ├── ReplayHandler.cs
│ └── Session
│ │ ├── CacheType.cs
│ │ ├── SessionCache.cs
│ │ └── SessionToken.cs
├── Proxy
│ ├── Handlers
│ │ ├── EventArgs
│ │ │ └── CreateConnectionAsyncCompletedEventArgs.cs
│ │ ├── Exceptions
│ │ │ └── ProxyException.cs
│ │ ├── HttpProxyClient.cs
│ │ ├── IProxyClient.cs
│ │ ├── ProxyClientFactory.cs
│ │ ├── Socks4ProxyClient.cs
│ │ ├── Socks4aProxyClient.cs
│ │ ├── Socks5ProxyClient.cs
│ │ └── Utils.cs
│ └── ProxyHandler.cs
├── Resources
│ ├── AppIcon.ico
│ ├── appicon_creeper1.ico
│ ├── appicon_grassblock.ico
│ ├── appicon_terminal.ico
│ ├── config
│ │ └── MinecraftClient.ini
│ ├── containers
│ │ ├── ContainerType.BrewingStand.txt
│ │ ├── ContainerType.Crafting.txt
│ │ ├── ContainerType.Generic_3x3.txt
│ │ ├── ContainerType.Generic_9x3.txt
│ │ ├── ContainerType.Generic_9x6.txt
│ │ └── ContainerType.PlayerInventory.txt
│ └── lang
│ │ ├── de.ini
│ │ ├── en.ini
│ │ ├── fr.ini
│ │ ├── ru.ini
│ │ └── zh-CHS.ini
├── Settings.cs
├── TaskWithDelay.cs
├── TaskWithResult.cs
├── Translations.cs
├── WinAPI
│ ├── ConsoleIcon.cs
│ ├── ExitCleanUp.cs
│ └── WindowsVersion.cs
└── config
│ ├── ChatBots
│ ├── AutoLook.cs
│ ├── AutoTree.cs
│ ├── ClckRuAPI.cs
│ ├── CobblestoneMiner.cs
│ ├── DiscordWebhook.cs
│ ├── MineCube.cs
│ ├── OreMiner.cs
│ ├── PayKassa.cs
│ ├── QIWIAPI.cs
│ ├── SugarCaneFarmer.cs
│ ├── SugarCaneMiner.cs
│ ├── TreeFarmer.cs
│ └── VkMessager.cs
│ ├── README.md
│ ├── alerts-exclude.txt
│ ├── alerts.txt
│ ├── hangman-en.txt
│ ├── hangman-fr.txt
│ ├── kickmessages.txt
│ ├── sample-accounts.txt
│ ├── sample-matches.ini
│ ├── sample-script-extended.cs
│ ├── sample-script-pm-forwarder.cs
│ ├── sample-script-random-command.cs
│ ├── sample-script-with-chatbot.cs
│ ├── sample-script-with-http-request.cs
│ ├── sample-script-with-task.cs
│ ├── sample-script-with-world-access.cs
│ ├── sample-script.cs
│ ├── sample-script.txt
│ ├── sample-servers.txt
│ └── sample-tasks.ini
├── MinecraftClientGUI.sln
├── MinecraftClientGUI
├── .gitignore
├── AppIcon.ico
├── Form1.Designer.cs
├── Form1.cs
├── Form1.resx
├── MinecraftClient.cs
├── MinecraftClientGUI.csproj
├── MinecraftClientGUI.csproj.user
├── Program.cs
└── Properties
│ ├── AssemblyInfo.cs
│ ├── Resources.Designer.cs
│ ├── Resources.resx
│ ├── Settings.Designer.cs
│ └── Settings.settings
├── README-zh-Hans.md
└── README.md
/.github/ISSUE_TEMPLATE/feature_request_form.yaml:
--------------------------------------------------------------------------------
1 | name: Feature Request
2 | description: Suggest an idea for this project
3 | title: "[Idea] "
4 | labels:
5 | - "a:enhancement"
6 | - "a:new-feature"
7 | body:
8 | - type: checkboxes
9 | id: prerequisites
10 | attributes:
11 | label: Prerequisites
12 | options:
13 | - label: I have read and understood the [user manual](https://github.com/MCCTeam/Minecraft-Console-Client/tree/master/MinecraftClient/config)
14 | required: true
15 | - label: I made sure I am running the latest [development build](https://ci.appveyor.com/project/ORelio/Minecraft-Console-Client/build/artifacts)
16 | required: true
17 | - label: I tried to [look for similar feature requests](https://github.com/MCCTeam/Minecraft-Console-Client/issues?q=is%3Aissue) before opening a new one
18 | required: true
19 | - type: input
20 | id: client-version
21 | attributes:
22 | label: Console Client Version
23 | description: Please make sure you are using the latest version
24 | placeholder: Latest
25 | validations:
26 | required: true
27 | - type: textarea
28 | id: problem
29 | attributes:
30 | label: Describe your problem
31 | placeholder: What feature is lacking?
32 | validations:
33 | required: true
34 | - type: textarea
35 | id: solution
36 | attributes:
37 | label: Suggest a possible solution
38 | placeholder: What do you want to happen?
39 | - type: textarea
40 | id: screenshot
41 | attributes:
42 | label: Attach screenshot here (If applicable)
43 | - type: input
44 | id: mc-version
45 | attributes:
46 | label: Minecraft Version
47 | placeholder: 1.x.x
48 | - type: dropdown
49 | id: device
50 | attributes:
51 | label: Device
52 | description: What device you are using to run the client?
53 | options:
54 | - Desktop
55 | - Laptop
56 | - VPS
57 | - Raspberry Pi
58 | - Other
59 | - type: dropdown
60 | id: operating-system
61 | attributes:
62 | label: Operating System
63 | description: What operating system is your device running?
64 | options:
65 | - Windows
66 | - Linux
67 | - MacOS
68 | - Other
69 | - type: markdown
70 | id: credit
71 | attributes:
72 | value: Thank you for filling the request form. Feel free to submit the request to us.
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | /DebugTools/MinecraftClientProxy.suo
2 | /DebugTools/MinecraftClientProxy.v11.suo
3 | /MinecraftClient.v11.suo
4 | /MinecraftClient.suo
5 | /MinecraftClientGUI.v11.suo
6 | /MinecraftClientGUI.suo
7 | /MinecraftClient.userprefs
8 | /Other/
9 | /.vs/
10 | SessionCache.ini
11 | .*
12 | !/.github
13 | /packages
--------------------------------------------------------------------------------
/.idea/.gitignore:
--------------------------------------------------------------------------------
1 | # Default ignored files
2 | /.idea.MinecraftClient/.idea/workspace.xml
3 |
--------------------------------------------------------------------------------
/DebugTools/MinecraftClientProxy.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 11.00
3 | # Visual Studio 2010
4 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MinecraftClientProxy", "MinecraftClientProxy\MinecraftClientProxy.csproj", "{025E4E4C-F38B-46F6-8492-61B732018B1E}"
5 | EndProject
6 | Global
7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
8 | Debug|x86 = Debug|x86
9 | Release|x86 = Release|x86
10 | EndGlobalSection
11 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
12 | {025E4E4C-F38B-46F6-8492-61B732018B1E}.Debug|x86.ActiveCfg = Debug|x86
13 | {025E4E4C-F38B-46F6-8492-61B732018B1E}.Debug|x86.Build.0 = Debug|x86
14 | {025E4E4C-F38B-46F6-8492-61B732018B1E}.Release|x86.ActiveCfg = Release|x86
15 | {025E4E4C-F38B-46F6-8492-61B732018B1E}.Release|x86.Build.0 = Release|x86
16 | EndGlobalSection
17 | GlobalSection(SolutionProperties) = preSolution
18 | HideSolutionNode = FALSE
19 | EndGlobalSection
20 | EndGlobal
21 |
--------------------------------------------------------------------------------
/DebugTools/MinecraftClientProxy/.gitignore:
--------------------------------------------------------------------------------
1 | /bin/
2 | /obj/
--------------------------------------------------------------------------------
/DebugTools/MinecraftClientProxy/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Net.Sockets;
6 | using System.Net;
7 | using MinecraftClient.Protocol.Handlers;
8 |
9 | namespace MinecraftClientProxy
10 | {
11 | class Program
12 | {
13 | static void Main(string[] args)
14 | {
15 | Console.WriteLine("Waiting for client on port 25565...");
16 | TcpListener listener = new TcpListener(IPAddress.Any, 25565);
17 | listener.Start();
18 | TcpClient client = listener.AcceptTcpClient();
19 |
20 | Console.WriteLine("Connecting to server on port 25566...");
21 | TcpClient server = new TcpClient("localhost", 25566);
22 |
23 | Console.WriteLine("Starting proxy...\n");
24 | new PacketProxy(client, server).Run();
25 |
26 | Console.ReadLine();
27 | }
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/DebugTools/MinecraftClientProxy/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("MinecraftClientProxy")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("MinecraftClientProxy")]
13 | [assembly: AssemblyCopyright("Copyright © 2015-2016 ORelio")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 | [assembly: ComVisible(false)]
21 |
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM
23 | [assembly: Guid("0a3e2a48-94e9-4b02-96dd-5884585c561e")]
24 |
25 | // Version information for an assembly consists of the following four values:
26 | //
27 | // Major Version
28 | // Minor Version
29 | // Build Number
30 | // Revision
31 | //
32 | // You can specify all the values or you can default the Build and Revision Numbers
33 | // by using the '*' as shown below:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/DebugTools/MinecraftClientProxy/ZlibUtils.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using Ionic.Zlib;
6 |
7 | namespace MinecraftClient.Protocol.Handlers
8 | {
9 | ///
10 | /// Quick Zlib compression handling for network packet compression.
11 | /// Note: Underlying compression handling is taken from the DotNetZip Library.
12 | /// This library is open source and provided under the Microsoft Public License.
13 | /// More info about DotNetZip at dotnetzip.codeplex.com.
14 | ///
15 |
16 | public static class ZlibUtils
17 | {
18 | ///
19 | /// Decompress a byte array into another byte array of the specified size
20 | ///
21 | /// Data to decompress
22 | /// Size of the data once decompressed
23 | /// Decompressed data as a byte array
24 |
25 | public static byte[] Decompress(byte[] to_decompress, int size_uncompressed)
26 | {
27 | ZlibStream stream = new ZlibStream(new System.IO.MemoryStream(to_decompress, false), CompressionMode.Decompress);
28 | byte[] packetData_decompressed = new byte[size_uncompressed];
29 | stream.Read(packetData_decompressed, 0, size_uncompressed);
30 | stream.Close();
31 | return packetData_decompressed;
32 | }
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/DebugTools/README.txt:
--------------------------------------------------------------------------------
1 | This part of the repository contains tools that may be useful for debugging
2 |
3 | MinecraftClientProxy
4 | A proxy between a MCC/Vanilla client and an offline-mode server which can intercept packets
5 | Useful to dump packets sent by a Vanilla minecraft client and compare them with packets from MCC
6 | Example of use case: https://github.com/MCCTeam/Minecraft-Console-Client/issues/195
--------------------------------------------------------------------------------
/Docker/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM mono:6.12.0
2 |
3 | COPY start-latest.sh /opt/start-latest.sh
4 |
5 | RUN apt-get update && \
6 | apt-get install -y jq && \
7 | mkdir /opt/data && \
8 | chmod +x /opt/start-latest.sh
9 |
10 | ENTRYPOINT ["/bin/sh", "-c", "/opt/start-latest.sh"]
--------------------------------------------------------------------------------
/Docker/docker-compose.yml:
--------------------------------------------------------------------------------
1 | version: '2'
2 |
3 | services:
4 | MCC:
5 | image: 'minecraft-console-client:latest'
6 | container_name: 'MinecraftConsoleClient'
7 | # You could also comment out the volumes section if you don't want to mount the volume. That is up to you. If you do so it's harder to edit the .ini file if thats something you want to do.
8 | volumes:
9 | - './data:/opt/data'
10 |
--------------------------------------------------------------------------------
/Docker/start-latest.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | cd /opt/data || exit 1
4 |
5 | # Get latest Job ID
6 | JOB_ID=$(curl -L https://ci.appveyor.com/api/projects/ORelio/minecraft-console-client | jq -r .build.jobs[0].jobId)
7 |
8 | # Download latest version
9 | curl -L https://ci.appveyor.com/api/buildjobs/"$JOB_ID"/artifacts/MinecraftClient%2Fbin%2FRelease%2FMinecraftClient.exe --output MinecraftClient.exe
10 |
11 | # Start Client
12 | mono MinecraftClient.exe
--------------------------------------------------------------------------------
/MinecraftClient.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 11.00
3 | # Visual Studio 2010
4 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MinecraftClient", "MinecraftClient\MinecraftClient.csproj", "{1E2FACE4-F5CA-4323-9641-740C6A551770}"
5 | EndProject
6 | Global
7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
8 | Debug|x86 = Debug|x86
9 | Release|x86 = Release|x86
10 | EndGlobalSection
11 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
12 | {1E2FACE4-F5CA-4323-9641-740C6A551770}.Debug|x86.ActiveCfg = Debug|x86
13 | {1E2FACE4-F5CA-4323-9641-740C6A551770}.Debug|x86.Build.0 = Debug|x86
14 | {1E2FACE4-F5CA-4323-9641-740C6A551770}.Release|x86.ActiveCfg = Release|x86
15 | {1E2FACE4-F5CA-4323-9641-740C6A551770}.Release|x86.Build.0 = Release|x86
16 | EndGlobalSection
17 | GlobalSection(SolutionProperties) = preSolution
18 | HideSolutionNode = FALSE
19 | EndGlobalSection
20 | EndGlobal
21 |
--------------------------------------------------------------------------------
/MinecraftClient/.gitignore:
--------------------------------------------------------------------------------
1 | /bin/
2 | /obj/
3 | MinecraftClient.sln
4 | MinecraftClient.v11.suo
--------------------------------------------------------------------------------
/MinecraftClient/AutoTimeout.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Threading;
3 |
4 | namespace MinecraftClient
5 | {
6 | ///
7 | /// Allow easy timeout on pieces of code
8 | ///
9 | ///
10 | /// By ORelio - (c) 2014 - CDDL 1.0
11 | ///
12 | public class AutoTimeout
13 | {
14 | ///
15 | /// Perform the specified action with specified timeout
16 | ///
17 | /// Action to run
18 | /// Maximum timeout in milliseconds
19 | /// True if the action finished whithout timing out
20 | public static bool Perform(Action action, int timeout)
21 | {
22 | return Perform(action, TimeSpan.FromMilliseconds(timeout));
23 | }
24 |
25 | ///
26 | /// Perform the specified action with specified timeout
27 | ///
28 | /// Action to run
29 | /// Maximum timeout
30 | /// True if the action finished whithout timing out
31 | public static bool Perform(Action action, TimeSpan timeout)
32 | {
33 | Thread thread = new Thread(new ThreadStart(action));
34 | thread.Start();
35 | bool success = thread.Join(timeout);
36 | if (!success)
37 | thread.Abort();
38 | return success;
39 | }
40 | }
41 | }
--------------------------------------------------------------------------------
/MinecraftClient/ChatBots/AntiAFK.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace MinecraftClient.ChatBots
7 | {
8 | ///
9 | /// This bot sends a command every 60 seconds in order to stay non-afk.
10 | ///
11 |
12 | public class AntiAFK : ChatBot
13 | {
14 | private int count;
15 | private int timeping;
16 |
17 | ///
18 | /// This bot sends a /ping command every X seconds in order to stay non-afk.
19 | ///
20 | /// Time amount between each ping (10 = 1s, 600 = 1 minute, etc.)
21 |
22 | public AntiAFK(int pingparam)
23 | {
24 | count = 0;
25 | timeping = pingparam;
26 | if (timeping < 10) { timeping = 10; } //To avoid flooding
27 | }
28 |
29 | public override void Update()
30 | {
31 | count++;
32 | if (count == timeping)
33 | {
34 | SendText(Settings.AntiAFK_Command);
35 | count = 0;
36 | }
37 | }
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/MinecraftClient/ChatBots/PlayerListLogger.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace MinecraftClient.ChatBots
7 | {
8 | ///
9 | /// This bot sends a /list command every X seconds and save the result.
10 | ///
11 |
12 | public class PlayerListLogger : ChatBot
13 | {
14 | private int count;
15 | private int timeping;
16 | private string file;
17 |
18 | ///
19 | /// This bot sends a /list command every X seconds and save the result.
20 | ///
21 | /// Time amount between each list ping (10 = 1s, 600 = 1 minute, etc.)
22 |
23 | public PlayerListLogger(int pingparam, string filetosavein)
24 | {
25 | count = 0;
26 | file = filetosavein;
27 | timeping = pingparam;
28 | if (timeping < 10) { timeping = 10; } //To avoid flooding
29 |
30 | }
31 |
32 | public override void Update()
33 | {
34 | count++;
35 | if (count == timeping)
36 | {
37 | SendText("/list");
38 | count = 0;
39 | }
40 | }
41 |
42 | public override void GetText(string text)
43 | {
44 | if (text.Contains("Joueurs en ligne") || text.Contains("Connected:") || text.Contains("online:"))
45 | {
46 | LogToConsole("Saving Player List");
47 | DateTime now = DateTime.Now;
48 | string TimeStamp = "[" + now.Year + '/' + now.Month + '/' + now.Day + ' ' + now.Hour + ':' + now.Minute + ']';
49 | System.IO.File.AppendAllText(file, TimeStamp + "\n" + GetVerbatim(text) + "\n\n");
50 | }
51 | }
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/MinecraftClient/ChatBots/RemoteControl.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace MinecraftClient.ChatBots
7 | {
8 | ///
9 | /// Allow to perform operations using whispers to the bot
10 | ///
11 |
12 | public class RemoteControl : ChatBot
13 | {
14 | public override void GetText(string text)
15 | {
16 | text = GetVerbatim(text);
17 | string command = "", sender = "";
18 | if (IsPrivateMessage(text, ref command, ref sender) && Settings.Bots_Owners.Contains(sender.ToLower().Trim()))
19 | {
20 | string response = "";
21 | PerformInternalCommand(command, ref response);
22 | response = GetVerbatim(response);
23 | foreach (char disallowedChar in McClient.GetDisallowedChatCharacters())
24 | {
25 | response = response.Replace(disallowedChar.ToString(), String.Empty);
26 | }
27 | if (response.Length > 0)
28 | {
29 | SendPrivateMessage(sender, response);
30 | }
31 | }
32 | else if (Settings.RemoteCtrl_AutoTpaccept
33 | && IsTeleportRequest(text, ref sender)
34 | && (Settings.RemoteCtrl_AutoTpaccept_Everyone || Settings.Bots_Owners.Contains(sender.ToLower().Trim())))
35 | {
36 | SendText("/tpaccept");
37 | }
38 | }
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/MinecraftClient/ChatBots/TestBot.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace MinecraftClient.ChatBots
7 | {
8 | ///
9 | /// Example of message receiving.
10 | ///
11 |
12 | public class TestBot : ChatBot
13 | {
14 | public override void GetText(string text)
15 | {
16 | string message = "";
17 | string username = "";
18 | text = GetVerbatim(text);
19 |
20 | if (IsPrivateMessage(text, ref message, ref username))
21 | {
22 | LogToConsoleTranslated("bot.testBot.told", username, message);
23 | }
24 | else if (IsChatMessage(text, ref message, ref username))
25 | {
26 | LogToConsoleTranslated("bot.testBot.said", username, message);
27 | }
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/MinecraftClient/Commands/Animation.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace MinecraftClient.Commands
7 | {
8 | public class Animation : Command
9 | {
10 | public override string CmdName { get { return "animation"; } }
11 | public override string CmdUsage { get { return "animation "; } }
12 | public override string CmdDesc { get { return "cmd.animation.desc"; } }
13 |
14 | public override string Run(McClient handler, string command, Dictionary localVars)
15 | {
16 | if (hasArg(command))
17 | {
18 | string[] args = getArgs(command);
19 | if (args.Length > 0)
20 | {
21 | if (args[0] == "mainhand" || args[0] == "0")
22 | {
23 | handler.DoAnimation(0);
24 | return Translations.Get("general.done");
25 | }
26 | else if (args[0] == "offhand" || args[0] == "1")
27 | {
28 | handler.DoAnimation(1);
29 | return Translations.Get("general.done");
30 | }
31 | else
32 | {
33 | return GetCmdDescTranslated();
34 | }
35 | }
36 | else
37 | {
38 | return GetCmdDescTranslated();
39 | }
40 | }
41 | else return GetCmdDescTranslated();
42 | }
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/MinecraftClient/Commands/ChangeSlot.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace MinecraftClient.Commands
7 | {
8 | class ChangeSlot : Command
9 | {
10 | public override string CmdName { get { return "changeslot"; } }
11 | public override string CmdUsage { get { return "changeslot <1-9>"; } }
12 | public override string CmdDesc { get { return "cmd.changeSlot.desc"; } }
13 |
14 | public override string Run(McClient handler, string command, Dictionary localVars)
15 | {
16 | if (!handler.GetInventoryEnabled())
17 | return Translations.Get("extra.inventory_required");
18 |
19 | if (hasArg(command))
20 | {
21 | short slot;
22 | try
23 | {
24 | slot = Convert.ToInt16(getArg(command));
25 | }
26 | catch (FormatException)
27 | {
28 | return Translations.Get("cmd.changeSlot.nan");
29 | }
30 | if (slot >= 1 && slot <= 9)
31 | {
32 | if (handler.ChangeSlot(slot-=1))
33 | {
34 | return Translations.Get("cmd.changeSlot.changed", (slot+=1));
35 | }
36 | else
37 | {
38 | return Translations.Get("cmd.changeSlot.fail");
39 | }
40 | }
41 | }
42 | return GetCmdDescTranslated();
43 | }
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/MinecraftClient/Commands/Connect.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace MinecraftClient.Commands
7 | {
8 | public class Connect : Command
9 | {
10 | public override string CmdName { get { return "connect"; } }
11 | public override string CmdUsage { get { return "connect [account]"; } }
12 | public override string CmdDesc { get { return "cmd.connect.desc"; } }
13 |
14 | public override string Run(McClient handler, string command, Dictionary localVars)
15 | {
16 | if (hasArg(command))
17 | {
18 | string[] args = getArgs(command);
19 | if (args.Length > 1)
20 | {
21 | if (!Settings.SetAccount(args[1]))
22 | {
23 | return Translations.Get("cmd.connect.unknown", args[1]);
24 | }
25 | }
26 |
27 | if (Settings.SetServerIP(args[0]))
28 | {
29 | Program.Restart();
30 | return "";
31 | }
32 | else return Translations.Get("cmd.connect.invalid_ip", args[0]);
33 | }
34 | else return GetCmdDescTranslated();
35 | }
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/MinecraftClient/Commands/Debug.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace MinecraftClient.Commands
7 | {
8 | public class Debug : Command
9 | {
10 | public override string CmdName { get { return "debug"; } }
11 | public override string CmdUsage { get { return "debug [on|off]"; } }
12 | public override string CmdDesc { get { return "cmd.debug.desc"; } }
13 |
14 | public override string Run(McClient handler, string command, Dictionary localVars)
15 | {
16 | if (hasArg(command))
17 | {
18 | Settings.DebugMessages = (getArg(command).ToLower() == "on");
19 | }
20 | else Settings.DebugMessages = !Settings.DebugMessages;
21 | return Translations.Get(Settings.DebugMessages ? "cmd.debug.state_on" : "cmd.debug.state_off");
22 | }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/MinecraftClient/Commands/Dig.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using MinecraftClient.Mapping;
6 |
7 | namespace MinecraftClient.Commands
8 | {
9 | public class Dig : Command
10 | {
11 | public override string CmdName { get { return "dig"; } }
12 | public override string CmdUsage { get { return "dig "; } }
13 | public override string CmdDesc { get { return "cmd.dig.desc"; } }
14 |
15 | public override string Run(McClient handler, string command, Dictionary localVars)
16 | {
17 | if (!handler.GetTerrainEnabled())
18 | return Translations.Get("extra.terrainandmovement_required");
19 |
20 | if (hasArg(command))
21 | {
22 | string[] args = getArgs(command);
23 | if (args.Length == 3)
24 | {
25 | try
26 | {
27 | int x = int.Parse(args[0]);
28 | int y = int.Parse(args[1]);
29 | int z = int.Parse(args[2]);
30 | Location blockToBreak = new Location(x, y, z);
31 | if (blockToBreak.DistanceSquared(handler.GetCurrentLocation().EyesLocation()) > 25)
32 | return Translations.Get("cmd.dig.too_far");
33 | if (handler.GetWorld().GetBlock(blockToBreak).Type == Material.Air)
34 | return Translations.Get("cmd.dig.no_block");
35 | if (handler.DigBlock(blockToBreak))
36 | return Translations.Get("cmd.dig.dig", x, y, z);
37 | else return "cmd.dig.fail";
38 | }
39 | catch (FormatException) { return GetCmdDescTranslated(); }
40 | }
41 | else return GetCmdDescTranslated();
42 | }
43 | else return GetCmdDescTranslated();
44 | }
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/MinecraftClient/Commands/DropItem.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using MinecraftClient.Inventory;
6 |
7 | namespace MinecraftClient.Commands
8 | {
9 | class DropItem : Command
10 | {
11 | public override string CmdName { get { return "dropitem"; } }
12 |
13 | public override string CmdDesc { get { return "cmd.dropItem.desc"; } }
14 |
15 | public override string CmdUsage { get { return "/dropitem "; } }
16 |
17 | public override string Run(McClient handler, string command, Dictionary localVars)
18 | {
19 | if (!handler.GetInventoryEnabled())
20 | {
21 | return Translations.Get("extra.inventory_required");
22 | }
23 | if (hasArg(command))
24 | {
25 | string arg = getArg(command);
26 | ItemType itemType;
27 | if (Enum.TryParse(arg, true, out itemType))
28 | {
29 | int inventoryId;
30 | var inventories = handler.GetInventories();
31 | List availableIds = inventories.Keys.ToList();
32 | availableIds.Remove(0); // remove player inventory ID from list
33 | if (availableIds.Count == 1)
34 | inventoryId = availableIds[0]; // one container, use it
35 | else
36 | inventoryId = 0;
37 | var p = inventories[inventoryId];
38 | int[] targetItems = p.SearchItem(itemType);
39 | foreach (int slot in targetItems)
40 | {
41 | handler.DoWindowAction(inventoryId, slot, WindowActionType.DropItemStack);
42 | }
43 | return Translations.Get("cmd.dropItem.dropped", itemType.ToString(), inventoryId);
44 | }
45 | else
46 | {
47 | return Translations.Get("cmd.dropItem.unknown_item", arg);
48 | }
49 | }
50 | else
51 | {
52 | return CmdUsage;
53 | }
54 | }
55 | }
56 | }
57 |
--------------------------------------------------------------------------------
/MinecraftClient/Commands/Exit.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace MinecraftClient.Commands
7 | {
8 | public class Exit : Command
9 | {
10 | public override string CmdName { get { return "exit"; } }
11 | public override string CmdUsage { get { return "exit"; } }
12 | public override string CmdDesc { get { return "cmd.exit.desc"; } }
13 |
14 | public override string Run(McClient handler, string command, Dictionary localVars)
15 | {
16 | Program.Exit();
17 | return "";
18 | }
19 |
20 | public override IEnumerable getCMDAliases()
21 | {
22 | return new string[] { "quit" };
23 | }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/MinecraftClient/Commands/Health.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace MinecraftClient.Commands
7 | {
8 | class Health : Command
9 | {
10 | public override string CmdName { get { return "health"; } }
11 | public override string CmdUsage { get { return "health"; } }
12 | public override string CmdDesc { get { return "cmd.health.desc"; } }
13 |
14 | public override string Run(McClient handler, string command, Dictionary localVars)
15 | {
16 | return Translations.Get("cmd.health.response", handler.GetHealth(), handler.GetSaturation(), handler.GetLevel(), handler.GetTotalExperience());
17 | }
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/MinecraftClient/Commands/List.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace MinecraftClient.Commands
7 | {
8 | public class List : Command
9 | {
10 | public override string CmdName { get { return "list"; } }
11 | public override string CmdUsage { get { return "list"; } }
12 | public override string CmdDesc { get { return "cmd.list.desc"; } }
13 |
14 | public override string Run(McClient handler, string command, Dictionary localVars)
15 | {
16 | return Translations.Get("cmd.list.players", String.Join(", ", handler.GetOnlinePlayers()));
17 | }
18 | }
19 | }
20 |
21 |
--------------------------------------------------------------------------------
/MinecraftClient/Commands/Log.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace MinecraftClient.Commands
7 | {
8 | public class Log : Command
9 | {
10 | public override string CmdName { get { return "log"; } }
11 | public override string CmdUsage { get { return "log "; } }
12 | public override string CmdDesc { get { return "cmd.log.desc"; } }
13 |
14 | public override string Run(McClient handler, string command, Dictionary localVars)
15 | {
16 | if (hasArg(command))
17 | {
18 | ConsoleIO.WriteLogLine(getArg(command));
19 | return "";
20 | }
21 | else return GetCmdDescTranslated();
22 | }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/MinecraftClient/Commands/Reco.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace MinecraftClient.Commands
7 | {
8 | public class Reco : Command
9 | {
10 | public override string CmdName { get { return "reco"; } }
11 | public override string CmdUsage { get { return "reco [account]"; } }
12 | public override string CmdDesc { get { return "cmd.reco.desc"; } }
13 |
14 | public override string Run(McClient handler, string command, Dictionary localVars)
15 | {
16 | string[] args = getArgs(command);
17 | if (args.Length > 0)
18 | {
19 | if (!Settings.SetAccount(args[0]))
20 | {
21 | return Translations.Get("cmd.connect.unknown", args[0]);
22 | }
23 | }
24 | Program.Restart();
25 | return "";
26 | }
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/MinecraftClient/Commands/Respawn.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace MinecraftClient.Commands
7 | {
8 | public class Respawn : Command
9 | {
10 | public override string CmdName { get { return "respawn"; } }
11 | public override string CmdUsage { get { return "respawn"; } }
12 | public override string CmdDesc { get { return "cmd.respawn.desc"; } }
13 |
14 | public override string Run(McClient handler, string command, Dictionary localVars)
15 | {
16 | handler.SendRespawnPacket();
17 | return Translations.Get("cmd.respawn.done");
18 | }
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/MinecraftClient/Commands/Script.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace MinecraftClient.Commands
7 | {
8 | public class Script : Command
9 | {
10 | public override string CmdName { get { return "script"; } }
11 | public override string CmdUsage { get { return "script "; } }
12 | public override string CmdDesc { get { return "cmd.script.desc"; } }
13 |
14 | public override string Run(McClient handler, string command, Dictionary localVars)
15 | {
16 | if (hasArg(command))
17 | {
18 | handler.BotLoad(new ChatBots.Script(getArg(command), null, localVars));
19 | return "";
20 | }
21 | else return GetCmdDescTranslated();
22 | }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/MinecraftClient/Commands/Send.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace MinecraftClient.Commands
7 | {
8 | public class Send : Command
9 | {
10 | public override string CmdName { get { return "send"; } }
11 | public override string CmdUsage { get { return "send "; } }
12 | public override string CmdDesc { get { return "cmd.send.desc"; } }
13 |
14 | public override string Run(McClient handler, string command, Dictionary localVars)
15 | {
16 | if (hasArg(command))
17 | {
18 | handler.SendText(getArg(command));
19 | return "";
20 | }
21 | else return GetCmdDescTranslated();
22 | }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/MinecraftClient/Commands/Set.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace MinecraftClient.Commands
7 | {
8 | public class Set : Command
9 | {
10 | public override string CmdName { get { return "set"; } }
11 | public override string CmdUsage { get { return "set varname=value"; } }
12 | public override string CmdDesc { get { return "cmd.set.desc"; } }
13 |
14 | public override string Run(McClient handler, string command, Dictionary localVars)
15 | {
16 | if (hasArg(command))
17 | {
18 | string[] temp = getArg(command).Split('=');
19 | if (temp.Length > 1)
20 | {
21 | if (Settings.SetVar(temp[0], getArg(command).Substring(temp[0].Length + 1)))
22 | {
23 | return ""; //Success
24 | }
25 | else return Translations.Get("cmd.set.format");
26 | }
27 | else return GetCmdDescTranslated();
28 | }
29 | else return GetCmdDescTranslated();
30 | }
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/MinecraftClient/Commands/Sneak.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace MinecraftClient.Commands
7 | {
8 | public class Sneak : Command
9 | {
10 | private bool sneaking = false;
11 | public override string CmdName { get { return "Sneak"; } }
12 | public override string CmdUsage { get { return "Sneak"; } }
13 | public override string CmdDesc { get { return "cmd.sneak.desc"; } }
14 |
15 | public override string Run(McClient handler, string command, Dictionary localVars)
16 | {
17 | if (sneaking)
18 | {
19 | var result = handler.SendEntityAction(Protocol.EntityActionType.StopSneaking);
20 | if (result)
21 | sneaking = false;
22 | return Translations.Get(result ? "cmd.sneak.off" : "general.fail");
23 | }
24 | else
25 | {
26 | var result = handler.SendEntityAction(Protocol.EntityActionType.StartSneaking);
27 | if (result)
28 | sneaking = true;
29 | return Translations.Get(result ? "cmd.sneak.on" : "general.fail");
30 | }
31 |
32 | }
33 | }
34 | }
--------------------------------------------------------------------------------
/MinecraftClient/Commands/Tps.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace MinecraftClient.Commands
7 | {
8 | class Tps : Command
9 | {
10 | public override string CmdName { get { return "tps"; } }
11 | public override string CmdUsage { get { return "tps"; } }
12 | public override string CmdDesc { get { return "cmd.tps.desc"; } }
13 |
14 | public override string Run(McClient handler, string command, Dictionary localVars)
15 | {
16 | var tps = Math.Round(handler.GetServerTPS(), 2);
17 | string color;
18 | if (tps < 10)
19 | color = "§c"; // Red
20 | else if (tps < 15)
21 | color = "§e"; // Yellow
22 | else color = "§a"; // Green
23 | return Translations.Get("cmd.tps.current") + ": " + color + tps;
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/MinecraftClient/Commands/UseItem.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace MinecraftClient.Commands
7 | {
8 | class UseItem : Command
9 | {
10 | public override string CmdName { get { return "useitem"; } }
11 | public override string CmdUsage { get { return "useitem"; } }
12 | public override string CmdDesc { get { return "cmd.useitem.desc"; } }
13 |
14 | public override string Run(McClient handler, string command, Dictionary localVars)
15 | {
16 | if (handler.GetInventoryEnabled())
17 | {
18 | handler.UseItemOnHand();
19 | return Translations.Get("cmd.useitem.use");
20 | }
21 | else return Translations.Get("extra.inventory_required");
22 | }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/MinecraftClient/Commands/Useblock.cs:
--------------------------------------------------------------------------------
1 | using MinecraftClient.Mapping;
2 | using System;
3 | using System.Collections.Generic;
4 | using System.Linq;
5 | using System.Text;
6 |
7 | namespace MinecraftClient.Commands
8 | {
9 | class Useblock : Command
10 | {
11 | public override string CmdName { get { return "useblock"; } }
12 | public override string CmdUsage { get { return "useblock "; } }
13 | public override string CmdDesc { get { return "cmd.useblock.desc"; } }
14 |
15 | public override string Run(McClient handler, string command, Dictionary localVars)
16 | {
17 | if (!handler.GetTerrainEnabled()) return Translations.Get("extra.terrainandmovement_required");
18 | if (hasArg(command))
19 | {
20 | string[] args = getArgs(command);
21 | if (args.Length >= 3)
22 | {
23 | int x = Convert.ToInt32(args[0]);
24 | int y = Convert.ToInt32(args[1]);
25 | int z = Convert.ToInt32(args[2]);
26 | handler.PlaceBlock(new Location(x, y, z), Direction.Down);
27 | }
28 | else { return GetCmdDescTranslated(); }
29 | }
30 | return GetCmdDescTranslated();
31 | }
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/MinecraftClient/Crypto/IAesStream.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace MinecraftClient.Crypto
7 | {
8 | ///
9 | /// Interface for AES stream
10 | /// Allows to use a different implementation depending on the framework being used.
11 | ///
12 |
13 | public interface IAesStream
14 | {
15 | int Read(byte[] buffer, int offset, int count);
16 | void Write(byte[] buffer, int offset, int count);
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/MinecraftClient/Crypto/Streams/BouncyAes/Check.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Org.BouncyCastle.Crypto
4 | {
5 | internal class Check
6 | {
7 | internal static void DataLength(bool condition, string msg)
8 | {
9 | if (condition)
10 | throw new DataLengthException(msg);
11 | }
12 |
13 | internal static void DataLength(byte[] buf, int off, int len, string msg)
14 | {
15 | if (off + len > buf.Length)
16 | throw new DataLengthException(msg);
17 | }
18 |
19 | internal static void OutputLength(byte[] buf, int off, int len, string msg)
20 | {
21 | if (off + len > buf.Length)
22 | throw new OutputLengthException(msg);
23 | }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/MinecraftClient/Crypto/Streams/BouncyAes/CryptoException.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Org.BouncyCastle.Crypto
4 | {
5 | #if !(NETCF_1_0 || NETCF_2_0 || SILVERLIGHT)
6 | [Serializable]
7 | #endif
8 | public class CryptoException
9 | : Exception
10 | {
11 | public CryptoException()
12 | {
13 | }
14 |
15 | public CryptoException(
16 | string message)
17 | : base(message)
18 | {
19 | }
20 |
21 | public CryptoException(
22 | string message,
23 | Exception exception)
24 | : base(message, exception)
25 | {
26 | }
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/MinecraftClient/Crypto/Streams/BouncyAes/DataLengthException.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Org.BouncyCastle.Crypto
4 | {
5 | /**
6 | * this exception is thrown if a buffer that is meant to have output
7 | * copied into it turns out to be too short, or if we've been given
8 | * insufficient input. In general this exception will Get thrown rather
9 | * than an ArrayOutOfBounds exception.
10 | */
11 | #if !(NETCF_1_0 || NETCF_2_0 || SILVERLIGHT)
12 | [Serializable]
13 | #endif
14 | public class DataLengthException
15 | : CryptoException
16 | {
17 | /**
18 | * base constructor.
19 | */
20 | public DataLengthException()
21 | {
22 | }
23 |
24 | /**
25 | * create a DataLengthException with the given message.
26 | *
27 | * @param message the message to be carried with the exception.
28 | */
29 | public DataLengthException(
30 | string message)
31 | : base(message)
32 | {
33 | }
34 |
35 | public DataLengthException(
36 | string message,
37 | Exception exception)
38 | : base(message, exception)
39 | {
40 | }
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/MinecraftClient/Crypto/Streams/BouncyAes/IBlockCipher.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Org.BouncyCastle.Crypto
4 | {
5 | /// Base interface for a symmetric key block cipher.
6 | public interface IBlockCipher
7 | {
8 | /// The name of the algorithm this cipher implements.
9 | string AlgorithmName { get; }
10 |
11 | /// Initialise the cipher.
12 | /// Initialise for encryption if true, for decryption if false.
13 | /// The key or other data required by the cipher.
14 | void Init(bool forEncryption, ICipherParameters parameters);
15 |
16 | /// The block size for this cipher, in bytes.
17 | int GetBlockSize();
18 |
19 | /// Indicates whether this cipher can handle partial blocks.
20 | bool IsPartialBlockOkay { get; }
21 |
22 | /// Process a block.
23 | /// The input buffer.
24 | /// The offset into inBuf that the input block begins.
25 | /// The output buffer.
26 | /// The offset into outBuf to write the output block.
27 | /// If input block is wrong size, or outBuf too small.
28 | /// The number of bytes processed and produced.
29 | int ProcessBlock(byte[] inBuf, int inOff, byte[] outBuf, int outOff);
30 |
31 | ///
32 | /// Reset the cipher to the same state as it was after the last init (if there was one).
33 | ///
34 | void Reset();
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/MinecraftClient/Crypto/Streams/BouncyAes/IBufferedCipher.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Org.BouncyCastle.Crypto
4 | {
5 | /// Block cipher engines are expected to conform to this interface.
6 | public interface IBufferedCipher
7 | {
8 | /// The name of the algorithm this cipher implements.
9 | string AlgorithmName { get; }
10 |
11 | /// Initialise the cipher.
12 | /// If true the cipher is initialised for encryption,
13 | /// if false for decryption.
14 | /// The key and other data required by the cipher.
15 | void Init(bool forEncryption, ICipherParameters parameters);
16 |
17 | int GetBlockSize();
18 |
19 | int GetOutputSize(int inputLen);
20 |
21 | int GetUpdateOutputSize(int inputLen);
22 |
23 | byte[] ProcessByte(byte input);
24 | int ProcessByte(byte input, byte[] output, int outOff);
25 |
26 | byte[] ProcessBytes(byte[] input);
27 | byte[] ProcessBytes(byte[] input, int inOff, int length);
28 | int ProcessBytes(byte[] input, byte[] output, int outOff);
29 | int ProcessBytes(byte[] input, int inOff, int length, byte[] output, int outOff);
30 |
31 | byte[] DoFinal();
32 | byte[] DoFinal(byte[] input);
33 | byte[] DoFinal(byte[] input, int inOff, int length);
34 | int DoFinal(byte[] output, int outOff);
35 | int DoFinal(byte[] input, byte[] output, int outOff);
36 | int DoFinal(byte[] input, int inOff, int length, byte[] output, int outOff);
37 |
38 | ///
39 | /// Reset the cipher. After resetting the cipher is in the same state
40 | /// as it was after the last init (if there was one).
41 | ///
42 | void Reset();
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/MinecraftClient/Crypto/Streams/BouncyAes/ICipherParameters.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Org.BouncyCastle.Crypto
4 | {
5 | /**
6 | * all parameter classes implement this.
7 | */
8 | public interface ICipherParameters
9 | {
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/MinecraftClient/Crypto/Streams/BouncyAes/KeyParameter.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | using Org.BouncyCastle.Crypto;
4 |
5 | namespace Org.BouncyCastle.Crypto.Parameters
6 | {
7 | public class KeyParameter
8 | : ICipherParameters
9 | {
10 | private readonly byte[] key;
11 |
12 | public KeyParameter(
13 | byte[] key)
14 | {
15 | if (key == null)
16 | throw new ArgumentNullException("key");
17 |
18 | this.key = (byte[]) key.Clone();
19 | }
20 |
21 | public KeyParameter(
22 | byte[] key,
23 | int keyOff,
24 | int keyLen)
25 | {
26 | if (key == null)
27 | throw new ArgumentNullException("key");
28 | if (keyOff < 0 || keyOff > key.Length)
29 | throw new ArgumentOutOfRangeException("keyOff");
30 | if (keyLen < 0 || (keyOff + keyLen) > key.Length)
31 | throw new ArgumentOutOfRangeException("keyLen");
32 |
33 | this.key = new byte[keyLen];
34 | Array.Copy(key, keyOff, this.key, 0, keyLen);
35 | }
36 |
37 | public byte[] GetKey()
38 | {
39 | return (byte[]) key.Clone();
40 | }
41 | }
42 |
43 | }
44 |
--------------------------------------------------------------------------------
/MinecraftClient/Crypto/Streams/BouncyAes/OutputLengthException.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Org.BouncyCastle.Crypto
4 | {
5 | #if !(NETCF_1_0 || NETCF_2_0 || SILVERLIGHT)
6 | [Serializable]
7 | #endif
8 | public class OutputLengthException
9 | : DataLengthException
10 | {
11 | public OutputLengthException()
12 | {
13 | }
14 |
15 | public OutputLengthException(
16 | string message)
17 | : base(message)
18 | {
19 | }
20 |
21 | public OutputLengthException(
22 | string message,
23 | Exception exception)
24 | : base(message, exception)
25 | {
26 | }
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/MinecraftClient/Crypto/Streams/BouncyAes/ParametersWithIV.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Org.BouncyCastle.Crypto.Parameters
4 | {
5 | public class ParametersWithIV
6 | : ICipherParameters
7 | {
8 | private readonly ICipherParameters parameters;
9 | private readonly byte[] iv;
10 |
11 | public ParametersWithIV(
12 | ICipherParameters parameters,
13 | byte[] iv)
14 | : this(parameters, iv, 0, iv.Length)
15 | {
16 | }
17 |
18 | public ParametersWithIV(
19 | ICipherParameters parameters,
20 | byte[] iv,
21 | int ivOff,
22 | int ivLen)
23 | {
24 | // NOTE: 'parameters' may be null to imply key re-use
25 | if (iv == null)
26 | throw new ArgumentNullException("iv");
27 |
28 | this.parameters = parameters;
29 | this.iv = new byte[ivLen];
30 | Array.Copy(iv, ivOff, this.iv, 0, ivLen);
31 | }
32 |
33 | public byte[] GetIV()
34 | {
35 | return (byte[]) iv.Clone();
36 | }
37 |
38 | public ICipherParameters Parameters
39 | {
40 | get { return parameters; }
41 | }
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/MinecraftClient/Inventory/ContainerType.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace MinecraftClient.Inventory
7 | {
8 | // For MC 1.14 after ONLY
9 | public enum ContainerType
10 | {
11 | Generic_9x1,
12 | Generic_9x2,
13 | Generic_9x3, // chest, ender chest, minecart with chest, barrel
14 | Generic_9x4,
15 | Generic_9x5,
16 | Generic_9x6,
17 | Generic_3x3,
18 | Anvil,
19 | Beacon,
20 | BlastFurnace,
21 | BrewingStand,
22 | Crafting,
23 | Enchantment,
24 | Furnace,
25 | Grindstone,
26 | Hopper,
27 | Lectern,
28 | Loom,
29 | Merchant,
30 | ShulkerBox,
31 | Smoker,
32 | Cartography,
33 | Stonecutter,
34 | // not in the wiki.vg list
35 | PlayerInventory,
36 | Unknown
37 | }
38 | public enum ContainerTypeOld
39 | {
40 | CONTAINER,
41 | CHEST,
42 | CRAFTING_TABLE,
43 | FURNACE,
44 | DISPENSER,
45 | ENCHANTING_TABLE,
46 | BREWING_STAND,
47 | VILLAGER,
48 | BEACON,
49 | ANVIL,
50 | HOPPER,
51 | DROPPER,
52 | SHULKER_BOX,
53 | ENTITYHORSE
54 | }
55 | public static class ConvertType
56 | {
57 | public static ContainerType ToNew(ContainerTypeOld type)
58 | {
59 | switch (type)
60 | {
61 | case ContainerTypeOld.CONTAINER: return ContainerType.Unknown;
62 | case ContainerTypeOld.CHEST: return ContainerType.Generic_9x3;
63 | case ContainerTypeOld.CRAFTING_TABLE: return ContainerType.Crafting;
64 | case ContainerTypeOld.FURNACE: return ContainerType.Furnace;
65 | case ContainerTypeOld.DISPENSER: return ContainerType.Generic_3x3;
66 | case ContainerTypeOld.ENCHANTING_TABLE: return ContainerType.Enchantment;
67 | case ContainerTypeOld.BREWING_STAND: return ContainerType.BrewingStand;
68 | case ContainerTypeOld.VILLAGER: return ContainerType.Merchant;
69 | case ContainerTypeOld.HOPPER: return ContainerType.Hopper;
70 | case ContainerTypeOld.DROPPER: return ContainerType.Generic_3x3;
71 | case ContainerTypeOld.SHULKER_BOX: return ContainerType.ShulkerBox;
72 | case ContainerTypeOld.ENTITYHORSE: return ContainerType.Unknown;
73 | default: return ContainerType.Unknown;
74 | }
75 | }
76 | }
77 | }
78 |
--------------------------------------------------------------------------------
/MinecraftClient/Inventory/Effects.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace MinecraftClient.Inventory
8 | {
9 | ///
10 | /// Represents a Minecraft effects
11 | ///
12 | public enum Effects
13 | {
14 | Speed = 1,
15 | Slowness = 2,
16 | Haste = 3,
17 | MiningFatigue = 4,
18 | Strength = 5,
19 | InstantHealth = 6,
20 | InstantDamage = 7,
21 | JumpBoost = 8,
22 | Nausea = 9,
23 | Regeneration = 10,
24 | Resistance = 11,
25 | FireResistance = 12,
26 | WaterBreathing = 13,
27 | Invisibility = 14,
28 | Blindness = 15,
29 | NightVision = 16,
30 | Hunger = 17,
31 | Weakness = 18,
32 | Poison = 19,
33 | Wither = 20,
34 | HealthBoost = 21,
35 | Absorption = 22,
36 | Saturation = 23,
37 | Glowing = 24,
38 | Levitation = 25,
39 | Luck = 26,
40 | BadLuck = 27,
41 | SlowFalling = 28,
42 | ConduitPower = 29,
43 | DolphinsGrace = 30,
44 | BadOmen = 31,
45 | HerooftheVillage = 32,
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/MinecraftClient/Inventory/Hand.cs:
--------------------------------------------------------------------------------
1 | namespace MinecraftClient.Inventory
2 | {
3 | ///
4 | /// Represents a Minecraft hand
5 | ///
6 | public enum Hand
7 | {
8 | MainHand = 0,
9 | OffHand = 1,
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/MinecraftClient/Inventory/ItemPalettes/ItemPalette.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace MinecraftClient.Inventory.ItemPalettes
7 | {
8 | public abstract class ItemPalette
9 | {
10 | protected abstract Dictionary GetDict();
11 | private readonly Dictionary DictReverse = new Dictionary();
12 |
13 | public ItemPalette()
14 | {
15 | // Index reverse mappings for use in ToId()
16 | foreach (KeyValuePair entry in GetDict())
17 | DictReverse.Add(entry.Value, entry.Key);
18 |
19 | // Hardcoded placeholder types for internal and network use
20 | DictReverse[ItemType.Unknown] = (int)ItemType.Unknown;
21 | DictReverse[ItemType.Null] = (int)ItemType.Null;
22 | }
23 |
24 | public ItemType FromId(int id)
25 | {
26 | // Unknown item types may appear on Forge servers for custom items
27 | if (!GetDict().ContainsKey(id))
28 | return ItemType.Unknown;
29 |
30 | return GetDict()[id];
31 | }
32 |
33 | public int ToId(ItemType itemType)
34 | {
35 | return DictReverse[itemType];
36 | }
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/MinecraftClient/Inventory/ItemPalettes/ItemPaletteGenerator.cs:
--------------------------------------------------------------------------------
1 | using MinecraftClient.Protocol;
2 | using System;
3 | using System.Collections.Generic;
4 | using System.Linq;
5 | using System.Text;
6 |
7 | namespace MinecraftClient.Inventory.ItemPalettes
8 | {
9 | public static class ItemPaletteGenerator
10 | {
11 | ///
12 | /// Place below line to Program.cs
13 | /// Inventory.ItemPalettes.ItemPaletteGenerator.GenerateItemType(@"your\path\to\registries.json");
14 | /// See https://wiki.vg/Data_Generators for getting those .json
15 | ///
16 | ///
17 | public static void GenerateItemType(string registriesJsonFile)
18 | {
19 | DataTypeGenerator.GenerateEnumWithPalette(
20 | registriesJsonFile,
21 | "minecraft:item",
22 | "ItemType",
23 | "MinecraftClient.Inventory",
24 | "ItemPalette",
25 | "MinecraftClient.Inventory.ItemPalettes");
26 | }
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/MinecraftClient/Inventory/VillagerInfo.cs:
--------------------------------------------------------------------------------
1 | namespace MinecraftClient.Mapping
2 | {
3 | ///
4 | /// Properties of a villager
5 | ///
6 | public class VillagerInfo
7 | {
8 | public int Level { get; set; }
9 | public int Experience { get; set; }
10 | public bool IsRegularVillager { get; set; }
11 | public bool CanRestock { get; set; }
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/MinecraftClient/Inventory/VillagerTrade.cs:
--------------------------------------------------------------------------------
1 | namespace MinecraftClient.Inventory
2 | {
3 | ///
4 | /// Represents a trade of a villager
5 | ///
6 | public class VillagerTrade
7 | {
8 | public Item InputItem1;
9 | public Item OutputItem;
10 | public Item InputItem2;
11 | public bool TradeDisabled;
12 | public int NumberOfTradeUses;
13 | public int MaximumNumberOfTradeUses;
14 | public int Xp;
15 | public int SpecialPrice;
16 | public float PriceMultiplier;
17 | public int Demand;
18 |
19 | public VillagerTrade(Item inputItem1, Item outputItem, Item inputItem2, bool tradeDisabled, int numberOfTradeUses, int maximumNumberOfTradeUses, int xp, int specialPrice, float priceMultiplier, int demand)
20 | {
21 | this.InputItem1 = inputItem1;
22 | this.OutputItem = outputItem;
23 | this.InputItem2 = inputItem2;
24 | this.TradeDisabled = tradeDisabled;
25 | this.NumberOfTradeUses = numberOfTradeUses;
26 | this.MaximumNumberOfTradeUses = maximumNumberOfTradeUses;
27 | this.Xp = xp;
28 | this.SpecialPrice = specialPrice;
29 | this.PriceMultiplier = priceMultiplier;
30 | this.Demand = demand;
31 | }
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/MinecraftClient/Inventory/WindowActionType.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace MinecraftClient.Inventory
7 | {
8 | ///
9 | /// Represents mouse interactions with an inventory window
10 | ///
11 | public enum WindowActionType
12 | {
13 | ///
14 | /// Left click with mouse on a slot: grab or drop a whole item stack
15 | ///
16 | LeftClick,
17 |
18 | ///
19 | /// Right click with mouse on a slot: grab half a stack or drop a single item
20 | ///
21 | RightClick,
22 |
23 | ///
24 | /// Middle click with mouse on a slot: grab a full stack from creative inventory
25 | ///
26 | MiddleClick,
27 |
28 | ///
29 | /// Shift+Left click with mouse on a slot: send a whole item stack to the hotbar or other inventory
30 | ///
31 | ShiftClick,
32 |
33 | ///
34 | /// Drop a single item on ground
35 | ///
36 | DropItem,
37 |
38 | ///
39 | /// Drop a whole item stack on ground
40 | ///
41 | DropItemStack,
42 |
43 | ///
44 | /// Start hovering slots with left button pressed: Distribute evenly the stack on hovered slots
45 | ///
46 | StartDragLeft,
47 |
48 | ///
49 | /// Start hovering slots with right button pressed: Drop one item on each hovered slot
50 | ///
51 | StartDragRight,
52 |
53 | ///
54 | /// Start hovering slots with middle button pressed: Create one item stack on each hovered slot in creative mode
55 | ///
56 | StartDragMiddle,
57 |
58 | ///
59 | /// Hover a slot to distribute evenly an item stack
60 | ///
61 | AddDragLeft,
62 |
63 | ///
64 | /// Hover a slot to drop one item from an item stack
65 | ///
66 | AddDragRight,
67 |
68 | ///
69 | /// Hover a slot to create one item stack in creative mode
70 | ///
71 | AddDragMiddle,
72 |
73 | ///
74 | /// Stop hovering slots with left button pressed
75 | ///
76 | EndDragLeft,
77 |
78 | ///
79 | /// Stop hovering slots with right button pressed
80 | ///
81 | EndDragRight,
82 |
83 | ///
84 | /// Stop hovering slots with middble button pressed
85 | ///
86 | EndDragMiddle,
87 | }
88 | }
89 |
--------------------------------------------------------------------------------
/MinecraftClient/Logger/FilteredLogger.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Text.RegularExpressions;
6 |
7 | namespace MinecraftClient.Logger
8 | {
9 | public class FilteredLogger : LoggerBase
10 | {
11 | protected enum FilterChannel { Debug, Chat }
12 |
13 | protected bool ShouldDisplay(FilterChannel channel, string msg)
14 | {
15 | Regex regexToUse = null;
16 | // Convert to bool for XOR later. Whitelist = 0, Blacklist = 1
17 | bool filterMode = Settings.FilterMode == Settings.FilterModeEnum.Blacklist ? true : false;
18 | switch (channel)
19 | {
20 | case FilterChannel.Chat: regexToUse = Settings.ChatFilter; break;
21 | case FilterChannel.Debug: regexToUse = Settings.DebugFilter; break;
22 | }
23 | if (regexToUse != null)
24 | {
25 | // IsMatch and white/blacklist result can be represented using XOR
26 | // e.g. matched(true) ^ blacklist(true) => shouldn't log(false)
27 | return regexToUse.IsMatch(msg) ^ filterMode;
28 | }
29 | else return true;
30 | }
31 |
32 | public override void Debug(string msg)
33 | {
34 | if (DebugEnabled)
35 | {
36 | if (ShouldDisplay(FilterChannel.Debug, msg))
37 | {
38 | Log("§8[DEBUG] " + msg);
39 | }
40 | // Don't write debug lines here as it could cause a stack overflow
41 | }
42 | }
43 |
44 | public override void Info(string msg)
45 | {
46 | if (InfoEnabled)
47 | ConsoleIO.WriteLogLine(msg);
48 | }
49 |
50 | public override void Warn(string msg)
51 | {
52 | if (WarnEnabled)
53 | Log("§6[WARN] " + msg);
54 | }
55 |
56 | public override void Error(string msg)
57 | {
58 | if (ErrorEnabled)
59 | Log("§c[ERROR] " + msg);
60 | }
61 |
62 | public override void Chat(string msg)
63 | {
64 | if (ChatEnabled)
65 | {
66 | if (ShouldDisplay(FilterChannel.Chat, msg))
67 | {
68 | Log(msg);
69 | }
70 | else Debug("[Logger] One Chat message filtered: " + msg);
71 | }
72 | }
73 | }
74 | }
75 |
--------------------------------------------------------------------------------
/MinecraftClient/Logger/ILogger.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace MinecraftClient.Logger
7 | {
8 | public interface ILogger
9 | {
10 | bool DebugEnabled { get; set; }
11 | bool WarnEnabled { get; set; }
12 | bool InfoEnabled { get; set; }
13 | bool ErrorEnabled { get; set; }
14 | bool ChatEnabled { get; set; }
15 |
16 | void Info(string msg);
17 | void Info(string msg, params object[] args);
18 | void Info(object msg);
19 |
20 | void Debug(string msg);
21 | void Debug(string msg, params object[] args);
22 | void Debug(object msg);
23 |
24 | void Warn(string msg);
25 | void Warn(string msg, params object[] args);
26 | void Warn(object msg);
27 |
28 | void Error(string msg);
29 | void Error(string msg, params object[] args);
30 | void Error(object msg);
31 |
32 | void Chat(string msg);
33 | void Chat(string msg, params object[] args);
34 | void Chat(object msg);
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/MinecraftClient/Mapping/BlockPalettes/BlockPalette.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace MinecraftClient.Mapping.BlockPalettes
7 | {
8 | public abstract class BlockPalette
9 | {
10 | ///
11 | /// Get mapping dictionary. Must be overriden with proper implementation.
12 | ///
13 | /// Palette dictionary
14 | protected abstract Dictionary GetDict();
15 |
16 | ///
17 | /// Get material from block ID or block state ID
18 | ///
19 | /// Block ID (up to MC 1.12) or block state (MC 1.13+)
20 | /// Material corresponding to the specified ID
21 | public Material FromId(int id)
22 | {
23 | Dictionary materials = GetDict();
24 | if (materials.ContainsKey(id))
25 | return materials[id];
26 | return Material.Air;
27 | }
28 |
29 | ///
30 | /// Returns TRUE if block ID uses old metadata encoding with ID and Meta inside one ushort
31 | /// Only Palette112 should override this.
32 | ///
33 | public virtual bool IdHasMetadata
34 | {
35 | get
36 | {
37 | return false;
38 | }
39 | }
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/MinecraftClient/Mapping/Chunk.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace MinecraftClient.Mapping
7 | {
8 | ///
9 | /// Represent a chunk of terrain in a Minecraft world
10 | ///
11 | public class Chunk
12 | {
13 | public const int SizeX = 16;
14 | public const int SizeY = 16;
15 | public const int SizeZ = 16;
16 |
17 | ///
18 | /// Blocks contained into the chunk
19 | ///
20 | private readonly Block[,,] blocks = new Block[SizeX, SizeY, SizeZ];
21 |
22 | ///
23 | /// Read, or set the specified block
24 | ///
25 | /// Block X
26 | /// Block Y
27 | /// Block Z
28 | /// chunk at the given location
29 | public Block this[int blockX, int blockY, int blockZ]
30 | {
31 | get
32 | {
33 | if (blockX < 0 || blockX >= SizeX)
34 | throw new ArgumentOutOfRangeException("blockX", "Must be between 0 and " + (SizeX - 1) + " (inclusive)");
35 | if (blockY < 0 || blockY >= SizeY)
36 | throw new ArgumentOutOfRangeException("blockY", "Must be between 0 and " + (SizeY - 1) + " (inclusive)");
37 | if (blockZ < 0 || blockZ >= SizeZ)
38 | throw new ArgumentOutOfRangeException("blockZ", "Must be between 0 and " + (SizeZ - 1) + " (inclusive)");
39 | return blocks[blockX, blockY, blockZ];
40 | }
41 | set
42 | {
43 | if (blockX < 0 || blockX >= SizeX)
44 | throw new ArgumentOutOfRangeException("blockX", "Must be between 0 and " + (SizeX - 1) + " (inclusive)");
45 | if (blockY < 0 || blockY >= SizeY)
46 | throw new ArgumentOutOfRangeException("blockY", "Must be between 0 and " + (SizeY - 1) + " (inclusive)");
47 | if (blockZ < 0 || blockZ >= SizeZ)
48 | throw new ArgumentOutOfRangeException("blockZ", "Must be between 0 and " + (SizeZ - 1) + " (inclusive)");
49 | blocks[blockX, blockY, blockZ] = value;
50 | }
51 | }
52 |
53 | ///
54 | /// Get block at the specified location
55 | ///
56 | /// Location, a modulo will be applied
57 | /// The block
58 | public Block GetBlock(Location location)
59 | {
60 | return this[location.ChunkBlockX, location.ChunkBlockY, location.ChunkBlockZ];
61 | }
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/MinecraftClient/Mapping/ChunkColumn.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace MinecraftClient.Mapping
7 | {
8 | ///
9 | /// Represent a column of chunks of terrain in a Minecraft world
10 | ///
11 | public class ChunkColumn
12 | {
13 | public const int ColumnSize = 16;
14 |
15 | ///
16 | /// Blocks contained into the chunk
17 | ///
18 | private readonly Chunk[] chunks = new Chunk[ColumnSize];
19 |
20 | ///
21 | /// Get or set the specified chunk column
22 | ///
23 | /// ChunkColumn X
24 | /// ChunkColumn Y
25 | /// chunk at the given location
26 | public Chunk this[int chunkY]
27 | {
28 | get
29 | {
30 | return chunks[chunkY];
31 | }
32 | set
33 | {
34 | chunks[chunkY] = value;
35 | }
36 | }
37 |
38 | ///
39 | /// Get chunk at the specified location
40 | ///
41 | /// Location, a modulo will be applied
42 | /// The chunk, or null if not loaded
43 | public Chunk GetChunk(Location location)
44 | {
45 | try
46 | {
47 | return this[location.ChunkY];
48 | }
49 | catch (IndexOutOfRangeException)
50 | {
51 | return null;
52 | }
53 | }
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/MinecraftClient/Mapping/CommandBlockFlags.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace MinecraftClient.Mapping
7 | {
8 | ///
9 | /// Represents a unit movement in the world
10 | ///
11 | ///
12 | public enum CommandBlockFlags
13 | {
14 | TrackOutput = 0x01,
15 | IsConditional = 0x02,
16 | Automatic = 0x04,
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/MinecraftClient/Mapping/CommandBlockMode.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace MinecraftClient.Mapping
7 | {
8 | ///
9 | /// Represents a unit movement in the world
10 | ///
11 | ///
12 | public enum CommandBlockMode
13 | {
14 | Sequence = 0,
15 | Auto = 1,
16 | Redstone = 2,
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/MinecraftClient/Mapping/Direction.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace MinecraftClient.Mapping
7 | {
8 | ///
9 | /// Represents a unit movement in the world
10 | ///
11 | ///
12 | public enum Direction
13 | {
14 | South = 0,
15 | West = 1,
16 | North = 2,
17 | East = 3,
18 | Up = 4,
19 | Down = 5
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/MinecraftClient/Mapping/EntityPalettes/EntityPalette.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace MinecraftClient.Mapping.EntityPalettes
7 | {
8 | public abstract class EntityPalette
9 | {
10 | ///
11 | /// Get mapping dictionary. Must be overriden with proper implementation.
12 | ///
13 | /// Palette dictionary
14 | protected abstract Dictionary GetDict();
15 |
16 | ///
17 | /// Get mapping dictionary for pre-1.14 non-living entities.
18 | ///
19 | /// Palette dictionary for non-living entities (pre-1.14)
20 | protected virtual Dictionary GetDictNonLiving()
21 | {
22 | return null;
23 | }
24 |
25 | ///
26 | /// Get entity type from type ID
27 | ///
28 | /// Entity type ID
29 | /// EntityType corresponding to the specified ID
30 | public EntityType FromId(int id, bool living)
31 | {
32 | Dictionary entityTypes = GetDict();
33 | Dictionary entityTypesNonLiving = GetDictNonLiving();
34 |
35 | if (entityTypesNonLiving != null && !living)
36 | {
37 | //Pre-1.14 non-living entities have a different set of IDs (entityTypesNonLiving != null)
38 | if (entityTypesNonLiving.ContainsKey(id))
39 | return entityTypesNonLiving[id];
40 | }
41 | else
42 | {
43 | //1.14+ entities have the same set of IDs regardless of living status
44 | if (entityTypes.ContainsKey(id))
45 | return entityTypes[id];
46 | }
47 |
48 | throw new System.IO.InvalidDataException("Unknown Entity ID " + id + ". Is Entity Palette up to date for this Minecraft version?");
49 | }
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/MinecraftClient/Mapping/EntityPalettes/EntityPaletteGenerator.cs:
--------------------------------------------------------------------------------
1 | using MinecraftClient.Protocol;
2 |
3 | namespace MinecraftClient.Mapping.EntityPalettes
4 | {
5 | ///
6 | /// Generator for MCC ItemType enumeration
7 | ///
8 | public static class EntityPaletteGenerator
9 | {
10 | ///
11 | /// Generate EntityType.cs from Minecraft registries.json
12 | ///
13 | /// path to registries.json
14 | /// java -cp minecraft_server.jar net.minecraft.data.Main --reports
15 | public static void GenerateEntityTypes(string registriesJsonFile)
16 | {
17 | DataTypeGenerator.GenerateEnumWithPalette(registriesJsonFile, "minecraft:entity_type", "EntityType", "MinecraftClient.Mapping", "EntityPalette", "MinecraftClient.Mapping.EntityPalettes");
18 | }
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/MinecraftClient/Mapping/EntityPose.cs:
--------------------------------------------------------------------------------
1 | namespace MinecraftClient.Mapping
2 | {
3 | public enum EntityPose
4 | {
5 | Standing = 0,
6 | FallFlying = 1,
7 | Sleeping = 2,
8 | Swimming = 3,
9 | SpinAttack = 4,
10 | Sneaking = 5,
11 | Dying = 6,
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/MinecraftClient/Mapping/VillagerInfo.cs:
--------------------------------------------------------------------------------
1 | namespace MinecraftClient
2 | {
3 | ///
4 | /// Information of a villager
5 | ///
6 | public class VillagerInfo
7 | {
8 | public int Level { get; set; }
9 | public int Experience { get; set; }
10 | public bool IsRegularVillager { get; set; }
11 | public bool CanRestock { get; set; }
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/MinecraftClient/MinecraftClient.csproj.user:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | TestBot - localhost
5 |
6 |
7 | publish\
8 |
9 |
10 |
11 |
12 |
13 | en-US
14 | false
15 |
16 |
17 | TestBot - localhost
18 |
19 |
20 | 4
21 |
22 |
--------------------------------------------------------------------------------
/MinecraftClient/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("Minecraft Console Client")]
9 | [assembly: AssemblyDescription("Lightweight console for Minecraft chat and automated scripts")]
10 | //[assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("https://github.com/MCCTeam/Minecraft-Console-Client")]
12 | [assembly: AssemblyProduct("MinecraftClient")]
13 | [assembly: AssemblyCopyright("Copyright © 2012-2021 The MCC Team")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 | [assembly: ComVisible(false)]
21 |
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM
23 | [assembly: Guid("78af6200-1f48-4daa-b473-109a9728b61f")]
24 |
25 | // Version information for an assembly consists of the following four values:
26 | //
27 | // Major Version
28 | // Minor Version
29 | // Build Number
30 | // Revision
31 | //
32 | // You can specify all the values or you can default the Build and Revision Numbers
33 | // by using the '*' as shown below:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | // [assembly: AssemblyVersion("1.0.0")]
36 | // [assembly: AssemblyFileVersion("1.0.0")]
37 |
38 | // AppVeyor Build Number
39 | // MCC will use the following command as CMD pre-build script in AppVeyor msbuild settings:
40 | // echo [assembly: AssemblyConfiguration("AppVeyor build %APPVEYOR_BUILD_NUMBER%, built on %DATE% from commit %APPVEYOR_REPO_COMMIT:~0,7%")] >> MinecraftClient\Properties\AssemblyInfo.cs
41 | // The command will add build info like the example below to be incorporated in Assembly Info in order to display build info on launch
42 | // [assembly: AssemblyConfiguration("AppVeyor build 1234, built on Sun 31/12/2017 from commit abc1def")]
43 |
--------------------------------------------------------------------------------
/MinecraftClient/Protocol/Dns/Records/NotUsed/RecordA6.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | /*
3 |
4 | */
5 |
6 | namespace Heijden.DNS
7 | {
8 | public class RecordA6 : Record
9 | {
10 | public byte[] RDATA;
11 |
12 | public RecordA6(RecordReader rr)
13 | {
14 | // re-read length
15 | ushort RDLENGTH = rr.ReadUInt16(-2);
16 | RDATA = rr.ReadBytes(RDLENGTH);
17 | }
18 |
19 | public override string ToString()
20 | {
21 | return string.Format("not-used");
22 | }
23 |
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/MinecraftClient/Protocol/Dns/Records/NotUsed/RecordAPL.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | /*
3 |
4 | */
5 |
6 | namespace Heijden.DNS
7 | {
8 | public class RecordAPL : Record
9 | {
10 | public byte[] RDATA;
11 |
12 | public RecordAPL(RecordReader rr)
13 | {
14 | // re-read length
15 | ushort RDLENGTH = rr.ReadUInt16(-2);
16 | RDATA = rr.ReadBytes(RDLENGTH);
17 | }
18 |
19 | public override string ToString()
20 | {
21 | return string.Format("not-used");
22 | }
23 |
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/MinecraftClient/Protocol/Dns/Records/NotUsed/RecordATMA.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | /*
3 |
4 | */
5 |
6 | namespace Heijden.DNS
7 | {
8 | public class RecordATMA : Record
9 | {
10 | public byte[] RDATA;
11 |
12 | public RecordATMA(RecordReader rr)
13 | {
14 | // re-read length
15 | ushort RDLENGTH = rr.ReadUInt16(-2);
16 | RDATA = rr.ReadBytes(RDLENGTH);
17 | }
18 |
19 | public override string ToString()
20 | {
21 | return string.Format("not-used");
22 | }
23 |
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/MinecraftClient/Protocol/Dns/Records/NotUsed/RecordCERT.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | /*
3 |
4 | */
5 |
6 | namespace Heijden.DNS
7 | {
8 | public class RecordCERT : Record
9 | {
10 | public byte[] RDATA;
11 |
12 | public RecordCERT(RecordReader rr)
13 | {
14 | // re-read length
15 | ushort RDLENGTH = rr.ReadUInt16(-2);
16 | RDATA = rr.ReadBytes(RDLENGTH);
17 | }
18 |
19 | public override string ToString()
20 | {
21 | return string.Format("not-used");
22 | }
23 |
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/MinecraftClient/Protocol/Dns/Records/NotUsed/RecordDHCID.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | /*
3 |
4 | */
5 |
6 | namespace Heijden.DNS
7 | {
8 | public class RecordDHCID : Record
9 | {
10 | public byte[] RDATA;
11 |
12 | public RecordDHCID(RecordReader rr)
13 | {
14 | // re-read length
15 | ushort RDLENGTH = rr.ReadUInt16(-2);
16 | RDATA = rr.ReadBytes(RDLENGTH);
17 | }
18 |
19 | public override string ToString()
20 | {
21 | return string.Format("not-used");
22 | }
23 |
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/MinecraftClient/Protocol/Dns/Records/NotUsed/RecordDNSKEY.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | /*
3 |
4 | */
5 |
6 | namespace Heijden.DNS
7 | {
8 | public class RecordDNSKEY : Record
9 | {
10 | public byte[] RDATA;
11 |
12 | public RecordDNSKEY(RecordReader rr)
13 | {
14 | // re-read length
15 | ushort RDLENGTH = rr.ReadUInt16(-2);
16 | RDATA = rr.ReadBytes(RDLENGTH);
17 | }
18 |
19 | public override string ToString()
20 | {
21 | return string.Format("not-used");
22 | }
23 |
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/MinecraftClient/Protocol/Dns/Records/NotUsed/RecordEID.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | /*
3 |
4 | */
5 |
6 | namespace Heijden.DNS
7 | {
8 | public class RecordEID : Record
9 | {
10 | public byte[] RDATA;
11 |
12 | public RecordEID(RecordReader rr)
13 | {
14 | // re-read length
15 | ushort RDLENGTH = rr.ReadUInt16(-2);
16 | RDATA = rr.ReadBytes(RDLENGTH);
17 | }
18 |
19 | public override string ToString()
20 | {
21 | return string.Format("not-used");
22 | }
23 |
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/MinecraftClient/Protocol/Dns/Records/NotUsed/RecordGID.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | /*
3 |
4 | */
5 |
6 | namespace Heijden.DNS
7 | {
8 | public class RecordGID : Record
9 | {
10 | public byte[] RDATA;
11 |
12 | public RecordGID(RecordReader rr)
13 | {
14 | // re-read length
15 | ushort RDLENGTH = rr.ReadUInt16(-2);
16 | RDATA = rr.ReadBytes(RDLENGTH);
17 | }
18 |
19 | public override string ToString()
20 | {
21 | return string.Format("not-used");
22 | }
23 |
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/MinecraftClient/Protocol/Dns/Records/NotUsed/RecordHIP.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | /*
3 |
4 | */
5 |
6 | namespace Heijden.DNS
7 | {
8 | public class RecordHIP : Record
9 | {
10 | public byte[] RDATA;
11 |
12 | public RecordHIP(RecordReader rr)
13 | {
14 | // re-read length
15 | ushort RDLENGTH = rr.ReadUInt16(-2);
16 | RDATA = rr.ReadBytes(RDLENGTH);
17 | }
18 |
19 | public override string ToString()
20 | {
21 | return string.Format("not-used");
22 | }
23 |
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/MinecraftClient/Protocol/Dns/Records/NotUsed/RecordIPSECKEY.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | /*
3 |
4 | */
5 |
6 | namespace Heijden.DNS
7 | {
8 | public class RecordIPSECKEY : Record
9 | {
10 | public byte[] RDATA;
11 |
12 | public RecordIPSECKEY(RecordReader rr)
13 | {
14 | // re-read length
15 | ushort RDLENGTH = rr.ReadUInt16(-2);
16 | RDATA = rr.ReadBytes(RDLENGTH);
17 | }
18 |
19 | public override string ToString()
20 | {
21 | return string.Format("not-used");
22 | }
23 |
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/MinecraftClient/Protocol/Dns/Records/NotUsed/RecordNIMLOC.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | /*
3 |
4 | */
5 |
6 | namespace Heijden.DNS
7 | {
8 | public class RecordNIMLOC : Record
9 | {
10 | public byte[] RDATA;
11 |
12 | public RecordNIMLOC(RecordReader rr)
13 | {
14 | // re-read length
15 | ushort RDLENGTH = rr.ReadUInt16(-2);
16 | RDATA = rr.ReadBytes(RDLENGTH);
17 | }
18 |
19 | public override string ToString()
20 | {
21 | return string.Format("not-used");
22 | }
23 |
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/MinecraftClient/Protocol/Dns/Records/NotUsed/RecordNSEC.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | /*
3 |
4 | */
5 |
6 | namespace Heijden.DNS
7 | {
8 | public class RecordNSEC : Record
9 | {
10 | public byte[] RDATA;
11 |
12 | public RecordNSEC(RecordReader rr)
13 | {
14 | // re-read length
15 | ushort RDLENGTH = rr.ReadUInt16(-2);
16 | RDATA = rr.ReadBytes(RDLENGTH);
17 | }
18 |
19 | public override string ToString()
20 | {
21 | return string.Format("not-used");
22 | }
23 |
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/MinecraftClient/Protocol/Dns/Records/NotUsed/RecordNSEC3.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | /*
3 |
4 | */
5 |
6 | namespace Heijden.DNS
7 | {
8 | public class RecordNSEC3 : Record
9 | {
10 | public byte[] RDATA;
11 |
12 | public RecordNSEC3(RecordReader rr)
13 | {
14 | // re-read length
15 | ushort RDLENGTH = rr.ReadUInt16(-2);
16 | RDATA = rr.ReadBytes(RDLENGTH);
17 | }
18 |
19 | public override string ToString()
20 | {
21 | return string.Format("not-used");
22 | }
23 |
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/MinecraftClient/Protocol/Dns/Records/NotUsed/RecordNSEC3PARAM.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | /*
3 |
4 | */
5 |
6 | namespace Heijden.DNS
7 | {
8 | public class RecordNSEC3PARAM : Record
9 | {
10 | public byte[] RDATA;
11 |
12 | public RecordNSEC3PARAM(RecordReader rr)
13 | {
14 | // re-read length
15 | ushort RDLENGTH = rr.ReadUInt16(-2);
16 | RDATA = rr.ReadBytes(RDLENGTH);
17 | }
18 |
19 | public override string ToString()
20 | {
21 | return string.Format("not-used");
22 | }
23 |
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/MinecraftClient/Protocol/Dns/Records/NotUsed/RecordOPT.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | /*
3 |
4 | */
5 |
6 | namespace Heijden.DNS
7 | {
8 | public class RecordOPT : Record
9 | {
10 | public byte[] RDATA;
11 |
12 | public RecordOPT(RecordReader rr)
13 | {
14 | // re-read length
15 | ushort RDLENGTH = rr.ReadUInt16(-2);
16 | RDATA = rr.ReadBytes(RDLENGTH);
17 | }
18 |
19 | public override string ToString()
20 | {
21 | return string.Format("not-used");
22 | }
23 |
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/MinecraftClient/Protocol/Dns/Records/NotUsed/RecordRRSIG.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | /*
3 |
4 | */
5 |
6 | namespace Heijden.DNS
7 | {
8 | public class RecordRRSIG : Record
9 | {
10 | public byte[] RDATA;
11 |
12 | public RecordRRSIG(RecordReader rr)
13 | {
14 | // re-read length
15 | ushort RDLENGTH = rr.ReadUInt16(-2);
16 | RDATA = rr.ReadBytes(RDLENGTH);
17 | }
18 |
19 | public override string ToString()
20 | {
21 | return string.Format("not-used");
22 | }
23 |
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/MinecraftClient/Protocol/Dns/Records/NotUsed/RecordSINK.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | /*
3 |
4 | */
5 |
6 | namespace Heijden.DNS
7 | {
8 | public class RecordSINK : Record
9 | {
10 | public byte[] RDATA;
11 |
12 | public RecordSINK(RecordReader rr)
13 | {
14 | // re-read length
15 | ushort RDLENGTH = rr.ReadUInt16(-2);
16 | RDATA = rr.ReadBytes(RDLENGTH);
17 | }
18 |
19 | public override string ToString()
20 | {
21 | return string.Format("not-used");
22 | }
23 |
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/MinecraftClient/Protocol/Dns/Records/NotUsed/RecordSPF.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | /*
3 |
4 | */
5 |
6 | namespace Heijden.DNS
7 | {
8 | public class RecordSPF : Record
9 | {
10 | public byte[] RDATA;
11 |
12 | public RecordSPF(RecordReader rr)
13 | {
14 | // re-read length
15 | ushort RDLENGTH = rr.ReadUInt16(-2);
16 | RDATA = rr.ReadBytes(RDLENGTH);
17 | }
18 |
19 | public override string ToString()
20 | {
21 | return string.Format("not-used");
22 | }
23 |
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/MinecraftClient/Protocol/Dns/Records/NotUsed/RecordSSHFP.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | /*
3 |
4 | */
5 |
6 | namespace Heijden.DNS
7 | {
8 | public class RecordSSHFP : Record
9 | {
10 | public byte[] RDATA;
11 |
12 | public RecordSSHFP(RecordReader rr)
13 | {
14 | // re-read length
15 | ushort RDLENGTH = rr.ReadUInt16(-2);
16 | RDATA = rr.ReadBytes(RDLENGTH);
17 | }
18 |
19 | public override string ToString()
20 | {
21 | return string.Format("not-used");
22 | }
23 |
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/MinecraftClient/Protocol/Dns/Records/NotUsed/RecordUID.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | /*
3 |
4 | */
5 |
6 | namespace Heijden.DNS
7 | {
8 | public class RecordUID : Record
9 | {
10 | public byte[] RDATA;
11 |
12 | public RecordUID(RecordReader rr)
13 | {
14 | // re-read length
15 | ushort RDLENGTH = rr.ReadUInt16(-2);
16 | RDATA = rr.ReadBytes(RDLENGTH);
17 | }
18 |
19 | public override string ToString()
20 | {
21 | return string.Format("not-used");
22 | }
23 |
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/MinecraftClient/Protocol/Dns/Records/NotUsed/RecordUINFO.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | /*
3 |
4 | */
5 |
6 | namespace Heijden.DNS
7 | {
8 | public class RecordUINFO : Record
9 | {
10 | public byte[] RDATA;
11 |
12 | public RecordUINFO(RecordReader rr)
13 | {
14 | // re-read length
15 | ushort RDLENGTH = rr.ReadUInt16(-2);
16 | RDATA = rr.ReadBytes(RDLENGTH);
17 | }
18 |
19 | public override string ToString()
20 | {
21 | return string.Format("not-used");
22 | }
23 |
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/MinecraftClient/Protocol/Dns/Records/NotUsed/RecordUNSPEC.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | /*
3 |
4 | */
5 |
6 | namespace Heijden.DNS
7 | {
8 | public class RecordUNSPEC : Record
9 | {
10 | public byte[] RDATA;
11 |
12 | public RecordUNSPEC(RecordReader rr)
13 | {
14 | // re-read length
15 | ushort RDLENGTH = rr.ReadUInt16(-2);
16 | RDATA = rr.ReadBytes(RDLENGTH);
17 | }
18 |
19 | public override string ToString()
20 | {
21 | return string.Format("not-used");
22 | }
23 |
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/MinecraftClient/Protocol/Dns/Records/NotUsed/RecordUnknown.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Heijden.DNS
4 | {
5 | public class RecordUnknown : Record
6 | {
7 | public byte[] RDATA;
8 | public RecordUnknown(RecordReader rr)
9 | {
10 | // re-read length
11 | ushort RDLENGTH = rr.ReadUInt16(-2);
12 | RDATA = rr.ReadBytes(RDLENGTH);
13 | }
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/MinecraftClient/Protocol/Dns/Records/Obsolete/RecordGPOS.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | /*
3 | * http://tools.ietf.org/rfc/rfc1712.txt
4 | *
5 | 3. RDATA Format
6 |
7 | MSB LSB
8 | +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
9 | / LONGITUDE /
10 | +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
11 | / LATITUDE /
12 | +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
13 | / ALTITUDE /
14 | +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
15 |
16 | where:
17 |
18 | LONGITUDE The real number describing the longitude encoded as a
19 | printable string. The precision is limited by 256 charcters
20 | within the range -90..90 degrees. Positive numbers
21 | indicate locations north of the equator.
22 |
23 | LATITUDE The real number describing the latitude encoded as a
24 | printable string. The precision is limited by 256 charcters
25 | within the range -180..180 degrees. Positive numbers
26 | indicate locations east of the prime meridian.
27 |
28 | ALTITUDE The real number describing the altitude (in meters) from
29 | mean sea-level encoded as a printable string. The precision
30 | is limited by 256 charcters. Positive numbers indicate
31 | locations above mean sea-level.
32 |
33 | Latitude/Longitude/Altitude values are encoded as strings as to avoid
34 | the precision limitations imposed by encoding as unsigned integers.
35 | Although this might not be considered optimal, it allows for a very
36 | high degree of precision with an acceptable average encoded record
37 | length.
38 |
39 | */
40 |
41 | namespace Heijden.DNS
42 | {
43 | public class RecordGPOS : Record
44 | {
45 | public string LONGITUDE;
46 | public string LATITUDE;
47 | public string ALTITUDE;
48 |
49 | public RecordGPOS(RecordReader rr)
50 | {
51 | LONGITUDE = rr.ReadString();
52 | LATITUDE = rr.ReadString();
53 | ALTITUDE = rr.ReadString();
54 | }
55 |
56 | public override string ToString()
57 | {
58 | return string.Format("{0} {1} {2}",
59 | LONGITUDE,
60 | LATITUDE,
61 | ALTITUDE);
62 | }
63 |
64 | }
65 | }
66 |
--------------------------------------------------------------------------------
/MinecraftClient/Protocol/Dns/Records/Obsolete/RecordMD.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | /*
3 | 3.3.4. MD RDATA format (Obsolete)
4 |
5 | +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
6 | / MADNAME /
7 | / /
8 | +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
9 |
10 | where:
11 |
12 | MADNAME A which specifies a host which has a mail
13 | agent for the domain which should be able to deliver
14 | mail for the domain.
15 |
16 | MD records cause additional section processing which looks up an A type
17 | record corresponding to MADNAME.
18 |
19 | MD is obsolete. See the definition of MX and [RFC-974] for details of
20 | the new scheme. The recommended policy for dealing with MD RRs found in
21 | a master file is to reject them, or to convert them to MX RRs with a
22 | preference of 0.
23 | * */
24 | namespace Heijden.DNS
25 | {
26 | public class RecordMD : Record
27 | {
28 | public string MADNAME;
29 |
30 | public RecordMD(RecordReader rr)
31 | {
32 | MADNAME = rr.ReadDomainName();
33 | }
34 |
35 | public override string ToString()
36 | {
37 | return MADNAME;
38 | }
39 |
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/MinecraftClient/Protocol/Dns/Records/Obsolete/RecordMF.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | /*
3 | *
4 | 3.3.5. MF RDATA format (Obsolete)
5 |
6 | +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
7 | / MADNAME /
8 | / /
9 | +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
10 |
11 | where:
12 |
13 | MADNAME A which specifies a host which has a mail
14 | agent for the domain which will accept mail for
15 | forwarding to the domain.
16 |
17 | MF records cause additional section processing which looks up an A type
18 | record corresponding to MADNAME.
19 |
20 | MF is obsolete. See the definition of MX and [RFC-974] for details ofw
21 | the new scheme. The recommended policy for dealing with MD RRs found in
22 | a master file is to reject them, or to convert them to MX RRs with a
23 | preference of 10. */
24 | namespace Heijden.DNS
25 | {
26 | public class RecordMF : Record
27 | {
28 | public string MADNAME;
29 |
30 | public RecordMF(RecordReader rr)
31 | {
32 | MADNAME = rr.ReadDomainName();
33 | }
34 |
35 | public override string ToString()
36 | {
37 | return MADNAME;
38 | }
39 |
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/MinecraftClient/Protocol/Dns/Records/Obsolete/RecordNSAPPTR.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | /*
3 | * http://tools.ietf.org/rfc/rfc1348.txt
4 |
5 | * The NSAP-PTR RR
6 |
7 | The NSAP-PTR RR is defined with mnemonic NSAP-PTR and a type code 23
8 | (decimal).
9 |
10 | Its function is analogous to the PTR record used for IP addresses [4,7].
11 |
12 | NSAP-PTR has the following format:
13 |
14 | NSAP-PTR
15 |
16 | All fields are required.
17 |
18 | enumerates the actual octet values assigned by the
19 | assigning authority for the LOCAL network. Its format in master
20 | files is a syntactically identical to that used in
21 | TXT and HINFO.
22 |
23 | The format of NSAP-PTR is class insensitive. NSAP-PTR RR causes no
24 | additional section processing.
25 |
26 | For example:
27 |
28 | In net ff08000574.nsap-in-addr.arpa:
29 |
30 | 444433332222111199990123000000ff NSAP-PTR foo.bar.com.
31 |
32 | Or in net 11110031f67293.nsap-in-addr.arpa:
33 |
34 | 67894444333322220000 NSAP-PTR host.school.de.
35 |
36 | The RR data is the ASCII representation of the digits. It is encoded
37 | as a .
38 |
39 | */
40 |
41 | namespace Heijden.DNS
42 | {
43 | public class RecordNSAPPTR : Record
44 | {
45 | public string OWNER;
46 |
47 | public RecordNSAPPTR(RecordReader rr)
48 | {
49 | OWNER = rr.ReadString();
50 | }
51 |
52 | public override string ToString()
53 | {
54 | return string.Format("{0}",OWNER);
55 | }
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/MinecraftClient/Protocol/Dns/Records/Obsolete/RecordNXT.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Text;
3 | /*
4 | * http://tools.ietf.org/rfc/rfc2065.txt
5 | *
6 | 5.2 NXT RDATA Format
7 |
8 | The RDATA for an NXT RR consists simply of a domain name followed by
9 | a bit map.
10 |
11 | The type number for the NXT RR is 30.
12 |
13 | 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3
14 | 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
15 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
16 | | next domain name /
17 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
18 | | type bit map /
19 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
20 |
21 | The NXT RR type bit map is one bit per RR type present for the owner
22 | name similar to the WKS socket bit map. The first bit represents RR
23 | type zero (an illegal type which should not be present.) A one bit
24 | indicates that at least one RR of that type is present for the owner
25 | name. A zero indicates that no such RR is present. All bits not
26 | specified because they are beyond the end of the bit map are assumed
27 | to be zero. Note that bit 30, for NXT, will always be on so the
28 | minimum bit map length is actually four octets. The NXT bit map
29 | should be printed as a list of RR type mnemonics or decimal numbers
30 | similar to the WKS RR.
31 |
32 | The domain name may be compressed with standard DNS name compression
33 | when being transmitted over the network. The size of the bit map can
34 | be inferred from the RDLENGTH and the length of the next domain name.
35 |
36 |
37 |
38 | */
39 | namespace Heijden.DNS
40 | {
41 | public class RecordNXT : Record
42 | {
43 | public string NEXTDOMAINNAME;
44 | public byte[] BITMAP;
45 |
46 | public RecordNXT(RecordReader rr)
47 | {
48 | ushort length = rr.ReadUInt16(-2);
49 | NEXTDOMAINNAME = rr.ReadDomainName();
50 | length -= (ushort)rr.Position;
51 | BITMAP = new byte[length];
52 | BITMAP = rr.ReadBytes(length);
53 | }
54 |
55 | private bool IsSet(int bitNr)
56 | {
57 | int intByte = (int)(bitNr / 8);
58 | int intOffset = (bitNr % 8);
59 | byte b = BITMAP[intByte];
60 | int intTest = 1 << intOffset;
61 | if ((b & intTest) == 0)
62 | return false;
63 | else
64 | return true;
65 | }
66 |
67 |
68 | public override string ToString()
69 | {
70 | StringBuilder sb = new StringBuilder();
71 | for (int bitNr = 1; bitNr < (BITMAP.Length * 8); bitNr++)
72 | {
73 | if (IsSet(bitNr))
74 | sb.Append(" " + (Type)bitNr);
75 | }
76 | return string.Format("{0}{1}", NEXTDOMAINNAME, sb.ToString());
77 | }
78 |
79 | }
80 | }
81 |
--------------------------------------------------------------------------------
/MinecraftClient/Protocol/Dns/Records/Record.cs:
--------------------------------------------------------------------------------
1 | // Stuff records are made of
2 |
3 | namespace Heijden.DNS
4 | {
5 | public abstract class Record
6 | {
7 | ///
8 | /// The Resource Record this RDATA record belongs to
9 | ///
10 | public RR RR;
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/MinecraftClient/Protocol/Dns/Records/RecordA.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | /*
3 | 3.4.1. A RDATA format
4 |
5 | +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
6 | | ADDRESS |
7 | +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
8 |
9 | where:
10 |
11 | ADDRESS A 32 bit Internet address.
12 |
13 | Hosts that have multiple Internet addresses will have multiple A
14 | records.
15 | *
16 | */
17 | namespace Heijden.DNS
18 | {
19 | public class RecordA : Record
20 | {
21 | public System.Net.IPAddress Address;
22 |
23 | public RecordA(RecordReader rr)
24 | {
25 | System.Net.IPAddress.TryParse(string.Format("{0}.{1}.{2}.{3}",
26 | rr.ReadByte(),
27 | rr.ReadByte(),
28 | rr.ReadByte(),
29 | rr.ReadByte()), out this.Address);
30 | }
31 |
32 | public override string ToString()
33 | {
34 | return Address.ToString();
35 | }
36 |
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/MinecraftClient/Protocol/Dns/Records/RecordAAAA.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | #region Rfc info
4 | /*
5 | 2.2 AAAA data format
6 |
7 | A 128 bit IPv6 address is encoded in the data portion of an AAAA
8 | resource record in network byte order (high-order byte first).
9 | */
10 | #endregion
11 |
12 | namespace Heijden.DNS
13 | {
14 | public class RecordAAAA : Record
15 | {
16 | public System.Net.IPAddress Address;
17 |
18 | public RecordAAAA(RecordReader rr)
19 | {
20 | System.Net.IPAddress.TryParse(
21 | string.Format("{0:x}:{1:x}:{2:x}:{3:x}:{4:x}:{5:x}:{6:x}:{7:x}",
22 | rr.ReadUInt16(),
23 | rr.ReadUInt16(),
24 | rr.ReadUInt16(),
25 | rr.ReadUInt16(),
26 | rr.ReadUInt16(),
27 | rr.ReadUInt16(),
28 | rr.ReadUInt16(),
29 | rr.ReadUInt16()), out this.Address);
30 | }
31 |
32 | public override string ToString()
33 | {
34 | return Address.ToString();
35 | }
36 |
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/MinecraftClient/Protocol/Dns/Records/RecordAFSDB.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | /* http://tools.ietf.org/rfc/rfc1183.txt
3 |
4 | * 1. AFS Data Base location
5 |
6 | This section defines an extension of the DNS to locate servers both
7 | for AFS (AFS is a registered trademark of Transarc Corporation) and
8 | for the Open Software Foundation's (OSF) Distributed Computing
9 | Environment (DCE) authenticated naming system using HP/Apollo's NCA,
10 | both to be components of the OSF DCE. The discussion assumes that
11 | the reader is familiar with AFS [5] and NCA [6].
12 |
13 | The AFS (originally the Andrew File System) system uses the DNS to
14 | map from a domain name to the name of an AFS cell database server.
15 | The DCE Naming service uses the DNS for a similar function: mapping
16 | from the domain name of a cell to authenticated name servers for that
17 | cell. The method uses a new RR type with mnemonic AFSDB and type
18 | code of 18 (decimal).
19 |
20 | AFSDB has the following format:
21 |
22 | AFSDB
23 |
24 | Both RDATA fields are required in all AFSDB RRs. The field
25 | is a 16 bit integer. The field is a domain name of a host
26 | that has a server for the cell named by the owner name of the RR.
27 |
28 | */
29 |
30 | namespace Heijden.DNS
31 | {
32 | public class RecordAFSDB : Record
33 | {
34 | public ushort SUBTYPE;
35 | public string HOSTNAME;
36 |
37 | public RecordAFSDB(RecordReader rr)
38 | {
39 | SUBTYPE = rr.ReadUInt16();
40 | //HOSTNAME = rr.ReadString();
41 | HOSTNAME = rr.ReadDomainName();
42 | }
43 |
44 | public override string ToString()
45 | {
46 | return string.Format("{0} {1}",
47 | SUBTYPE,
48 | HOSTNAME);
49 | }
50 |
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/MinecraftClient/Protocol/Dns/Records/RecordCNAME.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | /*
3 | *
4 | 3.3.1. CNAME RDATA format
5 |
6 | +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
7 | / CNAME /
8 | / /
9 | +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
10 |
11 | where:
12 |
13 | CNAME A which specifies the canonical or primary
14 | name for the owner. The owner name is an alias.
15 |
16 | CNAME RRs cause no additional section processing, but name servers may
17 | choose to restart the query at the canonical name in certain cases. See
18 | the description of name server logic in [RFC-1034] for details.
19 |
20 | *
21 | */
22 | namespace Heijden.DNS
23 | {
24 | public class RecordCNAME : Record
25 | {
26 | public string CNAME;
27 |
28 | public RecordCNAME(RecordReader rr)
29 | {
30 | CNAME = rr.ReadDomainName();
31 | }
32 |
33 | public override string ToString()
34 | {
35 | return CNAME;
36 | }
37 |
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/MinecraftClient/Protocol/Dns/Records/RecordDNAME.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | /*
3 | * http://tools.ietf.org/rfc/rfc2672.txt
4 | *
5 | 3. The DNAME Resource Record
6 |
7 | The DNAME RR has mnemonic DNAME and type code 39 (decimal).
8 | DNAME has the following format:
9 |
10 | DNAME
11 |
12 | The format is not class-sensitive. All fields are required. The
13 | RDATA field is a [DNSIS].
14 |
15 | *
16 | */
17 | namespace Heijden.DNS
18 | {
19 | public class RecordDNAME : Record
20 | {
21 | public string TARGET;
22 |
23 | public RecordDNAME(RecordReader rr)
24 | {
25 | TARGET = rr.ReadDomainName();
26 | }
27 |
28 | public override string ToString()
29 | {
30 | return TARGET;
31 | }
32 |
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/MinecraftClient/Protocol/Dns/Records/RecordDS.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Text;
3 | /*
4 | * http://tools.ietf.org/rfc/rfc3658.txt
5 | *
6 | 2.4. Wire Format of the DS record
7 |
8 | The DS (type=43) record contains these fields: key tag, algorithm,
9 | digest type, and the digest of a public key KEY record that is
10 | allowed and/or used to sign the child's apex KEY RRset. Other keys
11 | MAY sign the child's apex KEY RRset.
12 |
13 | 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3
14 | 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
15 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
16 | | key tag | algorithm | Digest type |
17 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
18 | | digest (length depends on type) |
19 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
20 | | (SHA-1 digest is 20 bytes) |
21 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
22 | | |
23 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-|
24 | | |
25 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-|
26 | | |
27 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
28 |
29 | */
30 |
31 | namespace Heijden.DNS
32 | {
33 | public class RecordDS : Record
34 | {
35 | public UInt16 KEYTAG;
36 | public byte ALGORITHM;
37 | public byte DIGESTTYPE;
38 | public byte[] DIGEST;
39 |
40 | public RecordDS(RecordReader rr)
41 | {
42 | ushort length = rr.ReadUInt16(-2);
43 | KEYTAG = rr.ReadUInt16();
44 | ALGORITHM = rr.ReadByte();
45 | DIGESTTYPE = rr.ReadByte();
46 | length -= 4;
47 | DIGEST = new byte[length];
48 | DIGEST = rr.ReadBytes(length);
49 | }
50 |
51 | public override string ToString()
52 | {
53 | StringBuilder sb = new StringBuilder();
54 | for (int intI = 0; intI < DIGEST.Length; intI++)
55 | sb.AppendFormat("{0:x2}", DIGEST[intI]);
56 | return string.Format("{0} {1} {2} {3}",
57 | KEYTAG,
58 | ALGORITHM,
59 | DIGESTTYPE,
60 | sb.ToString());
61 | }
62 |
63 | }
64 | }
65 |
--------------------------------------------------------------------------------
/MinecraftClient/Protocol/Dns/Records/RecordHINFO.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | /*
4 | 3.3.2. HINFO RDATA format
5 |
6 | +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
7 | / CPU /
8 | +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
9 | / OS /
10 | +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
11 |
12 | where:
13 |
14 | CPU A which specifies the CPU type.
15 |
16 | OS A which specifies the operating
17 | system type.
18 |
19 | Standard values for CPU and OS can be found in [RFC-1010].
20 |
21 | HINFO records are used to acquire general information about a host. The
22 | main use is for protocols such as FTP that can use special procedures
23 | when talking between machines or operating systems of the same type.
24 | */
25 |
26 | namespace Heijden.DNS
27 | {
28 | public class RecordHINFO : Record
29 | {
30 | public string CPU;
31 | public string OS;
32 |
33 | public RecordHINFO(RecordReader rr)
34 | {
35 | CPU = rr.ReadString();
36 | OS = rr.ReadString();
37 | }
38 |
39 | public override string ToString()
40 | {
41 | return string.Format("CPU={0} OS={1}",CPU,OS);
42 | }
43 |
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/MinecraftClient/Protocol/Dns/Records/RecordKEY.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | #region Rfc info
4 | /* http://www.ietf.org/rfc/rfc2535.txt
5 | *
6 | 3.1 KEY RDATA format
7 |
8 | The RDATA for a KEY RR consists of flags, a protocol octet, the
9 | algorithm number octet, and the public key itself. The format is as
10 | follows:
11 | 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3
12 | 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
13 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
14 | | flags | protocol | algorithm |
15 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
16 | | /
17 | / public key /
18 | / /
19 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-|
20 |
21 | The KEY RR is not intended for storage of certificates and a separate
22 | certificate RR has been developed for that purpose, defined in [RFC
23 | 2538].
24 |
25 | The meaning of the KEY RR owner name, flags, and protocol octet are
26 | described in Sections 3.1.1 through 3.1.5 below. The flags and
27 | algorithm must be examined before any data following the algorithm
28 | octet as they control the existence and format of any following data.
29 | The algorithm and public key fields are described in Section 3.2.
30 | The format of the public key is algorithm dependent.
31 |
32 | KEY RRs do not specify their validity period but their authenticating
33 | SIG RR(s) do as described in Section 4 below.
34 |
35 | */
36 | #endregion
37 |
38 | namespace Heijden.DNS
39 | {
40 | public class RecordKEY : Record
41 | {
42 | public UInt16 FLAGS;
43 | public byte PROTOCOL;
44 | public byte ALGORITHM;
45 | public string PUBLICKEY;
46 |
47 | public RecordKEY(RecordReader rr)
48 | {
49 | FLAGS = rr.ReadUInt16();
50 | PROTOCOL = rr.ReadByte();
51 | ALGORITHM = rr.ReadByte();
52 | PUBLICKEY = rr.ReadString();
53 | }
54 |
55 | public override string ToString()
56 | {
57 | return string.Format("{0} {1} {2} \"{3}\"",
58 | FLAGS,
59 | PROTOCOL,
60 | ALGORITHM,
61 | PUBLICKEY);
62 | }
63 |
64 | }
65 | }
66 |
--------------------------------------------------------------------------------
/MinecraftClient/Protocol/Dns/Records/RecordKX.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | /*
3 | * http://tools.ietf.org/rfc/rfc2230.txt
4 | *
5 | * 3.1 KX RDATA format
6 |
7 | The KX DNS record has the following RDATA format:
8 |
9 | +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
10 | | PREFERENCE |
11 | +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
12 | / EXCHANGER /
13 | / /
14 | +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
15 |
16 | where:
17 |
18 | PREFERENCE A 16 bit non-negative integer which specifies the
19 | preference given to this RR among other KX records
20 | at the same owner. Lower values are preferred.
21 |
22 | EXCHANGER A which specifies a host willing to
23 | act as a mail exchange for the owner name.
24 |
25 | KX records MUST cause type A additional section processing for the
26 | host specified by EXCHANGER. In the event that the host processing
27 | the DNS transaction supports IPv6, KX records MUST also cause type
28 | AAAA additional section processing.
29 |
30 | The KX RDATA field MUST NOT be compressed.
31 |
32 | */
33 | namespace Heijden.DNS
34 | {
35 | public class RecordKX : Record, IComparable
36 | {
37 | public ushort PREFERENCE;
38 | public string EXCHANGER;
39 |
40 | public RecordKX(RecordReader rr)
41 | {
42 | PREFERENCE = rr.ReadUInt16();
43 | EXCHANGER = rr.ReadDomainName();
44 | }
45 |
46 | public override string ToString()
47 | {
48 | return string.Format("{0} {1}", PREFERENCE, EXCHANGER);
49 | }
50 |
51 | public int CompareTo(object objA)
52 | {
53 | RecordKX recordKX = objA as RecordKX;
54 | if (recordKX == null)
55 | return -1;
56 | else if (this.PREFERENCE > recordKX.PREFERENCE)
57 | return 1;
58 | else if (this.PREFERENCE < recordKX.PREFERENCE)
59 | return -1;
60 | else // they are the same, now compare case insensitive names
61 | return string.Compare(this.EXCHANGER, recordKX.EXCHANGER, true);
62 | }
63 |
64 | }
65 | }
66 |
--------------------------------------------------------------------------------
/MinecraftClient/Protocol/Dns/Records/RecordMB.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | /*
3 | 3.3.3. MB RDATA format (EXPERIMENTAL)
4 |
5 | +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
6 | / MADNAME /
7 | / /
8 | +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
9 |
10 | where:
11 |
12 | MADNAME A which specifies a host which has the
13 | specified mailbox.
14 |
15 | MB records cause additional section processing which looks up an A type
16 | RRs corresponding to MADNAME.
17 | */
18 | namespace Heijden.DNS
19 | {
20 | public class RecordMB : Record
21 | {
22 | public string MADNAME;
23 |
24 | public RecordMB(RecordReader rr)
25 | {
26 | MADNAME = rr.ReadDomainName();
27 | }
28 |
29 | public override string ToString()
30 | {
31 | return MADNAME;
32 | }
33 |
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/MinecraftClient/Protocol/Dns/Records/RecordMG.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | /*
3 | 3.3.6. MG RDATA format (EXPERIMENTAL)
4 |
5 | +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
6 | / MGMNAME /
7 | / /
8 | +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
9 |
10 | where:
11 |
12 | MGMNAME A which specifies a mailbox which is a
13 | member of the mail group specified by the domain name.
14 |
15 | MG records cause no additional section processing.
16 | */
17 | namespace Heijden.DNS
18 | {
19 | public class RecordMG : Record
20 | {
21 | public string MGMNAME;
22 |
23 | public RecordMG(RecordReader rr)
24 | {
25 | MGMNAME = rr.ReadDomainName();
26 | }
27 |
28 | public override string ToString()
29 | {
30 | return MGMNAME;
31 | }
32 |
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/MinecraftClient/Protocol/Dns/Records/RecordMINFO.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | /*
3 | 3.3.7. MINFO RDATA format (EXPERIMENTAL)
4 |
5 | +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
6 | / RMAILBX /
7 | +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
8 | / EMAILBX /
9 | +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
10 |
11 | where:
12 |
13 | RMAILBX A which specifies a mailbox which is
14 | responsible for the mailing list or mailbox. If this
15 | domain name names the root, the owner of the MINFO RR is
16 | responsible for itself. Note that many existing mailing
17 | lists use a mailbox X-request for the RMAILBX field of
18 | mailing list X, e.g., Msgroup-request for Msgroup. This
19 | field provides a more general mechanism.
20 |
21 |
22 | EMAILBX A which specifies a mailbox which is to
23 | receive error messages related to the mailing list or
24 | mailbox specified by the owner of the MINFO RR (similar
25 | to the ERRORS-TO: field which has been proposed). If
26 | this domain name names the root, errors should be
27 | returned to the sender of the message.
28 |
29 | MINFO records cause no additional section processing. Although these
30 | records can be associated with a simple mailbox, they are usually used
31 | with a mailing list.
32 | */
33 | namespace Heijden.DNS
34 | {
35 | public class RecordMINFO : Record
36 | {
37 | public string RMAILBX;
38 | public string EMAILBX;
39 |
40 | public RecordMINFO(RecordReader rr)
41 | {
42 | RMAILBX = rr.ReadDomainName();
43 | EMAILBX = rr.ReadDomainName();
44 | }
45 |
46 | public override string ToString()
47 | {
48 | return string.Format("{0} {1}",RMAILBX,EMAILBX);
49 | }
50 |
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/MinecraftClient/Protocol/Dns/Records/RecordMR.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | /*
3 | 3.3.8. MR RDATA format (EXPERIMENTAL)
4 |
5 | +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
6 | / NEWNAME /
7 | / /
8 | +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
9 |
10 | where:
11 |
12 | NEWNAME A which specifies a mailbox which is the
13 | proper rename of the specified mailbox.
14 |
15 | MR records cause no additional section processing. The main use for MR
16 | is as a forwarding entry for a user who has moved to a different
17 | mailbox.
18 | */
19 | namespace Heijden.DNS
20 | {
21 | public class RecordMR : Record
22 | {
23 | public string NEWNAME;
24 |
25 | public RecordMR(RecordReader rr)
26 | {
27 | NEWNAME = rr.ReadDomainName();
28 | }
29 |
30 | public override string ToString()
31 | {
32 | return NEWNAME;
33 | }
34 |
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/MinecraftClient/Protocol/Dns/Records/RecordMX.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Heijden.DNS
4 | {
5 | /*
6 | 3.3.9. MX RDATA format
7 |
8 | +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
9 | | PREFERENCE |
10 | +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
11 | / EXCHANGE /
12 | / /
13 | +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
14 |
15 | where:
16 |
17 | PREFERENCE A 16 bit integer which specifies the preference given to
18 | this RR among others at the same owner. Lower values
19 | are preferred.
20 |
21 | EXCHANGE A which specifies a host willing to act as
22 | a mail exchange for the owner name.
23 |
24 | MX records cause type A additional section processing for the host
25 | specified by EXCHANGE. The use of MX RRs is explained in detail in
26 | [RFC-974].
27 | */
28 |
29 | public class RecordMX : Record, IComparable
30 | {
31 | public ushort PREFERENCE;
32 | public string EXCHANGE;
33 |
34 | public RecordMX(RecordReader rr)
35 | {
36 | PREFERENCE = rr.ReadUInt16();
37 | EXCHANGE = rr.ReadDomainName();
38 | }
39 |
40 | public override string ToString()
41 | {
42 | return string.Format("{0} {1}", PREFERENCE, EXCHANGE);
43 | }
44 |
45 | public int CompareTo(object objA)
46 | {
47 | RecordMX recordMX = objA as RecordMX;
48 | if (recordMX == null)
49 | return -1;
50 | else if (this.PREFERENCE > recordMX.PREFERENCE)
51 | return 1;
52 | else if (this.PREFERENCE < recordMX.PREFERENCE)
53 | return -1;
54 | else // they are the same, now compare case insensitive names
55 | return string.Compare(this.EXCHANGE, recordMX.EXCHANGE, true);
56 | }
57 |
58 | }
59 | }
60 |
--------------------------------------------------------------------------------
/MinecraftClient/Protocol/Dns/Records/RecordNAPTR.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | /*
3 | * http://www.faqs.org/rfcs/rfc2915.html
4 | *
5 | 8. DNS Packet Format
6 |
7 | The packet format for the NAPTR record is:
8 |
9 | 1 1 1 1 1 1
10 | 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5
11 | +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
12 | | ORDER |
13 | +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
14 | | PREFERENCE |
15 | +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
16 | / FLAGS /
17 | +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
18 | / SERVICES /
19 | +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
20 | / REGEXP /
21 | +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
22 | / REPLACEMENT /
23 | / /
24 | +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
25 |
26 | where:
27 |
28 | FLAGS A which contains various flags.
29 |
30 | SERVICES A which contains protocol and service
31 | identifiers.
32 |
33 | REGEXP A which contains a regular expression.
34 |
35 | REPLACEMENT A which specifies the new value in the
36 | case where the regular expression is a simple replacement
37 | operation.
38 |
39 | and as used here are defined in
40 | RFC1035 [1].
41 |
42 | */
43 |
44 | namespace Heijden.DNS
45 | {
46 | public class RecordNAPTR : Record
47 | {
48 | public ushort ORDER;
49 | public ushort PREFERENCE;
50 | public string FLAGS;
51 | public string SERVICES;
52 | public string REGEXP;
53 | public string REPLACEMENT;
54 |
55 | public RecordNAPTR(RecordReader rr)
56 | {
57 | ORDER = rr.ReadUInt16();
58 | PREFERENCE = rr.ReadUInt16();
59 | FLAGS = rr.ReadString();
60 | SERVICES = rr.ReadString();
61 | REGEXP = rr.ReadString();
62 | REPLACEMENT = rr.ReadDomainName();
63 | }
64 |
65 | public override string ToString()
66 | {
67 | return string.Format("{0} {1} \"{2}\" \"{3}\" \"{4}\" {5}",
68 | ORDER,
69 | PREFERENCE,
70 | FLAGS,
71 | SERVICES,
72 | REGEXP,
73 | REPLACEMENT);
74 | }
75 |
76 | }
77 | }
78 |
--------------------------------------------------------------------------------
/MinecraftClient/Protocol/Dns/Records/RecordNS.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | /*
3 | 3.3.11. NS RDATA format
4 |
5 | +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
6 | / NSDNAME /
7 | / /
8 | +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
9 |
10 | where:
11 |
12 | NSDNAME A which specifies a host which should be
13 | authoritative for the specified class and domain.
14 |
15 | NS records cause both the usual additional section processing to locate
16 | a type A record, and, when used in a referral, a special search of the
17 | zone in which they reside for glue information.
18 |
19 | The NS RR states that the named host should be expected to have a zone
20 | starting at owner name of the specified class. Note that the class may
21 | not indicate the protocol family which should be used to communicate
22 | with the host, although it is typically a strong hint. For example,
23 | hosts which are name servers for either Internet (IN) or Hesiod (HS)
24 | class information are normally queried using IN class protocols.
25 | */
26 | namespace Heijden.DNS
27 | {
28 | public class RecordNS : Record
29 | {
30 | public string NSDNAME;
31 |
32 | public RecordNS(RecordReader rr)
33 | {
34 | NSDNAME = rr.ReadDomainName();
35 | }
36 |
37 | public override string ToString()
38 | {
39 | return NSDNAME;
40 | }
41 |
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/MinecraftClient/Protocol/Dns/Records/RecordNSAP.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Text;
3 | /*
4 | * http://tools.ietf.org/rfc/rfc1348.txt
5 | * http://tools.ietf.org/html/rfc1706
6 | *
7 | * |--------------|
8 | | <-- IDP --> |
9 | |--------------|-------------------------------------|
10 | | AFI | IDI | <-- DSP --> |
11 | |-----|--------|-------------------------------------|
12 | | 47 | 0005 | DFI | AA |Rsvd | RD |Area | ID |Sel |
13 | |-----|--------|-----|----|-----|----|-----|----|----|
14 | octets | 1 | 2 | 1 | 3 | 2 | 2 | 2 | 6 | 1 |
15 | |-----|--------|-----|----|-----|----|-----|----|----|
16 |
17 | IDP Initial Domain Part
18 | AFI Authority and Format Identifier
19 | IDI Initial Domain Identifier
20 | DSP Domain Specific Part
21 | DFI DSP Format Identifier
22 | AA Administrative Authority
23 | Rsvd Reserved
24 | RD Routing Domain Identifier
25 | Area Area Identifier
26 | ID System Identifier
27 | SEL NSAP Selector
28 |
29 | Figure 1: GOSIP Version 2 NSAP structure.
30 |
31 |
32 | */
33 |
34 | namespace Heijden.DNS
35 | {
36 | public class RecordNSAP : Record
37 | {
38 | public ushort LENGTH;
39 | public byte[] NSAPADDRESS;
40 |
41 | public RecordNSAP(RecordReader rr)
42 | {
43 | LENGTH = rr.ReadUInt16();
44 | NSAPADDRESS = rr.ReadBytes(LENGTH);
45 | }
46 |
47 | public override string ToString()
48 | {
49 | StringBuilder sb = new StringBuilder();
50 | sb.AppendFormat("{0} ", LENGTH);
51 | for (int intI = 0; intI < NSAPADDRESS.Length; intI++)
52 | sb.AppendFormat("{0:X00}", NSAPADDRESS[intI]);
53 | return sb.ToString();
54 | }
55 |
56 | public string ToGOSIPV2()
57 | {
58 | return string.Format("{0:X}.{1:X}.{2:X}.{3:X}.{4:X}.{5:X}.{6:X}{7:X}.{8:X}",
59 | NSAPADDRESS[0], // AFI
60 | NSAPADDRESS[1] << 8 | NSAPADDRESS[2], // IDI
61 | NSAPADDRESS[3], // DFI
62 | NSAPADDRESS[4] << 16 | NSAPADDRESS[5] << 8 | NSAPADDRESS[6], // AA
63 | NSAPADDRESS[7] << 8 | NSAPADDRESS[8], // Rsvd
64 | NSAPADDRESS[9] << 8 | NSAPADDRESS[10],// RD
65 | NSAPADDRESS[11] << 8 | NSAPADDRESS[12],// Area
66 | NSAPADDRESS[13] << 16 | NSAPADDRESS[14] << 8 | NSAPADDRESS[15], // ID-High
67 | NSAPADDRESS[16] << 16 | NSAPADDRESS[17] << 8 | NSAPADDRESS[18], // ID-Low
68 | NSAPADDRESS[19]);
69 | }
70 |
71 | }
72 | }
73 |
--------------------------------------------------------------------------------
/MinecraftClient/Protocol/Dns/Records/RecordNULL.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | /*
3 | 3.3.10. NULL RDATA format (EXPERIMENTAL)
4 |
5 | +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
6 | / /
7 | / /
8 | +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
9 |
10 | Anything at all may be in the RDATA field so long as it is 65535 octets
11 | or less.
12 |
13 | NULL records cause no additional section processing. NULL RRs are not
14 | allowed in master files. NULLs are used as placeholders in some
15 | experimental extensions of the DNS.
16 | */
17 | namespace Heijden.DNS
18 | {
19 | public class RecordNULL : Record
20 | {
21 | public byte[] ANYTHING;
22 |
23 | public RecordNULL(RecordReader rr)
24 | {
25 | rr.Position -= 2;
26 | // re-read length
27 | ushort RDLENGTH = rr.ReadUInt16();
28 | ANYTHING = new byte[RDLENGTH];
29 | ANYTHING = rr.ReadBytes(RDLENGTH);
30 | }
31 |
32 | public override string ToString()
33 | {
34 | return string.Format("...binary data... ({0}) bytes",ANYTHING.Length);
35 | }
36 |
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/MinecraftClient/Protocol/Dns/Records/RecordPTR.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | /*
3 | 3.3.12. PTR RDATA format
4 |
5 | +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
6 | / PTRDNAME /
7 | +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
8 |
9 | where:
10 |
11 | PTRDNAME A which points to some location in the
12 | domain name space.
13 |
14 | PTR records cause no additional section processing. These RRs are used
15 | in special domains to point to some other location in the domain space.
16 | These records are simple data, and don't imply any special processing
17 | similar to that performed by CNAME, which identifies aliases. See the
18 | description of the IN-ADDR.ARPA domain for an example.
19 | */
20 |
21 | namespace Heijden.DNS
22 | {
23 | public class RecordPTR : Record
24 | {
25 | public string PTRDNAME;
26 |
27 | public RecordPTR(RecordReader rr)
28 | {
29 | PTRDNAME = rr.ReadDomainName();
30 | }
31 |
32 | public override string ToString()
33 | {
34 | return PTRDNAME;
35 | }
36 |
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/MinecraftClient/Protocol/Dns/Records/RecordRP.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | /* http://tools.ietf.org/rfc/rfc1183.txt
3 |
4 | 2.2. The Responsible Person RR
5 |
6 | The method uses a new RR type with mnemonic RP and type code of 17
7 | (decimal).
8 |
9 | RP has the following format:
10 |
11 | RP
12 |
13 | Both RDATA fields are required in all RP RRs.
14 |
15 | The first field, , is a domain name that specifies the
16 | mailbox for the responsible person. Its format in master files uses
17 | the DNS convention for mailbox encoding, identical to that used for
18 | the RNAME mailbox field in the SOA RR. The root domain name (just
19 | ".") may be specified for to indicate that no mailbox is
20 | available.
21 |
22 | The second field, , is a domain name for which TXT RR's
23 | exist. A subsequent query can be performed to retrieve the
24 | associated TXT resource records at . This provides a
25 | level of indirection so that the entity can be referred to from
26 | multiple places in the DNS. The root domain name (just ".") may be
27 | specified for to indicate that the TXT_DNAME is absent,
28 | and no associated TXT RR exists.
29 |
30 | */
31 |
32 | namespace Heijden.DNS
33 | {
34 | public class RecordRP : Record
35 | {
36 | public string MBOXDNAME;
37 | public string TXTDNAME;
38 |
39 | public RecordRP(RecordReader rr)
40 | {
41 | //MBOXDNAME = rr.ReadString();
42 | MBOXDNAME = rr.ReadDomainName();
43 | TXTDNAME = rr.ReadDomainName();
44 | }
45 |
46 | public override string ToString()
47 | {
48 | return string.Format("{0} {1}",
49 | MBOXDNAME,
50 | TXTDNAME);
51 | }
52 |
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/MinecraftClient/Protocol/Dns/Records/RecordRT.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | /* http://tools.ietf.org/rfc/rfc1183.txt
3 |
4 | 3.3. The Route Through RR
5 |
6 | The Route Through RR is defined with mnemonic RT and type code 21
7 | (decimal).
8 |
9 | The RT resource record provides a route-through binding for hosts
10 | that do not have their own direct wide area network addresses. It is
11 | used in much the same way as the MX RR.
12 |
13 | RT has the following format:
14 |
15 | RT
16 |
17 | Both RDATA fields are required in all RT RRs.
18 |
19 | The first field, , is a 16 bit integer, representing the
20 | preference of the route. Smaller numbers indicate more preferred
21 | routes.
22 |
23 | is the domain name of a host which will serve as
24 | an intermediate in reaching the host specified by . The DNS
25 | RRs associated with are expected to include at
26 | least one A, X25, or ISDN record.
27 |
28 | The format of the RT RR is class insensitive. RT records cause type
29 | X25, ISDN, and A additional section processing for .
31 |
32 | For example,
33 |
34 | sh.prime.com. IN RT 2 Relay.Prime.COM.
35 | IN RT 10 NET.Prime.COM.
36 | *.prime.com. IN RT 90 Relay.Prime.COM.
37 |
38 | When a host is looking up DNS records to attempt to route a datagram,
39 | it first looks for RT records for the destination host, which point
40 | to hosts with address records (A, X25, ISDN) compatible with the wide
41 | area networks available to the host. If it is itself in the set of
42 | RT records, it discards any RTs with preferences higher or equal to
43 | its own. If there are no (remaining) RTs, it can then use address
44 | records of the destination itself.
45 |
46 | Wild-card RTs are used exactly as are wild-card MXs. RT's do not
47 | "chain"; that is, it is not valid to use the RT RRs found for a host
48 | referred to by an RT.
49 |
50 | The concrete encoding is identical to the MX RR.
51 |
52 |
53 | */
54 |
55 | namespace Heijden.DNS
56 | {
57 | public class RecordRT : Record
58 | {
59 | public ushort PREFERENCE;
60 | public string INTERMEDIATEHOST;
61 |
62 | public RecordRT(RecordReader rr)
63 | {
64 | PREFERENCE = rr.ReadUInt16();
65 | INTERMEDIATEHOST = rr.ReadDomainName();
66 | }
67 |
68 | public override string ToString()
69 | {
70 | return string.Format("{0} {1}",
71 | PREFERENCE,
72 | INTERMEDIATEHOST);
73 | }
74 |
75 | }
76 | }
77 |
--------------------------------------------------------------------------------
/MinecraftClient/Protocol/Dns/Records/RecordTKEY.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | /*
3 | * http://tools.ietf.org/rfc/rfc2930.txt
4 | *
5 | 2. The TKEY Resource Record
6 |
7 | The TKEY resource record (RR) has the structure given below. Its RR
8 | type code is 249.
9 |
10 | Field Type Comment
11 | ----- ---- -------
12 | Algorithm: domain
13 | Inception: u_int32_t
14 | Expiration: u_int32_t
15 | Mode: u_int16_t
16 | Error: u_int16_t
17 | Key Size: u_int16_t
18 | Key Data: octet-stream
19 | Other Size: u_int16_t
20 | Other Data: octet-stream undefined by this specification
21 |
22 | */
23 |
24 | namespace Heijden.DNS
25 | {
26 | public class RecordTKEY : Record
27 | {
28 | public string ALGORITHM;
29 | public UInt32 INCEPTION;
30 | public UInt32 EXPIRATION;
31 | public UInt16 MODE;
32 | public UInt16 ERROR;
33 | public UInt16 KEYSIZE;
34 | public byte[] KEYDATA;
35 | public UInt16 OTHERSIZE;
36 | public byte[] OTHERDATA;
37 |
38 | public RecordTKEY(RecordReader rr)
39 | {
40 | ALGORITHM = rr.ReadDomainName();
41 | INCEPTION = rr.ReadUInt32();
42 | EXPIRATION = rr.ReadUInt32();
43 | MODE = rr.ReadUInt16();
44 | ERROR = rr.ReadUInt16();
45 | KEYSIZE = rr.ReadUInt16();
46 | KEYDATA = rr.ReadBytes(KEYSIZE);
47 | OTHERSIZE = rr.ReadUInt16();
48 | OTHERDATA = rr.ReadBytes(OTHERSIZE);
49 | }
50 |
51 | public override string ToString()
52 | {
53 | return string.Format("{0} {1} {2} {3} {4}",
54 | ALGORITHM,
55 | INCEPTION,
56 | EXPIRATION,
57 | MODE,
58 | ERROR);
59 | }
60 |
61 | }
62 | }
63 |
--------------------------------------------------------------------------------
/MinecraftClient/Protocol/Dns/Records/RecordTSIG.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | /*
3 | * http://www.ietf.org/rfc/rfc2845.txt
4 | *
5 | * Field Name Data Type Notes
6 | --------------------------------------------------------------
7 | Algorithm Name domain-name Name of the algorithm
8 | in domain name syntax.
9 | Time Signed u_int48_t seconds since 1-Jan-70 UTC.
10 | Fudge u_int16_t seconds of error permitted
11 | in Time Signed.
12 | MAC Size u_int16_t number of octets in MAC.
13 | MAC octet stream defined by Algorithm Name.
14 | Original ID u_int16_t original message ID
15 | Error u_int16_t expanded RCODE covering
16 | TSIG processing.
17 | Other Len u_int16_t length, in octets, of
18 | Other Data.
19 | Other Data octet stream empty unless Error == BADTIME
20 |
21 | */
22 |
23 | namespace Heijden.DNS
24 | {
25 | public class RecordTSIG : Record
26 | {
27 | public string ALGORITHMNAME;
28 | public long TIMESIGNED;
29 | public UInt16 FUDGE;
30 | public UInt16 MACSIZE;
31 | public byte[] MAC;
32 | public UInt16 ORIGINALID;
33 | public UInt16 ERROR;
34 | public UInt16 OTHERLEN;
35 | public byte[] OTHERDATA;
36 |
37 | public RecordTSIG(RecordReader rr)
38 | {
39 | ALGORITHMNAME = rr.ReadDomainName();
40 | TIMESIGNED = rr.ReadUInt32() << 32 | rr.ReadUInt32();
41 | FUDGE = rr.ReadUInt16();
42 | MACSIZE = rr.ReadUInt16();
43 | MAC = rr.ReadBytes(MACSIZE);
44 | ORIGINALID = rr.ReadUInt16();
45 | ERROR = rr.ReadUInt16();
46 | OTHERLEN = rr.ReadUInt16();
47 | OTHERDATA = rr.ReadBytes(OTHERLEN);
48 | }
49 |
50 | public override string ToString()
51 | {
52 | DateTime dateTime = new DateTime(1970, 1, 1, 0, 0, 0, 0);
53 | dateTime = dateTime.AddSeconds(TIMESIGNED);
54 | string printDate = dateTime.ToShortDateString() + " " + dateTime.ToShortTimeString();
55 | return string.Format("{0} {1} {2} {3} {4}",
56 | ALGORITHMNAME,
57 | printDate,
58 | FUDGE,
59 | ORIGINALID,
60 | ERROR);
61 | }
62 |
63 | }
64 | }
65 |
--------------------------------------------------------------------------------
/MinecraftClient/Protocol/Dns/Records/RecordTXT.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | #region Rfc info
4 | /*
5 | 3.3.14. TXT RDATA format
6 |
7 | +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
8 | / TXT-DATA /
9 | +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
10 |
11 | where:
12 |
13 | TXT-DATA One or more s.
14 |
15 | TXT RRs are used to hold descriptive text. The semantics of the text
16 | depends on the domain where it is found.
17 | *
18 | */
19 | #endregion
20 |
21 | namespace Heijden.DNS
22 | {
23 | public class RecordTXT : Record
24 | {
25 | public string TXT;
26 |
27 | public RecordTXT(RecordReader rr)
28 | {
29 | TXT = rr.ReadString();
30 | }
31 |
32 | public override string ToString()
33 | {
34 | return string.Format("\"{0}\"",TXT);
35 | }
36 |
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/MinecraftClient/Protocol/Dns/Records/RecordWKS.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | /*
3 | * 3.4.2. WKS RDATA format
4 |
5 | +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
6 | | ADDRESS |
7 | +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
8 | | PROTOCOL | |
9 | +--+--+--+--+--+--+--+--+ |
10 | | |
11 | / /
12 | / /
13 | +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
14 |
15 | where:
16 |
17 | ADDRESS An 32 bit Internet address
18 |
19 | PROTOCOL An 8 bit IP protocol number
20 |
21 | A variable length bit map. The bit map must be a
22 | multiple of 8 bits long.
23 |
24 | The WKS record is used to describe the well known services supported by
25 | a particular protocol on a particular internet address. The PROTOCOL
26 | field specifies an IP protocol number, and the bit map has one bit per
27 | port of the specified protocol. The first bit corresponds to port 0,
28 | the second to port 1, etc. If the bit map does not include a bit for a
29 | protocol of interest, that bit is assumed zero. The appropriate values
30 | and mnemonics for ports and protocols are specified in [RFC-1010].
31 |
32 | For example, if PROTOCOL=TCP (6), the 26th bit corresponds to TCP port
33 | 25 (SMTP). If this bit is set, a SMTP server should be listening on TCP
34 | port 25; if zero, SMTP service is not supported on the specified
35 | address.
36 |
37 | The purpose of WKS RRs is to provide availability information for
38 | servers for TCP and UDP. If a server supports both TCP and UDP, or has
39 | multiple Internet addresses, then multiple WKS RRs are used.
40 |
41 | WKS RRs cause no additional section processing.
42 |
43 | In master files, both ports and protocols are expressed using mnemonics
44 | or decimal numbers.
45 |
46 | */
47 | namespace Heijden.DNS
48 | {
49 | public class RecordWKS : Record
50 | {
51 | public string ADDRESS;
52 | public int PROTOCOL;
53 | public byte[] BITMAP;
54 |
55 | public RecordWKS(RecordReader rr)
56 | {
57 | ushort length = rr.ReadUInt16(-2);
58 | ADDRESS = string.Format("{0}.{1}.{2}.{3}",
59 | rr.ReadByte(),
60 | rr.ReadByte(),
61 | rr.ReadByte(),
62 | rr.ReadByte());
63 | PROTOCOL = (int)rr.ReadByte();
64 | length -= 5;
65 | BITMAP = new byte[length];
66 | BITMAP = rr.ReadBytes(length);
67 | }
68 |
69 | public override string ToString()
70 | {
71 | return string.Format("{0} {1}",ADDRESS,PROTOCOL);
72 | }
73 |
74 | }
75 | }
76 |
--------------------------------------------------------------------------------
/MinecraftClient/Protocol/Dns/Records/RecordX25.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | /* http://tools.ietf.org/rfc/rfc1183.txt
3 |
4 | 3.1. The X25 RR
5 |
6 | The X25 RR is defined with mnemonic X25 and type code 19 (decimal).
7 |
8 | X25 has the following format:
9 |
10 | X25
11 |
12 | is required in all X25 RRs.
13 |
14 | identifies the PSDN (Public Switched Data Network)
15 | address in the X.121 [10] numbering plan associated with .
16 | Its format in master files is a syntactically
17 | identical to that used in TXT and HINFO.
18 |
19 | The format of X25 is class insensitive. X25 RRs cause no additional
20 | section processing.
21 |
22 | The is a string of decimal digits, beginning with the
23 | 4 digit DNIC (Data Network Identification Code), as specified in
24 | X.121. National prefixes (such as a 0) MUST NOT be used.
25 |
26 | For example:
27 |
28 | Relay.Prime.COM. X25 311061700956
29 |
30 |
31 | */
32 |
33 | namespace Heijden.DNS
34 | {
35 | public class RecordX25 : Record
36 | {
37 | public string PSDNADDRESS;
38 |
39 | public RecordX25(RecordReader rr)
40 | {
41 | PSDNADDRESS = rr.ReadString();
42 | }
43 |
44 | public override string ToString()
45 | {
46 | return string.Format("{0}",
47 | PSDNADDRESS);
48 | }
49 |
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/MinecraftClient/Protocol/Dns/Records/totla.txt:
--------------------------------------------------------------------------------
1 | Record.cs
2 | RecordA.cs
3 | RecordAAAA.cs
4 | RecordCNAME.cs
5 | RecordHINFO.cs
6 | RecordMB.cs
7 | RecordMD.cs
8 | RecordMF.cs
9 | RecordMG.cs
10 | RecordMINFO.cs
11 | RecordMR.cs
12 | RecordMX.cs
13 | RecordNS.cs
14 | RecordNULL.cs
15 | RecordPTR.cs
16 | RecordReader.cs
17 | RecordSOA.cs
18 | RecordTXT.cs
19 | RecordUnknown.cs
20 | RecordWKS.cs
21 | totla.txt
22 |
--------------------------------------------------------------------------------
/MinecraftClient/Protocol/Dns/Request.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 |
5 | namespace Heijden.DNS
6 | {
7 | public class Request
8 | {
9 | public Header header;
10 |
11 | private List questions;
12 |
13 | public Request()
14 | {
15 | header = new Header();
16 | header.OPCODE = OPCode.Query;
17 | header.QDCOUNT = 0;
18 |
19 | questions = new List();
20 | }
21 |
22 | public void AddQuestion(Question question)
23 | {
24 | questions.Add(question);
25 | }
26 |
27 | public byte[] Data
28 | {
29 | get
30 | {
31 | List data = new List();
32 | header.QDCOUNT = (ushort)questions.Count;
33 | data.AddRange(header.Data);
34 | foreach (Question q in questions)
35 | data.AddRange(q.Data);
36 | return data.ToArray();
37 | }
38 | }
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/MinecraftClient/Protocol/EntityActionType.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace MinecraftClient.Protocol
7 | {
8 | public enum EntityActionType
9 | {
10 | StartSneaking = 0,
11 | StopSneaking = 1,
12 | LeaveBed = 2,
13 | StartSprinting = 3,
14 | StopSprinting = 4,
15 | StartJumpWithHorse = 5,
16 | StopJumpWithHorse = 6,
17 | OpenHorseInventory = 7,
18 | StartFlyingWithElytra = 8,
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/MinecraftClient/Protocol/GuidExtensions.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace MinecraftClient.Protocol
7 | {
8 | public static class GuidExtensions
9 | {
10 | ///
11 | /// A CLSCompliant method to convert a Java big-endian Guid to a .NET
12 | /// little-endian Guid.
13 | /// The Guid Constructor (UInt32, UInt16, UInt16, Byte, Byte, Byte, Byte,
14 | /// Byte, Byte, Byte, Byte) is not CLSCompliant.
15 | ///
16 | public static Guid ToLittleEndian(this Guid javaGuid)
17 | {
18 | byte[] net = new byte[16];
19 | byte[] java = javaGuid.ToByteArray();
20 | for (int i = 8; i < 16; i++)
21 | {
22 | net[i] = java[i];
23 | }
24 | net[3] = java[0];
25 | net[2] = java[1];
26 | net[1] = java[2];
27 | net[0] = java[3];
28 | net[5] = java[4];
29 | net[4] = java[5];
30 | net[6] = java[7];
31 | net[7] = java[6];
32 | return new Guid(net);
33 | }
34 |
35 | ///
36 | /// Converts little-endian .NET guids to big-endian Java guids:
37 | ///
38 | public static Guid ToBigEndian(this Guid netGuid)
39 | {
40 | byte[] java = new byte[16];
41 | byte[] net = netGuid.ToByteArray();
42 | for (int i = 8; i < 16; i++)
43 | {
44 | java[i] = net[i];
45 | }
46 | java[0] = net[3];
47 | java[1] = net[2];
48 | java[2] = net[1];
49 | java[3] = net[0];
50 | java[4] = net[5];
51 | java[5] = net[4];
52 | java[6] = net[7];
53 | java[7] = net[6];
54 | return new Guid(java);
55 | }
56 |
57 | ///
58 | /// Converts little-endian .NET guids to big-endian Java guids:
59 | ///
60 | public static byte[] ToBigEndianBytes(this Guid netGuid)
61 | {
62 | byte[] java = new byte[16];
63 | byte[] net = netGuid.ToByteArray();
64 | for (int i = 8; i < 16; i++)
65 | {
66 | java[i] = net[i];
67 | }
68 | java[0] = net[3];
69 | java[1] = net[2];
70 | java[2] = net[1];
71 | java[3] = net[0];
72 | java[4] = net[5];
73 | java[5] = net[4];
74 | java[6] = net[7];
75 | java[7] = net[6];
76 | return java;
77 | }
78 | }
79 | }
80 |
--------------------------------------------------------------------------------
/MinecraftClient/Protocol/Handlers/Compression/Zip/ZipConstants.cs:
--------------------------------------------------------------------------------
1 | // ZipConstants.cs
2 | // ------------------------------------------------------------------
3 | //
4 | // Copyright (c) 2006, 2007, 2008, 2009 Dino Chiesa and Microsoft Corporation.
5 | // All rights reserved.
6 | //
7 | // This code module is part of DotNetZip, a zipfile class library.
8 | //
9 | // ------------------------------------------------------------------
10 | //
11 | // This code is licensed under the Microsoft Public License.
12 | // See the file License.txt for the license details.
13 | // More info on: http://dotnetzip.codeplex.com
14 | //
15 | // ------------------------------------------------------------------
16 | //
17 | // last saved (in emacs):
18 | // Time-stamp: <2009-August-27 23:22:32>
19 | //
20 | // ------------------------------------------------------------------
21 | //
22 | // This module defines a few constants that are used in the project.
23 | //
24 | // ------------------------------------------------------------------
25 |
26 | using System;
27 |
28 | namespace Ionic.Zip
29 | {
30 | static class ZipConstants
31 | {
32 | public const UInt32 PackedToRemovableMedia = 0x30304b50;
33 | public const UInt32 Zip64EndOfCentralDirectoryRecordSignature = 0x06064b50;
34 | public const UInt32 Zip64EndOfCentralDirectoryLocatorSignature = 0x07064b50;
35 | public const UInt32 EndOfCentralDirectorySignature = 0x06054b50;
36 | public const int ZipEntrySignature = 0x04034b50;
37 | public const int ZipEntryDataDescriptorSignature = 0x08074b50;
38 | public const int SplitArchiveSignature = 0x08074b50;
39 | public const int ZipDirEntrySignature = 0x02014b50;
40 |
41 |
42 | // These are dictated by the Zip Spec.See APPNOTE.txt
43 | public const int AesKeySize = 192; // 128, 192, 256
44 | public const int AesBlockSize = 128; // ???
45 |
46 | public const UInt16 AesAlgId128 = 0x660E;
47 | public const UInt16 AesAlgId192 = 0x660F;
48 | public const UInt16 AesAlgId256 = 0x6610;
49 |
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/MinecraftClient/Protocol/Handlers/Compression/Zip/ZipEntrySource.cs:
--------------------------------------------------------------------------------
1 | // ZipEntrySource.cs
2 | // ------------------------------------------------------------------
3 | //
4 | // Copyright (c) 2009 Dino Chiesa
5 | // All rights reserved.
6 | //
7 | // This code module is part of DotNetZip, a zipfile class library.
8 | //
9 | // ------------------------------------------------------------------
10 | //
11 | // This code is licensed under the Microsoft Public License.
12 | // See the file License.txt for the license details.
13 | // More info on: http://dotnetzip.codeplex.com
14 | //
15 | // ------------------------------------------------------------------
16 | //
17 | // last saved (in emacs):
18 | // Time-stamp: <2009-November-19 11:18:42>
19 | //
20 | // ------------------------------------------------------------------
21 | //
22 |
23 | namespace Ionic.Zip
24 | {
25 | ///
26 | /// An enum that specifies the source of the ZipEntry.
27 | ///
28 | public enum ZipEntrySource
29 | {
30 | ///
31 | /// Default value. Invalid on a bonafide ZipEntry.
32 | ///
33 | None = 0,
34 |
35 | ///
36 | /// The entry was instantiated by calling AddFile() or another method that
37 | /// added an entry from the filesystem.
38 | ///
39 | FileSystem,
40 |
41 | ///
42 | /// The entry was instantiated via or
43 | /// .
44 | ///
45 | Stream,
46 |
47 | ///
48 | /// The ZipEntry was instantiated by reading a zipfile.
49 | ///
50 | ZipFile,
51 |
52 | ///
53 | /// The content for the ZipEntry will be or was provided by the WriteDelegate.
54 | ///
55 | WriteDelegate,
56 |
57 | ///
58 | /// The content for the ZipEntry will be obtained from the stream dispensed by the OpenDelegate.
59 | /// The entry was instantiated via .
60 | ///
61 | JitStream,
62 |
63 | ///
64 | /// The content for the ZipEntry will be or was obtained from a ZipOutputStream.
65 | ///
66 | ZipOutputStream,
67 | }
68 |
69 | }
--------------------------------------------------------------------------------
/MinecraftClient/Protocol/Handlers/Compression/Zip/ZipFile.SaveSelfExtractor.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/goldenlib/Minecraft-Console-Client/9e75d1808b1e84722ee263e4f921807961df628b/MinecraftClient/Protocol/Handlers/Compression/Zip/ZipFile.SaveSelfExtractor.cs
--------------------------------------------------------------------------------
/MinecraftClient/Protocol/Handlers/Forge/FMLHandshakeClientState.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace MinecraftClient.Protocol.Handlers.Forge
7 | {
8 | ///
9 | /// Copy of the forge enum for client states.
10 | /// https://github.com/MinecraftForge/MinecraftForge/blob/ebe9b6d4cbc4a5281c386994f1fbda04df5d2e1f/src/main/java/net/minecraftforge/fml/common/network/handshake/FMLHandshakeClientState.java
11 | ///
12 | enum FMLHandshakeClientState : byte
13 | {
14 | START,
15 | HELLO,
16 | WAITINGSERVERDATA,
17 | WAITINGSERVERCOMPLETE,
18 | PENDINGCOMPLETE,
19 | COMPLETE,
20 | DONE,
21 | ERROR
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/MinecraftClient/Protocol/Handlers/Forge/FMLHandshakeDiscriminator.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace MinecraftClient.Protocol.Handlers.Forge
7 | {
8 | ///
9 | /// Different "discriminator byte" values for the forge handshake.
10 | /// https://github.com/MinecraftForge/MinecraftForge/blob/ebe9b6d4cbc4a5281c386994f1fbda04df5d2e1f/src/main/java/net/minecraftforge/fml/common/network/handshake/FMLHandshakeCodec.java
11 | ///
12 | enum FMLHandshakeDiscriminator : byte
13 | {
14 | ServerHello = 0,
15 | ClientHello = 1,
16 | ModList = 2,
17 | RegistryData = 3,
18 | HandshakeAck = 255, //-1
19 | HandshakeReset = 254, //-2
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/MinecraftClient/Protocol/Handlers/Forge/FMLVersion.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace MinecraftClient.Protocol.Handlers.Forge
7 | {
8 | ///
9 | /// Version of the FML protocol
10 | ///
11 | ///
12 | enum FMLVersion
13 | {
14 | FML,
15 | FML2
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/MinecraftClient/Protocol/Handlers/PacketTypesOut.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace MinecraftClient.Protocol.Handlers
7 | {
8 | ///
9 | /// Outgoing packet types
10 | ///
11 | public enum PacketTypesOut
12 | {
13 | TeleportConfirm,
14 | QueryBlockNBT,
15 | SetDifficulty,
16 | ChatMessage,
17 | ClientStatus,
18 | ClientSettings,
19 | TabComplete,
20 | WindowConfirmation,
21 | ClickWindowButton,
22 | ClickWindow,
23 | CloseWindow,
24 | PluginMessage,
25 | EditBook,
26 | EntityNBTRequest,
27 | InteractEntity,
28 | KeepAlive,
29 | LockDifficulty,
30 | PlayerPosition,
31 | PlayerPositionAndRotation,
32 | PlayerRotation,
33 | PlayerMovement,
34 | VehicleMove,
35 | SteerBoat,
36 | PickItem,
37 | CraftRecipeRequest,
38 | PlayerAbilities,
39 | PlayerDigging,
40 | EntityAction,
41 | SteerVehicle,
42 | RecipeBookData,
43 | NameItem,
44 | ResourcePackStatus,
45 | AdvancementTab,
46 | SelectTrade,
47 | SetBeaconEffect,
48 | HeldItemChange,
49 | UpdateCommandBlock,
50 | UpdateCommandBlockMinecart,
51 | CreativeInventoryAction,
52 | UpdateJigsawBlock,
53 | UpdateStructureBlock,
54 | UpdateSign,
55 | Animation,
56 | Spectate,
57 | PlayerBlockPlacement,
58 | UseItem,
59 | Pong,
60 | PrepareCraftingGrid, // For 1.12 - 1.12.1 only
61 | EnchantItem, // For 1.13.2 or below
62 | GenerateStructure, // Added in 1.16
63 | SetDisplayedRecipe, // Added in 1.16.2
64 | SetRecipeBookState, // Added in 1.16.2
65 | Unknown // For old version packet that have been removed and not used by mcc
66 | }
67 | }
68 |
--------------------------------------------------------------------------------
/MinecraftClient/Protocol/JwtPayloadDecode.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace MinecraftClient.Protocol
7 | {
8 | // Thanks to https://stackoverflow.com/questions/60404612/parse-jwt-token-to-get-the-payload-content-only-without-external-library-in-c-sh
9 | public static class JwtPayloadDecode
10 | {
11 | public static string GetPayload(string token)
12 | {
13 | var content = token.Split('.')[1];
14 | var jsonPayload = Encoding.UTF8.GetString(Decode(content));
15 | return jsonPayload;
16 | }
17 |
18 | private static byte[] Decode(string input)
19 | {
20 | var output = input;
21 | output = output.Replace('-', '+'); // 62nd char of encoding
22 | output = output.Replace('_', '/'); // 63rd char of encoding
23 | switch (output.Length % 4) // Pad with trailing '='s
24 | {
25 | case 0: break; // No pad chars in this case
26 | case 2: output += "=="; break; // Two pad chars
27 | case 3: output += "="; break; // One pad char
28 | default: throw new System.ArgumentOutOfRangeException("input", "Illegal base64url string!");
29 | }
30 | var converted = Convert.FromBase64String(output); // Standard base64 decoder
31 | return converted;
32 | }
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/MinecraftClient/Protocol/Session/CacheType.cs:
--------------------------------------------------------------------------------
1 | namespace MinecraftClient.Protocol.Session
2 | {
3 | public enum CacheType
4 | {
5 | ///
6 | /// Do not perform any session caching, always perform login requests from scratch.
7 | ///
8 | None,
9 |
10 | ///
11 | /// Cache session information in memory to reuse session tokens across server joins.
12 | ///
13 | Memory,
14 |
15 | ///
16 | /// Cache session information in a SessionCache file to share session tokens between different MCC instances.
17 | ///
18 | Disk
19 | };
20 | }
21 |
--------------------------------------------------------------------------------
/MinecraftClient/Protocol/Session/SessionToken.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text.RegularExpressions;
4 | using System.IO;
5 |
6 | namespace MinecraftClient.Protocol.Session
7 | {
8 | [Serializable]
9 | public class SessionToken
10 | {
11 | private static readonly Regex JwtRegex = new Regex("^[A-Za-z0-9-_]+\\.[A-Za-z0-9-_]+\\.[A-Za-z0-9-_]+$");
12 |
13 | public string ID { get; set; }
14 | public string PlayerName { get; set; }
15 | public string PlayerID { get; set; }
16 | public string ClientID { get; set; }
17 | public string RefreshToken { get; set; }
18 |
19 | public SessionToken()
20 | {
21 | ID = String.Empty;
22 | PlayerName = String.Empty;
23 | PlayerID = String.Empty;
24 | ClientID = String.Empty;
25 | RefreshToken = String.Empty;
26 | }
27 |
28 | public override string ToString()
29 | {
30 | return String.Join(",", ID, PlayerName, PlayerID, ClientID, RefreshToken);
31 | }
32 |
33 | public static SessionToken FromString(string tokenString)
34 | {
35 | string[] fields = tokenString.Split(',');
36 | if (fields.Length < 4)
37 | throw new InvalidDataException("Invalid string format");
38 |
39 | SessionToken session = new SessionToken();
40 | session.ID = fields[0];
41 | session.PlayerName = fields[1];
42 | session.PlayerID = fields[2];
43 | session.ClientID = fields[3];
44 | // Backward compatible with old session file without refresh token field
45 | if (fields.Length > 4)
46 | session.RefreshToken = fields[4];
47 | else
48 | session.RefreshToken = String.Empty;
49 |
50 | Guid temp;
51 | if (!JwtRegex.IsMatch(session.ID))
52 | throw new InvalidDataException("Invalid session ID");
53 | if (!ChatBot.IsValidName(session.PlayerName))
54 | throw new InvalidDataException("Invalid player name");
55 | if (!Guid.TryParseExact(session.PlayerID, "N", out temp))
56 | throw new InvalidDataException("Invalid player ID");
57 | if (!Guid.TryParseExact(session.ClientID, "N", out temp))
58 | throw new InvalidDataException("Invalid client ID");
59 | // No validation on refresh token because it is custom format token (not Jwt)
60 |
61 | return session;
62 | }
63 | }
64 | }
65 |
--------------------------------------------------------------------------------
/MinecraftClient/Proxy/Handlers/EventArgs/CreateConnectionAsyncCompletedEventArgs.cs:
--------------------------------------------------------------------------------
1 | /*
2 | * Authors: Benton Stark
3 | *
4 | * Copyright (c) 2007-2012 Starksoft, LLC (http://www.starksoft.com)
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in
14 | * all copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | * THE SOFTWARE.
23 | *
24 | */
25 |
26 | using System;
27 | using System.Net.Sockets;
28 | using System.ComponentModel;
29 |
30 | namespace Starksoft.Net.Proxy
31 | {
32 | ///
33 | /// Event arguments class for the EncryptAsyncCompleted event.
34 | ///
35 | public class CreateConnectionAsyncCompletedEventArgs : AsyncCompletedEventArgs
36 | {
37 | private TcpClient _proxyConnection;
38 |
39 | ///
40 | /// Constructor.
41 | ///
42 | /// Exception information generated by the event.
43 | /// Cancelled event flag. This flag is set to true if the event was cancelled.
44 | /// Proxy Connection. The initialized and open TcpClient proxy connection.
45 | public CreateConnectionAsyncCompletedEventArgs(Exception error, bool cancelled, TcpClient proxyConnection)
46 | : base(error, cancelled, null)
47 | {
48 | _proxyConnection = proxyConnection;
49 | }
50 |
51 | ///
52 | /// The proxy connection.
53 | ///
54 | public TcpClient ProxyConnection
55 | {
56 | get { return _proxyConnection; }
57 | }
58 | }
59 |
60 | }
61 |
--------------------------------------------------------------------------------
/MinecraftClient/Proxy/Handlers/Exceptions/ProxyException.cs:
--------------------------------------------------------------------------------
1 | /*
2 | * Authors: Benton Stark
3 | *
4 | * Copyright (c) 2007-2012 Starksoft, LLC (http://www.starksoft.com)
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in
14 | * all copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | * THE SOFTWARE.
23 | *
24 | */
25 |
26 | using System;
27 | using System.Runtime.Serialization;
28 |
29 | namespace Starksoft.Net.Proxy
30 | {
31 |
32 | ///
33 | /// This exception is thrown when a general, unexpected proxy error.
34 | ///
35 | [Serializable()]
36 | public class ProxyException : Exception
37 | {
38 | ///
39 | /// Constructor.
40 | ///
41 | public ProxyException()
42 | {
43 | }
44 |
45 | ///
46 | /// Constructor.
47 | ///
48 | /// Exception message text.
49 | public ProxyException(string message)
50 | : base(message)
51 | {
52 | }
53 |
54 | ///
55 | /// Constructor.
56 | ///
57 | /// Exception message text.
58 | /// The inner exception object.
59 | public ProxyException(string message, Exception innerException)
60 | :
61 | base(message, innerException)
62 | {
63 | }
64 |
65 | ///
66 | /// Constructor.
67 | ///
68 | /// Serialization information.
69 | /// Stream context information.
70 | protected ProxyException(SerializationInfo info,
71 | StreamingContext context)
72 | : base(info, context)
73 | {
74 | }
75 | }
76 |
77 | }
--------------------------------------------------------------------------------
/MinecraftClient/Proxy/Handlers/Utils.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Text;
3 | using System.Globalization;
4 | using System.Net.Sockets;
5 |
6 | namespace Starksoft.Net.Proxy
7 | {
8 | internal static class Utils
9 | {
10 | internal static string GetHost(TcpClient client)
11 | {
12 | if (client == null)
13 | throw new ArgumentNullException("client");
14 |
15 | string host = "";
16 | try
17 | {
18 | host = ((System.Net.IPEndPoint)client.Client.RemoteEndPoint).Address.ToString();
19 | }
20 | catch
21 | { };
22 |
23 | return host;
24 | }
25 |
26 | internal static string GetPort(TcpClient client)
27 | {
28 | if (client == null)
29 | throw new ArgumentNullException("client");
30 |
31 | string port = "";
32 | try
33 | {
34 | port = ((System.Net.IPEndPoint)client.Client.RemoteEndPoint).Port.ToString(CultureInfo.InvariantCulture);
35 | }
36 | catch
37 | { };
38 |
39 | return port;
40 | }
41 |
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/MinecraftClient/Resources/AppIcon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/goldenlib/Minecraft-Console-Client/9e75d1808b1e84722ee263e4f921807961df628b/MinecraftClient/Resources/AppIcon.ico
--------------------------------------------------------------------------------
/MinecraftClient/Resources/appicon_creeper1.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/goldenlib/Minecraft-Console-Client/9e75d1808b1e84722ee263e4f921807961df628b/MinecraftClient/Resources/appicon_creeper1.ico
--------------------------------------------------------------------------------
/MinecraftClient/Resources/appicon_grassblock.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/goldenlib/Minecraft-Console-Client/9e75d1808b1e84722ee263e4f921807961df628b/MinecraftClient/Resources/appicon_grassblock.ico
--------------------------------------------------------------------------------
/MinecraftClient/Resources/appicon_terminal.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/goldenlib/Minecraft-Console-Client/9e75d1808b1e84722ee263e4f921807961df628b/MinecraftClient/Resources/appicon_terminal.ico
--------------------------------------------------------------------------------
/MinecraftClient/Resources/containers/ContainerType.BrewingStand.txt:
--------------------------------------------------------------------------------
1 | ╔═════════════════════════════════════╗
2 | ║ Brewing Stand ║
3 | ║ ╔═══╗ ⡈ ⠄╔═══╗ ║
4 | ║ ║ 4 ╟───╮ ⢠⡐⢈║ 3 ║ ┃ ║
5 | ║ ╚═══╝ ╭─╯ ⠂⡠⢂╚╦╦╦╝ ┃ ║
6 | ║ ╰───■■■■ ║║║ ▼ ║
7 | ║ ╔═══╦═╝║╚═╦═══╗ ║
8 | ║ ║ 0 ║╔═╩═╗║ 2 ║ ║
9 | ║ ╚═══╝║ 1 ║╚═══╝ ║
10 | ║ Inventory ╚═══╝ ║
11 | ║╔═══╦═══╦═══╦═══╦═══╦═══╦═══╦═══╦═══╗║
12 | ║║ 5 ║ 6 ║ 7 ║ 8 ║ 9 ║10 ║11 ║12 ║13 ║║
13 | ║╠═══╬═══╬═══╬═══╬═══╬═══╬═══╬═══╬═══╣║
14 | ║║14 ║15 ║16 ║17 ║18 ║19 ║20 ║21 ║22 ║║
15 | ║╠═══╬═══╬═══╬═══╬═══╬═══╬═══╬═══╬═══╣║
16 | ║║23 ║24 ║25 ║26 ║27 ║28 ║29 ║30 ║31 ║║
17 | ║╚═══╩═══╩═══╩═══╩═══╩═══╩═══╩═══╩═══╝║
18 | ║╔═══╦═══╦═══╦═══╦═══╦═══╦═══╦═══╦═══╗║
19 | ║║32 ║33 ║34 ║35 ║36 ║37 ║38 ║39 ║40 ║║
20 | ║╚═══╩═══╩═══╩═══╩═══╩═══╩═══╩═══╩═══╝║
21 | ║ 1 2 3 4 5 6 7 8 9 ║
22 | ╚═════════════════════════════════════╝
--------------------------------------------------------------------------------
/MinecraftClient/Resources/containers/ContainerType.Crafting.txt:
--------------------------------------------------------------------------------
1 | ╔═════════════════════════════════════╗
2 | ║ Crafting ║
3 | ║ ╔═══╦═══╦═══╗ ║
4 | ║ ║ 1 ║ 2 ║ 3 ║ ║
5 | ║ ╠═══╬═══╬═══╣ ╔═══╗ ║
6 | ║ ║ 4 ║ 5 ║ 6 ║ ━━▶ ║ 0 ║ ║
7 | ║ ╠═══╬═══╬═══╣ ╚═══╝ ║
8 | ║ ║ 7 ║ 8 ║ 9 ║ ║
9 | ║ ╚═══╩═══╩═══╝ ║
10 | ║ Inventory ║
11 | ║╔═══╦═══╦═══╦═══╦═══╦═══╦═══╦═══╦═══╗║
12 | ║║10 ║11 ║12 ║13 ║14 ║15 ║16 ║17 ║18 ║║
13 | ║╠═══╬═══╬═══╬═══╬═══╬═══╬═══╬═══╬═══╣║
14 | ║║19 ║20 ║21 ║22 ║23 ║24 ║25 ║26 ║27 ║║
15 | ║╠═══╬═══╬═══╬═══╬═══╬═══╬═══╬═══╬═══╣║
16 | ║║28 ║29 ║30 ║31 ║32 ║33 ║34 ║35 ║36 ║║
17 | ║╚═══╩═══╩═══╩═══╩═══╩═══╩═══╩═══╩═══╝║
18 | ║╔═══╦═══╦═══╦═══╦═══╦═══╦═══╦═══╦═══╗║
19 | ║║37 ║38 ║39 ║40 ║41 ║42 ║43 ║44 ║45 ║║
20 | ║╚═══╩═══╩═══╩═══╩═══╩═══╩═══╩═══╩═══╝║
21 | ║ 1 2 3 4 5 6 7 8 9 ║
22 | ╚═════════════════════════════════════╝
--------------------------------------------------------------------------------
/MinecraftClient/Resources/containers/ContainerType.Generic_3x3.txt:
--------------------------------------------------------------------------------
1 | ╔═════════════════════════════════════╗
2 | ║ Container ║
3 | ║ ╔═══╦═══╦═══╗ ║
4 | ║ ║ 0 ║ 1 ║ 2 ║ ║
5 | ║ ╠═══╬═══╬═══╣ ║
6 | ║ ║ 3 ║ 4 ║ 5 ║ ║
7 | ║ ╠═══╬═══╬═══╣ ║
8 | ║ ║ 6 ║ 7 ║ 8 ║ ║
9 | ║ ╚═══╩═══╩═══╝ ║
10 | ║ Inventory ║
11 | ║╔═══╦═══╦═══╦═══╦═══╦═══╦═══╦═══╦═══╗║
12 | ║║ 9 ║10 ║11 ║12 ║13 ║14 ║15 ║16 ║17 ║║
13 | ║╠═══╬═══╬═══╬═══╬═══╬═══╬═══╬═══╬═══╣║
14 | ║║18 ║19 ║20 ║21 ║22 ║23 ║24 ║25 ║26 ║║
15 | ║╠═══╬═══╬═══╬═══╬═══╬═══╬═══╬═══╬═══╣║
16 | ║║27 ║28 ║29 ║30 ║31 ║32 ║33 ║34 ║35 ║║
17 | ║╚═══╩═══╩═══╩═══╩═══╩═══╩═══╩═══╩═══╝║
18 | ║╔═══╦═══╦═══╦═══╦═══╦═══╦═══╦═══╦═══╗║
19 | ║║36 ║37 ║38 ║39 ║40 ║41 ║42 ║43 ║44 ║║
20 | ║╚═══╩═══╩═══╩═══╩═══╩═══╩═══╩═══╩═══╝║
21 | ║ 1 2 3 4 5 6 7 8 9 ║
22 | ╚═════════════════════════════════════╝
--------------------------------------------------------------------------------
/MinecraftClient/Resources/containers/ContainerType.Generic_9x3.txt:
--------------------------------------------------------------------------------
1 | ╔═════════════════════════════════════╗
2 | ║ Container ║
3 | ║╔═══╦═══╦═══╦═══╦═══╦═══╦═══╦═══╦═══╗║
4 | ║║ 0 ║ 1 ║ 2 ║ 3 ║ 4 ║ 5 ║ 6 ║ 7 ║ 8 ║║
5 | ║╠═══╬═══╬═══╬═══╬═══╬═══╬═══╬═══╬═══╣║
6 | ║║ 9 ║10 ║11 ║12 ║13 ║14 ║15 ║16 ║17 ║║
7 | ║╠═══╬═══╬═══╬═══╬═══╬═══╬═══╬═══╬═══╣║
8 | ║║18 ║19 ║20 ║21 ║22 ║23 ║24 ║25 ║26 ║║
9 | ║╚═══╩═══╩═══╩═══╩═══╩═══╩═══╩═══╩═══╝║
10 | ║ Inventory ║
11 | ║╔═══╦═══╦═══╦═══╦═══╦═══╦═══╦═══╦═══╗║
12 | ║║27 ║28 ║29 ║30 ║31 ║32 ║33 ║34 ║35 ║║
13 | ║╠═══╬═══╬═══╬═══╬═══╬═══╬═══╬═══╬═══╣║
14 | ║║36 ║37 ║38 ║39 ║40 ║41 ║42 ║43 ║44 ║║
15 | ║╠═══╬═══╬═══╬═══╬═══╬═══╬═══╬═══╬═══╣║
16 | ║║45 ║46 ║47 ║48 ║49 ║50 ║51 ║52 ║53 ║║
17 | ║╚═══╩═══╩═══╩═══╩═══╩═══╩═══╩═══╩═══╝║
18 | ║╔═══╦═══╦═══╦═══╦═══╦═══╦═══╦═══╦═══╗║
19 | ║║54 ║55 ║56 ║57 ║58 ║59 ║60 ║61 ║62 ║║
20 | ║╚═══╩═══╩═══╩═══╩═══╩═══╩═══╩═══╩═══╝║
21 | ║ 1 2 3 4 5 6 7 8 9 ║
22 | ╚═════════════════════════════════════╝
--------------------------------------------------------------------------------
/MinecraftClient/Resources/containers/ContainerType.Generic_9x6.txt:
--------------------------------------------------------------------------------
1 | ╔═════════════════════════════════════╗
2 | ║ Container ║
3 | ║╔═══╦═══╦═══╦═══╦═══╦═══╦═══╦═══╦═══╗║
4 | ║║ 0 ║ 1 ║ 2 ║ 3 ║ 4 ║ 5 ║ 6 ║ 7 ║ 8 ║║
5 | ║╠═══╬═══╬═══╬═══╬═══╬═══╬═══╬═══╬═══╣║
6 | ║║ 9 ║10 ║11 ║12 ║13 ║14 ║15 ║16 ║17 ║║
7 | ║╠═══╬═══╬═══╬═══╬═══╬═══╬═══╬═══╬═══╣║
8 | ║║18 ║19 ║20 ║21 ║22 ║23 ║24 ║25 ║26 ║║
9 | ║╠═══╬═══╬═══╬═══╬═══╬═══╬═══╬═══╬═══╣║
10 | ║║27 ║28 ║29 ║30 ║31 ║32 ║33 ║34 ║35 ║║
11 | ║╠═══╬═══╬═══╬═══╬═══╬═══╬═══╬═══╬═══╣║
12 | ║║36 ║37 ║38 ║39 ║40 ║41 ║42 ║43 ║44 ║║
13 | ║╠═══╬═══╬═══╬═══╬═══╬═══╬═══╬═══╬═══╣║
14 | ║║45 ║46 ║47 ║48 ║49 ║50 ║51 ║52 ║53 ║║
15 | ║╚═══╩═══╩═══╩═══╩═══╩═══╩═══╩═══╩═══╝║
16 | ║ Inventory ║
17 | ║╔═══╦═══╦═══╦═══╦═══╦═══╦═══╦═══╦═══╗║
18 | ║║54 ║55 ║56 ║57 ║58 ║59 ║60 ║61 ║62 ║║
19 | ║╠═══╬═══╬═══╬═══╬═══╬═══╬═══╬═══╬═══╣║
20 | ║║63 ║64 ║65 ║66 ║67 ║68 ║69 ║70 ║71 ║║
21 | ║╠═══╬═══╬═══╬═══╬═══╬═══╬═══╬═══╬═══╣║
22 | ║║72 ║73 ║74 ║75 ║76 ║77 ║78 ║79 ║80 ║║
23 | ║╚═══╩═══╩═══╩═══╩═══╩═══╩═══╩═══╩═══╝║
24 | ║╔═══╦═══╦═══╦═══╦═══╦═══╦═══╦═══╦═══╗║
25 | ║║81 ║82 ║83 ║84 ║85 ║86 ║87 ║88 ║89 ║║
26 | ║╚═══╩═══╩═══╩═══╩═══╩═══╩═══╩═══╩═══╝║
27 | ║ 1 2 3 4 5 6 7 8 9 ║
28 | ╚═════════════════════════════════════╝
--------------------------------------------------------------------------------
/MinecraftClient/Resources/containers/ContainerType.PlayerInventory.txt:
--------------------------------------------------------------------------------
1 | ╔═════════════════════════════════════╗
2 | ║╔═══╦═══════════╗ ║
3 | ║║ 5 ║ ███ ║ ╔═══╦═══╗ ║
4 | ║╠═══╣ ███ ║ ║ 1 ║ 2 ║ ╔═══╗║
5 | ║║ 6 ║ ███████ ║ ╠═══╬═══╣━━▶║ 0 ║║
6 | ║╠═══╣ ███████ ║ ║ 3 ║ 4 ║ ╚═══╝║
7 | ║║ 7 ║ ███████ ║ ╚═══╩═══╝ ║
8 | ║╠═══╣ ███ ╠═══╗ ║
9 | ║║ 8 ║ ███ ║45 ║ ║
10 | ║╚═══╩═══════════╩═══╝ ║
11 | ║╔═══╦═══╦═══╦═══╦═══╦═══╦═══╦═══╦═══╗║
12 | ║║ 9 ║10 ║11 ║12 ║13 ║14 ║15 ║16 ║17 ║║
13 | ║╠═══╬═══╬═══╬═══╬═══╬═══╬═══╬═══╬═══╣║
14 | ║║18 ║19 ║20 ║21 ║22 ║23 ║24 ║25 ║26 ║║
15 | ║╠═══╬═══╬═══╬═══╬═══╬═══╬═══╬═══╬═══╣║
16 | ║║27 ║28 ║29 ║30 ║31 ║32 ║33 ║34 ║35 ║║
17 | ║╚═══╩═══╩═══╩═══╩═══╩═══╩═══╩═══╩═══╝║
18 | ║╔═══╦═══╦═══╦═══╦═══╦═══╦═══╦═══╦═══╗║
19 | ║║36 ║37 ║38 ║39 ║40 ║41 ║42 ║43 ║44 ║║
20 | ║╚═══╩═══╩═══╩═══╩═══╩═══╩═══╩═══╩═══╝║
21 | ║ 1 2 3 4 5 6 7 8 9 ║
22 | ╚═════════════════════════════════════╝
--------------------------------------------------------------------------------
/MinecraftClient/TaskWithDelay.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace MinecraftClient
7 | {
8 | ///
9 | /// Holds a task with delay
10 | ///
11 | class TaskWithDelay
12 | {
13 | private Action _task;
14 | private int tickCounter;
15 | private DateTime dateToLaunch;
16 |
17 | public Action Task { get { return _task; } }
18 |
19 | public TaskWithDelay(Action task, int delayTicks)
20 | {
21 | _task = task;
22 | tickCounter = delayTicks;
23 | dateToLaunch = DateTime.MaxValue;
24 | }
25 |
26 | public TaskWithDelay(Action task, TimeSpan delay)
27 | {
28 | _task = task;
29 | tickCounter = int.MaxValue;
30 | dateToLaunch = DateTime.Now + delay;
31 | }
32 |
33 | ///
34 | /// Tick the counter
35 | ///
36 | /// Return true if the task should run now
37 | public bool Tick()
38 | {
39 | tickCounter--;
40 | if (tickCounter <= 0 || dateToLaunch < DateTime.Now)
41 | return true;
42 | return false;
43 | }
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/MinecraftClient/config/ChatBots/AutoLook.cs:
--------------------------------------------------------------------------------
1 | //MCCScript 1.0
2 |
3 | MCC.LoadBot(new AutoLook());
4 |
5 | //MCCScript Extensions
6 |
7 | public class AutoLook : ChatBot
8 | {
9 | private Entity _entityToLookAt;
10 | public override void Initialize()
11 | {
12 | if (GetEntityHandlingEnabled() && GetTerrainEnabled()) return;
13 | LogToConsole("Entity Handling or Terrain Handling is not enabled in the config file!");
14 | LogToConsole("This bot will be unloaded.");
15 | UnloadBot();
16 | }
17 |
18 | public override void OnEntityDespawn(Entity entity)
19 | {
20 | if (entity == _entityToLookAt)
21 | {
22 | _entityToLookAt = null;
23 | }
24 | }
25 | public override void OnEntitySpawn(Entity entity)
26 | {
27 | HandleEntity(entity);
28 | }
29 | public override void OnEntityMove(Entity entity)
30 | {
31 | var tempBool = HandleEntity(entity);
32 | //LogDebugToConsole(tempBool);
33 | if (!tempBool) return;
34 | LookAtLocation(entity.Location);
35 | }
36 |
37 | ///
38 | /// Handles an entity, and tracks it if it is closer then the one we are currently tracking
39 | ///
40 | /// True if found
41 | private bool HandleEntity(Entity entity)
42 | {
43 | if (entity.Type != EntityType.Player)
44 | {
45 | return false;
46 | }
47 | if (_entityToLookAt == null)
48 | {
49 | _entityToLookAt = entity;
50 | return true;
51 | }
52 | if (GetCurrentLocation().Distance(entity.Location) < GetCurrentLocation().Distance(_entityToLookAt.Location))
53 | {
54 | _entityToLookAt = entity;
55 | return true;
56 | }
57 |
58 | if (entity.ID != _entityToLookAt.ID) return false;
59 | _entityToLookAt = entity; //Handle looking at the same entity
60 | return true;
61 |
62 | }
63 |
64 | }
--------------------------------------------------------------------------------
/MinecraftClient/config/ChatBots/ClckRuAPI.cs:
--------------------------------------------------------------------------------
1 | //MCCScript 1.0
2 | //using System.Threading.Tasks;
3 |
4 | MCC.LoadBot(new ClckRuAPIBot());
5 |
6 | //MCCScript Extensions
7 |
8 | public class ClckRuAPIBot : ChatBot
9 | {
10 | private PayKassaSCI clckapi { get; set; }
11 |
12 | public ClckRuAPIBot()
13 | {
14 | clckapi = new ClckRuAPI();
15 | }
16 |
17 | }
18 |
19 | internal class ClckRuAPI
20 | {
21 | public string ToCutURl(string url)
22 | {
23 |
24 | WebClient webClient = new WebClient();
25 | string done = webClient.DownloadString("https://clck.ru/--?url=" + url);
26 | return done;
27 | }
28 | }
29 |
30 |
--------------------------------------------------------------------------------
/MinecraftClient/config/ChatBots/CobblestoneMiner.cs:
--------------------------------------------------------------------------------
1 | //MCCScript 1.0
2 |
3 | MCC.LoadBot(new CobblestoneMiner());
4 |
5 | //MCCScript Extensions
6 |
7 | public class CobblestoneMiner: ChatBot
8 | {
9 | // === CONFIG - REPLACE COBBLESTONE LOCATION x y z VALUES HERE ===
10 | // You need to stand in front of the cobblestone block to mine
11 | // Also make sure the Cobblestone will regenerate e.g. using water and lava
12 | Location cobblestone = new Location(x, y, z);
13 | // === END OF CONFIG ===
14 |
15 | public override void Initialize()
16 | {
17 | LogToConsole("Bot enabled!");
18 | }
19 |
20 | public override void Update()
21 | {
22 | Material blockType = GetWorld().GetBlock(cobblestone).Type;
23 | switch (blockType)
24 | {
25 | case Material.Stone:
26 | DigBlock(cobblestone);
27 | break;
28 | case Material.Cobblestone:
29 | DigBlock(cobblestone);
30 | break;
31 | }
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/MinecraftClient/config/ChatBots/OreMiner.cs:
--------------------------------------------------------------------------------
1 | //MCCScript 1.0
2 |
3 | MCC.LoadBot(new OreMiner());
4 |
5 | //MCCScript Extensions
6 |
7 | ///
8 | /// This bot can mine blocks that auto-spawn at given locations
9 | ///
10 | public class OreMiner: ChatBot
11 | {
12 | // === CONFIG - REPLACE BLOCK LOCATION x y z VALUES HERE ===
13 | List location = new List()
14 | {
15 | new Location(x, y, z),
16 | new Location(x2, y2, z2),
17 | new Location(x3, y3, z3),
18 | // Add more here
19 | };
20 | // === END OF CONFIG ===
21 | int index = 0;
22 |
23 | public override void Initialize()
24 | {
25 | LogToConsole("Bot enabled!");
26 | }
27 |
28 | public override void Update()
29 | {
30 | Material blockType = GetWorld().GetBlock(location[index]).Type;
31 | switch (blockType)
32 | {
33 | //Adjust here block types to mine
34 | case Material.DiamondOre:
35 | case Material.EmeraldOre:
36 | case Material.GoldOre:
37 | case Material.IronOre:
38 | case Material.CoalOre:
39 | case Material.LapisOre:
40 | case Material.RedstoneOre:
41 | case Material.NetherQuartzOre:
42 | DigBlock(location[index]);
43 | break;
44 | }
45 | index++;
46 | if (index >= location.Count)
47 | index = 0;
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/MinecraftClient/config/ChatBots/SugarCaneMiner.cs:
--------------------------------------------------------------------------------
1 | //MCCScript 1.0
2 |
3 | MCC.LoadBot(new SugarCaneMiner());
4 |
5 | //MCCScript Extensions
6 |
7 | public class SugarCaneMiner : ChatBot
8 | {
9 | // === CONFIG - REPLACE SURGAR CANE LOCATION x y z VALUES HERE ===
10 | // You need to stand in front of the sugar cane
11 | Location sugarCane = new Location(x, y, z);
12 | bool fullHeight = true;
13 | // === END OF CONFIG ===
14 |
15 | public override void Initialize()
16 | {
17 | LogToConsole("Bot enabled!");
18 | }
19 |
20 | public override void Update()
21 | {
22 | if (DetectSugarCane(sugarCane, fullHeight))
23 | {
24 | DigBlock(sugarCane);
25 | }
26 | }
27 |
28 | public bool DetectSugarCane(Location sugarCaneLoc, bool fullHeight)
29 | {
30 | Material blockType = GetWorld().GetBlock(sugarCaneLoc).Type;
31 | if (blockType == Material.SugarCane)
32 | {
33 | blockType = GetWorld().GetBlock(new Location(sugarCaneLoc.X, sugarCaneLoc.Y - 1, sugarCaneLoc.Z)).Type;
34 | if (blockType == Material.SugarCane)
35 | {
36 | blockType = GetWorld().GetBlock(new Location(sugarCaneLoc.X, sugarCaneLoc.Y - 2, sugarCaneLoc.Z)).Type;
37 | if (blockType != Material.SugarCane)
38 | {
39 | if (!fullHeight)
40 | return true;
41 | blockType = GetWorld().GetBlock(new Location(sugarCaneLoc.X, sugarCaneLoc.Y + 1, sugarCaneLoc.Z)).Type;
42 | if (blockType == Material.SugarCane)
43 | return true;
44 | }
45 | }
46 | }
47 | return false;
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/MinecraftClient/config/ChatBots/TreeFarmer.cs:
--------------------------------------------------------------------------------
1 | //MCCScript 1.0
2 |
3 | MCC.LoadBot(new TreeFarmer());
4 |
5 | //MCCScript Extensions
6 |
7 | public class TreeFarmer : ChatBot
8 | {
9 | // You need to stand in front of the sapling and put items in your inventory hotbar:
10 | // - First slot on the left (Slot 0): Axe for digging the tree
11 | // - Second slot on the left (Slot 1): Sapling stack for planting the tree
12 | // Then set sapling location below, login with MCC and load this script
13 |
14 | // === CONFIG - REPLACE SAPLING LOCATION x y z VALUES HERE ===
15 | Location sapling = new Location(x, y, z);
16 | // === END OF CONFIG ===
17 |
18 | public override void Update()
19 | {
20 | Material blockType = GetWorld().GetBlock(sapling).Type;
21 | switch (blockType)
22 | {
23 | case Material.OakSapling:
24 | // Still a sapling, nothing to do
25 | break;
26 | case Material.OakLog:
27 | // Tree has grown, dig 4 blocks
28 | ChangeSlot(0);
29 | DigBlock(sapling);
30 | Thread.Sleep(100);
31 | // 1
32 | DigBlock(new Location(sapling.X, sapling.Y + 1, sapling.Z));
33 | Thread.Sleep(100);
34 | // 2
35 | DigBlock(new Location(sapling.X, sapling.Y + 2, sapling.Z));
36 | Thread.Sleep(100);
37 | // 3
38 | DigBlock(new Location(sapling.X, sapling.Y + 3, sapling.Z));
39 | Thread.Sleep(100);
40 | // 4
41 | DigBlock(new Location(sapling.X, sapling.Y + 4, sapling.Z));
42 | Thread.Sleep(100);
43 | break;
44 | case Material.Air:
45 | // No tree, plant something
46 | ChangeSlot(1);
47 | SendPlaceBlock(sapling, Direction.Up);
48 | break;
49 | default:
50 | // Other block, cannot grow trees here
51 | LogToConsole("Block at " + sapling + " is not a sapling: " + blockType + "...");
52 | break;
53 | }
54 | }
55 | public override void Initialize()
56 | {
57 |
58 | }
59 | }
60 |
--------------------------------------------------------------------------------
/MinecraftClient/config/alerts-exclude.txt:
--------------------------------------------------------------------------------
1 | myserver.com
2 | Yourname>:
3 | Player Yourname
4 | Yourname joined
5 | Yourname left
6 | [Lockette] (Admin)
7 | Yourname:
8 | Yourname is
--------------------------------------------------------------------------------
/MinecraftClient/config/alerts.txt:
--------------------------------------------------------------------------------
1 | Yourname
2 | whispers
3 | -> me
4 | admin
5 | .com
6 | .net
7 | .fr
8 | .us
9 | .uk
10 | !!!!
11 | ????
12 | aaaa
13 | zzzz
14 | eeee
15 | rrrr
16 | tttt
17 | yyyy
18 | uuuu
19 | iiii
20 | oooo
21 | pppp
22 | qqqq
23 | ssss
24 | dddd
25 | ffff
26 | gggg
27 | hhhh
28 | jjjj
29 | kkkk
30 | llll
31 | mmmm
32 | wwww
33 | xxxx
34 | cccc
35 | vvvv
36 | bbbb
37 | nnnn
--------------------------------------------------------------------------------
/MinecraftClient/config/kickmessages.txt:
--------------------------------------------------------------------------------
1 | Connection has been lost
2 | Server is restarting
3 | Server is full
4 | Too Many people
--------------------------------------------------------------------------------
/MinecraftClient/config/sample-accounts.txt:
--------------------------------------------------------------------------------
1 | # Minecraft Console Client
2 | # Account list file
3 |
4 | # Put account data as comma separated values
5 | # Values are: Alias,Login,Password
6 | # It allows a fast account switching
7 | # without directly using the credentials
8 |
9 | # Usage examples:
10 | # /tell reco Player2
11 | # /connect Player1
12 |
13 | Player1,playerone@email.com,thepassword
14 | Player2,TestBot,-
--------------------------------------------------------------------------------
/MinecraftClient/config/sample-matches.ini:
--------------------------------------------------------------------------------
1 | # Minecraft Console Client
2 | # AutoRespond matches
3 | # Example config file
4 |
5 | # Structure of a match: [Match] Followed by the match and action
6 | # The match can be a simple match or an advanced regular expression
7 | # You can use $u for username of the player triggering the match
8 | # You can define an action if the match was in a private message
9 | # You can define an action if the match was not sent by a player
10 | # Regex matches are also supported eg $1, $2, $3.. in actions
11 | # Matches can optionally be restricted to bot owners only
12 | # Matches can have a cooldown, specified in seconds
13 |
14 | # When running a script from an AutoRespond match,
15 | # additional %variables% are available from within your script:
16 | # %match_u% will hold username of the player triggering the match
17 | # %match_1%, %match_2%, %match_3%.. will hold regex matches
18 |
19 | # Simple example: Respond to a message containing a keyword
20 |
21 | [Match]
22 | match=hi
23 | action=send hi, $u!
24 | actionprivate=send /tell $u Hello!
25 | actionother=log detected "hi" message
26 | ownersonly=false
27 | cooldown=0
28 |
29 | # You do not need to specify all the "action" fields
30 | # Only one of them is required for each match
31 |
32 | # Advanced example: Use a regular expression
33 | # Here a "regex" field is used instead of "match" field
34 | # Do not use both "regex" and "match" fields...
35 |
36 | [Match]
37 | regex=^.*hello ([a-zA-Z0-9_]+).*$
38 | action=send hello too, $1!
39 |
40 | # Example of using a script
41 |
42 | [Match]
43 | match=dotest
44 | action=script test
45 |
46 | # Example of matching a server announcement
47 |
48 | [Match]
49 | match=server is restarting
50 | actionother=script restart
51 |
52 | # Example of custom remote control command
53 |
54 | [Match]
55 | match=gohome
56 | actionprivate=send /home
57 | ownersonly=true
58 |
59 | # Example of match with 1-minute cooldown
60 |
61 | [Match]
62 | match=hello
63 | action=send hello!
64 | cooldown=60
65 |
66 | # Enjoy!
67 | # - ORelio
--------------------------------------------------------------------------------
/MinecraftClient/config/sample-script-extended.cs:
--------------------------------------------------------------------------------
1 | //MCCScript 1.0
2 |
3 | /* This script demonstrates how to use methods and arguments */
4 |
5 | string text = "hello";
6 |
7 | if (args.Length > 0)
8 | text = args[0];
9 |
10 | for (int i = 0; i < 5; i++)
11 | {
12 | int count = MCC.GetVarAsInt("test") + 1;
13 | MCC.SetVar("test", count);
14 | SendHelloWorld(count, text);
15 | SleepBetweenSends();
16 | }
17 |
18 | //MCCScript Extensions
19 |
20 | /* Here you can define methods for use into your script */
21 |
22 | void SendHelloWorld(int count, string text)
23 | {
24 | MCC.SendText("Hello World no. " + count + ": " + text);
25 | }
26 |
27 | void SleepBetweenSends()
28 | {
29 | MCC.LogToConsole("Sleeping for 5 seconds...");
30 | Thread.Sleep(5000);
31 | }
--------------------------------------------------------------------------------
/MinecraftClient/config/sample-script-pm-forwarder.cs:
--------------------------------------------------------------------------------
1 | //MCCScript 1.0
2 |
3 | MCC.LoadBot(new PMForwarder());
4 |
5 | //MCCScript Extensions
6 |
7 | ///
8 | /// This bot can forward received PMs to other players
9 | ///
10 | public class PMForwarder : ChatBot
11 | {
12 | private const string PMRecipientsFile = "pm-forward-to.txt";
13 | private string[] pmRecipients;
14 |
15 | public PMForwarder()
16 | {
17 | pmRecipients = LoadDistinctEntriesFromFile(PMRecipientsFile);
18 | if (Settings.Bots_Owners.Count == 0)
19 | LogToConsole("No Bot owners in Settings INI file. Unloading.");
20 | else if (pmRecipients.Length == 0)
21 | LogToConsole("No PM Recipients in '" + PMRecipientsFile + "'. Unloading.");
22 | else LogToConsole(String.Format(
23 | "Forwarding PMs from owners {0} to recipients {1}",
24 | String.Join(", ", Settings.Bots_Owners), String.Join(", ", pmRecipients)));
25 | }
26 |
27 | public override void GetText(string text)
28 | {
29 | text = GetVerbatim(text);
30 | string message = "", sender = "";
31 | if (IsPrivateMessage(text, ref message, ref sender) && Settings.Bots_Owners.Contains(sender.ToLower().Trim()))
32 | {
33 | LogToConsole("Forwarding PM to " + String.Join(", ", pmRecipients));
34 | foreach (string recipient in pmRecipients)
35 | SendPrivateMessage(recipient, message);
36 | }
37 | }
38 | }
39 | }
--------------------------------------------------------------------------------
/MinecraftClient/config/sample-script-random-command.cs:
--------------------------------------------------------------------------------
1 | //MCCScript 1.0
2 |
3 | string[] commands = new[] {
4 | "send command1",
5 | "send command2",
6 | "send command3"
7 | };
8 |
9 | int randomIndex = new Random().Next(0, commands.Length);
10 | string randomCommand = commands[randomIndex];
11 | MCC.PerformInternalCommand(randomCommand);
--------------------------------------------------------------------------------
/MinecraftClient/config/sample-script-with-chatbot.cs:
--------------------------------------------------------------------------------
1 | //MCCScript 1.0
2 |
3 | /* This is a sample script that will load a ChatBot into Minecraft Console Client
4 | * Simply execute the script once with /script or the script scheduler to load the bot */
5 |
6 | MCC.LoadBot(new ExampleBot());
7 |
8 | //MCCScript Extensions
9 |
10 | /* The ChatBot class must be defined as an extension of the script in the Extensions section
11 | * The class can override common methods from ChatBot.cs, take a look at MCC's source code */
12 |
13 | public class ExampleBot : ChatBot
14 | {
15 | public override void Initialize()
16 | {
17 | LogToConsole("Sucessfully Initialized!");
18 | }
19 |
20 | public override void GetText(string text)
21 | {
22 | string message = "";
23 | string username = "";
24 | text = GetVerbatim(text);
25 |
26 | if (IsChatMessage(text, ref message, ref username))
27 | {
28 | LogToConsole("Public message from " + username + ": " + message);
29 | }
30 | else if (IsPrivateMessage(text, ref message, ref username))
31 | {
32 | LogToConsole("Private message from " + username + ": " + message);
33 | }
34 | }
35 | }
--------------------------------------------------------------------------------
/MinecraftClient/config/sample-script-with-http-request.cs:
--------------------------------------------------------------------------------
1 | //MCCScript 1.0
2 |
3 | string mojangStatus = PerformHttpRequest("https://status.mojang.com/check");
4 | MCC.LogToConsole(mojangStatus);
5 |
6 | //MCCScript Extensions
7 |
8 | string PerformHttpRequest(string uri)
9 | {
10 | var request = (System.Net.HttpWebRequest)System.Net.WebRequest.Create(uri);
11 | var response = (System.Net.HttpWebResponse)request.GetResponse();
12 | string responseString;
13 | using (var stream = response.GetResponseStream())
14 | using (var reader = new StreamReader(stream))
15 | responseString = reader.ReadToEnd();
16 | return responseString;
17 | }
18 |
19 | void SendHttpPostAsync(string uri, string text)
20 | {
21 | new Thread(() => {
22 | var request = (System.Net.HttpWebRequest)System.Net.WebRequest.Create(uri);
23 | request.ContentType = "text/plain";
24 | request.Method = "POST";
25 | using (var streamWriter = new StreamWriter(request.GetRequestStream()))
26 | streamWriter.Write(text);
27 | var response = (System.Net.HttpWebResponse)request.GetResponse();
28 | string responseString;
29 | using (var stream = response.GetResponseStream())
30 | using (var reader = new StreamReader(stream))
31 | responseString = reader.ReadToEnd();
32 | //LogToConsole(responseString);
33 | }).Start();
34 | }
--------------------------------------------------------------------------------
/MinecraftClient/config/sample-script-with-task.cs:
--------------------------------------------------------------------------------
1 | //MCCScript 1.0
2 |
3 | MCC.LoadBot(new PeriodicTask());
4 |
5 | //MCCScript Extensions
6 |
7 | ///
8 | /// The ChatBot API is not thread-safe so tasks must occur on the main thread.
9 | /// This bot shows an example of running a task periodically without using threads.
10 | ///
11 | public class PeriodicTask : ChatBot
12 | {
13 | private DateTime nextTaskRun = DateTime.Now;
14 |
15 | ///
16 | /// Called on each MCC tick, around 10 times per second
17 | ///
18 | public override void Update()
19 | {
20 | DateTime dateNow = DateTime.Now;
21 | if (nextTaskRun < dateNow)
22 | {
23 | LogDebugToConsole("Running task @ " + dateNow);
24 |
25 | // Your task here
26 | SendText("/ping");
27 |
28 | // Schedule next run
29 | nextTaskRun = dateNow.AddSeconds(60);
30 | }
31 | }
32 | }
--------------------------------------------------------------------------------
/MinecraftClient/config/sample-script-with-world-access.cs:
--------------------------------------------------------------------------------
1 | //MCCScript 1.0
2 |
3 | MCC.LoadBot(new WatchLamp());
4 |
5 | //MCCScript Extensions
6 |
7 | /* The ChatBot will access the world on a regular basis to watch for a lamp.
8 | * This is an example of how the world around the player can be accessed from a C# script. */
9 |
10 | class WatchLamp : ChatBot
11 | {
12 | /* == CONFIG == */
13 |
14 | int lampX = 0;
15 | int lampY = 64;
16 | int lampZ = 0;
17 |
18 | /* == CODE == */
19 |
20 | int checkCount = 0;
21 | Location lampLoc;
22 |
23 | public WatchLamp()
24 | {
25 | if (!Settings.TerrainAndMovements)
26 | {
27 | LogToConsole("WARNING: Terrain handling is disabled in INI file.");
28 | LogToConsole("WARNING: This means this bot cannot watch for lamps.");
29 | UnloadBot();
30 | }
31 | else
32 | {
33 | lampLoc = new Location(lampX, lampY, lampZ);
34 | LogToConsole("Watching lamp at " + lampLoc);
35 | }
36 | }
37 |
38 | public override void Update()
39 | {
40 | if (checkCount > 10)
41 | {
42 | checkCount = 0;
43 | Material blockType = GetWorld().GetBlock(lampLoc).Type;
44 | switch (blockType)
45 | {
46 | case Material.RedstoneLampOn:
47 | //Lamp is on. All right. Nothing to say here.
48 | break;
49 | case Material.RedstoneLampOff:
50 | LogToConsole("Lamp at " + lampLoc + " is currently turned OFF !!!");
51 | for (int i = 0; i < 3; i++)
52 | Console.Beep();
53 | break;
54 | default:
55 | LogToConsole("Block at " + lampLoc + " is not a lamp: " + blockType + "...");
56 | break;
57 | }
58 | }
59 | else checkCount++;
60 | }
61 | }
--------------------------------------------------------------------------------
/MinecraftClient/config/sample-script.cs:
--------------------------------------------------------------------------------
1 | //MCCScript 1.0
2 |
3 | /* This is a sample script for Minecraft Console Client
4 | * The code provided in this file will be compiled at runtime and executed
5 | * Allowed instructions: Any C# code AND methods provided by the MCC API */
6 |
7 | for (int i = 0; i < 5; i++)
8 | {
9 | int count = MCC.GetVarAsInt("test") + 1;
10 | MCC.SetVar("test", count);
11 | MCC.SendText("Hello World no. " + count);
12 | MCC.LogToConsole("Sleeping for 5 seconds...");
13 | Thread.Sleep(5000);
14 | }
--------------------------------------------------------------------------------
/MinecraftClient/config/sample-script.txt:
--------------------------------------------------------------------------------
1 | # This is a sample script for Minecraft Console Client
2 | # Any line beginning with "#" is ignored and treated as a comment.
3 | # Allowed instructions: see README file for an updated list of instructions.
4 |
5 | send Hello World! I'm a bot scripted using Minecraft Console Client.
6 | wait 60
7 | send Now quitting. Bye :)
8 | exit
--------------------------------------------------------------------------------
/MinecraftClient/config/sample-servers.txt:
--------------------------------------------------------------------------------
1 | # Minecraft Console Client
2 | # Server list file
3 |
4 | # Put server data as comma separated values
5 | # Values are: Alias,ServerIP:Port
6 | # Aliases cannot contains dots or spaces
7 | # The name "localhost" cannot be used as an alias
8 | # It allows an easier and faster server switching
9 | # with short aliases instead of full server IP
10 | # It also adds a bit of privacy for remote control
11 |
12 | # Usage examples:
13 | # /tell connect Server1
14 | # /connect Server2
15 |
16 | Server1,localhost
17 | Server2,mc.awesomeserver.com:25567
18 | Server3,192.168.1.27:1348 # Example of LAN server
--------------------------------------------------------------------------------
/MinecraftClient/config/sample-tasks.ini:
--------------------------------------------------------------------------------
1 | # Minecraft Console Client
2 | # ScriptScheduler Tasks
3 | # Example config file
4 |
5 | # Structure of a task: [Task] Followed by triggers and other settings.
6 | # The example below contains all the possible fields for a task
7 | # Time is HH:mm format, several different hours can be provided
8 | # Action command can be "script" or any other internal command
9 |
10 | [Task]
11 | triggerOnFirstLogin=false
12 | triggerOnLogin=false
13 | triggerOnTime=true
14 | triggerOnInterval=false
15 | timeValue=19:30
16 | timeValue=08:10
17 | timeInterval=0
18 | action=script event.txt
19 |
20 | # Another minimal example: some properties may be omitted
21 | # This is highly recommended for improving task readability
22 |
23 | [Task]
24 | triggerOnFirstLogin=true
25 | action=script startup.txt
26 |
27 | # Of course, the tasks file can contain as much tasks as you want.
28 | # Another example triggered on logging in and every night at midnight:
29 |
30 | [Task]
31 | triggerOnLogin=true
32 | triggerOnTime=true
33 | timeValue=00:00
34 | action=log It's midnight!
35 |
36 | # Example of task occuring every 30 seconds
37 | # Could be used for jumping as antiAFK method
38 |
39 | [Task]
40 | triggerOnInterval=true
41 | timeInterval=30
42 | action=move up
43 |
44 | # Enjoy!
45 | # - ORelio
46 |
--------------------------------------------------------------------------------
/MinecraftClientGUI.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 11.00
3 | # Visual Studio 2010
4 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MinecraftClientGUI", "MinecraftClientGUI\MinecraftClientGUI.csproj", "{B9E600B3-C8F0-4BF8-85E1-C164956B0B0D}"
5 | EndProject
6 | Global
7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
8 | Debug|x86 = Debug|x86
9 | Release|x86 = Release|x86
10 | EndGlobalSection
11 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
12 | {B9E600B3-C8F0-4BF8-85E1-C164956B0B0D}.Debug|x86.ActiveCfg = Debug|x86
13 | {B9E600B3-C8F0-4BF8-85E1-C164956B0B0D}.Debug|x86.Build.0 = Debug|x86
14 | {B9E600B3-C8F0-4BF8-85E1-C164956B0B0D}.Release|x86.ActiveCfg = Release|x86
15 | {B9E600B3-C8F0-4BF8-85E1-C164956B0B0D}.Release|x86.Build.0 = Release|x86
16 | EndGlobalSection
17 | GlobalSection(SolutionProperties) = preSolution
18 | HideSolutionNode = FALSE
19 | EndGlobalSection
20 | EndGlobal
21 |
--------------------------------------------------------------------------------
/MinecraftClientGUI/.gitignore:
--------------------------------------------------------------------------------
1 | /bin/
2 | /obj/
3 |
--------------------------------------------------------------------------------
/MinecraftClientGUI/AppIcon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/goldenlib/Minecraft-Console-Client/9e75d1808b1e84722ee263e4f921807961df628b/MinecraftClientGUI/AppIcon.ico
--------------------------------------------------------------------------------
/MinecraftClientGUI/MinecraftClientGUI.csproj.user:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | TestBot - Localhost
5 |
6 |
--------------------------------------------------------------------------------
/MinecraftClientGUI/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Windows.Forms;
5 |
6 | namespace MinecraftClientGUI
7 | {
8 | static class Program
9 | {
10 | ///
11 | /// Minecraft Console Client GUI by ORelio (c) 2013.
12 | /// Allows to use Minecraft Console Client in a more user friendly interface
13 | /// This source code is released under the CDDL 1.0 License.
14 | ///
15 |
16 | [STAThread]
17 | static void Main(string[] args)
18 | {
19 | if (!System.IO.File.Exists(MinecraftClient.ExePath))
20 | {
21 | MessageBox.Show("File not found: " + MinecraftClient.ExePath, "Minecraft client not found", MessageBoxButtons.OK, MessageBoxIcon.Error);
22 | }
23 | else
24 | {
25 | Application.EnableVisualStyles();
26 | Application.SetCompatibleTextRenderingDefault(false);
27 | Application.Run(new Form1(args));
28 | }
29 | }
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/MinecraftClientGUI/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("MinecraftClientGUI")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("MinecraftClientGUI")]
13 | [assembly: AssemblyCopyright("Copyright © ORelio 2013")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 | [assembly: ComVisible(false)]
21 |
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM
23 | [assembly: Guid("fc338f38-8ee7-49d8-afca-546a938daa90")]
24 |
25 | // Version information for an assembly consists of the following four values:
26 | //
27 | // Major Version
28 | // Minor Version
29 | // Build Number
30 | // Revision
31 | //
32 | // You can specify all the values or you can default the Build and Revision Numbers
33 | // by using the '*' as shown below:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0")]
37 |
--------------------------------------------------------------------------------
/MinecraftClientGUI/Properties/Settings.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.18046
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace MinecraftClientGUI.Properties
12 | {
13 |
14 |
15 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
16 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "10.0.0.0")]
17 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
18 | {
19 |
20 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
21 |
22 | public static Settings Default
23 | {
24 | get
25 | {
26 | return defaultInstance;
27 | }
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/MinecraftClientGUI/Properties/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/README-zh-Hans.md:
--------------------------------------------------------------------------------
1 | 我的世界控制台客户端
2 | ========================
3 |
4 | [](https://ci.appveyor.com/project/ORelio/minecraft-console-client)
5 |
6 | 我的世界控制台客户端(MCC)是一个轻量级的程序,它允许你连接至任何我的世界服务器,
7 | 简单快速地发送指令和接收聊天信息而不需要开启游戏。它也提供了多种自动化管理服务器和进行其他操作的可能性。
8 |
9 | **注意!** MCC仅可以连接到**我的世界Java版**,而**不能连接到我的世界基岩版/中国版!**
10 |
11 | ## 正在寻找维护者
12 |
13 | 由于不再有足够的时间来为新的我的世界版本提供升级和修复错误,开发者正在寻找有开发动力的人来接手该项目。如果您认为您可以接手该项目,请查看 [issues](https://github.com/MCCTeam/Minecraft-Console-Client/issues?q=is%3Aissue+is%3Aopen+label%3Awaiting-for%3Acontributor) 部分 :)
14 |
15 | ## 下载
16 |
17 | 从最新的[开发构建](https://ci.appveyor.com/project/ORelio/minecraft-console-client/build/artifacts)处获取exe文件。
18 | 这是一个同样兼容于macOS以及Linux的.NET可执行文件。
19 |
20 | ## 如何使用
21 |
22 | 在此查看[示例配置文件](MinecraftClient/config/) ,其中有基础使用教程 README 文件。
23 | 更多帮助和信息可以从[我的世界官方论坛](http://www.minecraftforum.net/topic/1314800-/)中查询。
24 |
25 | ## 从原代码编译
26 |
27 | 首先,下载[原代码zip压缩包](https://github.com/MCCTeam/Minecraft-Console-Client/archive/master.zip),将其解压并进入`MinecraftClient`文件夹
28 |
29 | 编辑 `MinecraftClient.csproj` 的[第四行](https://github.com/MCCTeam/Minecraft-Console-Client/blob/master/MinecraftClient/MinecraftClient.csproj#L4),将编译目标设置为 `Release`:
30 |
31 | ```xml
32 | Release
33 | ```
34 |
35 | ### 在Windows环境下
36 |
37 | 1. 找到 `C:\Windows\Microsoft.NET\Framework\v4.X.XXXXX` 下的 `MSBuild.exe`
38 | 2. 将 `MinecraftClient.csproj` 拖到 `MSBuild.exe` 上方并放开以开始编译
39 | 3. 如果编译成功,您将可以在 `MinecraftClient\bin\Release` 路径下找到 `MinecraftClient.exe`
40 |
41 | ### 在macOS/Linux环境下
42 |
43 | 1. 安装[Mono Framework](https://www.mono-project.com/download/stable/#download-lin)
44 | 2. 在终端内执行 `msbuild MinecraftClient.csproj`
45 | 3. 如果编译成功,您将可以在 `MinecraftClient\bin\Release` 路径下找到 `MinecraftClient.exe`
46 |
47 | ## 贡献代码
48 |
49 | 如果您希望为我的世界控制台客户端出一份力的话,我们不胜感激,您可以fork此repo并提交合并请求。 *Indev* 分支将不会继续被使用, 我们将只会把MCC作为测试版软件发布。
50 |
51 | ## 许可证
52 |
53 | 除非有特殊说明,此项目代码全部来自MCC开发者,并以CDDL-1.0协议发布。
54 | 在其他情况下,许可证和原作者会被提及于源码文件的顶部。
55 | CDDL-1.0许可证的主要条件基本上在列明于下列:
56 |
57 | - 你可以在任何一个程序使用许可证编码不管是使用完整的或一部分,程序的许可证是处于完整(或者相当的,不包括你借用的编码)。程序本身可以使开放来源或是封闭来源,自由的或商业的。
58 | - 无论如何,在CDDL编码(在CDDl编码里被任何编码引用直接修改会被认为是增建部分于CDDL编码里,所以是被限制于这需求;列子:对math fuction的改进使用快速查阅资料表会让资料表被认为是个增建部分,不管这是否在自己本身的来源编码之中)里,所有案列例如任何修改,改进,或者是增建部分必须使其公开的和自由的在来源中,当然也被限制于CDDL许可证里。
59 | - 在任何程序(来源或二进制)使用CDDL编码,确认必须要被给于CDDl编码的来源(任何一个项目或作者)。同样的,对CDDL编码(必须分布作为来源)的改进不得移除作为指引来源编码的通知。
60 |
61 | 更多资讯在 http://qstuff.blogspot.fr/2007/04/why-cddl.html
62 | 完整许可证在 http://opensource.org/licenses/CDDL-1.0
63 |
--------------------------------------------------------------------------------