Java Code Examples for cpw.mods.fml.common.gameevent.TickEvent.Phase#END
The following examples show how to use
cpw.mods.fml.common.gameevent.TickEvent.Phase#END .
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: TickDynamicMod.java From TickDynamic with MIT License | 6 votes |
@SubscribeEvent(priority=EventPriority.LOWEST) public void tickEventEnd(ServerTickEvent event) { if(event.phase == Phase.END) { getTimedGroup("other").endTimer(); root.endTick(true); if(debugTimer) System.out.println("Tick time used: " + (root.getTimeUsed()/root.timeMilisecond) + "ms"); //After every world is done ticking, re-balance the time slices according //to the data gathered during the tick. root.balanceTime(); //Calculate TPS updateTPS(); if(saveConfig) { saveConfig = false; config.save(); } } }
Example 2
Source File: MovingStructure.java From Framez with GNU General Public License v3.0 | 6 votes |
public void tick(Phase phase) { FakeWorld.getFakeWorld(this); if (progress >= 1) return; if (phase == Phase.END) { if (progress == 0) { if (!getWorld().isRemote) NetworkHandler.instance().sendToAllAround(new PacketStartMoving(motor, this), getWorld(), 128); startMoving(); if (!getWorld().isRemote) NetworkHandler.instance().sendToAllAround(new PacketBlockSync(motor, this), getWorld(), 128); } progress += speed; moveEntities(); if (progress >= 1) finishMoving(); } }
Example 3
Source File: TankSynchroniser.java From EnderStorage with MIT License | 5 votes |
@SubscribeEvent public void tickEnd(ServerTickEvent event) { if(event.phase == Phase.END && playerItemTankStates != null) for(Entry<String, PlayerItemTankCache> entry : playerItemTankStates.entrySet()) entry.getValue().update(); }
Example 4
Source File: TankSynchroniser.java From EnderStorage with MIT License | 5 votes |
@SubscribeEvent public void tickEnd(ClientTickEvent event) { if(event.phase == Phase.END) if(ClientUtils.inWorld()) clientState.update(); }
Example 5
Source File: ChunkLoaderEventHandler.java From ChickenChunks with MIT License | 5 votes |
@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 6
Source File: CraftingGridKeyHandler.java From Translocators with MIT License | 5 votes |
@SubscribeEvent @SideOnly(Side.CLIENT) public void tick(ClientTickEvent event) { if(event.phase != Phase.END) return; boolean pressed = getIsKeyPressed(); if(pressed != wasPressed) { wasPressed = pressed; if(pressed) onKeyPressed(); } }
Example 7
Source File: CommonPlayerTicker.java From archimedes-ships with MIT License | 5 votes |
@SubscribeEvent public void onPlayerTick(PlayerTickEvent e) { if (e.phase == Phase.END && e.player.ridingEntity instanceof EntityParachute && e.player.ridingEntity.ticksExisted < 40) { if (e.player.isSneaking()) { e.player.setSneaking(false); } } }
Example 8
Source File: TerminalManagerClient.java From OpenPeripheral-Addons with MIT License | 5 votes |
@SubscribeEvent public void onClientTick(ClientTickEvent evt) { if (evt.phase == Phase.END) { final EntityPlayer player = Minecraft.getMinecraft().thePlayer; terminalGuid = player != null? TerminalIdAccess.instance.getIdFrom(player) : Optional.<Long> absent(); } }
Example 9
Source File: WorldTickEventHandler.java From Et-Futurum with The Unlicense | 4 votes |
@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 10
Source File: ChunkLoaderEventHandler.java From ChickenChunks with MIT License | 4 votes |
@SubscribeEvent public void serverTick(ServerTickEvent event) { if (event.phase == Phase.END) PlayerChunkViewerManager.instance().update(); }
Example 11
Source File: HUDTickHandler.java From SimplyJetpacks with MIT License | 4 votes |
@SubscribeEvent public void onRenderTick(RenderTickEvent evt) { if (evt.phase == Phase.END && (Config.enableFuelHUD || Config.enableStateHUD)) { tickEnd(); } }
Example 12
Source File: WRCoreEventHandler.java From WirelessRedstone with MIT License | 4 votes |
@SubscribeEvent public void serverTick(WorldTickEvent event) { if(event.phase == Phase.END && !event.world.isRemote) RedstoneEther.server().tick(event.world); }