當前位置: 首頁>>代碼示例>>Java>>正文


Java TickEvent.WorldTickEvent方法代碼示例

本文整理匯總了Java中net.minecraftforge.fml.common.gameevent.TickEvent.WorldTickEvent方法的典型用法代碼示例。如果您正苦於以下問題:Java TickEvent.WorldTickEvent方法的具體用法?Java TickEvent.WorldTickEvent怎麽用?Java TickEvent.WorldTickEvent使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在net.minecraftforge.fml.common.gameevent.TickEvent的用法示例。


在下文中一共展示了TickEvent.WorldTickEvent方法的13個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: worldTick

import net.minecraftforge.fml.common.gameevent.TickEvent; //導入方法依賴的package包/類
@SubscribeEvent
public void worldTick(TickEvent.WorldTickEvent event) {
    if (event.phase == TickEvent.Phase.END) {
        try {
            for (Entity entity : event.world.loadedEntityList) {
                if (entity.hasCapability(CapabilityHackingProvider.HACKING_CAPABILITY, null)) {
                    IHacking hack = entity.getCapability(CapabilityHackingProvider.HACKING_CAPABILITY, null);
                    if (!hack.getCurrentHacks().isEmpty()) {
                        hack.update(entity);
                    }
                }
            }
        } catch (Throwable e) {
            // Catching a CME which I have no clue on what might cause it.
        }
    }
}
 
開發者ID:TeamPneumatic,項目名稱:pnc-repressurized,代碼行數:18,代碼來源:HackTickHandler.java

示例2: tickEnd

import net.minecraftforge.fml.common.gameevent.TickEvent; //導入方法依賴的package包/類
@SubscribeEvent
public void tickEnd(TickEvent.WorldTickEvent event) {
    if (event.phase == TickEvent.Phase.END) {
        World world = event.world;
        checkLightning(world);
        DroneClaimManager.getInstance(world).update();
        if (!event.world.isRemote && event.world.provider.getDimension() == 0 && event.world.getWorldTime() % (24000 / AmadronOfferPeriodicConfig.timesPerDay) == 1) {
            AmadronOfferManager.getInstance().shufflePeriodicOffers();
        }
        if (!event.world.isRemote && event.world.getTotalWorldTime() % 100 == 0) {
            double tickTime = net.minecraft.util.math.MathHelper.average(FMLCommonHandler.instance().getMinecraftServerInstance().tickTimeArray) * 1.0E-6D;//In case world are going to get their own thread: MinecraftServer.getServer().worldTickTimes.get(event.world.provider.getDimension())
            NetworkHandler.sendToDimension(new PacketServerTickTime(tickTime), event.world.provider.getDimension());
            if (event.world.getTotalWorldTime() % 600 == 0)
                AmadronOfferManager.getInstance().tryRestockCustomOffers();
        }
    }
}
 
開發者ID:TeamPneumatic,項目名稱:pnc-repressurized,代碼行數:18,代碼來源:TickHandlerPneumaticCraft.java

示例3: onWorldTick

import net.minecraftforge.fml.common.gameevent.TickEvent; //導入方法依賴的package包/類
@SubscribeEvent
public void onWorldTick(TickEvent.WorldTickEvent event) {
	if(event.world.isRemote){ return; } // Not called on client
	long time = event.world.getWorldTime();
	if (time > Util.ticksInDay) {
		MapStorage storage = event.world.getPerWorldStorage();
		TimeData td = (TimeData) storage.getOrLoadData(TimeData.class, "firmatime");
		if(td==null){
			td = new TimeData("");
			storage.setData("firmatime", td);
		}
		td.addDay();
		event.world.setWorldTime(time - Util.ticksInDay);
		td.setDirty(true);
		System.out.println("Day inceremented on Server " + td.toString());
	}
}
 
開發者ID:trigg,項目名稱:Firma,代碼行數:18,代碼來源:CommonProxy.java

示例4: onTick

import net.minecraftforge.fml.common.gameevent.TickEvent; //導入方法依賴的package包/類
@SubscribeEvent
public void onTick(TickEvent.WorldTickEvent event)
{
    //only run this stuff if we are in the right world
    if(!event.world.equals(this.worldObj))return;

    //tick down time alive
    alive--;

    //if we've run out of time, delete self and replace with previous block and tile entity.
    //I wonder if this will work?
    if(alive<=0)
    {
        this.worldObj.setBlockState(this.pos,this.prev);
        this.worldObj.setTileEntity(this.pos,this.tile);
    }
}
 
開發者ID:Drazuam,項目名稱:RunicArcana,代碼行數:18,代碼來源:VanishingTileEntity.java

示例5: onServerWorldTick

import net.minecraftforge.fml.common.gameevent.TickEvent; //導入方法依賴的package包/類
@SubscribeEvent
public static void onServerWorldTick(TickEvent.WorldTickEvent event) {
	if (event.side != Side.CLIENT) {

		int dim = event.world.provider.getDimension();
		if (ticks % 20 == 0) {
			for (ChunkPos pos : getDirtyChunks(dim)) {
				event.world.markChunkDirty(new BlockPos(pos.x << 4, 16, pos.z << 4), null);
			}
			getDirtyChunks(dim).clear();

			// for (InstabilityEvent e : instabilityEvents.get(dim)) {
			// e.affectChunk(event.world);
			// }
			// instabilityEvents.clear();
		}

		ticks++;
	}
}
 
開發者ID:the-realest-stu,項目名稱:Etheric,代碼行數:21,代碼來源:StabilityHandler.java

示例6: onWorldTick

import net.minecraftforge.fml.common.gameevent.TickEvent; //導入方法依賴的package包/類
@SubscribeEvent
public void onWorldTick(TickEvent.WorldTickEvent e) {
    if (!e.world.isRemote && e.phase == TickEvent.Phase.START && e.world.provider.getDimension() == 0) {
        long now = Instant.now().getEpochSecond();
        if (now - lastCheck > checkInterval) {
            BlockPos spawn = e.world.getSpawnPoint();
            for (int i = 0; i < e.world.playerEntities.size(); i++)
            {
                EntityPlayer p = e.world.playerEntities.get(i);
                // If the user is inside the zone radius, force them back to creative
                if (p.getDistance(spawn.getX(), p.posY, spawn.getZ()) < zoneRadius) {
                    p.setGameType(GameType.CREATIVE);
                } else {
                    // Otherwise, the user is outside the radius and we need to force
                    // them back to survival (assuming they're not on the whitelist)
                    if (!whitelist.contains(p.getName())) {
                        p.setGameType(GameType.SURVIVAL);
                    }
                }
            }
            lastCheck = now;
        }
    }
}
 
開發者ID:dizzyd,項目名稱:creativezone,代碼行數:25,代碼來源:CreativeZoneMod.java

示例7: onUpdate

import net.minecraftforge.fml.common.gameevent.TickEvent; //導入方法依賴的package包/類
@SubscribeEvent
public static void onUpdate(TickEvent.WorldTickEvent event)
{
    if(event.side == Side.SERVER && event.phase == TickEvent.Phase.END)
    {
        openContainers.values().forEach(ContainerWrapper::update);
    }
}
 
開發者ID:DaedalusGame,項目名稱:Soot,代碼行數:9,代碼來源:VillagerAntimonyHandler.java

示例8: onWorldTick

import net.minecraftforge.fml.common.gameevent.TickEvent; //導入方法依賴的package包/類
@SubscribeEvent
public void onWorldTick(TickEvent.WorldTickEvent event){
    if(DifficultyManager.enabled) {
        DifficultyManager.onWorldTick(event.world.provider.getDimension());
        MobUpkeepController.tick(event.world);
    }
}
 
開發者ID:talandar,項目名稱:ProgressiveDifficulty,代碼行數:8,代碼來源:EventHandler.java

示例9: onWorldTick

import net.minecraftforge.fml.common.gameevent.TickEvent; //導入方法依賴的package包/類
@SubscribeEvent
public void onWorldTick(TickEvent.WorldTickEvent event) {
    if (event.type == TickEvent.Type.WORLD && tick >= 40) {
        TreeFluidExtractorTile.WoodLodProgress.woodLodProgressList.stream().filter(woodLodProgress -> woodLodProgress.getProgress() > 0).forEach(woodLodProgress -> woodLodProgress.getWorld().sendBlockBreakProgress(woodLodProgress.getBreakID(), woodLodProgress.getBlockPos(), woodLodProgress.getProgress() - 1));
        tick = 0;
    }
    ++tick;
}
 
開發者ID:Buuz135,項目名稱:Industrial-Foregoing,代碼行數:9,代碼來源:WorldTickHandler.java

示例10: onWorldTick

import net.minecraftforge.fml.common.gameevent.TickEvent; //導入方法依賴的package包/類
@SubscribeEvent
public void onWorldTick(TickEvent.WorldTickEvent evt) {
    if (evt.phase == TickEvent.Phase.START) {
        return;
    }
    World world = evt.world;
    DimensionData data = getDimensionData(world);
    if (data != null) {
        data.worldTick(world);
    }
}
 
開發者ID:McJty,項目名稱:needtobreath,代碼行數:12,代碼來源:ForgeEventHandlers.java

示例11: doNextTick

import net.minecraftforge.fml.common.gameevent.TickEvent; //導入方法依賴的package包/類
@SubscribeEvent
public void doNextTick(TickEvent.WorldTickEvent event)
{

    //only tick in this dimension
    if(event.world.provider.getDimension()!=this.player.worldObj.provider.getDimension())
    {
        return;
    }
    //make sure player is still holding item
    if((this.startPoint==StartPoint.RIGHT_CLICK||this.startPoint==StartPoint.SNEAK_RIGHT||this.startPoint==StartPoint.BLOCK_BREAK)
        &&!(this.player.getHeldItem(EnumHand.MAIN_HAND)== RunicItem ||this.player.getHeldItem(EnumHand.OFF_HAND)== RunicItem)) {
        done();
        return;
    }

    this.processesThisTick=0;
    variablesChanged=false;
    //update script
    compiledSymbols = ModDust.getScriptFromItem(RunicItem);

    //run through our list until we've hit max processes
    while(this.processesThisTick<processesPerTick&&actionQueue.size()>2)
    {
        processesThisTick++;
        try {
            resolveNextOutput();
        }
        catch(NullPointerException e)
        {

        }
    }

    if(actionQueue.size()<3) done();

    if(variablesChanged)
        ModDust.loadScriptToItem(compiledSymbols, RunicItem);
}
 
開發者ID:Drazuam,項目名稱:RunicArcana,代碼行數:40,代碼來源:ScriptExecutor.java

示例12: onWorldTick

import net.minecraftforge.fml.common.gameevent.TickEvent; //導入方法依賴的package包/類
@SubscribeEvent
public void onWorldTick(TickEvent.WorldTickEvent evt)
{
	if (evt.world.hasCapability(ExPWorldCapability.worldCap, null) && evt.phase == Phase.END && evt.world.provider.getDimension() == 0)
	{
		IExPWorld.of(evt.world).onTick();
		if (evt.world.isRaining() && evt.world instanceof WorldServer)
		{
			WeatherUtils.handleServerTick((WorldServer) evt.world);
		}
	}
}
 
開發者ID:V0idWa1k3r,項目名稱:ExPetrum,代碼行數:13,代碼來源:ExPHandlerServer.java

示例13: onWorldTick

import net.minecraftforge.fml.common.gameevent.TickEvent; //導入方法依賴的package包/類
@SubscribeEvent
public void onWorldTick(TickEvent.WorldTickEvent event) {
    if (!event.world.isRemote) {
        syncWithPlayers(event.world);
    }
}
 
開發者ID:TeamPneumatic,項目名稱:pnc-repressurized,代碼行數:7,代碼來源:SemiBlockManager.java


注:本文中的net.minecraftforge.fml.common.gameevent.TickEvent.WorldTickEvent方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。