Skip to content

Commit

Permalink
Fix leaves rendering odd like. Closes #425
Browse files Browse the repository at this point in the history
  • Loading branch information
alexbegt committed Jan 10, 2018
1 parent e04c8cd commit bcf9049
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 125 deletions.
Expand Up @@ -2,6 +2,14 @@

import net.minecraft.block.BlockLeaves;
import net.minecraft.block.BlockPlanks.EnumType;
import net.minecraft.block.state.IBlockState;
import net.minecraft.init.Blocks;
import net.minecraft.util.BlockRenderLayer;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;

public abstract class BlockLeavesBase extends BlockLeaves
{
Expand All @@ -10,6 +18,26 @@ public BlockLeavesBase()
super();
}

@Override
@SideOnly(Side.CLIENT)
public BlockRenderLayer getBlockLayer()
{
return Blocks.LEAVES.getBlockLayer();
}

@Override
public boolean isOpaqueCube(IBlockState state)
{
return Blocks.LEAVES.isOpaqueCube(state);
}

@SideOnly(Side.CLIENT)
@Override
public boolean shouldSideBeRendered(IBlockState state, IBlockAccess world, BlockPos pos, EnumFacing side)
{
return Blocks.LEAVES.shouldSideBeRendered(state, world, pos, side);
}

@Override
public EnumType getWoodType(int meta)
{
Expand Down
Expand Up @@ -20,8 +20,6 @@
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.BlockRenderLayer;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.IStringSerializable;
import net.minecraft.util.NonNullList;
import net.minecraft.util.math.BlockPos;
Expand Down Expand Up @@ -175,29 +173,6 @@ public void getDrops(NonNullList<ItemStack> drops, IBlockAccess world, BlockPos
}
}

/**
* Used to determine ambient occlusion and culling when rebuilding chunks for render
*/
@Override
public boolean isOpaqueCube(IBlockState state)
{
return !NaturaNether.proxy.fancyGraphicsEnabled();
}

@Override
@SideOnly(Side.CLIENT)
public BlockRenderLayer getBlockLayer()
{
return NaturaNether.proxy.fancyGraphicsEnabled() ? BlockRenderLayer.CUTOUT_MIPPED : BlockRenderLayer.SOLID;
}

@Override
@SideOnly(Side.CLIENT)
public boolean shouldSideBeRendered(IBlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side)
{
return !NaturaNether.proxy.fancyGraphicsEnabled() && blockAccess.getBlockState(pos.offset(side)).getBlock() == this ? false : super.shouldSideBeRendered(blockState, blockAccess, pos, side);
}

public enum LeavesType implements IStringSerializable, EnumBlock.IEnumMeta
{
GHOSTWOOD(0, 0), BLOODWOOD(0, 1), FUSEWOOD(1, 2);
Expand Down
Expand Up @@ -20,8 +20,6 @@
import net.minecraft.init.Blocks;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.BlockRenderLayer;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.IStringSerializable;
import net.minecraft.util.NonNullList;
import net.minecraft.util.math.BlockPos;
Expand Down Expand Up @@ -157,29 +155,6 @@ public boolean isLeaves(IBlockState state, IBlockAccess world, BlockPos pos)
return true;
}

/**
* Used to determine ambient occlusion and culling when rebuilding chunks for render
*/
@Override
public boolean isOpaqueCube(IBlockState state)
{
return !NaturaNether.proxy.fancyGraphicsEnabled();
}

@Override
@SideOnly(Side.CLIENT)
public BlockRenderLayer getBlockLayer()
{
return NaturaNether.proxy.fancyGraphicsEnabled() ? BlockRenderLayer.CUTOUT_MIPPED : BlockRenderLayer.SOLID;
}

@Override
@SideOnly(Side.CLIENT)
public boolean shouldSideBeRendered(IBlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side)
{
return !NaturaNether.proxy.fancyGraphicsEnabled() && blockAccess.getBlockState(pos.offset(side)).getBlock() == this ? false : super.shouldSideBeRendered(blockState, blockAccess, pos, side);
}

/**
* Returns the quantity of items to drop on block destruction.
*/
Expand Down
Expand Up @@ -18,8 +18,6 @@
import net.minecraft.init.Blocks;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.BlockRenderLayer;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.NonNullList;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
Expand Down Expand Up @@ -139,27 +137,4 @@ public boolean isLeaves(IBlockState state, IBlockAccess world, BlockPos pos)
{
return true;
}

/**
* Used to determine ambient occlusion and culling when rebuilding chunks for render
*/
@Override
public boolean isOpaqueCube(IBlockState state)
{
return !NaturaOverworld.proxy.fancyGraphicsEnabled();
}

@Override
@SideOnly(Side.CLIENT)
public BlockRenderLayer getBlockLayer()
{
return NaturaOverworld.proxy.fancyGraphicsEnabled() ? BlockRenderLayer.CUTOUT_MIPPED : BlockRenderLayer.SOLID;
}

@Override
@SideOnly(Side.CLIENT)
public boolean shouldSideBeRendered(IBlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side)
{
return !NaturaOverworld.proxy.fancyGraphicsEnabled() && blockAccess.getBlockState(pos.offset(side)).getBlock() == this ? false : super.shouldSideBeRendered(blockState, blockAccess, pos, side);
}
}
Expand Up @@ -18,8 +18,6 @@
import net.minecraft.init.Blocks;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.BlockRenderLayer;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.NonNullList;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
Expand Down Expand Up @@ -139,27 +137,4 @@ public boolean isLeaves(IBlockState state, IBlockAccess world, BlockPos pos)
{
return true;
}

/**
* Used to determine ambient occlusion and culling when rebuilding chunks for render
*/
@Override
public boolean isOpaqueCube(IBlockState state)
{
return !NaturaOverworld.proxy.fancyGraphicsEnabled();
}

@Override
@SideOnly(Side.CLIENT)
public BlockRenderLayer getBlockLayer()
{
return NaturaOverworld.proxy.fancyGraphicsEnabled() ? BlockRenderLayer.CUTOUT_MIPPED : BlockRenderLayer.SOLID;
}

@Override
@SideOnly(Side.CLIENT)
public boolean shouldSideBeRendered(IBlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side)
{
return !NaturaOverworld.proxy.fancyGraphicsEnabled() && blockAccess.getBlockState(pos.offset(side)).getBlock() == this ? false : super.shouldSideBeRendered(blockState, blockAccess, pos, side);
}
}
Expand Up @@ -19,8 +19,6 @@
import net.minecraft.init.Blocks;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.BlockRenderLayer;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.IStringSerializable;
import net.minecraft.util.NonNullList;
import net.minecraft.util.math.BlockPos;
Expand Down Expand Up @@ -183,29 +181,6 @@ public boolean isLeaves(IBlockState state, IBlockAccess world, BlockPos pos)
return true;
}

/**
* Used to determine ambient occlusion and culling when rebuilding chunks for render
*/
@Override
public boolean isOpaqueCube(IBlockState state)
{
return !NaturaOverworld.proxy.fancyGraphicsEnabled();
}

@Override
@SideOnly(Side.CLIENT)
public BlockRenderLayer getBlockLayer()
{
return NaturaOverworld.proxy.fancyGraphicsEnabled() ? BlockRenderLayer.CUTOUT_MIPPED : BlockRenderLayer.SOLID;
}

@Override
@SideOnly(Side.CLIENT)
public boolean shouldSideBeRendered(IBlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side)
{
return !NaturaOverworld.proxy.fancyGraphicsEnabled() && blockAccess.getBlockState(pos.offset(side)).getBlock() == this ? false : super.shouldSideBeRendered(blockState, blockAccess, pos, side);
}

public enum RedwoodType implements IStringSerializable, EnumBlock.IEnumMeta
{
NORMAL;
Expand Down

0 comments on commit bcf9049

Please sign in to comment.