cpw.mods.fml.common.network.simpleimpl.MessageContext Java Examples
The following examples show how to use
cpw.mods.fml.common.network.simpleimpl.MessageContext.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: PacketAnimationAbsorb.java From Gadomancy with GNU Lesser General Public License v3.0 | 6 votes |
@Override @SideOnly(Side.CLIENT) public IMessage onMessage(PacketAnimationAbsorb p, MessageContext ctx) { Block b; int md; if(p.bid != -1 && p.bmd != -1) { b = Block.getBlockById(p.bid); md = p.bmd; } else { b = Minecraft.getMinecraft().theWorld.getBlock(p.targetX, p.targetY, p.targetZ); md = Minecraft.getMinecraft().theWorld.getBlockMetadata(p.targetX, p.targetY, p.targetZ); } MultiTickEffectDispatcher.VortexDigInfo info = new MultiTickEffectDispatcher.VortexDigInfo(Minecraft.getMinecraft().theWorld.provider.dimensionId, p.x, p.y, p.z, p.targetX, p.targetY, p.targetZ, b, md, p.tickCap); MultiTickEffectDispatcher.registerVortexDig(info); return null; }
Example #2
Source File: MessageModKey.java From SimplyJetpacks with MIT License | 6 votes |
@Override public IMessage onMessage(MessageModKey msg, MessageContext ctx) { EntityPlayer entityPlayer = ctx.getServerHandler().playerEntity; if (entityPlayer != null) { ItemStack armor = entityPlayer.inventory.armorItemInSlot(2); if (armor != null && armor.getItem() instanceof IControllableArmor) { if (msg.keyId < 0 || msg.keyId >= ModKey.values().length) { return null; } ModKey key = ModKey.values()[msg.keyId]; ((IControllableArmor) armor.getItem()).onKeyPressed(armor, entityPlayer, key, msg.showInChat); } } return null; }
Example #3
Source File: ControlRodChangeInsertionMessage.java From BigReactors with MIT License | 6 votes |
@Override protected IMessage handleMessage(ControlRodChangeInsertionMessage message, MessageContext ctx, TileEntity te) { if(te instanceof TileEntityReactorControlRod) { TileEntityReactorControlRod rod = (TileEntityReactorControlRod)te; int newInsertion = rod.getControlRodInsertion() + (short)message.amount; if(message.changeAll && rod.getReactorController() != null) { rod.getReactorController().setAllControlRodInsertionValues(newInsertion); } else { rod.setControlRodInsertion((short)newInsertion); } } return null; }
Example #4
Source File: ReactorMessageServer.java From BigReactors with MIT License | 6 votes |
@Override protected IMessage handleMessage(M message, MessageContext ctx, TileEntity te) { if(te instanceof TileEntityReactorPartBase) { MultiblockReactor reactor = ((TileEntityReactorPartBase)te).getReactorController(); if(reactor != null) { return handleMessage(message, ctx, reactor); } else { BRLog.error("Received ReactorMessageServer for a reactor part @ %d, %d, %d which has no attached reactor", te.xCoord, te.yCoord, te.zCoord); } } else { BRLog.error("Received ReactorMessageServer for a non-reactor-part block @ %d, %d, %d", message.x, message.y, message.z); } return null; }
Example #5
Source File: TurbineMessageServer.java From BigReactors with MIT License | 6 votes |
@Override protected IMessage handleMessage(M message, MessageContext ctx, TileEntity te) { if(te instanceof TileEntityTurbinePartBase) { MultiblockTurbine reactor = ((TileEntityTurbinePartBase)te).getTurbine(); if(reactor != null) { return handleMessage(message, ctx, reactor); } else { BRLog.error("Received TurbineMessageServer for a turbine part @ %d, %d, %d which has no attached turbine", te.xCoord, te.yCoord, te.zCoord); } } else { BRLog.error("Received TurbineMessageServer for a non-turbine-part block @ %d, %d, %d", message.x, message.y, message.z); } return null; }
Example #6
Source File: PacketTCNotificationText.java From Gadomancy with GNU Lesser General Public License v3.0 | 6 votes |
@Override public IMessage onMessage(PacketTCNotificationText message, MessageContext ctx) { if(message.text == null) return null; String translated = StatCollector.translateToLocal(message.text); ResourceLocation image = null; int color = message.color; Aspect a = Aspect.getAspect(message.additionalInfo); if(a != null) { image = a.getImage(); color = a.getColor(); } if(message.text.equals("gadomancy.aura.research.unlock")) { if(a != null) { translated = EnumChatFormatting.GREEN + String.format(translated, a.getName()); } else { translated = EnumChatFormatting.GREEN + String.format(translated, message.additionalInfo); } } color &= 0xFFFFFF; PlayerNotifications.addNotification(translated, image, color); return null; }
Example #7
Source File: DeviceChangeExposureMessage.java From BigReactors with MIT License | 6 votes |
@Override protected IMessage handleMessage(DeviceChangeExposureMessage message, MessageContext ctx, TileEntity te) { if(te instanceof TileEntityBeefBase) { TileEntityBeefBase beefTe = (TileEntityBeefBase)te; if(message.increment) { beefTe.incrSide(message.side); } else { beefTe.decrSide(message.side); } } else { BRLog.warning("Received SideChangeMessage for TE at %d, %d, %d, but it was not a TE with an iterable side exposure!", te.xCoord, te.yCoord, te.zCoord); } return null; }
Example #8
Source File: ReactorMessageClient.java From BigReactors with MIT License | 6 votes |
@Override protected IMessage handleMessage(M message, MessageContext ctx, TileEntity te) { if(te instanceof TileEntityReactorPartBase) { MultiblockReactor reactor = ((TileEntityReactorPartBase)te).getReactorController(); if(reactor != null) { return handleMessage(message, ctx, reactor); } else { BRLog.error("Received ReactorMessageClient for a reactor part @ %d, %d, %d which has no attached reactor", te.xCoord, te.yCoord, te.zCoord); } } else { BRLog.error("Received ReactorMessageClient for a non-reactor-part block @ %d, %d, %d", message.x, message.y, message.z); } return null; }
Example #9
Source File: TurbineMessageClient.java From BigReactors with MIT License | 6 votes |
@Override protected IMessage handleMessage(M message, MessageContext ctx, TileEntity te) { if(te instanceof TileEntityTurbinePartBase) { MultiblockTurbine reactor = ((TileEntityTurbinePartBase)te).getTurbine(); if(reactor != null) { return handleMessage(message, ctx, reactor); } else { BRLog.error("Received TurbineMessageClient for a turbine part @ %d, %d, %d which has no attached turbine", te.xCoord, te.yCoord, te.zCoord); } } else { BRLog.error("Received TurbineMessageClient for a non-turbine-part block @ %d, %d, %d", message.x, message.y, message.z); } return null; }
Example #10
Source File: ReactorCommandEjectToPortMessage.java From BigReactors with MIT License | 5 votes |
@Override public IMessage handleMessage(ReactorCommandEjectToPortMessage message, MessageContext ctx, MultiblockReactor reactor) { CoordTriplet dest = new CoordTriplet(message.portX, message.portY, message.portZ); if(message.ejectFuel) { reactor.ejectFuel(message.dumpExcess, dest); } else { reactor.ejectWaste(message.dumpExcess, dest); } return null; }
Example #11
Source File: PacketSyncConfigs.java From Gadomancy with GNU Lesser General Public License v3.0 | 5 votes |
@Override public IMessage onMessage(PacketSyncConfigs message, MessageContext ctx) { try { for(Tuple tuple : message.fieldData) { Field field = ModConfig.class.getField(tuple.field); field.set(null, tuple.value); } } catch (Throwable ignored) { throw new RuntimeException(ignored); } return null; }
Example #12
Source File: ReactorCommandEjectMessage.java From BigReactors with MIT License | 5 votes |
@Override public IMessage handleMessage(ReactorCommandEjectMessage message, MessageContext ctx, MultiblockReactor reactor) { if(message.ejectFuel) { reactor.ejectFuel(message.dumpExcess, null); } else { reactor.ejectWaste(message.dumpExcess, null); } return null; }
Example #13
Source File: PacketTCWispyLine.java From Gadomancy with GNU Lesser General Public License v3.0 | 5 votes |
@Override public IMessage onMessage(PacketTCWispyLine p, MessageContext ctx) { MultiTickEffectDispatcher.FloatyLineInfo info = new MultiTickEffectDispatcher.FloatyLineInfo(p.dimId, p.pedestalX, p.pedestalY, p.pedestalZ, p.originX, p.originY, p.originZ, p.tickCap, p.colorAsInt); MultiTickEffectDispatcher.registerFloatyLine(info); return null; }
Example #14
Source File: PacketAbortTransform.java From Gadomancy with GNU Lesser General Public License v3.0 | 5 votes |
@Override public IMessage onMessage(PacketAbortTransform message, MessageContext ctx) { if(ctx.side == Side.SERVER) { if(ctx.getServerHandler().playerEntity.getEntityId() == entityId) { } } else { TransformationHelper.onAbortTransformation(entityId); } return null; }
Example #15
Source File: MessageSlotUpdate.java From Chisel-2 with GNU General Public License v2.0 | 5 votes |
@Override public IMessage onMessage(MessageSlotUpdate message, MessageContext ctx) { TileEntity te = Chisel.proxy.getClientWorld().getTileEntity(message.x, message.y, message.z); if (te != null && te instanceof IInventory) { ((IInventory) te).setInventorySlotContents(message.slot, message.stack); } return null; }
Example #16
Source File: MessageJetpackSync.java From SimplyJetpacks with MIT License | 5 votes |
@Override public IMessage onMessage(MessageJetpackSync msg, MessageContext ctx) { Entity entity = FMLClientHandler.instance().getClient().theWorld.getEntityByID(msg.entityId); if (entity != null && entity instanceof EntityLivingBase && entity != FMLClientHandler.instance().getClient().thePlayer) { if (msg.particleId >= 0) { ParticleType particle = ParticleType.values()[msg.particleId]; SyncHandler.processJetpackUpdate(msg.entityId, particle); } else { SyncHandler.processJetpackUpdate(msg.entityId, null); } } return null; }
Example #17
Source File: PacketUpdateGolemTypeOrder.java From Gadomancy with GNU Lesser General Public License v3.0 | 5 votes |
@Override public IMessage onMessage(PacketUpdateGolemTypeOrder message, MessageContext ctx) { if(message.mapping != null) { GolemEnumHelper.reorderEnum(message.mapping); } return null; }
Example #18
Source File: ReactorChangeWasteEjectionMessage.java From BigReactors with MIT License | 5 votes |
@Override protected IMessage handleMessage( ReactorChangeWasteEjectionMessage message, MessageContext ctx, MultiblockReactor reactor) { reactor.setWasteEjection(MultiblockReactor.s_EjectionSettings[message.newSetting]); return null; }
Example #19
Source File: MessageAutoChisel.java From Chisel-2 with GNU General Public License v2.0 | 5 votes |
public IMessage onMessage(MessageAutoChisel message, MessageContext ctx) { TileEntity te = message.getTileEntity(ctx); if (te instanceof TileEntityAutoChisel) { ((TileEntityAutoChisel) te).doChiselAnim(message.base, message.chiseled, message.playSound, message.breakChisel); } return null; }
Example #20
Source File: MessageKeyboardSync.java From SimplyJetpacks with MIT License | 5 votes |
@Override public IMessage onMessage(MessageKeyboardSync msg, MessageContext ctx) { EntityPlayer entityPlayer = ctx.getServerHandler().playerEntity; if (entityPlayer != null) { SyncHandler.processKeyUpdate(entityPlayer, msg.flyState, msg.descendState, msg.forwardState, msg.backwardState, msg.leftState, msg.rightState); } return null; }
Example #21
Source File: AbstractPacket.java From PneumaticCraft with GNU General Public License v3.0 | 5 votes |
@Override public REQ onMessage(REQ message, MessageContext ctx){ if(ctx.side == Side.SERVER) { handleServerSide(message, ctx.getServerHandler().playerEntity); } else { handleClientSide(message, PneumaticCraft.proxy.getPlayer()); } return null; }
Example #22
Source File: MessageChiselSound.java From Chisel-2 with GNU General Public License v2.0 | 5 votes |
@Override public IMessage onMessage(MessageChiselSound message, MessageContext ctx) { String sound = ItemChisel.carving.getVariationSound(Block.getBlockById(message.block), message.meta); GeneralChiselClient.spawnChiselEffect(message.x, message.y, message.z, sound); if (message.breakChisel) { EntityPlayer player = Chisel.proxy.getClientPlayer(); player.renderBrokenItemStack(player.getCurrentEquippedItem()); } return null; }
Example #23
Source File: MachineCommandActivateMessage.java From BigReactors with MIT License | 5 votes |
@Override protected IMessage handleMessage(MachineCommandActivateMessage message, MessageContext ctx, TileEntity te) { if(te instanceof IActivateable) { IActivateable machine = (IActivateable)te; machine.setActive(message.setActive); } else { BRLog.error("Received a MachineCommandActivateMessage for %d, %d, %d but found no activateable machine", message.x, message.y, message.z); } return null; }
Example #24
Source File: ControlRodUpdateMessage.java From BigReactors with MIT License | 5 votes |
@Override protected IMessage handleMessage(ControlRodUpdateMessage message, MessageContext ctx, TileEntity te) { if(te instanceof TileEntityReactorControlRod) { ((TileEntityReactorControlRod)te).onControlRodUpdate(message.insertion); } return null; }
Example #25
Source File: TileMessageClient.java From BigReactors with MIT License | 5 votes |
@Override protected IMessage handleMessage(MESSAGE message, MessageContext ctx, TileEntity te) { TE concrete = getImpl(te); if(concrete != null) { return handle(message, ctx, concrete); } else { BRLog.error("Received a TileMessageClient for a non-resolvable TileEntity @ %d, %d, %d", message.x, message.y, message.z); } return null; }
Example #26
Source File: ControlRodChangeNameMessage.java From BigReactors with MIT License | 5 votes |
@Override protected IMessage handleMessage(ControlRodChangeNameMessage message, MessageContext ctx, TileEntity te) { if(te instanceof TileEntityReactorControlRod) { ((TileEntityReactorControlRod)te).setName(message.name); } return null; }
Example #27
Source File: DeviceUpdateMessage.java From BigReactors with MIT License | 5 votes |
@Override public IMessage handleMessage(DeviceUpdateMessage message, MessageContext ctx, TileEntity te) { if(te instanceof TileEntityBeefBase) { ((TileEntityBeefBase)te).onReceiveUpdate(message.compound); } return null; }
Example #28
Source File: WorldMessage.java From BigReactors with MIT License | 5 votes |
public IMessage onMessage(WorldMessage message, MessageContext ctx) { World world = getWorld(ctx); if(world == null) { BRLog.fatal("Unable to resolve world from messagecontext for WorldMessage"); return null; } TileEntity te = world.getTileEntity(message.x, message.y, message.z); if(te == null) { BRLog.error("Unable to find tile entity for WorldMessage at %d, %d, %d", message.x, message.y, message.z); return null; } return handleMessage((M)message, ctx, te); }
Example #29
Source File: TileMessageServer.java From BigReactors with MIT License | 5 votes |
@Override protected IMessage handleMessage(MESSAGE message, MessageContext ctx, TileEntity te) { TE concrete = getImpl(te); if(concrete != null) { return handle(message, ctx, concrete); } else { BRLog.error("Received a TileMessageServer for a non-resolvable TileEntity @ %d, %d, %d", message.x, message.y, message.z); } return null; }
Example #30
Source File: DeviceUpdateExposureMessage.java From BigReactors with MIT License | 5 votes |
@Override protected IMessage handleMessage(DeviceUpdateExposureMessage message, MessageContext ctx, TileEntity te) { if(te instanceof TileEntityBeefBase) { TileEntityBeefBase beefTe = (TileEntityBeefBase)te; beefTe.setSides(message.exposures); } // TODO Auto-generated method stub return null; }