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


Java WorldServer.isBlockLoaded方法代码示例

本文整理汇总了Java中net.minecraft.world.WorldServer.isBlockLoaded方法的典型用法代码示例。如果您正苦于以下问题:Java WorldServer.isBlockLoaded方法的具体用法?Java WorldServer.isBlockLoaded怎么用?Java WorldServer.isBlockLoaded使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.minecraft.world.WorldServer的用法示例。


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

示例1: processUpdateSign

import net.minecraft.world.WorldServer; //导入方法依赖的package包/类
public void processUpdateSign(C12PacketUpdateSign packetIn)
{
    PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.playerEntity.getServerForPlayer());
    this.playerEntity.markPlayerActive();
    WorldServer worldserver = this.serverController.worldServerForDimension(this.playerEntity.dimension);
    BlockPos blockpos = packetIn.getPosition();

    if (worldserver.isBlockLoaded(blockpos))
    {
        TileEntity tileentity = worldserver.getTileEntity(blockpos);

        if (!(tileentity instanceof TileEntitySign))
        {
            return;
        }

        TileEntitySign tileentitysign = (TileEntitySign)tileentity;

        if (!tileentitysign.getIsEditable() || tileentitysign.getPlayer() != this.playerEntity)
        {
            this.serverController.logWarning("Player " + this.playerEntity.getName() + " just tried to change non-editable sign");
            return;
        }

        IChatComponent[] aichatcomponent = packetIn.getLines();

        for (int i = 0; i < aichatcomponent.length; ++i)
        {
            tileentitysign.signText[i] = new ChatComponentText(EnumChatFormatting.getTextWithoutFormattingCodes(aichatcomponent[i].getUnformattedText()));
        }

        tileentitysign.markDirty();
        worldserver.markBlockForUpdate(blockpos);
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:36,代码来源:NetHandlerPlayServer.java

示例2: processUpdateSign

import net.minecraft.world.WorldServer; //导入方法依赖的package包/类
public void processUpdateSign(CPacketUpdateSign packetIn)
{
    PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.playerEntity.getServerWorld());
    this.playerEntity.markPlayerActive();
    WorldServer worldserver = this.serverController.worldServerForDimension(this.playerEntity.dimension);
    BlockPos blockpos = packetIn.getPosition();

    if (worldserver.isBlockLoaded(blockpos))
    {
        IBlockState iblockstate = worldserver.getBlockState(blockpos);
        TileEntity tileentity = worldserver.getTileEntity(blockpos);

        if (!(tileentity instanceof TileEntitySign))
        {
            return;
        }

        TileEntitySign tileentitysign = (TileEntitySign)tileentity;

        if (!tileentitysign.getIsEditable() || tileentitysign.getPlayer() != this.playerEntity)
        {
            this.serverController.logWarning("Player " + this.playerEntity.getName() + " just tried to change non-editable sign");
            return;
        }

        String[] astring = packetIn.getLines();

        for (int i = 0; i < astring.length; ++i)
        {
            tileentitysign.signText[i] = new TextComponentString(TextFormatting.getTextWithoutFormattingCodes(astring[i]));
        }

        tileentitysign.markDirty();
        worldserver.notifyBlockUpdate(blockpos, iblockstate, iblockstate, 3);
    }
}
 
开发者ID:NSExceptional,项目名称:Zombe-Modpack,代码行数:37,代码来源:NetHandlerPlayServer.java


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