本文整理汇总了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);
}
}
示例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);
}
示例3: getTileEntity
import net.minecraft.tileentity.TileEntity; //导入方法依赖的package包/类
public TileEntity getTileEntity()
{
if (getNbt() != null)
return TileEntity.create(getWorld(), getNbt());
else return null;
}
示例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"));
}
}
}
}
示例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);
}