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


Java TileEntity.create方法代碼示例

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


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

示例1: setTileTag

import net.minecraft.tileentity.TileEntity; //導入方法依賴的package包/類
/**
 * Set tile entity as NBT tag
 * @param pos Block position over tile entity
 * @param tile Tile entity NBT tag
 */
public void setTileTag(UBlockPos pos, NBTTagCompound tile) {
    if (tile == null) {
        return;
    }
    removeTileEntity(pos);
    NBTTagCompound tag = tile.copy();
    tag.setInteger("x", pos.getX());
    tag.setInteger("y", pos.getY());
    tag.setInteger("z", pos.getZ());
    try {
        TileEntity entity = TileEntity.create(world, tag);
        setTileEntity(pos, entity);
    } catch (Throwable throwable) {
        Tiles.load(getTileEntity(pos), tile, 0);
    }
}
 
開發者ID:ternsip,項目名稱:StructPro,代碼行數:22,代碼來源:UWorld.java

示例2: placeDownBlock

import net.minecraft.tileentity.TileEntity; //導入方法依賴的package包/類
public void placeDownBlock(BlockPos pos) {
    // @todo what if this fails?
    IBlockState state = getHeldBlockState();
    if (state == null) {
        return;
    }
    if (state.getBlock() == ModBlocks.heldCubeBlock) {
        return;
    }

    world.setBlockState(pos, state, 3);
    NBTTagCompound tc = getCarriedNBT();
    if (tc != null) {
        tc.setInteger("x", pos.getX());
        tc.setInteger("y", pos.getY());
        tc.setInteger("z", pos.getZ());
        TileEntity tileEntity = TileEntity.create(world, tc);
        if (tileEntity != null) {
            world.getChunkFromBlockCoords(pos).addTileEntity(tileEntity);
            tileEntity.markDirty();
            world.notifyBlockUpdate(pos, state, state, 3);
        }
    }

    carriedNBT = null;
    setHeldBlockState(null);
}
 
開發者ID:McJty,項目名稱:MeeCreeps,代碼行數:28,代碼來源:EntityMeeCreeps.java

示例3: getTileEntity

import net.minecraft.tileentity.TileEntity; //導入方法依賴的package包/類
public TileEntity getTileEntity()
{
    if (getNbt() != null)
        return TileEntity.create(getWorld(), getNbt());
    else return null;
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:7,代碼來源:BlockSnapshot.java

示例4: loadEntities

import net.minecraft.tileentity.TileEntity; //導入方法依賴的package包/類
public void loadEntities(World worldIn, NBTTagCompound compound, Chunk chunk)
{
    NBTTagList nbttaglist1 = compound.getTagList("Entities", 10);

    if (nbttaglist1 != null)
    {
        for (int j1 = 0; j1 < nbttaglist1.tagCount(); ++j1)
        {
            NBTTagCompound nbttagcompound1 = nbttaglist1.getCompoundTagAt(j1);
            readChunkEntity(nbttagcompound1, worldIn, chunk);
            chunk.setHasEntities(true);
        }
    }

    NBTTagList nbttaglist2 = compound.getTagList("TileEntities", 10);

    if (nbttaglist2 != null)
    {
        for (int k1 = 0; k1 < nbttaglist2.tagCount(); ++k1)
        {
            NBTTagCompound nbttagcompound2 = nbttaglist2.getCompoundTagAt(k1);
            TileEntity tileentity = TileEntity.create(worldIn, nbttagcompound2);

            if (tileentity != null)
            {
                chunk.addTileEntity(tileentity);
            }
        }
    }

    if (compound.hasKey("TileTicks", 9))
    {
        NBTTagList nbttaglist3 = compound.getTagList("TileTicks", 10);

        if (nbttaglist3 != null)
        {
            for (int l1 = 0; l1 < nbttaglist3.tagCount(); ++l1)
            {
                NBTTagCompound nbttagcompound3 = nbttaglist3.getCompoundTagAt(l1);
                Block block;

                if (nbttagcompound3.hasKey("i", 8))
                {
                    block = Block.getBlockFromName(nbttagcompound3.getString("i"));
                }
                else
                {
                    block = Block.getBlockById(nbttagcompound3.getInteger("i"));
                }

                worldIn.scheduleBlockUpdate(new BlockPos(nbttagcompound3.getInteger("x"), nbttagcompound3.getInteger("y"), nbttagcompound3.getInteger("z")), block, nbttagcompound3.getInteger("t"), nbttagcompound3.getInteger("p"));
            }
        }
    }
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:56,代碼來源:AnvilChunkLoader.java

示例5: test

import net.minecraft.tileentity.TileEntity; //導入方法依賴的package包/類
public void test() {

		Template.BlockInfo template$blockinfo1 = null;
		BlockPos blockpos = null;
		World world = null;

		TileEntity tileEntity2 = TileEntity.create(world, template$blockinfo1.tileentityData);

		world.setTileEntity(blockpos, tileEntity2);
	}
 
開發者ID:modmuss50,項目名稱:StructureUtils,代碼行數:11,代碼來源:StructureTransformer.java


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