當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。