本文整理了Java中net.minecraft.block.Block.createTileEntity()
方法的一些代码示例,展示了Block.createTileEntity()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Block.createTileEntity()
方法的具体详情如下:
包路径:net.minecraft.block.Block
类名称:Block
方法名:createTileEntity
暂无
代码示例来源:origin: amadornes/MCMultiPart
public default IMultipartTile createMultipartTile(World world, IPartSlot slot, IBlockState state) {
TileEntity tileEntity = state.getBlock().createTileEntity(world, state);
return tileEntity != null ? convertToMultipartTile(tileEntity) : null;
}
代码示例来源:origin: SleepyTrousers/EnderIO
@SuppressWarnings("null")
private TileEntity createTileEntity(IBlockState state, @Nonnull BlockPos pos) {
Block block = state.getBlock();
if (!block.hasTileEntity(state) || teBlackList.containsKey(block)) {
return null;
}
if (teCache.containsKey(block)) {
try {
TileEntity tileEntity = teCache.get(block);
tileEntity.setPos(pos);
return tileEntity;
} catch (Throwable t) {
teCache.remove(block);
}
}
try {
TileEntity tileEntity = block.createTileEntity(null, state);
tileEntity.setPos(pos);
teCache.put(block, tileEntity);
return tileEntity;
} catch (Throwable t) {
teBlackList.put(block, true);
}
return null;
}
代码示例来源:origin: Vazkii/Patchouli
@Override
@Nullable
public TileEntity getTileEntity(BlockPos pos) {
IBlockState state = getBlockState(pos);
if (state.getBlock().hasTileEntity(state)) {
return teCache.computeIfAbsent(pos.toImmutable(), p -> state.getBlock().createTileEntity(world, state));
}
return null;
}
代码示例来源:origin: Vazkii/Botania
TileEntity newTile = block.createTileEntity(world, state);
world.setTileEntity(pos_, newTile);
代码示例来源:origin: WayofTime/BloodMagic
IBlockState state = replacementState;
if (block.hasTileEntity(state)) {
TileEntity tile = block.createTileEntity(world, state);
代码示例来源:origin: thraaawn/CompactMachines
@Nullable
@Override
public TileEntity getTileEntity(BlockPos pos) {
IBlockState state = getBlockState(pos);
if(state.getBlock().hasTileEntity(state)) {
TileEntity tileentity = state.getBlock().createTileEntity(proxyWorld, state);
tileentity.setWorld(proxyWorld);
if (tileentity != null) {
NBTTagCompound nbt = getVariantAtBlockPos(pos);
if(nbt != null) {
tileentity.readFromNBT(nbt);
for (AbstractExtraTileDataProvider provider : ExtraTileDataProviderRegistry.getDataProviders(tileentity)) {
String tagName = String.format("cm3_extra:%s", provider.getName());
if (nbt.hasKey(tagName)) {
provider.readExtraData(tileentity, (NBTTagCompound) nbt.getTag(tagName));
}
}
}
}
return tileentity;
}
return null;
}
代码示例来源:origin: AppliedEnergistics/Applied-Energistics-2
final TileEntity nte = blk.createTileEntity( world, state );
final NBTTagCompound data = new NBTTagCompound();
ote.writeToNBT( data );
代码示例来源:origin: thraaawn/CompactMachines
TileEntity restoredTe = machineWorld.getTileEntity(absolutePos);
if (restoredTe == null) {
restoredTe = bi.block.createTileEntity(machineWorld, state);
内容来源于网络,如有侵权,请联系作者删除!