当前位置: 首页>>代码示例>>Java>>正文


Java Side.SERVER属性代码示例

本文整理汇总了Java中net.minecraftforge.fml.relauncher.Side.SERVER属性的典型用法代码示例。如果您正苦于以下问题:Java Side.SERVER属性的具体用法?Java Side.SERVER怎么用?Java Side.SERVER使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在net.minecraftforge.fml.relauncher.Side的用法示例。


在下文中一共展示了Side.SERVER属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: InjectDedicated

@SideOnly(Side.SERVER)
public static void InjectDedicated(MinecraftServer server)
{
	PlayerList playerList = server.getPlayerList();

	try {
		if (playerList instanceof DedicatedPlayerList)
		{
			server.setPlayerList(new HookedDedicatedPlayerList((DedicatedPlayerList)playerList));
		}
		else
		{
			// uh ho...
			Util.logger.error("Unable to inject custom PlayerList into server due to unknown type! PlayerList was of type {}.", playerList.getClass().toString());
		}
	} catch (IllegalAccessException | NoSuchFieldException | SecurityException e) {
		Util.logger.logException("Exception trying to inject custom PlayerList into server!", e);
	}
}
 
开发者ID:orbwoi,项目名称:UniversalRemote,代码行数:19,代码来源:ServerInjector.java

示例2: handleData

@Override
public void handleData(NBTTagCompound data) 
{
	PacketType type = PacketType.registry.get(data.getShort("requestID"));
	NBTTagCompound dataTag = VoidNetwork.handlers.get(data.getShort("requestID")).handleRequest(data.getString("requester"));
	if (dataTag == null)
	{
		return;
	}
	
	if (MC.getSide() == Side.SERVER)
	{
		EntityPlayerMP to = Players.getPlayerByUsername(data.getString("requester"));
		VoidNetwork.sendDataToClient(type, dataTag, to);
	}
	else
	{
		VoidNetwork.sendDataToServer(type, dataTag);
	}
}
 
开发者ID:V0idWa1k3r,项目名称:VoidApi,代码行数:20,代码来源:HandlerRequest.java

示例3: onPlayerTick

@SubscribeEvent
public void onPlayerTick(TickEvent.PlayerTickEvent event)
{
    if(event.side == Side.SERVER && event.phase == TickEvent.Phase.END)
    {
        if(iChunUtil.eventHandlerServer.ticks + 5 % 10 == 2)
        {
            ItemStack isMain = event.player.getHeldItemMainhand();
            ItemStack isOff = event.player.getHeldItemOffhand();
            if(isMain.getItem() == Clef.itemInstrument)
            {
                InstrumentLibrary.checkForInstrument(isMain, event.player);
            }
            if(isOff.getItem() == Clef.itemInstrument)
            {
                InstrumentLibrary.checkForInstrument(isOff, event.player);
            }
        }
    }
}
 
开发者ID:iChun,项目名称:Clef,代码行数:20,代码来源:EventHandlerServer.java

示例4: init

@Mod.EventHandler
public void init(FMLInitializationEvent event) {
    // Don't run client-side, it makes kill not kill the whole client.
    if (event.getSide() != Side.SERVER) return;
    sig("TERM");
    sig("INT");
    sig("HUP");
}
 
开发者ID:Baughn,项目名称:signal-catcher,代码行数:8,代码来源:SignalCatcher.java

示例5: onMessage

@Override
public R onMessage(final M message, final MessageContext ctx) 
{
	if(ctx.side == Side.SERVER)
	{
		FMLServerHandler.instance().getServer().addScheduledTask(new Runnable() 
		{
			@Override
			public void run() 
			{
				processMessage(message, ctx);
			}
			
		});
	}
	else if(ctx.side == Side.CLIENT)
	{
		Minecraft.getMinecraft().addScheduledTask(new Runnable() 
		{
			@Override
			public void run() 
			{
				processMessage(message, ctx);
			}
			
		});
	}
	return null;
}
 
开发者ID:einsteinsci,项目名称:BetterBeginningsReborn,代码行数:29,代码来源:PacketHandlerBase.java

示例6: onMessage

@Override
public IMessage onMessage(MessagePictureBookInput message, MessageContext ctx) {
	if (ctx.side == Side.SERVER) {
		EntityPlayerMP player = ctx.getServerHandler().playerEntity;
		if (player != null && player.openContainer != null
				&& player.openContainer instanceof ContainerPictureBook) {
			ContainerPictureBook contaner = (ContainerPictureBook) player.openContainer;
			if (contaner.getSlot(0).getHasStack() && contaner.getSlot(0).getStack().hasTagCompound()
					&& contaner.getSlot(0).getStack().getTagCompound().hasKey("pid")) {
				ItemStack itemStack = contaner.getSlot(0).getStack();
				String pid = itemStack.getTagCompound().getString("pid");
				if (contaner.getTotalPictureNum() <= 100) {
					contaner.getListPid().add(pid);
					contaner.setTotalPictureNum(contaner.getTotalPictureNum() + 1);
					if (contaner.getTotalPictureNum() == 1) {
						contaner.setIndex(0);
					}
				} else {
					player.addChatComponentMessage(new TextComponentTranslation("chat.picturebook.tomany"));
					return null;
				}
			}
			contaner.getSlot(0).decrStackSize(64);
		}
	}
	return null;
}
 
开发者ID:PorPit,项目名称:MineCamera,代码行数:27,代码来源:MessagePictureBookInput.java

示例7: onMessage

@Override
public REQ onMessage(final REQ message, final MessageContext ctx) {
    if (ctx.side == Side.SERVER) {
        PneumaticCraftRepressurized.proxy.addScheduledTask(() -> message.handleServerSide(message, ctx.getServerHandler().player), true);
    } else {
        PneumaticCraftRepressurized.proxy.addScheduledTask(() -> message.handleClientSide(message, PneumaticCraftRepressurized.proxy.getPlayer()), false);
    }
    return null;
}
 
开发者ID:TeamPneumatic,项目名称:pnc-repressurized,代码行数:9,代码来源:AbstractPacket.java

示例8: onUpdate

@SubscribeEvent
public static void onUpdate(TickEvent.WorldTickEvent event)
{
    if(event.side == Side.SERVER && event.phase == TickEvent.Phase.END)
    {
        openContainers.values().forEach(ContainerWrapper::update);
    }
}
 
开发者ID:DaedalusGame,项目名称:Soot,代码行数:8,代码来源:VillagerAntimonyHandler.java

示例9: enableEnderPearlListener

@SideOnly(Side.SERVER)
public void enableEnderPearlListener(boolean enable)
{
    if      (enable)
        MinecraftForge.EVENT_BUS.register( this.enderPearlListener = new EnderPearlListener() );
    else if (enderPearlListener != null)
        MinecraftForge.EVENT_BUS.unregister(this.enderPearlListener);
}
 
开发者ID:abused,项目名称:World-Border,代码行数:8,代码来源:WorldBorder.java

示例10: onPlayerTick

@SubscribeEvent
public void onPlayerTick(TickEvent.PlayerTickEvent event) {
	if (event.side == Side.SERVER && event.phase == TickEvent.Phase.END) {
		IHardcoreRevival revival = event.player.getCapability(CapabilityHardcoreRevival.REVIVAL_CAPABILITY, null);
		if (revival != null && revival.getRescueTarget() != null) {
			// Stop rescuing if the target logged out
			if (revival.getRescueTarget().isDead) {
				abortRescue(event.player);
			} else {
				// Stop rescuing if the player is out of range
				float dist = event.player.getDistanceToEntity(revival.getRescueTarget());
				if (dist > ModConfig.maxRescueDist) {
					abortRescue(event.player);
				} else {
					int rescueTime = revival.getRescueTime() + 1;
					revival.setRescueTime(rescueTime);
					int step = ModConfig.rescueTime / 4;
					if (rescueTime >= ModConfig.rescueTime) {
						finishRescue(event.player);
					} else if (rescueTime % step == 0) {
						NetworkHandler.instance.sendTo(new MessageRevivalProgress(revival.getRescueTarget().getEntityId(), (float) rescueTime / (float) ModConfig.rescueTime), (EntityPlayerMP) event.player);
					}
				}
			}
		}
	}
}
 
开发者ID:blay09,项目名称:HardcoreRevival,代码行数:27,代码来源:RescueHandler.java

示例11: handleContentUpdate

@SideOnly(Side.SERVER)
public static void handleContentUpdate(ScriptyPacketContent content, EntityPlayerMP player) {
    BlockPos pos = content.getPos();
    TileEntity entity = player.world.getTileEntity(pos);
    if (entity != null && entity instanceof ScriptyBlock.TEScriptyBlock) {
        ((ScriptyBlock.TEScriptyBlock) entity).setLanguage(content.getLanguage());
        ((ScriptyBlock.TEScriptyBlock) entity).setContent(content.getContent());
        ((ScriptyBlock.TEScriptyBlock) entity).parse();
        entity.validate();
    }
}
 
开发者ID:ScriptyMod,项目名称:Scripty,代码行数:11,代码来源:ScriptyNetworkHandler.java

示例12: FMLProxyPacket

public FMLProxyPacket(CPacketCustomPayload original)
{
    this(original.getBufferData(), original.getChannelName());
    this.target = Side.SERVER;
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:5,代码来源:FMLProxyPacket.java

示例13: getPlayerForSide

@Override
public EntityPlayer getPlayerForSide(MessageContext ctx) {
	return ctx.side == Side.SERVER ? ctx.getServerHandler().player : Minecraft.getMinecraft().player;
}
 
开发者ID:rafradek,项目名称:Mods,代码行数:4,代码来源:ClientProxy.java

示例14: isWhiteListEnabled

@SideOnly(Side.SERVER)
public boolean isWhiteListEnabled()
{
    return this.whiteListEnforced;
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:5,代码来源:PlayerList.java

示例15: getSide

/**
 * @return The effective, i.e. logical, side of this interaction. This will be {@link Side#CLIENT} on the client thread, and {@link Side#SERVER} on the server thread.
 */
public Side getSide()
{
    return getWorld().isRemote ? Side.CLIENT : Side.SERVER;
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:7,代码来源:PlayerInteractEvent.java


注:本文中的net.minecraftforge.fml.relauncher.Side.SERVER属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。