当前位置: 首页>>代码示例>>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;未经允许,请勿转载。