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


Java TileEntitySign.isEditable方法代碼示例

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


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

示例1: handleUpdateSign

import net.minecraft.tileentity.TileEntitySign; //導入方法依賴的package包/類
/**
 * Updates Client side signs
 */
public void handleUpdateSign(Packet130UpdateSign par1Packet130UpdateSign)
{
    boolean flag = false;

    if (this.mc.theWorld.blockExists(par1Packet130UpdateSign.xPosition, par1Packet130UpdateSign.yPosition, par1Packet130UpdateSign.zPosition))
    {
        TileEntity tileentity = this.mc.theWorld.getBlockTileEntity(par1Packet130UpdateSign.xPosition, par1Packet130UpdateSign.yPosition, par1Packet130UpdateSign.zPosition);

        if (tileentity instanceof TileEntitySign)
        {
            TileEntitySign tileentitysign = (TileEntitySign)tileentity;

            if (tileentitysign.isEditable())
            {
                for (int i = 0; i < 4; ++i)
                {
                    tileentitysign.signText[i] = par1Packet130UpdateSign.signLines[i];
                }

                tileentitysign.onInventoryChanged();
            }

            flag = true;
        }
    }

    if (!flag && this.mc.thePlayer != null)
    {
        this.mc.thePlayer.sendChatToPlayer(ChatMessageComponent.createFromText("Unable to locate sign at " + par1Packet130UpdateSign.xPosition + ", " + par1Packet130UpdateSign.yPosition + ", " + par1Packet130UpdateSign.zPosition));
    }
}
 
開發者ID:HATB0T,項目名稱:RuneCraftery,代碼行數:35,代碼來源:NetClientHandler.java

示例2: handleUpdateSign

import net.minecraft.tileentity.TileEntitySign; //導入方法依賴的package包/類
/**
 * Updates Client side signs
 */
public void handleUpdateSign(Packet130UpdateSign par1Packet130UpdateSign)
{
    this.playerEntity.func_143004_u();
    WorldServer worldserver = this.mcServer.worldServerForDimension(this.playerEntity.dimension);

    if (worldserver.blockExists(par1Packet130UpdateSign.xPosition, par1Packet130UpdateSign.yPosition, par1Packet130UpdateSign.zPosition))
    {
        TileEntity tileentity = worldserver.getBlockTileEntity(par1Packet130UpdateSign.xPosition, par1Packet130UpdateSign.yPosition, par1Packet130UpdateSign.zPosition);

        if (tileentity instanceof TileEntitySign)
        {
            TileEntitySign tileentitysign = (TileEntitySign)tileentity;

            if (!tileentitysign.isEditable() || tileentitysign.func_142009_b() != this.playerEntity)
            {
                this.mcServer.logWarning("Player " + this.playerEntity.getCommandSenderName() + " just tried to change non-editable sign");
                return;
            }
        }

        int i;
        int j;

        for (j = 0; j < 4; ++j)
        {
            boolean flag = true;

            if (par1Packet130UpdateSign.signLines[j].length() > 15)
            {
                flag = false;
            }
            else
            {
                for (i = 0; i < par1Packet130UpdateSign.signLines[j].length(); ++i)
                {
                    if (ChatAllowedCharacters.allowedCharacters.indexOf(par1Packet130UpdateSign.signLines[j].charAt(i)) < 0)
                    {
                        flag = false;
                    }
                }
            }

            if (!flag)
            {
                par1Packet130UpdateSign.signLines[j] = "!?";
            }
        }

        if (tileentity instanceof TileEntitySign)
        {
            j = par1Packet130UpdateSign.xPosition;
            int k = par1Packet130UpdateSign.yPosition;
            i = par1Packet130UpdateSign.zPosition;
            TileEntitySign tileentitysign1 = (TileEntitySign)tileentity;
            System.arraycopy(par1Packet130UpdateSign.signLines, 0, tileentitysign1.signText, 0, 4);
            tileentitysign1.onInventoryChanged();
            worldserver.markBlockForUpdate(j, k, i);
        }
    }
}
 
開發者ID:HATB0T,項目名稱:RuneCraftery,代碼行數:64,代碼來源:NetServerHandler.java


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