当前位置: 首页>>代码示例>>Java>>正文


Java ITileEntityProvider类代码示例

本文整理汇总了Java中net.minecraft.block.ITileEntityProvider的典型用法代码示例。如果您正苦于以下问题:Java ITileEntityProvider类的具体用法?Java ITileEntityProvider怎么用?Java ITileEntityProvider使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ITileEntityProvider类属于net.minecraft.block包,在下文中一共展示了ITileEntityProvider类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: registerBlock

import net.minecraft.block.ITileEntityProvider; //导入依赖的package包/类
/**
 * Registers the given block.
 * Also adds the respective TileEntity if the block has one.
 * 
 * @param registerItemBlock - {@code true} to also register the block as item.
 */
private static void registerBlock(Block block, boolean registerItemBlock) {//TODO REGISTRY - Register block names with "oft." -prefix to avoid name clash between mods.

	/* Determine block's unlocalised name. */
	String name = block.getClass().getSimpleName().toLowerCase().substring(5);

	/* Register block (and its TileEntity, if existent). */
	if (block.getRegistryName() == null) {
		GameRegistry.register(block.setRegistryName(name).setUnlocalizedName(name));

		if(block instanceof ITileEntityProvider){
			Class<? extends TileEntity> tileEntityClass = ((ITileEntityProvider) block).createNewTileEntity(null, 0).getClass();
			GameRegistry.registerTileEntity(tileEntityClass, tileEntityClass.getSimpleName());
		}
	}

	/* Register block's item if required. */
	if (registerItemBlock && Item.getItemFromBlock(block) == null) {
		GameRegistry.register(new ItemBlock(block).setRegistryName(name));
	}
}
 
开发者ID:DonBruce64,项目名称:OpenFlexiTrack,代码行数:27,代码来源:OFTRegistry.java

示例2: addTileEntity

import net.minecraft.block.ITileEntityProvider; //导入依赖的package包/类
public void addTileEntity(BlockPos pos, TileEntity tileEntityIn)
{
    tileEntityIn.setWorldObj(this.worldObj);
    tileEntityIn.setPos(pos);

    if (this.getBlock(pos) instanceof ITileEntityProvider)
    {
        if (this.chunkTileEntityMap.containsKey(pos))
        {
            ((TileEntity)this.chunkTileEntityMap.get(pos)).invalidate();
        }

        tileEntityIn.validate();
        this.chunkTileEntityMap.put(pos, tileEntityIn);
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:17,代码来源:Chunk.java

示例3: addTileEntity

import net.minecraft.block.ITileEntityProvider; //导入依赖的package包/类
public void addTileEntity(BlockPos pos, TileEntity tileEntityIn)
{
    tileEntityIn.setWorldObj(this.worldObj);
    tileEntityIn.setPos(pos);

    if (this.getBlockState(pos).getBlock() instanceof ITileEntityProvider)
    {
        if (this.chunkTileEntityMap.containsKey(pos))
        {
            ((TileEntity)this.chunkTileEntityMap.get(pos)).invalidate();
        }

        tileEntityIn.validate();
        this.chunkTileEntityMap.put(pos, tileEntityIn);
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:17,代码来源:Chunk.java

示例4: getTileEntityMap

import net.minecraft.block.ITileEntityProvider; //导入依赖的package包/类
public Map<BlockPos, TileEntity> getTileEntityMap(World world) {
    Map<BlockPos, TileEntity> map = new HashMap<>();
    for(BlockPosition position : blocks) {
        Block block = position.getBlock();
        if(block == null) {
            continue;
        }
        if(block instanceof ITileEntityProvider) {
            TileEntity tile = ((ITileEntityProvider) block).createNewTileEntity(world, position.worldMeta);
            NBTTagCompound tag = position.getTag();
            if(tag == null) {
                tag = new NBTTagCompound();
            }
            tag.setInteger("x", position.x);
            tag.setInteger("y", position.y);
            tag.setInteger("z", position.z);
            tile.readFromNBT(tag);
            map.put(position.getBlockPos(), tile);
        }
    }
    return map;
}
 
开发者ID:InfinityRaider,项目名称:SettlerCraft,代码行数:23,代码来源:Schematic.java

示例5: fromSchematicData

import net.minecraft.block.ITileEntityProvider; //导入依赖的package包/类
public static StructureBuildPosition fromSchematicData(World world, BlockPos origin, int rotation, Schematic.BlockPosition schematicData) {
    BlockPos pos = SchematicRotationTransformer.getInstance().applyRotation(origin, schematicData.x, schematicData.y, schematicData.z, rotation);
    IBlockState state = schematicData.getBlockState(rotation);
    ItemStack resource = schematicData.getResourceStack();
    boolean fuzzy = schematicData.fuzzy;
    NBTTagCompound tag = schematicData.getTag();
    if(tag != null && (state.getBlock() instanceof ITileEntityProvider)) {
        tag.setInteger("x", pos.getX());
        tag.setInteger("y", pos.getY());
        tag.setInteger("z", pos.getZ());
        TileEntity tile = ((ITileEntityProvider) state.getBlock()).createNewTileEntity(world, schematicData.worldMeta);
        SchematicRotationTransformer.getInstance().rotateTileTag(tile, tag, rotation);
        return new StructureBuildPositionTileEntity(world, pos, state, resource, fuzzy, tag);
    } else {
        return new StructureBuildPosition(world, pos, state, resource, fuzzy);
    }

}
 
开发者ID:InfinityRaider,项目名称:SettlerCraft,代码行数:19,代码来源:StructureBuildPosition.java

示例6: findAllAbsorbersWithinRange

import net.minecraft.block.ITileEntityProvider; //导入依赖的package包/类
/**
 * A helper method for finding all {@link IAuraAbsorber} around a point
 * @param world The world of the point
 * @param x The x coord of the point
 * @param y The y coord of the point
 * @param z The z coord of the point
 * @param range The range
 * @return All the {@link IAuraAbsorber}s around the point
 */
public static List<AuraLocation<IAuraAbsorber>> findAllAbsorbersWithinRange(World world, int x, int y, int z, int range) {
	ArrayList<AuraLocation<IAuraAbsorber>> list = new ArrayList<AuraLocation<IAuraAbsorber>>();
	for (int i = 0-range; i < range+1; i++)
		for (int j = 0-range; j < range+1; j++)
			for (int k = 0-range; k < range+1; k++) {
				if (world.blockExists(x+i, y+j, z+k))
					if (!world.isAirBlock(x+i, y+j, z+k))
						if (world.getBlock(x, y, z) instanceof IAuraAbsorber) {
							list.add(new AuraLocation<IAuraAbsorber>((IAuraAbsorber) world.getBlock(x, y, z), world, x, y, z));
						} else if (world.getBlock(x, y, z) instanceof ITileEntityProvider) {
							if (world.getTileEntity(x, y, z) instanceof IAuraAbsorber)
								list.add(new AuraLocation<IAuraAbsorber>((IAuraAbsorber) world.getTileEntity(x, y, z), world, x, y, z));
						}
			}
	return list;
}
 
开发者ID:austinv11,项目名称:DartCraft2,代码行数:26,代码来源:DartCraft2API.java

示例7: findAllEmittersWithinRange

import net.minecraft.block.ITileEntityProvider; //导入依赖的package包/类
/**
 * A helper method for finding all {@link IAuraEmitter} around a point
 * @param world The world of the point
 * @param x The x coord of the point
 * @param y The y coord of the point
 * @param z The z coord of the point
 * @param range The range
 * @return All the {@link IAuraEmitter}s around the point
 */
public static List<AuraLocation<IAuraEmitter>> findAllEmittersWithinRange(World world, int x, int y, int z, int range) {
	ArrayList<AuraLocation<IAuraEmitter>> list = new ArrayList<AuraLocation<IAuraEmitter>>();
	for (int i = 0-range; i < range+1; i++)
		for (int j = 0-range; j < range+1; j++)
			for (int k = 0-range; k < range+1; k++) {
				if (world.blockExists(x+i, y+j, z+k))
					if (!world.isAirBlock(x+i, y+j, z+k))
						if (world.getBlock(x, y, z) instanceof IAuraEmitter) {
							list.add(new AuraLocation<IAuraEmitter>((IAuraEmitter) world.getBlock(x, y, z), world, x, y, z));
						} else if (world.getBlock(x, y, z) instanceof ITileEntityProvider) {
							if (world.getTileEntity(x, y, z) instanceof IAuraEmitter)
								list.add(new AuraLocation<IAuraEmitter>((IAuraEmitter) world.getTileEntity(x, y, z), world, x, y, z));
						}
			}
	return list;
}
 
开发者ID:austinv11,项目名称:DartCraft2,代码行数:26,代码来源:DartCraft2API.java

示例8: findAllPassiveEmittersWithinRange

import net.minecraft.block.ITileEntityProvider; //导入依赖的package包/类
/**
 * A helper method for finding all {@link IPassiveAuraEmitter} around a point
 * @param world The world of the point
 * @param x The x coord of the point
 * @param y The y coord of the point
 * @param z The z coord of the point
 * @param range The range
 * @return All the {@link IPassiveAuraEmitter}s around the point
 */
public static List<AuraLocation<IPassiveAuraEmitter>> findAllPassiveEmittersWithinRange(World world, int x, int y, int z, int range) {
	ArrayList<AuraLocation<IPassiveAuraEmitter>> list = new ArrayList<AuraLocation<IPassiveAuraEmitter>>();
	for (int i = 0-range; i < range+1; i++)
		for (int j = 0-range; j < range+1; j++)
			for (int k = 0-range; k < range+1; k++) {
				if (world.blockExists(x+i, y+j, z+k))
					if (!world.isAirBlock(x+i, y+j, z+k))
						if (world.getBlock(x, y, z) instanceof IPassiveAuraEmitter) {
							list.add(new AuraLocation<IPassiveAuraEmitter>((IPassiveAuraEmitter) world.getBlock(x, y, z), world, x, y, z));
						} else if (world.getBlock(x, y, z) instanceof ITileEntityProvider) {
							if (world.getTileEntity(x, y, z) instanceof IPassiveAuraEmitter)
								list.add(new AuraLocation<IPassiveAuraEmitter>((IPassiveAuraEmitter) world.getTileEntity(x, y, z), world, x, y, z));
						}
			}
	return list;
}
 
开发者ID:austinv11,项目名称:DartCraft2,代码行数:26,代码来源:DartCraft2API.java

示例9: func_150812_a

import net.minecraft.block.ITileEntityProvider; //导入依赖的package包/类
public void func_150812_a(int p_150812_1_, int p_150812_2_, int p_150812_3_, TileEntity p_150812_4_)
{
    ChunkPosition var5 = new ChunkPosition(p_150812_1_, p_150812_2_, p_150812_3_);
    p_150812_4_.setWorldObj(this.worldObj);
    p_150812_4_.field_145851_c = this.xPosition * 16 + p_150812_1_;
    p_150812_4_.field_145848_d = p_150812_2_;
    p_150812_4_.field_145849_e = this.zPosition * 16 + p_150812_3_;

    if (this.func_150810_a(p_150812_1_, p_150812_2_, p_150812_3_) instanceof ITileEntityProvider)
    {
        if (this.chunkTileEntityMap.containsKey(var5))
        {
            ((TileEntity)this.chunkTileEntityMap.get(var5)).invalidate();
        }

        p_150812_4_.validate();
        this.chunkTileEntityMap.put(var5, p_150812_4_);
    }
}
 
开发者ID:MinecraftModdedClients,项目名称:Resilience-Client-Source,代码行数:20,代码来源:Chunk.java

示例10: readMovementInfo

import net.minecraft.block.ITileEntityProvider; //导入依赖的package包/类
@Override
public void readMovementInfo(IMovingBlock block, NBTTagCompound tag) {

    block.setBlock(GameData.getBlockRegistry().getObject(tag.getString("block")));
    block.setMetadata(tag.getInteger("metadata"));
    TileEntity te = block.getTileEntity();

    if (tag.hasKey("data") && (te != null || block.getBlock() instanceof ITileEntityProvider)) {
        if (te == null) {
            te = ((ITileEntityProvider) block.getBlock()).createNewTileEntity(FakeWorld.getFakeWorld((MovingBlock) block),
                    block.getMetadata());
            System.out.println("creating!");
        }
        if (te != null) {
            te.readFromNBT(tag.getCompoundTag("data"));
            block.setTileEntity(te);
        }
    }

    ((MovingBlock) block).setRenderList(-1);
}
 
开发者ID:amadornes,项目名称:Framez,代码行数:22,代码来源:MovementDataProviderDefault.java

示例11: EntityBlock

import net.minecraft.block.ITileEntityProvider; //导入依赖的package包/类
public EntityBlock(World world, int i, int j, int k)
{
    this(world);

    setBlock(world.getBlock(i, j, k));
    setMeta(world.getBlockMetadata(i, j, k));

    TileEntity te = world.getTileEntity(i, j, k);
    if(te != null && block instanceof ITileEntityProvider)
    {
        world.setTileEntity(i, j, k, ((ITileEntityProvider)block).createNewTileEntity(world, getMeta()));

        tileEntityNBT = new NBTTagCompound();
        te.writeToNBT(tileEntityNBT);

        te.invalidate();
    }

    world.setBlockToAir(i, j, k);

    setLocationAndAngles(i + 0.5D, j + 0.5D - (double)yOffset, k + 0.5D, 0F, 0F);
}
 
开发者ID:iChun,项目名称:ItFellFromTheSky,代码行数:23,代码来源:EntityBlock.java

示例12: catagorize

import net.minecraft.block.ITileEntityProvider; //导入依赖的package包/类
private static String catagorize(ItemStack i) {
	StringBuilder sb = new StringBuilder();
	Item item = i.getItem();
	sb.append(GameData.getItemRegistry().getNameForObject(item).getResourceDomain());
	if(item instanceof ItemBlock){
		if(((ItemBlock)item).getBlock() instanceof ITileEntityProvider){
			sb.append("A");
		} else {
			sb.append("B");
		}
	} else {
		sb.append("I");
	}
	sb.append(item.getUnlocalizedName());
	sb.append(i.getMetadata());
	
	return sb.toString();
}
 
开发者ID:cyanobacterium,项目名称:PowerAdvantageAPI,代码行数:19,代码来源:ItemGroups.java

示例13: areConnectable

import net.minecraft.block.ITileEntityProvider; //导入依赖的package包/类
/**
 * Checks if a connection is valid by looking at the two blocks and asking each if they will connect to the other.
 * @param connection The connection to check
 * @return True if the two blocks cen send power to (or through) eachother, false otherwise
 */
public static boolean areConnectable(PowerConnectorContext connection) {
	if(connection.thisBlock.getBlock() instanceof ITypedConduit){
		if(connection.otherBlock.getBlock() instanceof ITypedConduit){
			// both blocks are Power Advantage conductors
			return ((ITypedConduit)connection.thisBlock.getBlock()).canAcceptConnection(connection)
					&& ((ITypedConduit)connection.otherBlock.getBlock()).canAcceptConnection(connection.reverse());
		} else if(connection.otherBlock.getBlock() instanceof ITileEntityProvider){
			if(PowerAdvantage.detectedRF
				&& PowerAdvantage.rfConversionTable.containsKey(connection.powerType)) {
				// RF cross-mod compatibility
				return connection.world.getTileEntity(connection.otherBlockPosition) instanceof IEnergyReceiver;
			}
			if(PowerAdvantage.detectedTechReborn
					&& PowerAdvantage.trConversionTable.containsKey(connection.powerType)) {
				// TR cross-mod compatibility
				return connection.world.getTileEntity(connection.otherBlockPosition) instanceof IEnergyInterfaceTile;
			}
		}
	}
	return false;
}
 
开发者ID:cyanobacterium,项目名称:PowerAdvantageAPI,代码行数:27,代码来源:PowerHelper.java

示例14: renderInventoryBlock

import net.minecraft.block.ITileEntityProvider; //导入依赖的package包/类
@Override
public void renderInventoryBlock(Block block, int metadata, int modelId, RenderBlocks renderer) {
    if (block instanceof ITileEntityProvider) {
        ITileEntityProvider prov = (ITileEntityProvider) block;
        te = prov.createNewTileEntity(null, metadata);
        te.blockMetadata = metadata;
    } else return;

    if (block instanceof IBlockRenderHook) {
        IBlockRenderHook hook = (IBlockRenderHook) block;
        hook.callbackInventory(te);
    }

    glRotatef(90F, 0F, 1F, 0F);
    glTranslatef(-0.5F, -0.5F, -0.5F);
    float scale = 1F;
    glScalef(scale, scale, scale);

    glAlphaFunc(GL_GREATER, 0.1F);
    TileEntityRendererDispatcher.instance.renderTileEntityAt(te, 0.0D, 0.0D, 0.0D, 0.0F);
}
 
开发者ID:MSourceCoded,项目名称:Quantum-Anomalies,代码行数:22,代码来源:SimpleTileProxy.java

示例15: renderInventoryBlock

import net.minecraft.block.ITileEntityProvider; //导入依赖的package包/类
@Override
public void renderInventoryBlock(Block block, int metadata, int modelId, RenderBlocks renderBlocks) {
    if (block instanceof ITileEntityProvider) {
        ITileEntityProvider prov = (ITileEntityProvider) block;
        te = prov.createNewTileEntity(null, metadata);
        te.blockMetadata = metadata;
    } else return;

    if (block instanceof IBlockRenderHook) {
        IBlockRenderHook hook = (IBlockRenderHook) block;
        hook.callbackInventory(te);
    }

    glRotatef(90F, 0F, 1F, 0F);
    glTranslatef(-0.5F, -0.5F, -0.5F);
    float scale = 1F;
    glScalef(scale, scale, scale);

    glAlphaFunc(GL_GREATER, 0.1F);
    TESRStaticHandler renderer = (TESRStaticHandler) TileEntityRendererDispatcher.instance.mapSpecialRenderers.get(te.getClass());
    renderer.renderTile(te, 0.0, 0.0, 0.0, 0, true, renderBlocks);

    renderer.renderTile(te, 0.0, 0.0, 0.0, 0, false, renderBlocks);
}
 
开发者ID:MSourceCoded,项目名称:Quantum-Anomalies,代码行数:25,代码来源:AdvancedTileProxy.java


注:本文中的net.minecraft.block.ITileEntityProvider类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。