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


Java MinecraftServer.getEntityWorld方法代码示例

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


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

示例1: shouldCreateWorld

import net.minecraft.server.MinecraftServer; //导入方法依赖的package包/类
@Override
public boolean shouldCreateWorld(MissionInit missionInit)
{
    if (this.dwparams != null && this.dwparams.isForceReset())
        return true;
    
	World world = null;
	MinecraftServer server = MinecraftServer.getServer();
	if (server.worldServers != null && server.worldServers.length != 0)
		world = server.getEntityWorld();

	if (Minecraft.getMinecraft().theWorld == null || world == null)
        return true;    // Definitely need to create a world if there isn't one in existence!

    String genOptions = world.getWorldInfo().getGeneratorOptions();
    if (genOptions != null && !genOptions.isEmpty())
    	return true;	// Default world has no generator options.

    return false;
}
 
开发者ID:Yarichi,项目名称:Proyecto-DASI,代码行数:21,代码来源:DefaultWorldGeneratorImplementation.java

示例2: shouldCreateWorld

import net.minecraft.server.MinecraftServer; //导入方法依赖的package包/类
@Override
public boolean shouldCreateWorld(MissionInit missionInit)
{
    if (this.fwparams != null && this.fwparams.isForceReset())
        return true;

    World world = null;
    MinecraftServer server = MinecraftServer.getServer();
    if (server.worldServers != null && server.worldServers.length != 0)
        world = server.getEntityWorld();

    if (world == null)
        return true;   // There is no world, so we definitely need to create one.

    String name = (world != null) ? world.getWorldInfo().getWorldName() : "";
    // Extract the name from the path (need to cope with backslashes or forward slashes.)
    String mapfile = (this.mapFilename == null) ? "" : this.mapFilename;    // Makes no sense to have an empty filename, but createWorld will deal with it graciously.
    String[] parts = mapfile.split("[\\\\/]");
    if (name.length() > 0 && parts[parts.length - 1].equalsIgnoreCase(name) && Minecraft.getMinecraft().theWorld != null)
        return false;	// We don't check whether the game modes match - it's up to the server state machine to sort that out.

    return true;	// There's no world, or the world is different to the basemap file, so create.
}
 
开发者ID:Yarichi,项目名称:Proyecto-DASI,代码行数:24,代码来源:FileWorldGeneratorImplementation.java

示例3: shouldCreateWorld

import net.minecraft.server.MinecraftServer; //导入方法依赖的package包/类
@Override
public boolean shouldCreateWorld(MissionInit missionInit)
{
	World world = null;
	MinecraftServer server = MinecraftServer.getServer();
	if (server.worldServers != null && server.worldServers.length != 0)
		world = server.getEntityWorld();
	
	if (this.fwparams != null && this.fwparams.isForceReset())
	    return true;
	
    if (Minecraft.getMinecraft().theWorld == null && world == null)
        return true;    // Definitely need to create a world if there isn't one in existence!
    
    String genOptions = world.getWorldInfo().getGeneratorOptions();
    if (!genOptions.equals(this.fwparams.getGeneratorString()))
        return true;    // Generation doesn't match, so recreate.
    
    return false;
}
 
开发者ID:Yarichi,项目名称:Proyecto-DASI,代码行数:21,代码来源:FlatWorldGeneratorImplementation.java

示例4: getWorldTime

import net.minecraft.server.MinecraftServer; //导入方法依赖的package包/类
@Override
protected long getWorldTime()
{
   	World world = null;
   	MinecraftServer server = MinecraftServer.getServer();
   	if (server.worldServers != null && server.worldServers.length != 0)
   		world = server.getEntityWorld();
	return (world != null) ? world.getTotalWorldTime() : 0;
}
 
开发者ID:Yarichi,项目名称:Proyecto-DASI,代码行数:10,代码来源:ServerQuitFromTimeUpImplementation.java

示例5: onServerTick

import net.minecraft.server.MinecraftServer; //导入方法依赖的package包/类
@SubscribeEvent
public void onServerTick(ServerTickEvent e)
{
	if(counter == 1)
	{
		MinecraftServer server = FMLCommonHandler.instance().getMinecraftServerInstance();
		World world = server.getEntityWorld();
	
		if(world.isRemote == false) 
		{
		
			long totalTime = world.getWorldTime();
			long currentTime = totalTime % 24000;
		
			if(currentTime == 1)
			{
				System.out.println("Time is 0");
				WorldTurn turn = WorldTurn.get(world);
				int currentTurn = turn.advanceTurn();
				System.out.println("New Turn!!  The World Turn is now " + currentTurn);
				ArrayList<EntityPlayerMP> playerList = (ArrayList<EntityPlayerMP>)(world.getMinecraftServer().getServer().getPlayerList().getPlayers());
				for(int i=0; i < playerList.size(); i++)
				{
					EntityPlayer player = playerList.get(i);
					ITurn playerTurn = player.getCapability(CapPlayerTurn.TURN_CAP, null);
					playerTurn.addTurn();
				}
			}
		}
		
		counter = 0;
	}
	else
	{
		counter++;
	}
}
 
开发者ID:stuebz88,项目名称:modName,代码行数:38,代码来源:EventHandlerCommon.java

示例6: onServerTick

import net.minecraft.server.MinecraftServer; //导入方法依赖的package包/类
@Override
protected void onServerTick(ServerTickEvent ev)
{
    if (this.missionHasEnded)
        return;	// In case we get in here after deciding the mission is over.
    
    if (!ServerStateMachine.this.checkWatchList())
        onError(null);  // We've lost a connection - abort the mission.
    
    if (ev.phase == Phase.START)
    {
        // Measure our performance - especially useful if we've been overclocked.
        if (this.secondStartTimeMs == 0)
            this.secondStartTimeMs = System.currentTimeMillis();

        long timeNow = System.currentTimeMillis();
        if (timeNow - this.secondStartTimeMs > 1000)
        {
            long targetTicks = 1000 / TimeHelper.serverTickLength;
            if (this.tickCount < targetTicks)
                System.out.println("Warning: managed " + this.tickCount + "/" + targetTicks + " ticks this second.");
            this.secondStartTimeMs = timeNow;
            this.tickCount = 0;
        }
        this.tickCount++;
    }

    if (ev.phase == Phase.END && getHandlers() != null && getHandlers().worldDecorator != null)
    {
        MinecraftServer server = MinecraftServer.getServer();
        if (server.worldServers != null && server.worldServers.length != 0)
        {
            World world = server.getEntityWorld();
            getHandlers().worldDecorator.update(world);
        }
    }

    if (ev.phase == Phase.END)
    {
        if (getHandlers() != null && getHandlers().quitProducer != null && getHandlers().quitProducer.doIWantToQuit(currentMissionInit()))
        {
            ServerStateMachine.this.quitCode = getHandlers().quitProducer.getOutcome();
            onMissionEnded(true);
        }
        else if (this.runningAgents.isEmpty())
        {
            ServerStateMachine.this.quitCode = "All agents finished";
            onMissionEnded(true);
        }
        // We need to make sure we keep the weather within mission parameters.
        // We set the weather just after building the world, but it's not a permanent setting,
        // and apparently there is a known bug in Minecraft that means the weather sometimes changes early.
        // To get around this, we reset it periodically.
        if (MinecraftServer.getServer().getTickCounter() % 500 == 0)
        {
            EnvironmentHelper.setMissionWeather(currentMissionInit());
        }
    }
}
 
开发者ID:Yarichi,项目名称:Proyecto-DASI,代码行数:60,代码来源:ServerStateMachine.java


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