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


Java BlockGlass类代码示例

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


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

示例1: searchForInventory

import net.minecraft.block.BlockGlass; //导入依赖的package包/类
private IInventory searchForInventory()
{
    for (int j = 1; j < 64; j++) {
        TileEntity foundte = worldObj.getTileEntity(getPos().add(0, j, 0));
        Block foundBlock = worldObj.getBlockState(getPos().add(0, j, 0)).getBlock();

        if (foundte != null && foundte instanceof IInventory) {
            this.foundInventory = getPos().add(0, j, 0);
            this.oldBlock = foundBlock;
            return (IInventory) foundte;
        } else if (foundte == null && !((foundBlock instanceof BlockGlass) || foundBlock instanceof BlockStainedGlass)) {
            this.foundInventory = null;
            this.oldBlock = null;
            return null;
        }
    }

    this.foundInventory = null;
    this.oldBlock = null;
    return null;
}
 
开发者ID:GamingsModding,项目名称:LittleThings-old,代码行数:22,代码来源:TileEntityItemElevator.java

示例2: setTexture

import net.minecraft.block.BlockGlass; //导入依赖的package包/类
public boolean setTexture(ItemStack stack) 
{
	if(stack != null && stack.getItem() instanceof ItemDye)
	{
		EnumDyeColor colour = EnumDyeColor.byDyeDamage(stack.getMetadata());
		texture = new ResourceLocation("textures/blocks/hardened_clay_stained_" + colour.getName() + ".png");
		return true;
	}
	if(stack != null && stack.getItem() instanceof ItemBlock)
	{
		System.out.println("called");
		Block block = ((ItemBlock) stack.getItem()).block;
		if(block.isNormalCube(block.getDefaultState()) || block instanceof BlockGlass)
		{
			IBakedModel model = Minecraft.getMinecraft().getBlockRendererDispatcher().getModelForState(block.getStateFromMeta(stack.getMetadata()));
			texture = new ResourceLocation(model.getParticleTexture().getIconName());
			return true;
		}
	}
	return false;
}
 
开发者ID:MrCrayfish,项目名称:MrCrayfishSkateboardingMod,代码行数:22,代码来源:TileEntityTextureable.java

示例3: onBlockActivated

import net.minecraft.block.BlockGlass; //导入依赖的package包/类
@Override
public boolean onBlockActivated(EntityPlayer player, ItemStack stack, TileEntity tileEntity)
   {
	if(stack != null && stack.getItem() instanceof ItemBlock && tileEntity instanceof TileEntityCable)
	{
		TileEntityCable cable = (TileEntityCable) tileEntity;
		if(cable.isCoverd()) return false;
		Block block = Block.getBlockFromItem(stack.getItem());
		if(!block.isNormalCube() && !(block instanceof BlockGlass))
		{
				return false;
		}
		cable.block = block;
		cable.meta = stack.getItemDamage();
		cable.updateBlock();
		cable.getWorldObj().playSoundEffect((double)((float)cable.xCoord + 0.5F), (double)((float)cable.yCoord + 0.5F), (double)((float)cable.zCoord + 0.5F), block.stepSound.func_150496_b(), (block.stepSound.getVolume() + 1.0F) / 2.0F, block.stepSound.getPitch() * 0.8F);
		if(!player.capabilities.isCreativeMode)stack.stackSize--;
		return true;
	}
	return false;
   }
 
开发者ID:CreativeMD,项目名称:RandomAdditions,代码行数:22,代码来源:SubBlockCable.java

示例4: isFullCubeModel

import net.minecraft.block.BlockGlass; //导入依赖的package包/类
private static boolean isFullCubeModel(IBlockState p_isFullCubeModel_0_)
{
    if (p_isFullCubeModel_0_.isFullCube())
    {
        return true;
    }
    else
    {
        Block block = p_isFullCubeModel_0_.getBlock();
        return block instanceof BlockGlass ? true : block instanceof BlockStainedGlass;
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:13,代码来源:ConnectedTextures.java

示例5: updatePartials

import net.minecraft.block.BlockGlass; //导入依赖的package包/类
private void updatePartials()
{
    for (int j = 1; j < 64; j++) {
        BlockPos added = getPos().add(0, j, 0);
        if (worldObj.getBlockState(added).getBlock() instanceof BlockGlass || worldObj.getBlockState(added).getBlock() instanceof BlockStainedGlass)
            for (int i = 10; i >= 1; i--)
                worldObj.spawnParticle(EnumParticleTypes.PORTAL,
                        added.getX() + 0.5, added.getY() - 1 + i / 10, added.getZ() + 0.5,
                        0, 0.3, 0);
        else break;
    }
}
 
开发者ID:GamingsModding,项目名称:LittleThings-old,代码行数:13,代码来源:TileEntityItemElevator.java

示例6: isBlockGlass

import net.minecraft.block.BlockGlass; //导入依赖的package包/类
public static boolean isBlockGlass(IBlockState blockState) {
	if(blockState == null || blockState.getMaterial() == Material.AIR) {
		return false;
	}

	if(blockState.getBlock() instanceof BlockGlass) {
		return true;
	}

	ItemStack is = new ItemStack(blockState.getBlock(), 1);
	return blockState.getMaterial() == Material.GLASS && !is.getUnlocalizedName().contains("pane");

}
 
开发者ID:Lordmau5,项目名称:FFS,代码行数:14,代码来源:GenericUtil.java

示例7: onItemUse

import net.minecraft.block.BlockGlass; //导入依赖的package包/类
@Override
public boolean onItemUse(ItemStack itemstack, EntityPlayer player, World world, int x, int y, int z, int side, float textureX, float textureY, float textureZ) {
   	if(!world.isRemote) {
   		if(world.getBlock(x, y, z) instanceof BlockColoured || world.getBlock(x, y, z) instanceof BlockColored || world.getBlock(x, y, z) instanceof BlockStainedGlass || world.getBlock(x, y, z) instanceof BlockStainedGlassPane) {
   			if(world.getBlockMetadata(x, y, z) != this.getDamage(itemstack)) {
   				world.setBlockMetadataWithNotify(x, y, z, this.getDamage(itemstack), 2);
   				player.inventory.setInventorySlotContents(player.inventory.currentItem, this.getContainerItem(itemstack));
       			return true;
   			} else return false;
   		} else if(world.getBlock(x, y, z) instanceof BlockHardenedClay) {
   			world.setBlock(x, y, z, Blocks.stained_hardened_clay, this.getDamage(itemstack), 2);
   			player.inventory.setInventorySlotContents(player.inventory.currentItem, this.getContainerItem(itemstack));
   			return true;
   		} else if(world.getBlock(x, y, z) instanceof BlockGlass) {
   			world.setBlock(x, y, z, Blocks.stained_glass, this.getDamage(itemstack), 2);
   			player.inventory.setInventorySlotContents(player.inventory.currentItem, this.getContainerItem(itemstack));
   			return true;
   		} else if(world.getBlock(x, y, z) == Blocks.glass_pane) {
   			world.setBlock(x, y, z, Blocks.stained_glass_pane, this.getDamage(itemstack), 2);
   			player.inventory.setInventorySlotContents(player.inventory.currentItem, this.getContainerItem(itemstack));
   			return true;
   		} else if(world.getBlock(x, y, z) instanceof BlockWood) {
   			world.setBlock(x, y, z, ModBlocks.woodColoured, this.getDamage(itemstack), 2);
   			player.inventory.setInventorySlotContents(player.inventory.currentItem, this.getContainerItem(itemstack));
   			return true;
   		} else if(world.getBlock(x, y, z) == Blocks.brick_block) {
   			world.setBlock(x, y, z, ModBlocks.brickColoured, this.getDamage(itemstack), 2);
   			player.inventory.setInventorySlotContents(player.inventory.currentItem, this.getContainerItem(itemstack));
   			return true;
   		}
   	}
   	return false;
   }
 
开发者ID:OmgImAlexis,项目名称:TheStuffMod,代码行数:34,代码来源:ItemPaintbrush.java

示例8: getStateMatcher

import net.minecraft.block.BlockGlass; //导入依赖的package包/类
@Override
public Predicate<IBlockState> getStateMatcher() {
    return blockState -> blockState.getBlock() instanceof BlockGlass;
}
 
开发者ID:McJty,项目名称:MeeCreeps,代码行数:5,代码来源:SchematicHouse.java

示例9: getMapColor

import net.minecraft.block.BlockGlass; //导入依赖的package包/类
/**
 * Get the MapColor for this Block and the given BlockState
 */
@Override
public MapColor getMapColor(IBlockState state, IBlockAccess worldIn, BlockPos pos)
{
	return ((BlockGlass)Blocks.GLASS).getMapColor(Blocks.GLASS.getDefaultState(), worldIn, pos);
}
 
开发者ID:Brian-Wuest,项目名称:MC-Prefab,代码行数:9,代码来源:BlockGlassSlab.java

示例10: onItemRightClick

import net.minecraft.block.BlockGlass; //导入依赖的package包/类
@Override
public ActionResult<ItemStack> onItemRightClick(ItemStack stack, World world, EntityPlayer player, EnumHand hand) {
    if (!world.isRemote) {
        if (cooldown <= 0) {
            if (WarsMod.getDonators().contains(player.getName())) {

                if (player instanceof EntityPlayerMP && ItemArmorMod.hasFullSuit(player, WarsItems.enderArmor)) {
                    RayTraceResult result = player.rayTrace(20, 1F);
                    int x = result.getBlockPos().getX();
                    int y = result.getBlockPos().getY();
                    int z = result.getBlockPos().getZ();
                    if(!teleportTo(x, y, z, player) && !(world.getBlockState(result.getBlockPos()).getBlock() instanceof BlockGlass)){//BlockGlass check prevents potentially escaping the dome
                        if(player.posX > x)
                            if(teleportTo(x+2, y, z, player)) {
                                cooldown = 80;
                                return new ActionResult(EnumActionResult.SUCCESS, stack);
                            }
                        if(player.posX < x)
                            if(teleportTo(x-2, y, z, player)) {
                                cooldown = 80;
                                return new ActionResult(EnumActionResult.SUCCESS, stack);
                            }
                        if(player.posZ > z)
                            if(teleportTo(x, y, z+2, player)) {
                                cooldown = 80;
                                return new ActionResult(EnumActionResult.SUCCESS, stack);
                            }
                        if(player.posZ < z)
                            if(teleportTo(x, y, z-2, player)) {
                                cooldown = 80;
                                return new ActionResult(EnumActionResult.SUCCESS, stack);
                            }
                    }
                    cooldown = 80;
                    return new ActionResult(EnumActionResult.SUCCESS, stack);
                }
            } else {
                player.addChatMessage(new TextComponentTranslation("class.donatoronly"));
                return new ActionResult(EnumActionResult.FAIL, stack);
            }
        }
    }
    return new ActionResult(EnumActionResult.PASS, stack);
}
 
开发者ID:The-Fireplace-Minecraft-Mods,项目名称:Wars-Mod,代码行数:45,代码来源:ItemEnderSword.java

示例11: canPlaceBlockAt

import net.minecraft.block.BlockGlass; //导入依赖的package包/类
@Override
public boolean canPlaceBlockAt(World world, BlockPos pos) {
	return super.canPlaceBlockAt(world, pos) && (world.isSideSolid(pos.down(), EnumFacing.UP) || world.getBlockState(pos.down()).getBlock() instanceof BlockGlass);
}
 
开发者ID:coolAlias,项目名称:ZeldaSwordSkills,代码行数:5,代码来源:BlockCeramicJar.java


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