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


Java BlockContainer类代码示例

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


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

示例1: shouldEat

import net.minecraft.block.BlockContainer; //导入依赖的package包/类
private boolean shouldEat()
{	
	if(!Wrapper.getPlayer().canEat(false))
		return false;
	
	if(Wrapper.getMinecraft().currentScreen != null)
		return false;
	
	if(Wrapper.getMinecraft().currentScreen == null && Wrapper.getMinecraft().objectMouseOver != null)
	{
		Entity entity = Wrapper.getMinecraft().objectMouseOver.entityHit;
		if(entity instanceof EntityVillager || entity instanceof EntityTameable)
			return false;
		
		if(Wrapper.getMinecraft().objectMouseOver.getBlockPos() != null && Wrapper.getWorld().
				getBlockState(Wrapper.getMinecraft().objectMouseOver.getBlockPos()).getBlock() instanceof BlockContainer)
			return false;
	}
	
	return true;
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:22,代码来源:AutoEat.java

示例2: onItemUse

import net.minecraft.block.BlockContainer; //导入依赖的package包/类
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int i, int j, int k, int side, float f, float f1, float f2)
{
  if (player.isSneaking()) {
    return false;
  }
  if (!world.isRemote)
  {
    if (!world.canMineBlock(player, i, j, k)) {
      return false;
    }
    if (!player.canPlayerEdit(i, j, k, side, stack)) {
      return false;
    }
    Block block = world.getBlock(i, j, k);
    if (prohibitedBlocks.contains(block)) {
      return false;
    }
    if ((block instanceof BlockContainer)) {
      return false;
    }
    int data = world.getBlockMetadata(i, j, k);
    world.setBlock(i, j, k, Blocks.air, 0, 3);
    world.spawnEntityInWorld(new EnderBlock(world, player, block, data));
  }
  return true;
}
 
开发者ID:RamiLego4Game,项目名称:GalacticraftPixelGalaxy,代码行数:27,代码来源:PixeltrixEndermanDNAModeItem.java

示例3: buildBlock

import net.minecraft.block.BlockContainer; //导入依赖的package包/类
/**
 * Places the block in the world, at the location specified in the slot.
 */
public void buildBlock(BptSlotInfo slot, IBptContext context) {
	// Meta needs to be specified twice, depending on the block behavior
	context.world().setBlock(slot.x, slot.y, slot.z, slot.blockId, slot.meta,3);
	context.world().setBlockMetadataWithNotify(slot.x, slot.y, slot.z, slot.meta,3);

	if (Block.blocksList[slot.blockId] instanceof BlockContainer) {
		TileEntity tile = context.world().getBlockTileEntity(slot.x, slot.y, slot.z);

		slot.cpt.setInteger("x", slot.x);
		slot.cpt.setInteger("y", slot.y);
		slot.cpt.setInteger("z", slot.z);

		if (tile != null) {
			tile.readFromNBT(slot.cpt);
		}
	}
}
 
开发者ID:austinv11,项目名称:PeripheralsPlusPlus,代码行数:21,代码来源:BptBlock.java

示例4: initializeFromWorld

import net.minecraft.block.BlockContainer; //导入依赖的package包/类
/**
 * Initializes a slot from the blueprint according to an objet placed on {x, y, z} on the world. This typically means adding entries in slot.cpt. Note that
 * "id" and "meta" will be set automatically, corresponding to the block id and meta.
 *
 * By default, if the block is a BlockContainer, tile information will be to save / load the block.
 */
public void initializeFromWorld(BptSlotInfo slot, IBptContext context, int x, int y, int z) {
	if (Block.blocksList[slot.blockId] instanceof BlockContainer) {
		TileEntity tile = context.world().getBlockTileEntity(x, y, z);

		if (tile != null) {
			tile.writeToNBT(slot.cpt);
		}
	}

	if (Block.blocksList[slot.blockId] != null) {
		ArrayList<ItemStack> req = Block.blocksList[slot.blockId].getBlockDropped(context.world(), x, y, z, context.world().getBlockMetadata(x, y, z), 0);

		if (req != null) {
			slot.storedRequirements.addAll(req);
		}
	}
}
 
开发者ID:austinv11,项目名称:PeripheralsPlusPlus,代码行数:24,代码来源:BptBlock.java

示例5: getSignature

import net.minecraft.block.BlockContainer; //导入依赖的package包/类
/**
 * By default, block class name, block tile name and block name are used to define block signature. Overriding this subprogram may allow to replace some of
 * these with stars, specify the mod that this block kind is coming from or add custom data to the signature.
 */
public BlockSignature getSignature(Block block) {
	BlockSignature sig = new BlockSignature();

	if (block.blockID > BuildCraftAPI.LAST_ORIGINAL_BLOCK) {
		sig.blockClassName = block.getClass().getSimpleName();

		if (block instanceof BlockContainer) {
			// TODO: Try to see if we can get a world instance to call with instead of null
			TileEntity tile = ((BlockContainer) block).createNewTileEntity(null);

			if (tile != null) {
				sig.tileClassName = tile.getClass().getSimpleName();
			}
		}
	}

	sig.blockName = block.getUnlocalizedName();
	sig.replaceNullWithStar();

	return sig;
}
 
开发者ID:austinv11,项目名称:PeripheralsPlusPlus,代码行数:26,代码来源:BptBlock.java

示例6: isPlantValidForSlot

import net.minecraft.block.BlockContainer; //导入依赖的package包/类
public boolean isPlantValidForSlot (World world, int x, int y, int z, int slot, PlantItem plant) {
    if (plant == null)
        return false;

    if (plant.getPlantBlock() instanceof BlockContainer)
        return false;

    if (!slotProfile.isPlantValidForSlot(world, x, y, z, slot, plant))
        return false;

    if (!enoughSpaceAround(world, x, y, z, slot, plant))
        return false;

    if (!isPlantValidForSubstrate(getGardenSubstrate(world, x, y, z, slot), plant))
        return false;

    if (canSustainPlantIndependently(world, x, y, z, plant))
        return false;

    return true;
}
 
开发者ID:jaquadro,项目名称:GardenCollection,代码行数:22,代码来源:BlockGarden.java

示例7: shouldEat

import net.minecraft.block.BlockContainer; //导入依赖的package包/类
private boolean shouldEat()
{
	// check hunger
	if(!WMinecraft.getPlayer().canEat(false))
		return false;
	
	// check screen
	if(!ignoreScreen.isChecked() && mc.currentScreen != null)
		return false;
	
	// check for clickable objects
	if(mc.currentScreen == null && mc.objectMouseOver != null)
	{
		// clickable entities
		Entity entity = mc.objectMouseOver.entityHit;
		if(entity instanceof EntityVillager
			|| entity instanceof EntityTameable)
			return false;
		
		// clickable blocks
		BlockPos pos = mc.objectMouseOver.getBlockPos();
		if(pos != null)
		{
			Block block =
				WMinecraft.getWorld().getBlockState(pos).getBlock();
			if(block instanceof BlockContainer
				|| block instanceof BlockWorkbench)
				return false;
		}
	}
	
	return true;
}
 
开发者ID:Wurst-Imperium,项目名称:Wurst-MC-1.12,代码行数:34,代码来源:AutoEatMod.java

示例8: shouldEatSoup

import net.minecraft.block.BlockContainer; //导入依赖的package包/类
private boolean shouldEatSoup()
{
	// check health
	if(WMinecraft.getPlayer().getHealth() > health.getValueF() * 2F)
		return false;
	
	// check screen
	if(!ignoreScreen.isChecked() && mc.currentScreen != null)
		return false;
	
	// check for clickable objects
	if(mc.currentScreen == null && mc.objectMouseOver != null)
	{
		// clickable entities
		Entity entity = mc.objectMouseOver.entityHit;
		if(entity instanceof EntityVillager
			|| entity instanceof EntityTameable)
			return false;
		
		// clickable blocks
		if(mc.objectMouseOver.getBlockPos() != null && WBlock.getBlock(
			mc.objectMouseOver.getBlockPos()) instanceof BlockContainer)
			return false;
	}
	
	return true;
}
 
开发者ID:Wurst-Imperium,项目名称:Wurst-MC-1.12,代码行数:28,代码来源:AutoSoupMod.java

示例9: initClient

import net.minecraft.block.BlockContainer; //导入依赖的package包/类
@Mod.EventHandler
@SideOnly(Side.CLIENT)
public void initClient(FMLPreInitializationEvent event) {
    for (Block b : chest_blocks) {
        BlockContainer chest = (BlockContainer) b;
        TileEntity te = chest.createNewTileEntity(null, 0);
        if (te == null) continue;
        TileEntityRendererDispatcher.instance.mapSpecialRenderers.remove(te.getClass());
    }
    // TODO: Needs a custom item renderer. Whatever. 1.8'll be here eventually.
}
 
开发者ID:purpleposeidon,项目名称:CyclopeanChests,代码行数:12,代码来源:YeOldeChesttes.java

示例10: register3DItem

import net.minecraft.block.BlockContainer; //导入依赖的package包/类
public void register3DItem(BlockContainer theBlock, TileEntitySpecialRenderer renderer) {
	try {
		MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(theBlock),
				new GenericBlockItemRenderer(renderer, theBlock.createNewTileEntity(null, 0)));
	} catch (Exception e) {
		e.printStackTrace();
	}
}
 
开发者ID:ItsAMysterious,项目名称:Real-Life-Mod-1.8,代码行数:9,代码来源:ClientProxy.java

示例11: updateWorldInfo

import net.minecraft.block.BlockContainer; //导入依赖的package包/类
@Override
public void updateWorldInfo(World worldIn, BlockPos pos)
{
	adjAirCount = 0;
	List<HeatManager> adjacentManagers = new ArrayList<HeatManager>();
	
	// For each adjacent block
	for (EnumFacing f : EnumFacing.VALUES) {
		BlockPos adjPos = pos.offset(f);
		Block block = worldIn.getBlockState(adjPos).getBlock();
		
		if (block.isAir(worldIn, adjPos))
		{
			// The block is an air block, will lose heat.
			if (ventSides.contains(f)) {
				adjAirCount += ventEfficiency;
			}
			else {
				adjAirCount ++;
			}
		}
		else if (block instanceof BlockContainer)
		{
			TileEntity te = worldIn.getTileEntity(adjPos);
			if (te instanceof ITileEntityHeated) {
				// This adjacent machine can exchange heat
				adjacentManagers.add(((ITileEntityHeated) te).getHeatManager());
			}
		}
	}
	
	adjManagers = adjacentManagers.toArray(new HeatManager[adjacentManagers.size()]);
}
 
开发者ID:JasonYe4273,项目名称:Minecraft-Modding,代码行数:34,代码来源:HeatVentManager.java

示例12: getOutputInventory

import net.minecraft.block.BlockContainer; //导入依赖的package包/类
private IInventory getOutputInventory() throws LuaException {
    ForgeDirection outDir = playerInterface.outputSide;
    if (outDir == null) {
        throw new LuaException("Output Side has not yet been set.");
    }
    Location blockLoc = new Location(playerInterface.xCoord + outDir.offsetX, playerInterface.yCoord + outDir.offsetY, playerInterface.zCoord + outDir.offsetZ, playerInterface.getWorldObj());
    Block block = playerInterface.getWorldObj().getBlock(blockLoc.getRoundedX(), blockLoc.getRoundedY(), blockLoc.getRoundedZ());
    if (block instanceof BlockContainer) {
        return (IInventory) playerInterface.getWorldObj().getTileEntity(blockLoc.getRoundedX(), blockLoc.getRoundedY(), blockLoc.getRoundedZ());
    } else {
        throw new LuaException("Invalid Output Inventory.");
    }
}
 
开发者ID:austinv11,项目名称:PeripheralsPlusPlus,代码行数:14,代码来源:LuaObjectPlayerInv.java

示例13: getInputInventory

import net.minecraft.block.BlockContainer; //导入依赖的package包/类
private IInventory getInputInventory() throws LuaException {
    ForgeDirection inDir = playerInterface.inputSide;
    if (inDir == null) {
        throw new LuaException("Input Side has not yet been set.");
    }
    Location blockLoc = new Location(playerInterface.xCoord + inDir.offsetX, playerInterface.yCoord + inDir.offsetY, playerInterface.zCoord + inDir.offsetZ, playerInterface.getWorldObj());
    Block block = playerInterface.getWorldObj().getBlock(blockLoc.getRoundedX(), blockLoc.getRoundedY(), blockLoc.getRoundedZ());
    if (block instanceof BlockContainer) {
        return (IInventory) playerInterface.getWorldObj().getTileEntity(blockLoc.getRoundedX(), blockLoc.getRoundedY(), blockLoc.getRoundedZ());
    } else {
        throw new LuaException("Invalid Input Inventory.");
    }
}
 
开发者ID:austinv11,项目名称:PeripheralsPlusPlus,代码行数:14,代码来源:LuaObjectPlayerInv.java

示例14: isInventoryOnSide

import net.minecraft.block.BlockContainer; //导入依赖的package包/类
private boolean isInventoryOnSide(ForgeDirection dir) {
	if (!worldObj.isAirBlock(xCoord+dir.offsetX, yCoord+dir.offsetY, zCoord+dir.offsetZ)) {
		Block block = worldObj.getBlock(xCoord+dir.offsetX, yCoord+dir.offsetY, zCoord+dir.offsetZ);
		if (block instanceof BlockContainer || block instanceof IInventory)
			return true;
		if (block.hasTileEntity(worldObj.getBlockMetadata(xCoord+dir.offsetX, yCoord+dir.offsetY, zCoord+dir.offsetZ))) {
			return worldObj.getTileEntity(xCoord+dir.offsetX, yCoord+dir.offsetY, zCoord+dir.offsetZ) instanceof IInventory;
		}
	}
	return false;
}
 
开发者ID:austinv11,项目名称:PeripheralsPlusPlus,代码行数:12,代码来源:TileEntityMEBridge.java

示例15: getInventoryForSide

import net.minecraft.block.BlockContainer; //导入依赖的package包/类
private IInventory getInventoryForSide(ForgeDirection dir) {
	if (!worldObj.isAirBlock(xCoord+dir.offsetX, yCoord+dir.offsetY, zCoord+dir.offsetZ)) {
		Block block = worldObj.getBlock(xCoord+dir.offsetX, yCoord+dir.offsetY, zCoord+dir.offsetZ);
		if (block instanceof IInventory) {
			return (IInventory) block;
		}
		if (block instanceof BlockContainer && block.hasTileEntity(worldObj.getBlockMetadata(xCoord+dir.offsetX, yCoord+dir.offsetY, zCoord+dir.offsetZ)))
			return (IInventory)worldObj.getTileEntity(xCoord+dir.offsetX, yCoord+dir.offsetY, zCoord+dir.offsetZ);
	}
	return null;
}
 
开发者ID:austinv11,项目名称:PeripheralsPlusPlus,代码行数:12,代码来源:TileEntityMEBridge.java


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