use of net.minecraftforge.fml.common.network.simpleimpl.IMessage in project Overloaded by CJ-MC-Mods.
the class ItemMultiTool method leftClickOnBlockClient.
@SideOnly(Side.CLIENT)
private void leftClickOnBlockClient(BlockPos pos, Vec3d hitVec) {
IMessage message = new MultiToolLeftClickMessage(pos);
Overloaded.proxy.networkWrapper.sendToServer(message);
// EntityPlayerSP player = Minecraft.getMinecraft().player;
// drawParticleStreamTo(player, hitVec, EnumParticleTypes.SMOKE_NORMAL);//EnumParticleTypes.TOWN_AURA
}
use of net.minecraftforge.fml.common.network.simpleimpl.IMessage in project SilentGems by SilentChaos512.
the class MessageKeyReturnHome method handleMessage.
@Override
public IMessage handleMessage(MessageContext ctx) {
if (ctx.side != Side.SERVER)
return null;
Predicate<ItemStack> predicate = s -> s.getItem() == ModItems.returnHomeCharm;
EntityPlayer player = ctx.getServerHandler().playerEntity;
ItemStackList stacks = BaublesCompat.getBaubles(player, predicate);
stacks.addAll(PlayerHelper.getNonEmptyStacks(player, predicate));
if (stacks.isEmpty())
return null;
ModItems.returnHomeCharm.tryTeleportPlayer(stacks.get(0), player);
return null;
}
use of net.minecraftforge.fml.common.network.simpleimpl.IMessage in project takumicraft by TNTModders.
the class AbstractPacket method onMessage.
@Override
public IMessage onMessage(AbstractPacket message, MessageContext ctx) {
EntityPlayer player;
IMessage reply = null;
switch(FMLCommonHandler.instance().getEffectiveSide()) {
case CLIENT:
if (message instanceof MessageToClient) {
player = this.getClientPlayer();
reply = ((MessageToClient) message).handleClientSide(player);
}
break;
case SERVER:
if (message instanceof MessageToServer) {
player = ((NetHandlerPlayServer) ctx.netHandler).player;
reply = ((MessageToServer) message).handleServerSide(player);
}
break;
default:
}
return reply;
}
Aggregations