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