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


Java ITickable类代码示例

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


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

示例1: addTileEntities

import net.minecraft.util.ITickable; //导入依赖的package包/类
public void addTileEntities(Collection<TileEntity> tileEntityCollection)
{
    if (this.processingLoadedTiles)
    {
        this.addedTileEntityList.addAll(tileEntityCollection);
    }
    else
    {
        for (TileEntity tileentity : tileEntityCollection)
        {
            this.loadedTileEntityList.add(tileentity);

            if (tileentity instanceof ITickable)
            {
                this.tickableTileEntities.add(tileentity);
            }
        }
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:20,代码来源:World.java

示例2: addTileEntity

import net.minecraft.util.ITickable; //导入依赖的package包/类
public boolean addTileEntity(TileEntity tile)
{
    boolean flag = this.loadedTileEntityList.add(tile);

    if (flag && tile instanceof ITickable)
    {
        this.tickableTileEntities.add(tile);
    }

    if (this.isRemote)
    {
        BlockPos blockpos = tile.getPos();
        IBlockState iblockstate = this.getBlockState(blockpos);
        this.notifyBlockUpdate(blockpos, iblockstate, iblockstate, 2);
    }

    return flag;
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:19,代码来源:World.java

示例3: addTileEntity

import net.minecraft.util.ITickable; //导入依赖的package包/类
public boolean addTileEntity(TileEntity tile)
{
    if (tile.getWorld() != null) // Forge - set the world early as vanilla doesn't set it until next tick
        tile.setWorldObj(this);

    List<TileEntity> dest = processingLoadedTiles ? addedTileEntityList : loadedTileEntityList;
    boolean flag = dest.add(tile);

    if (flag && tile instanceof ITickable)
    {
        this.tickableTileEntities.add(tile);
    }

    if (this.isRemote)
    {
        BlockPos blockpos = tile.getPos();
        IBlockState iblockstate = this.getBlockState(blockpos);
        this.notifyBlockUpdate(blockpos, iblockstate, iblockstate, 2);
    }

    return flag;
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:23,代码来源:World.java

示例4: removeTileEntity

import net.minecraft.util.ITickable; //导入依赖的package包/类
public void removeTileEntity(BlockPos pos)
{
    TileEntity tileentity = this.getTileEntity(pos);

    if (tileentity != null && this.processingLoadedTiles)
    {
        tileentity.invalidate();
        this.addedTileEntityList.remove(tileentity);
        if (!(tileentity instanceof ITickable)) //Forge: If they are not tickable they wont be removed in the update loop.
            this.loadedTileEntityList.remove(tileentity);
    }
    else
    {
        if (tileentity != null)
        {
            this.addedTileEntityList.remove(tileentity);
            this.loadedTileEntityList.remove(tileentity);
            this.tickableTileEntities.remove(tileentity);
        }

        this.getChunkFromBlockCoords(pos).removeTileEntity(pos);
    }
    this.updateComparatorOutputLevel(pos, getBlockState(pos).getBlock()); //Notify neighbors of changes
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:25,代码来源:World.java

示例5: onItemUse

import net.minecraft.util.ITickable; //导入依赖的package包/类
@Override
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ) {
    if (!world.isRemote) {
        IBlockState state = world.getBlockState(pos);
        Block block = state.getBlock();
        int mode = getMode(stack);

        if (!checkUsage(stack, player, cost[mode])) {
            return true;
        }
        TileEntity tileEntity = world.getTileEntity(pos);
        for (int i = 0; i < amount[mode]/(tileEntity == null ? 5 : 1); i ++){
            if (tileEntity == null){
                block.updateTick(world, pos, state, random);
            } else if (tileEntity instanceof ITickable) {
                ((ITickable)tileEntity).update();
            }

        }

        registerUsage(stack, player, cost[mode]);
    }
    return true;
}
 
开发者ID:romelo333,项目名称:notenoughwands1.8.8,代码行数:25,代码来源:AccelerationWand.java

示例6: onUpdate

import net.minecraft.util.ITickable; //导入依赖的package包/类
@Override
public void onUpdate()
{
	super.onUpdate();
	if(!this.worldObj.isRemote && (this.isClientNeedy() || (this.isDirty() &&
			random.nextInt(UPDATE_TICKS) == 0) || (this.isReallyDirty() && random.nextInt(UPDATE_TICKS / 10) == 0)))
	{
		this.setDirty(false);
		this.setClientNeedy(false);
		this.setReallyDirty(false);
		this.sendUpdateToAllAround();
	}
	if(shouldTileUpdate() && this.getTileEntity() instanceof ITickable)
	{
		((ITickable)this.getTileEntity()).update();
	}
	if(shouldUpdateBlockState)
	{
		IBlockState blockState = this.getBlockState(this.getMetadata());
		blockState = this.getCartBlock().getActualState(blockState, getFakeWorld(), BlockPos.ORIGIN);
		blockState = this.getCartBlock().getExtendedState(blockState, getFakeWorld(), BlockPos.ORIGIN);
		this.func_174899_a(blockState);
		this.shouldUpdateBlockState = false;
		this.sendUpdateToAllAround();
	}
}
 
开发者ID:BrassGoggledCoders,项目名称:MoarCarts,代码行数:27,代码来源:EntityMinecartTEBase.java

示例7: addTileEntity

import net.minecraft.util.ITickable; //导入依赖的package包/类
public boolean addTileEntity(TileEntity tile)
{
    boolean flag = this.loadedTileEntityList.add(tile);

    if (flag && tile instanceof ITickable)
    {
        this.tickableTileEntities.add(tile);
    }

    return flag;
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:12,代码来源:World.java

示例8: processReceivedPackets

import net.minecraft.util.ITickable; //导入依赖的package包/类
/**
 * Checks timeouts and processes all packets received
 */
public void processReceivedPackets()
{
    this.flushOutboundQueue();

    if (this.packetListener instanceof ITickable)
    {
        ((ITickable)this.packetListener).update();
    }

    this.channel.flush();
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:15,代码来源:NetworkManager.java

示例9: updateTimeLightAndEntities

import net.minecraft.util.ITickable; //导入依赖的package包/类
public void updateTimeLightAndEntities()
{
    this.theProfiler.startSection("jobs");

    synchronized (this.futureTaskQueue)
    {
        while (!this.futureTaskQueue.isEmpty())
        {
            Util.func_181617_a((FutureTask)this.futureTaskQueue.poll(), logger);
        }
    }

    this.theProfiler.endStartSection("levels");

    for (int j = 0; j < this.worldServers.length; ++j)
    {
        long i = System.nanoTime();

        if (j == 0 || this.getAllowNether())
        {
            WorldServer worldserver = this.worldServers[j];
            this.theProfiler.startSection(worldserver.getWorldInfo().getWorldName());

            if (this.tickCounter % 20 == 0)
            {
                this.theProfiler.startSection("timeSync");
                this.serverConfigManager.sendPacketToAllPlayersInDimension(new S03PacketTimeUpdate(worldserver.getTotalWorldTime(), worldserver.getWorldTime(), worldserver.getGameRules().getBoolean("doDaylightCycle")), worldserver.provider.getDimensionId());
                this.theProfiler.endSection();
            }

            this.theProfiler.startSection("tick");

            try
            {
                worldserver.tick();
            }
            catch (Throwable throwable1)
            {
                CrashReport crashreport = CrashReport.makeCrashReport(throwable1, "Exception ticking world");
                worldserver.addWorldInfoToCrashReport(crashreport);
                throw new ReportedException(crashreport);
            }

            try
            {
                worldserver.updateEntities();
            }
            catch (Throwable throwable)
            {
                CrashReport crashreport1 = CrashReport.makeCrashReport(throwable, "Exception ticking world entities");
                worldserver.addWorldInfoToCrashReport(crashreport1);
                throw new ReportedException(crashreport1);
            }

            this.theProfiler.endSection();
            this.theProfiler.startSection("tracker");
            worldserver.getEntityTracker().updateTrackedEntities();
            this.theProfiler.endSection();
            this.theProfiler.endSection();
        }

        this.timeOfLastDimensionTick[j][this.tickCounter % 100] = System.nanoTime() - i;
    }

    this.theProfiler.endStartSection("connection");
    this.getNetworkSystem().networkTick();
    this.theProfiler.endStartSection("players");
    this.serverConfigManager.onTick();
    this.theProfiler.endStartSection("tickables");

    for (int k = 0; k < this.playersOnline.size(); ++k)
    {
        ((ITickable)this.playersOnline.get(k)).update();
    }

    this.theProfiler.endSection();
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:78,代码来源:MinecraftServer.java

示例10: registerTickable

import net.minecraft.util.ITickable; //导入依赖的package包/类
public void registerTickable(ITickable tickable)
{
    this.playersOnline.add(tickable);
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:5,代码来源:MinecraftServer.java

示例11: updateTimeLightAndEntities

import net.minecraft.util.ITickable; //导入依赖的package包/类
public void updateTimeLightAndEntities()
{
    this.theProfiler.startSection("jobs");

    synchronized (this.futureTaskQueue)
    {
        while (!this.futureTaskQueue.isEmpty())
        {
            Util.runTask((FutureTask)this.futureTaskQueue.poll(), LOG);
        }
    }

    this.theProfiler.endStartSection("levels");

    for (int j = 0; j < this.worldServers.length; ++j)
    {
        long i = System.nanoTime();

        if (j == 0 || this.getAllowNether())
        {
            WorldServer worldserver = this.worldServers[j];
            this.theProfiler.startSection(worldserver.getWorldInfo().getWorldName());

            if (this.tickCounter % 20 == 0)
            {
                this.theProfiler.startSection("timeSync");
                this.playerList.sendPacketToAllPlayersInDimension(new SPacketTimeUpdate(worldserver.getTotalWorldTime(), worldserver.getWorldTime(), worldserver.getGameRules().getBoolean("doDaylightCycle")), worldserver.provider.getDimensionType().getId());
                this.theProfiler.endSection();
            }

            this.theProfiler.startSection("tick");

            try
            {
                worldserver.tick();
            }
            catch (Throwable throwable1)
            {
                CrashReport crashreport = CrashReport.makeCrashReport(throwable1, "Exception ticking world");
                worldserver.addWorldInfoToCrashReport(crashreport);
                throw new ReportedException(crashreport);
            }

            try
            {
                worldserver.updateEntities();
            }
            catch (Throwable throwable)
            {
                CrashReport crashreport1 = CrashReport.makeCrashReport(throwable, "Exception ticking world entities");
                worldserver.addWorldInfoToCrashReport(crashreport1);
                throw new ReportedException(crashreport1);
            }

            this.theProfiler.endSection();
            this.theProfiler.startSection("tracker");
            worldserver.getEntityTracker().updateTrackedEntities();
            this.theProfiler.endSection();
            this.theProfiler.endSection();
        }

        this.timeOfLastDimensionTick[j][this.tickCounter % 100] = System.nanoTime() - i;
    }

    this.theProfiler.endStartSection("connection");
    this.getNetworkSystem().networkTick();
    this.theProfiler.endStartSection("players");
    this.playerList.onTick();
    this.theProfiler.endStartSection("tickables");

    for (int k = 0; k < this.tickables.size(); ++k)
    {
        ((ITickable)this.tickables.get(k)).update();
    }

    this.theProfiler.endSection();
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:78,代码来源:MinecraftServer.java

示例12: registerTickable

import net.minecraft.util.ITickable; //导入依赖的package包/类
@SideOnly(Side.SERVER)
public void registerTickable(ITickable tickable)
{
    this.tickables.add(tickable);
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:6,代码来源:MinecraftServer.java

示例13: useServerTickHandler

import net.minecraft.util.ITickable; //导入依赖的package包/类
protected boolean useServerTickHandler() {
	return !(this instanceof ITickable);
}
 
开发者ID:tom5454,项目名称:Toms-Mod,代码行数:4,代码来源:PartDuct.java


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