BloodMagic/src/main/java/WayofTime/bloodmagic/network/BloodMagicPacketHandler.java

43 lines
2.1 KiB
Java
Raw Normal View History

package WayofTime.bloodmagic.network;
2015-10-30 16:54:59 -07:00
import WayofTime.bloodmagic.BloodMagic;
2015-10-30 16:54:59 -07:00
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.fml.common.network.NetworkRegistry;
import net.minecraftforge.fml.common.network.simpleimpl.IMessage;
import net.minecraftforge.fml.common.network.simpleimpl.SimpleNetworkWrapper;
import net.minecraftforge.fml.relauncher.Side;
import WayofTime.bloodmagic.util.ChatUtil;
2015-10-30 16:54:59 -07:00
public class BloodMagicPacketHandler
{
public static final SimpleNetworkWrapper INSTANCE = new SimpleNetworkWrapper(BloodMagic.MODID);
2015-10-30 16:54:59 -07:00
public static void init()
{
2015-10-30 16:54:59 -07:00
INSTANCE.registerMessage(ChatUtil.PacketNoSpamChat.Handler.class, ChatUtil.PacketNoSpamChat.class, 0, Side.CLIENT);
INSTANCE.registerMessage(ItemRouterButtonPacketProcessor.class, ItemRouterButtonPacketProcessor.class, 1, Side.SERVER);
INSTANCE.registerMessage(PlayerVelocityPacketProcessor.class, PlayerVelocityPacketProcessor.class, 2, Side.CLIENT);
INSTANCE.registerMessage(PlayerFallDistancePacketProcessor.class, PlayerFallDistancePacketProcessor.class, 3, Side.SERVER);
INSTANCE.registerMessage(SigilHoldingPacketProcessor.class, SigilHoldingPacketProcessor.class, 4, Side.SERVER);
INSTANCE.registerMessage(KeyProcessor.class, KeyProcessor.class, 5, Side.SERVER);
INSTANCE.registerMessage(DemonAuraPacketProcessor.class, DemonAuraPacketProcessor.class, 6, Side.CLIENT);
INSTANCE.registerMessage(ItemRouterAmountPacketProcessor.class, ItemRouterAmountPacketProcessor.class, 7, Side.SERVER);
2015-10-30 16:54:59 -07:00
}
public static void sendToAllAround(IMessage message, TileEntity te, int range)
{
INSTANCE.sendToAllAround(message, new NetworkRegistry.TargetPoint(te.getWorld().provider.getDimension(), te.getPos().getX(), te.getPos().getY(), te.getPos().getZ(), range));
2015-10-30 16:54:59 -07:00
}
public static void sendToAllAround(IMessage message, TileEntity te)
{
2015-10-30 16:54:59 -07:00
sendToAllAround(message, te, 64);
}
public static void sendTo(IMessage message, EntityPlayerMP player)
{
2015-10-30 16:54:59 -07:00
INSTANCE.sendTo(message, player);
}
}