Java Code Examples for net.minecraft.block.BlockGrass

The following are top voted examples for showing how to use net.minecraft.block.BlockGrass. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: SimplyTea   File: SimplyTea.java   Source Code and License 6 votes vote down vote up
@Override
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator,
		IChunkProvider chunkProvider) {
	if (random.nextInt(20) == 0){
		int x = chunkX * 16 + 2 + random.nextInt(12);
		int z = chunkZ * 16 + 2 + random.nextInt(12);
		BlockPos p = new BlockPos(x,0,z);
		p = world.getHeight(p);
		Biome b = world.getBiome(p);
		if (BiomeDictionary.hasType(b, BiomeDictionary.Type.FOREST) || b == Biomes.FOREST || b == Biomes.FOREST_HILLS){
			if (world.getBlockState(p.down()).getBlock() instanceof BlockGrass && world.isAirBlock(p)){
				BlockTeaSapling.generateTree(world, p, Blocks.AIR.getDefaultState(), random);
			}
		}
	}
}
 
Example 2
Project: Wurst-MC-1.12   File: BonemealAuraMod.java   Source Code and License 6 votes vote down vote up
private boolean isCorrectBlock(BlockPos pos)
{
	Block block = WBlock.getBlock(pos);
	
	if(!(block instanceof IGrowable) || block instanceof BlockGrass
		|| !((IGrowable)block).canGrow(WMinecraft.getWorld(), pos,
			WBlock.getState(pos), false))
		return false;
	
	if(block instanceof BlockSapling)
		return saplings.isChecked();
	else if(block instanceof BlockCrops)
		return crops.isChecked();
	else if(block instanceof BlockStem)
		return stems.isChecked();
	else if(block instanceof BlockCocoa)
		return cocoa.isChecked();
	else
		return other.isChecked();
}
 
Example 3
Project: Gravestone-mod-Extended   File: ItemBoneHoe.java   Source Code and License 6 votes vote down vote up
public static boolean applyBonemeal(ItemStack stack, World worldIn, BlockPos pos, IBlockState state, EntityPlayer player, @javax.annotation.Nullable EnumHand hand) {
    if (!(state.getBlock() instanceof BlockGrass) || player.isSneaking()) {

        int hook = net.minecraftforge.event.ForgeEventFactory.onApplyBonemeal(player, worldIn, pos, state, stack, hand);
        if (hook != 0) return hook > 0;

        IGrowable igrowable = (IGrowable) state.getBlock();
        if (igrowable.canGrow(worldIn, pos, state, worldIn.isRemote)) {
            if (!worldIn.isRemote) {
                if (igrowable.canUseBonemeal(worldIn, worldIn.rand, pos, state)) {
                    igrowable.grow(worldIn, worldIn.rand, pos, state);
                }
                stack.damageItem(1, player);
            }
            return true;
        }
    }
    return false;
}
 
Example 4
Project: vintagetg   File: MapGenFlora.java   Source Code and License 6 votes vote down vote up
void placeGrass(World world, BlockPos pos, Random random, int fertility) {
	Block block = world.getBlockState(pos.down()).getBlock();
	
	if (block instanceof BlockGrass && block.canPlaceBlockAt(world, pos)) {
		if (fertility < 50 && random.nextInt(15) == 0) {
			world.setBlockState(pos, Blocks.tallgrass.getDefaultState().withProperty(BlockTallGrass.TYPE, BlockTallGrass.EnumType.DEAD_BUSH), 2);
			return;
		}
		if (fertility > 200 && random.nextInt(3) == 0) {
			if (random.nextInt(20) == 0) {
				if (random.nextBoolean()) {
					world.setBlockState(pos, Blocks.brown_mushroom.getDefaultState());
				} else {
					world.setBlockState(pos, Blocks.red_mushroom.getDefaultState());
				}
				
				return;
			}
			world.setBlockState(pos, Blocks.tallgrass.getDefaultState().withProperty(BlockTallGrass.TYPE, BlockTallGrass.EnumType.FERN), 2);
			return;
		}
		
		world.setBlockState(pos, Blocks.tallgrass.getDefaultState().withProperty(BlockTallGrass.TYPE, BlockTallGrass.EnumType.GRASS), 2);
	}
}
 
Example 5
Project: ARKCraft-Code   File: WorldGeneratorBushes.java   Source Code and License 6 votes vote down vote up
@Override
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider)
{
	if (world.provider.getDimensionId() == 0)
	{
		for (int i = 0; i < 4; i++)
		{
			int x = chunkX * 16 + random.nextInt(16);
			int z = chunkZ * 16 + random.nextInt(16);

			BlockPos pos = world.getHorizon(new BlockPos(x, 0, z));

			if (world.getBlockState(pos.down()).getBlock() instanceof BlockGrass)
			{
				world.setBlockState(pos, ARKCraftBlocks.berryBush.getDefaultState());
			}
		}
	}
}
 
Example 6
Project: The-Derpy-Shiz-Mod   File: DerpyEvents.java   Source Code and License 6 votes vote down vote up
@SubscribeEvent
public void onUseHoe(UseHoeEvent event) {
	Block oblock = event.world.getBlock(event.x, event.y, event.z);
	if (LongHoe.AOEEnabled && event.current.getItem() instanceof LongHoe && (oblock instanceof BlockDirt || oblock instanceof BlockGrass)) {
		LongHoe.AOEEnabled = false;
		for (int x = event.x - 3; x < event.x + 3; x++) {
			for (int z = event.z - 3; z < event.z + 3; z++) {
				Block block = event.world.getBlock(x, event.y, z);
				if ((!(x == event.x && z == event.z)) && (block instanceof BlockDirt || block instanceof BlockGrass) && (!MinecraftForge.EVENT_BUS.post(new UseHoeEvent(event.entityPlayer, event.current, event.world, x, event.y, z)))) {
					event.world.setBlock(x, event.y, z, Blocks.farmland);
					if (event.world.getBlock(x, event.y + 1, z).isReplaceable(event.world, x, event.y + 1, z)) {
						event.world.setBlockToAir(x, event.y + 1, z);
					}
					DerpyItems.damageItem(event.current, 1, event.entityPlayer);
				}
			}
		}
		LongHoe.AOEEnabled = true;
	}
}
 
Example 7
Project: carpentersblocks   File: BlockHandlerBase.java   Source Code and License 6 votes vote down vote up
/**
 * Returns a integer with hex for 0xrrggbb for block.  Color is most
 * commonly different for {@link Blocks#grass}
 * <p>
 * If using our custom render helpers, be sure to use {@link #applyAnaglyph(float[])}.
 *
 * @param itemStack  the cover {@link ItemStack}
 * @param block  the {@link Block} inside the {@link ItemStack}
 * @param x  the x coordinate
 * @param y  the y coordinate
 * @param z  the z coordinate
 * @return a integer with hex for 0xrrggbb
 */
public int getBlockColor(Block block, int metadata, int x, int y, int z, int side, IIcon icon)
{
    if (block.hasTileEntity(metadata)) {
        block = Blocks.dirt;
    }

    TE.setMetadata(metadata);
    int color = OptifineHandler.enableOptifineIntegration ? OptifineHandler.getColorMultiplier(block, TE.getWorldObj(), x, y, z) : block.colorMultiplier(TE.getWorldObj(), x, y, z);
    TE.restoreMetadata();

    if (block.equals(Blocks.grass) && !isPositiveFace(side) && !icon.equals(BlockGrass.getIconSideOverlay())) {
        color = 16777215;
    }

    return color;
}
 
Example 8
Project: Backmemed   File: BetterGrass.java   Source Code and License 5 votes vote down vote up
public static List getFaceQuads(IBlockAccess p_getFaceQuads_0_, IBlockState p_getFaceQuads_1_, BlockPos p_getFaceQuads_2_, EnumFacing p_getFaceQuads_3_, List p_getFaceQuads_4_)
{
    if (p_getFaceQuads_3_ != EnumFacing.UP && p_getFaceQuads_3_ != EnumFacing.DOWN)
    {
        Block block = p_getFaceQuads_1_.getBlock();
        return block instanceof BlockMycelium ? getFaceQuadsMycelium(p_getFaceQuads_0_, p_getFaceQuads_1_, p_getFaceQuads_2_, p_getFaceQuads_3_, p_getFaceQuads_4_) : (block instanceof BlockGrassPath ? getFaceQuadsGrassPath(p_getFaceQuads_0_, p_getFaceQuads_1_, p_getFaceQuads_2_, p_getFaceQuads_3_, p_getFaceQuads_4_) : (block instanceof BlockDirt ? getFaceQuadsDirt(p_getFaceQuads_0_, p_getFaceQuads_1_, p_getFaceQuads_2_, p_getFaceQuads_3_, p_getFaceQuads_4_) : (block instanceof BlockGrass ? getFaceQuadsGrass(p_getFaceQuads_0_, p_getFaceQuads_1_, p_getFaceQuads_2_, p_getFaceQuads_3_, p_getFaceQuads_4_) : p_getFaceQuads_4_)));
    }
    else
    {
        return p_getFaceQuads_4_;
    }
}
 
Example 9
Project: vintagetg   File: MapGenCavesVC.java   Source Code and License 5 votes vote down vote up
protected boolean caveableBlock(IBlockState blockstate, IBlockState aboveblockstate) {
	if (aboveblockstate.getBlock().getMaterial() == Material.water) return false;
	
	return 
		blockstate.getBlock() instanceof BlockStone
		|| blockstate.getBlock() instanceof BlockDirt 
		|| blockstate.getBlock() instanceof BlockGrass 
	;
}
 
Example 10
Project: ThermalRecycling   File: Lawn.java   Source Code and License 5 votes vote down vote up
public void setLawn(final World world, final int x, final int y, final int z, final EntityLivingBase entity) {
	final Block block = world.getBlock(x, y, z);
	if(block instanceof BlockGrass || block instanceof Lawn) {
		final int i = MathHelper
				.floor_double((double) ((entity.rotationYaw * 4F) / 360F) + 0.5D) & 3;
		world.setBlock(x, y, z, BlockManager.lawn, dirMap[i], 2);
		world.markBlockForUpdate(x, y, z);
	}
}
 
Example 11
Project: Chisel   File: GrassVariation.java   Source Code and License 5 votes vote down vote up
@SideOnly(Side.CLIENT)
@Override
public boolean renderSide(Vertex5[] verts, int side, Vector3 pos,
                          LightMatrix lightMatrix, int color, Cuboid6 bounds) {

    if (grass.isTop(side)) {
        Tessellator.instance.setColorOpaque_I(color >> 8);
        grass.renderSide(verts, side, pos, lightMatrix, color, bounds);
    } else {
        Tessellator.instance.setColorOpaque_I(0xFFFFFFFF >> 8);
        dirt.renderSide(verts, side, pos, lightMatrix, 0xFFFFFFFF, bounds);
        if (dirt.isSide(side)) {
            //dummy.renderSide(verts, side, pos, lightMatrix, color);
            Tessellator.instance.setColorOpaque_I(color >> 8);

            IIcon temp = grass.getBoundIcon();
            grass.setBoundIcon(BlockGrass.getIconSideOverlay());
            if (bounds != null) {
                for (int i = 0; i < 4; i++) {
                    verts[i].uv.v -= 1 - bounds.max.y;
                }
            }
            grass.renderSide(verts, side, pos, lightMatrix, color, bounds);
            grass.setBoundIcon(temp);
        }
    }
    return true;
}
 
Example 12
Project: EnderZoo   File: MobSpawnEventHandler.java   Source Code and License 5 votes vote down vote up
@SubscribeEvent
public void onBlockHarvest(HarvestDropsEvent event) {

  if (!Config.direSlimeEnabled || event.isCanceled() || event.getWorld() == null || event.getWorld().isRemote) {
    return;
  }
  if (event.getHarvester() == null || event.getHarvester().capabilities.isCreativeMode) {
    return;
  }

  if (!(event.getState().getBlock() instanceof BlockDirt || event.getState().getBlock() instanceof BlockGrass)) {
    return;
  }

  if (!isToolEffective(event.getState(), event.getHarvester().getHeldItemMainhand())) {

    if (Config.direSlimeChance < event.getWorld().rand.nextFloat()) {
      return;
    }

    EntityDireSlime direSlime = new EntityDireSlime(event.getWorld());
    direSlime.setPosition(event.getPos().getX() + 0.5, event.getPos().getY() + 0.0, event.getPos().getZ() + 0.5);
    event.getWorld().spawnEntity(direSlime);
    direSlime.playLivingSound();
    for (ItemStack drop : event.getDrops()) {
      if (drop != null && drop.getItem() != null && drop.getItem() == Item.getItemFromBlock(Blocks.DIRT)) {
        if (drop.getCount() > 1) {
          drop.shrink(1);
        } else if (event.getDrops().size() == 1) {
          event.getDrops().clear();
        } else {
          event.getDrops().remove(drop);
        }
        return;
      }
    }
  }
}
 
Example 13
Project: PneumaticCraft   File: EventHandlerPneumaticCraft.java   Source Code and License 5 votes vote down vote up
@SubscribeEvent
public void onFertilization(BonemealEvent event){
    if(event.world.isRemote) return; // why would we want to handle this on the client-side?

    if(event.block == Blocks.netherrack || event.block == Blocks.end_stone || event.block.canSustainPlant(event.world, event.x, event.y, event.z, ForgeDirection.UP, Blocks.red_flower)) { // can bonemeal Biomes O' Plenty grass, etc.    			    			
        boolean onGrass = event.block instanceof BlockGrass;
        if(onGrass && Config.includePlantsOnBonemeal || !onGrass && Config.allowDirtBonemealing) {
            // we'll try to spawn plants in a 5x5 area which is centered on the block that has been bonemealed
            for(int x = event.x - 2; x < event.x + 3; x++) {
                for(int z = event.z - 2; z < event.z + 3; z++) {
                    if(event.world.isAirBlock(x, event.y + 1, z)) {
                        if(event.world.rand.nextInt(8) == 1) { // increase .nextInt(x) to lower the chances of spawning a plant
                            BlockPneumaticPlantBase trySpawn = BlockPlants.allPlants.get(event.world.rand.nextInt(BlockPlants.allPlants.size() - 1)); // select a random plant    							
                            if(trySpawn.canPlantGrowOnThisBlock(event.world.getBlock(x, event.y, z), event.world, x, event.y, z)) { // make sure that the plant we selected can grow on the soil
                                event.world.setBlock(x, event.y + (trySpawn.isPlantHanging() ? -1 : 1), z, trySpawn);
                            }
                        }
                    }
                }

                /*
                 * vanilla mechanics will spawn flowers etc. when bonemeal is used on grass,
                 * so we cannot set Result.ALLOW in this case because it would stop event-propagation
                 */
                if(!onGrass) event.setResult(Result.ALLOW);
            }
        }
    }
}
 
Example 14
Project: harshencastle   File: HarshenDimensionalFluidBlock.java   Source Code and License 4 votes vote down vote up
private boolean shouldBlockBeChanged(IBlockState state)
{
	return 	state.getBlock() instanceof BlockDirt ||
			state.getBlock() instanceof BlockGrass ||
			state.getBlock() instanceof BlockLeaves;
}
 
Example 15
Project: BaseClient   File: BetterGrass.java   Source Code and License 4 votes vote down vote up
public static List getFaceQuads(IBlockAccess p_getFaceQuads_0_, Block p_getFaceQuads_1_, BlockPos p_getFaceQuads_2_, EnumFacing p_getFaceQuads_3_, List p_getFaceQuads_4_)
{
    if (p_getFaceQuads_3_ != EnumFacing.UP && p_getFaceQuads_3_ != EnumFacing.DOWN)
    {
        if (p_getFaceQuads_1_ instanceof BlockMycelium)
        {
            return Config.isBetterGrassFancy() ? (getBlockAt(p_getFaceQuads_2_.down(), p_getFaceQuads_3_, p_getFaceQuads_0_) == Blocks.mycelium ? modelCubeMycelium.getFaceQuads(p_getFaceQuads_3_) : p_getFaceQuads_4_) : modelCubeMycelium.getFaceQuads(p_getFaceQuads_3_);
        }
        else
        {
            if (p_getFaceQuads_1_ instanceof BlockGrass)
            {
                Block block = p_getFaceQuads_0_.getBlockState(p_getFaceQuads_2_.up()).getBlock();
                boolean flag = block == Blocks.snow || block == Blocks.snow_layer;

                if (!Config.isBetterGrassFancy())
                {
                    if (flag)
                    {
                        return modelCubeGrassSnowy.getFaceQuads(p_getFaceQuads_3_);
                    }

                    return modelCubeGrass.getFaceQuads(p_getFaceQuads_3_);
                }

                if (flag)
                {
                    if (getBlockAt(p_getFaceQuads_2_, p_getFaceQuads_3_, p_getFaceQuads_0_) == Blocks.snow_layer)
                    {
                        return modelCubeGrassSnowy.getFaceQuads(p_getFaceQuads_3_);
                    }
                }
                else if (getBlockAt(p_getFaceQuads_2_.down(), p_getFaceQuads_3_, p_getFaceQuads_0_) == Blocks.grass)
                {
                    return modelCubeGrass.getFaceQuads(p_getFaceQuads_3_);
                }
            }

            return p_getFaceQuads_4_;
        }
    }
    else
    {
        return p_getFaceQuads_4_;
    }
}
 
Example 16
Project: BaseClient   File: BetterGrass.java   Source Code and License 4 votes vote down vote up
public static List getFaceQuads(IBlockAccess p_getFaceQuads_0_, Block p_getFaceQuads_1_, BlockPos p_getFaceQuads_2_, EnumFacing p_getFaceQuads_3_, List p_getFaceQuads_4_)
{
    if (p_getFaceQuads_3_ != EnumFacing.UP && p_getFaceQuads_3_ != EnumFacing.DOWN)
    {
        if (p_getFaceQuads_1_ instanceof BlockMycelium)
        {
            return Config.isBetterGrassFancy() ? (getBlockAt(p_getFaceQuads_2_.down(), p_getFaceQuads_3_, p_getFaceQuads_0_) == Blocks.mycelium ? modelCubeMycelium.getFaceQuads(p_getFaceQuads_3_) : p_getFaceQuads_4_) : modelCubeMycelium.getFaceQuads(p_getFaceQuads_3_);
        }
        else
        {
            if (p_getFaceQuads_1_ instanceof BlockGrass)
            {
                Block block = p_getFaceQuads_0_.getBlockState(p_getFaceQuads_2_.up()).getBlock();
                boolean flag = block == Blocks.snow || block == Blocks.snow_layer;

                if (!Config.isBetterGrassFancy())
                {
                    if (flag)
                    {
                        return modelCubeGrassSnowy.getFaceQuads(p_getFaceQuads_3_);
                    }

                    return modelCubeGrass.getFaceQuads(p_getFaceQuads_3_);
                }

                if (flag)
                {
                    if (getBlockAt(p_getFaceQuads_2_, p_getFaceQuads_3_, p_getFaceQuads_0_) == Blocks.snow_layer)
                    {
                        return modelCubeGrassSnowy.getFaceQuads(p_getFaceQuads_3_);
                    }
                }
                else if (getBlockAt(p_getFaceQuads_2_.down(), p_getFaceQuads_3_, p_getFaceQuads_0_) == Blocks.grass)
                {
                    return modelCubeGrass.getFaceQuads(p_getFaceQuads_3_);
                }
            }

            return p_getFaceQuads_4_;
        }
    }
    else
    {
        return p_getFaceQuads_4_;
    }
}
 
Example 17
Project: vintagetg   File: MapGenFlora.java   Source Code and License 4 votes vote down vote up
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider) {
	chunkX *= 16;
	chunkZ *= 16;

	int[] forestLayer = forestGen.getInts(chunkX, chunkZ, 16, 16);
	VCraftWorld.instance.setChunkNBT(chunkX/16, chunkZ/16, "forest", forestLayer);
	
	/**** 1. Flowers and Wheat ****/
	if (random.nextInt(8) == 0) {
		placeFlowers(world, chunkX, chunkZ, forestLayer, random);
	}

	/**** 2. Grass, Trees, Vines ****/
	for (int i = 0; i < 200; i++) {
		int x = random.nextInt(16);
		int z = random.nextInt(16);
		
		int density = forestLayer[x+z*16];
	
		BlockPos blockpos = world.getHorizon(new BlockPos(chunkX + x, 0, chunkZ + z));
		
		int climate[] = VCraftWorld.instance.getClimate(blockpos);
		

		if (random.nextInt(255) < Math.min(200, density) - Math.max(0, blockpos.getY() - 180)) {
			placeGrass(world, blockpos, random, climate[1]);
			if (density < 20) {
				placeGrass(world, blockpos.east(random.nextInt(2)*2 - 1).west(random.nextInt(2)*2 - 1), random, climate[1]);
			}
			if (density < 40) {
				placeGrass(world, blockpos.east(random.nextInt(2)*2 - 1).west(random.nextInt(2)*2 - 1), random, climate[1]);
			}

		}
		
		//if (true) continue;
		
		
		int forestDensityDiff = Math.max(1, climate[1] - 180);
		
		if (i <= 50 + forestDensityDiff/4 && (random.nextInt(255) > density || random.nextInt(forestDensityDiff) > 0)) {
			Block block = world.getBlockState(blockpos.down()).getBlock();
			if (!(block instanceof BlockGrass)) {
				continue;
			}
			
			
			
			int steepness = Math.max(
				Math.abs(world.getHorizon(blockpos.east(2)).getY() - world.getHorizon(blockpos.west(2)).getY()),
				Math.abs(world.getHorizon(blockpos.north(2)).getY() - world.getHorizon(blockpos.south(2)).getY())
			);
			
			DynTreeGen treegen = EnumTree.getRandomTreeGenForClimate(climate[2], climate[0], 255 - forestLayer[x+z*16], climate[1], steepness, blockpos.getY(), random);				
			
			if (treegen != null) {
				if (treegen.tree == EnumTree.JUNGLE) {
					treegen.growTree(world, blockpos.down(), 0.4f + random.nextFloat(), Math.max(0, climate[2] - 190));
				} else {
					treegen.growTree(world, blockpos.down(), 0.66f + random.nextFloat()/3 - Math.max(0, (blockpos.getY() * 1f / treegen.tree.maxy) - 0.5f), Math.max(0, climate[2] - 190));
				}
			}
		}
	}

}
 
Example 18
Project: carpentersblocks   File: BlockHandlerBase.java   Source Code and License 4 votes vote down vote up
/**
 * Renders multiple textures to side.
 */
protected void renderMultiTexturedSide(ItemStack itemStack, int x, int y, int z, int side)
{
    Block block = BlockProperties.toBlock(itemStack);
    boolean renderCover = (block instanceof BlockCoverable ? renderPass == 0 : block.canRenderInPass(renderPass));
    boolean hasDesign = TE.hasChiselDesign(coverRendering);
    boolean hasOverlay = TE.hasAttribute(TE.ATTR_OVERLAY[coverRendering]);
    double overlayOffset = 0.0D;

    if (hasOverlay) {
        if (hasDesign) {
            overlayOffset = RenderHelper.OFFSET_MAX;
        } else if (renderPass == PASS_OPAQUE && block.getRenderBlockPass() == PASS_ALPHA && !(block instanceof BlockCoverable)) {
            overlayOffset = RenderHelper.OFFSET_MIN;
        }
    }

    /* Render side */

    if (renderCover) {
        int tempRotation = getTextureRotation(side);
        if (BlockProperties.blockRotates(itemStack)) {
            setTextureRotationForDirectionalBlock(side);
        }
        setColorAndRender(itemStack, x, y, z, side, getIcon(itemStack, side));
        setTextureRotation(side, tempRotation);
    }

    /* Render BlockGrass side overlay here, if needed. */

    if (renderPass == PASS_OPAQUE && block.equals(Blocks.grass) && side > 0 && !isPositiveFace(side)) {
        if (Minecraft.isFancyGraphicsEnabled()) {
            setColorAndRender(new ItemStack(Blocks.grass), x, y, z, side, BlockGrass.getIconSideOverlay());
        } else {
            setColorAndRender(new ItemStack(Blocks.dirt), x, y, z, side, IconRegistry.icon_overlay_fast_grass_side);
        }
    }

    boolean temp_dye_state = suppressDyeColor;
    suppressDyeColor = true;

    if (hasDesign && !suppressChiselDesign && renderPass == PASS_ALPHA) {
        RenderHelper.setOffset(RenderHelper.OFFSET_MIN);
        renderChiselDesign(x, y, z, side);
        RenderHelper.clearOffset();
    }

    if (hasOverlay && !suppressOverlay && renderPass == PASS_OPAQUE) {
        RenderHelper.setOffset(overlayOffset);
        renderOverlay(x, y, z, side);
        RenderHelper.clearOffset();
    }

    suppressDyeColor = temp_dye_state;
}
 
Example 19
Project: carpentersblocks   File: OverlayHandler.java   Source Code and License 4 votes vote down vote up
@SideOnly(Side.CLIENT)
/**
 * Returns icon for overlay side.
 *
 * Returns null if there is no icon to return.
 */
public static IIcon getOverlayIcon(Overlay overlay, int side)
{
    Block block = BlockProperties.toBlock(overlay.getItemStack());

    switch (overlay) {
        case GRASS:
        case SNOW:
        case HAY:
        case MYCELIUM:
            switch (side) {
                case 0:
                    return null;
                case 1:
                    return block.getBlockTextureFromSide(1);
                default:
                    switch (overlay) {
                        case GRASS:
                            return RenderBlocks.fancyGrass ? BlockGrass.getIconSideOverlay() : IconRegistry.icon_overlay_fast_grass_side;
                        case SNOW:
                            return IconRegistry.icon_overlay_snow_side;
                        case HAY:
                            return IconRegistry.icon_overlay_hay_side;
                        case MYCELIUM:
                            return IconRegistry.icon_overlay_mycelium_side;
                        default:
                            return null;
                    }
            }
        case WEB:
        case VINE:
            return block.getBlockTextureFromSide(side);
        default: {
            return null;
        }
    }
}