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


Java WorldTickEvent类代码示例

本文整理汇总了Java中net.minecraftforge.fml.common.gameevent.TickEvent.WorldTickEvent的典型用法代码示例。如果您正苦于以下问题:Java WorldTickEvent类的具体用法?Java WorldTickEvent怎么用?Java WorldTickEvent使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: tickWorld

import net.minecraftforge.fml.common.gameevent.TickEvent.WorldTickEvent; //导入依赖的package包/类
public void tickWorld(WorldTickEvent event) {
	if(!(event.world instanceof WorldServer))
		return;

	// System.out.println("TICKING WORLD -> @" + event.world);
	// TaleCraft.proxy.tick(event);

	GameRules rules = event.world.getGameRules();
	//TODO: Fix this
	if(rules.getBoolean("tc_disableWeather")) {
		// Clear the weather for 5 seconds.
		event.world.getWorldInfo().setCleanWeatherTime(20*5);
	}
	NBTTagCompound current = rules.writeToNBT();
	if(!current.equals(gamerules)){
		gamerules = current;
		TaleCraft.network.sendToAll(new GameruleSyncPacket(current));
	}
}
 
开发者ID:tiffit,项目名称:TaleCraft,代码行数:20,代码来源:TCWorldManager.java

示例2: onServerWorldTick

import net.minecraftforge.fml.common.gameevent.TickEvent.WorldTickEvent; //导入依赖的package包/类
@SubscribeEvent
public void onServerWorldTick(WorldTickEvent event)
{
	World world = event.world;
	if(event.phase == Phase.START)
	{
		if(WorldGen.getInstance() != null)
		{
			if(world.provider.getDimension() == 0)
			{
				WorldGen.getInstance().trimCache();
				WorldGen.getInstance().buildFromQueue();
				WorldGen.getInstance().runUpdateLoop(event.world);
			}
		}			
	}
}
 
开发者ID:Deadrik,项目名称:TFC2,代码行数:18,代码来源:ServerTickHandler.java

示例3: onTick

import net.minecraftforge.fml.common.gameevent.TickEvent.WorldTickEvent; //导入依赖的package包/类
@SubscribeEvent
public void onTick(WorldTickEvent event)
{
	if(Minecraft.getMinecraft().world != null && ticks++%40==0)
		for(TileEntity te : new ArrayList<TileEntity>(Minecraft.getMinecraft().world.loadedTileEntityList))
			if(te instanceof TileEntityCaulronBlock && ((TileEntityCaulronBlock)te).isLeader())
				Minecraft.getMinecraft().renderGlobal.markBlockRangeForRenderUpdate(te.getPos().getX(), te.getPos().getY(), te.getPos().getZ(), 
						te.getPos().getX() + ((TileEntityCaulronBlock)te).getSize(), te.getPos().getY() + ((TileEntityCaulronBlock)te).getSize(), te.getPos().getZ() + ((TileEntityCaulronBlock)te).getSize());
}
 
开发者ID:kenijey,项目名称:harshencastle,代码行数:10,代码来源:CauldronUpdate.java

示例4: serverTick

import net.minecraftforge.fml.common.gameevent.TickEvent.WorldTickEvent; //导入依赖的package包/类
@SubscribeEvent
public void serverTick(WorldTickEvent event) {
    if (!event.world.isRemote) {
        if (event.phase == Phase.END) {
            RedstoneEther.server().tick(event.world);
        } else {
            RedstoneEtherAddons.server().processSMPMaps(event.world);
        }
    }
}
 
开发者ID:TheCBProject,项目名称:WirelessRedstone,代码行数:11,代码来源:WREventHandler.java

示例5: onWorldTick

import net.minecraftforge.fml.common.gameevent.TickEvent.WorldTickEvent; //导入依赖的package包/类
@SubscribeEvent
public static void onWorldTick(WorldTickEvent event) {
	WorldServer world = (WorldServer) event.world;
	
	
	if (world.isRaining()) {
		onTickSnowIncrease(world);
	} else if (world.provider.isDaytime()) {
		onTickSnowDecrease(world);
	}
}
 
开发者ID:cam72cam,项目名称:WinterWonderLand,代码行数:12,代码来源:WinterWonderLand.java

示例6: worldTick

import net.minecraftforge.fml.common.gameevent.TickEvent.WorldTickEvent; //导入依赖的package包/类
@SubscribeEvent
public static void worldTick(WorldTickEvent event){
	// I only want to tick on the server
	if(event.world.isRemote){return;}
	// If I don't have this code everything runs twice per tick
	if(event.phase == Phase.END){return;}
	if(Math.floorMod(event.world.getTotalWorldTime(), tickSpeed) != 0){return;}
	TickTracker tickTracker = getTickTrackerForDimension(event.world.provider.getDimension());
	if(!tickTracker.trackedWorldHasPlayers()){
		if(tickTracker.worldToTick == nextWorldToTick){
			tickTracker.hasTicked = true;
			findNextWorldToTick();
		}
		return;
	}
	if(!tickTracker.hasTicked && tickTracker.worldToTick == nextWorldToTick && event.world.getTotalWorldTime() > lastTickProcessed){
		if(dimensionsToTick.contains(tickTracker.worldToTick)){
			if(ConfigHandler.LOGGING)LogManager.getLogger().log(Level.INFO, "We're ticking in this dimension: " + tickTracker.worldToTick);
			if(tickTracker.trackedWorldHasPlayers() && tickTracker.playerToTick < event.world.playerEntities.size()){
				SpawnHandler.attemptSpawnNearPlayer(event.world.playerEntities.get(tickTracker.playerToTick), event.world);
				tickTracker.setNextPlayerToTick(event.world);
			}
		}
		tickTracker.hasTicked = true;
		findNextWorldToTick();
		lastTickProcessed = event.world.getTotalWorldTime();
		return;
	}
	// if we get to this point, a world has probably unloaded and eaten our tick tracker, so find a new world to tick on
	if(DimensionManager.getWorld(nextWorldToTick) == null){
		if(ConfigHandler.LOGGING)LogManager.getLogger().log(Level.WARN, "Tracker lost, generating new tracker.");
		findNextWorldToTick();
	}
}
 
开发者ID:Edicatad,项目名称:EmergentVillages,代码行数:35,代码来源:TickHandler.java

示例7: worldTicked

import net.minecraftforge.fml.common.gameevent.TickEvent.WorldTickEvent; //导入依赖的package包/类
@SubscribeEvent
public void worldTicked(WorldTickEvent event)
{
	if(event.phase == TickEvent.Phase.START && event.type == TickEvent.Type.WORLD)
	{
		if(event.world.getGameRules().getBoolean("teleportXP") || ModConfig.ignoreGamerule)
		{
			for(int i = 0; i < event.world.loadedEntityList.size(); i++)
			{
				if(event.world.loadedEntityList.get(i) instanceof EntityXPOrb)
				{
					EntityXPOrb xpOrb = (EntityXPOrb) event.world.loadedEntityList.get(i);
					EntityPlayer player;
					if (ModConfig.prioritizeNonCreative)
					{
						player = event.world.getNearestPlayerNotCreative(xpOrb, Double.MAX_VALUE);
						if(player != null)
						{
							xpOrb.setPosition(player.posX, player.posY, player.posZ);
							return;
						}
					}
					player = event.world.getClosestPlayerToEntity(xpOrb, Double.MAX_VALUE);
					if(player != null)
					{
						xpOrb.setPosition(player.posX, player.posY, player.posZ);
					}
				}
			}
		}
	}
}
 
开发者ID:adudewithapc,项目名称:Teleporting-XP,代码行数:33,代码来源:CommonEventHandler.java

示例8: cleanUp

import net.minecraftforge.fml.common.gameevent.TickEvent.WorldTickEvent; //导入依赖的package包/类
@SubscribeEvent
public void cleanUp(WorldTickEvent event) {
	if (event.world.getTotalWorldTime() % 20 != 0) {
		return;
	}
	despawnLogic(event, NemesisRegistryProvider.get(event.world));
}
 
开发者ID:ToroCraft,项目名称:NemesisSystem,代码行数:8,代码来源:Reaper.java

示例9: despawnLogic

import net.minecraftforge.fml.common.gameevent.TickEvent.WorldTickEvent; //导入依赖的package包/类
private void despawnLogic(WorldTickEvent event, INemesisRegistry registry) {
	registry.list().forEach((NemesisEntry nemesis) -> {
		if (nemesis.isSpawned()) {
			if (shouldBeDespawned(event.world, nemesis)) {
				despawnNemesis(event.world, registry, nemesis);
			} else {
				unloadNemesis(event.world, registry, nemesis);
			}
		}
	});
}
 
开发者ID:ToroCraft,项目名称:NemesisSystem,代码行数:12,代码来源:Reaper.java

示例10: onWorldTick

import net.minecraftforge.fml.common.gameevent.TickEvent.WorldTickEvent; //导入依赖的package包/类
@SubscribeEvent
public void onWorldTick(WorldTickEvent event)
{
	if (event.phase != Phase.END) { return; }	// Only doing it once
	if (event.side == Side.CLIENT) { return; }

	upkeepTick += 1;

	if (upkeepTick >= Main.getConsumeUpkeepTick())
	{
		TerritoryHandler.consumeUpkeep(event.world);
		upkeepTick = 0;	// Reset
	}
}
 
开发者ID:Domochevsky,项目名称:minecraft-territorialdealings,代码行数:15,代码来源:EventListener.java

示例11: onTick

import net.minecraftforge.fml.common.gameevent.TickEvent.WorldTickEvent; //导入依赖的package包/类
@SubscribeEvent
public void onTick(WorldTickEvent event) {
	if (event.phase == Phase.START) {
		onTickStart();
	} else if (event.phase == Phase.END) {
		onTickEnd();
	}
}
 
开发者ID:RemotecraftProject,项目名称:RemotecraftMod,代码行数:9,代码来源:Core.java

示例12: handleWorldTick

import net.minecraftforge.fml.common.gameevent.TickEvent.WorldTickEvent; //导入依赖的package包/类
@SubscribeEvent
public void handleWorldTick(WorldTickEvent event) {
	if (queue.size() < 1) {
		return;
	}
	runNextQueueItem();
}
 
开发者ID:ToroCraft,项目名称:ToroQuest,代码行数:8,代码来源:Timer.java

示例13: handleWorldTick

import net.minecraftforge.fml.common.gameevent.TickEvent.WorldTickEvent; //导入依赖的package包/类
@SubscribeEvent
public void handleWorldTick(WorldTickEvent event) {
	if (runQueue.size() < 1) {
		return;
	}
	runNextQueueItem();
}
 
开发者ID:ToroCraft,项目名称:TeleToro,代码行数:8,代码来源:Teletory.java

示例14: worldTick

import net.minecraftforge.fml.common.gameevent.TickEvent.WorldTickEvent; //导入依赖的package包/类
@SubscribeEvent
public void worldTick(WorldTickEvent event) {
    if (event.phase == Phase.END && !event.world.isRemote) {
        ChunkLoaderManager.onTickEnd((WorldServer) event.world);
        PlayerChunkViewerManager.instance().calculateChunkChanges((WorldServer) event.world);
    }
}
 
开发者ID:TheCBProject,项目名称:ChickenChunks,代码行数:8,代码来源:ChunkLoaderEventHandler.java

示例15: tickWorld

import net.minecraftforge.fml.common.gameevent.TickEvent.WorldTickEvent; //导入依赖的package包/类
public void tickWorld(WorldTickEvent event) {
	TCWorldManager mng = TaleCraft.worldsManager.fetchManager(event.world);

	if(mng == null) {
		TaleCraft.logger.error("No WorldManager for @" + event.world.hashCode());
		return;
	}

	mng.tickWorld(event);
}
 
开发者ID:tiffit,项目名称:TaleCraft,代码行数:11,代码来源:CommonProxy.java


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