cpw.mods.fml.common.gameevent.TickEvent.WorldTickEvent Java Examples

The following examples show how to use cpw.mods.fml.common.gameevent.TickEvent.WorldTickEvent. 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: WorldEventHandler.java    From TickDynamic with MIT License 5 votes vote down vote up
@SubscribeEvent
  public void worldTickEvent(WorldTickEvent event) {
Profiler profiler = event.world.theProfiler;
if(!(profiler instanceof CustomProfiler))
	return;
CustomProfiler customProfiler = (CustomProfiler)profiler;
  	
  	if(event.phase == Phase.START) {
  		customProfiler.setStage(CustomProfiler.Stage.BeforeLoop);
  	}
  	else {
  		customProfiler.setStage(CustomProfiler.Stage.None);
  	}
  }
 
Example #2
Source File: ChunkLoaderEventHandler.java    From ChickenChunks with MIT License 5 votes vote down vote up
@SubscribeEvent
public void worldTick(WorldTickEvent event) {
    if (event.phase == Phase.END && !event.world.isRemote) {
        ChunkLoaderManager.tickEnd((WorldServer) event.world);
        PlayerChunkViewerManager.instance().calculateChunkChanges((WorldServer) event.world);
    }
}
 
Example #3
Source File: WorldTickEventHandler.java    From Et-Futurum with The Unlicense 4 votes vote down vote up
@SubscribeEvent
public void tick(WorldTickEvent event) {
	if (event.side != Side.SERVER || event.phase != Phase.END || isReplacing)
		return;

	if (replacements == null) {
		replacements = new HashMap<Block, Block>();
		if (EtFuturum.enableBrewingStands)
			replacements.put(Blocks.brewing_stand, ModBlocks.brewing_stand);
		if (EtFuturum.enableColourfulBeacons)
			replacements.put(Blocks.beacon, ModBlocks.beacon);
		if (EtFuturum.enableEnchants)
			replacements.put(Blocks.enchanting_table, ModBlocks.enchantment_table);
		if (EtFuturum.enableInvertedDaylightSensor)
			replacements.put(Blocks.daylight_detector, ModBlocks.daylight_sensor);
	}

	if (replacements.isEmpty())
		return;

	isReplacing = true;
	World world = event.world;

	for (int i = 0; i < world.loadedTileEntityList.size(); i++) {
		TileEntity tile = (TileEntity) world.loadedTileEntityList.get(i);
		int x = tile.xCoord;
		int y = tile.yCoord;
		int z = tile.zCoord;
		Block replacement = replacements.get(world.getBlock(x, y, z));
		if (replacement != null && ((IConfigurable) replacement).isEnabled()) {
			NBTTagCompound nbt = new NBTTagCompound();
			tile.writeToNBT(nbt);
			if (tile instanceof IInventory) {
				IInventory invt = (IInventory) tile;
				for (int j = 0; j < invt.getSizeInventory(); j++)
					invt.setInventorySlotContents(j, null);
			}
			world.setBlock(x, y, z, replacement);
			TileEntity newTile = world.getTileEntity(x, y, z);
			newTile.readFromNBT(nbt);
			break;
		}
	}
	isReplacing = false;
}
 
Example #4
Source File: WRAddonEventHandler.java    From WirelessRedstone with MIT License 4 votes vote down vote up
@SubscribeEvent
public void worldTick(WorldTickEvent event) {
    if(event.phase == Phase.START)
        RedstoneEtherAddons.server().processSMPMaps(event.world);
}
 
Example #5
Source File: WRCoreEventHandler.java    From WirelessRedstone with MIT License 4 votes vote down vote up
@SubscribeEvent
public void serverTick(WorldTickEvent event) {
    if(event.phase == Phase.END && !event.world.isRemote)
        RedstoneEther.server().tick(event.world);
}