本文整理汇总了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);
}
}
示例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);
}
}
示例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);
}
}
}
}
示例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");
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
}
示例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);
}
示例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);
}
}
}
}
}
}
示例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();
}
}
示例12: FMLProxyPacket
public FMLProxyPacket(CPacketCustomPayload original)
{
this(original.getBufferData(), original.getChannelName());
this.target = Side.SERVER;
}
示例13: getPlayerForSide
@Override
public EntityPlayer getPlayerForSide(MessageContext ctx) {
return ctx.side == Side.SERVER ? ctx.getServerHandler().player : Minecraft.getMinecraft().player;
}
示例14: isWhiteListEnabled
@SideOnly(Side.SERVER)
public boolean isWhiteListEnabled()
{
return this.whiteListEnforced;
}
示例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;
}