This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
------ NEW ------ | |
Track = 36 | |
Dragon Egg = 32768 | |
Certus Quartz Crystal = 512 | |
Charged Certus Quartz Crystal = 768 | |
Singularity = 256000 | |
Yellorium Ingot = 4096 | |
Monochromium Ingot = 256 | |
Wool (any) = 48 | |
Barley Seeds = 16 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Цель: обе стороны должны иметь одно и то же значение - секрет. Это может быть что угодно (обычно массив байтов) | |
Условие: | |
Существует способ асимметрической криптографии (публичный ключ используется для зашифровки, секретный ключ используется для расшифровки). Используя этот способ никто не может узнать второй ключ, зная один из пары. | |
Решение: | |
1. Сервер создает случайную пару ключей. | |
2. Сервер передает публичный ключ клиенту (третья сторона имеет доступ к публичному ключу) | |
3. Клиент получает публичный ключ. | |
4. Клиент создает секрет. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
> Since 1.7 came out, there's a "GameProfile" assigned to every player now. You can get GameProfile of a player by using EntityPlayer.getGameProfile(). Yeah, with that said, you probably still wonder how does Minecraft UUID system work. Let me start explaining that. | |
>>>>>>>>>>>>>>>>>>>>>>>> DISCLAIMER! <<<<<<<<<<<<<<<<<<<<<<<< | |
>> 1. English is not my main language, I could make mistakes | |
>> 2. I could be wrong. | |
1. UUID in Java | |
> There's a concept of Universally Unique Identifier. If you're not familiar with it, try reading that*. If you have no time (too lazy) to read it, I'm going to cut a long story short here. UUID is an ID made out of 128 bits (16 bytes, 2 longs). It's called "unique" because the random number generator used when doing UUID.randomUUID() is very strong. According to wikipedia "only after generating 1 billion UUIDs every second for the next 100 years, the probability of creating just one duplicate would be about 50%", so yeah, pretty strong. UUIDs can be converted to hexadecimal string and |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package dany.test3; | |
import java.io.File; | |
import java.io.IOException; | |
import java.io.PrintWriter; | |
import java.net.URI; | |
import java.net.URISyntaxException; | |
import sun.awt.OSInfo; | |
import sun.awt.OSInfo.OSType; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@EventHandler | |
public static void init(FMLInitializationEvent e) | |
{ | |
// this should be in initialization | |
PacketHandler.initPackets(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentTranslation("message.redeem." + (result == EnumResult.SUCCESS ? "success" : "fail")).setChatStyle(new ChatStyle().setColor(result == EnumResult.SUCCESS ? EnumChatFormatting.GREEN : EnumChatFormatting.RED))); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// PacketHandler.java /// | |
public class PacketHandler | |
{ | |
public static PacketHandler instance; | |
public final SimpleNetworkWrapper net; | |
public static void init() | |
{ | |
instance = new PacketHandler(); | |
instance.net = NetworkRegistry.INSTANCE.newSimpleChannel("CHANNEL_NAME_USE_YOUR_MODID"); |