MightyDanp

Untitled

Jul 14th, 2015
26
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.99 KB | None | 0 0
  1. package com.mightydanp.eot.core.handler;
  2.  
  3. import com.mightydanp.eot.Eot;
  4.  
  5. import net.minecraft.entity.player.EntityPlayer;
  6. import cpw.mods.fml.common.network.simpleimpl.IMessage;
  7. import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
  8. import cpw.mods.fml.common.network.simpleimpl.MessageContext;
  9. import cpw.mods.fml.relauncher.Side;
  10. import cpw.mods.fml.relauncher.SideOnly;
  11.  
  12.  
  13.  
  14. public abstract class AbstractMessageHandler<T extends IMessage> implements IMessageHandler<T, IMessage> {
  15.  
  16. @SideOnly(Side.CLIENT)
  17. public abstract IMessage handleClientMessage(EntityPlayer player, T message, MessageContext ctx);
  18.  
  19. public abstract IMessage handleServerMessage(EntityPlayer player, T message, MessageContext ctx);
  20.  
  21. public IMessage onMessage(T message, MessageContext ctx) {
  22. if (ctx.side.isClient()) {
  23. return handleClientMessage(Eot.Proxy.getPlayerEntity(ctx),message, ctx);
  24. } else {
  25. return handleServerMessage(Eot.Proxy.getPlayerEntity(ctx),
  26. message, ctx);
  27. }
  28. }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment