Guest User

Untitled

a guest
Sep 28th, 2019
17
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package fr.feloria.felmod.common.network;
  2.  
  3. import fr.feloria.felmod.Main;
  4. import net.minecraft.util.ResourceLocation;
  5. import net.minecraftforge.fml.network.NetworkRegistry;
  6. import net.minecraftforge.fml.network.simple.SimpleChannel;
  7.  
  8. public class FeloriaNetwork {
  9. public static final String PROTOCOL_VERSION = String.valueOf(1);
  10.  
  11. public static final SimpleChannel CHANNEL = NetworkRegistry.ChannelBuilder
  12. .named(new ResourceLocation(Main.MOD_ID, "channel"))
  13. .networkProtocolVersion(() -> PROTOCOL_VERSION)
  14. .clientAcceptedVersions(PROTOCOL_VERSION::equals)
  15. .serverAcceptedVersions(PROTOCOL_VERSION::equals)
  16. .simpleChannel();
  17.  
  18. public static void registerNetworkPackets()
  19. {
  20. CHANNEL.messageBuilder(FeloriaPacket.class, 0)
  21. .encoder(FeloriaPacket::encode)
  22. .decoder(FeloriaPacket::decode)
  23. .consumer(FeloriaPacket::handle)
  24. .add();
  25. }
  26. }
RAW Paste Data