Fix colors of vine-like blocks
This commit is contained in:
parent
f70b075211
commit
f7f470be09
2 changed files with 44 additions and 8 deletions
|
@ -16,6 +16,10 @@ import biomesoplenty.common.item.ItemBOPBlock;
|
||||||
import net.minecraft.block.BlockVine;
|
import net.minecraft.block.BlockVine;
|
||||||
import net.minecraft.block.state.IBlockState;
|
import net.minecraft.block.state.IBlockState;
|
||||||
import net.minecraft.item.ItemBlock;
|
import net.minecraft.item.ItemBlock;
|
||||||
|
import net.minecraft.util.BlockPos;
|
||||||
|
import net.minecraft.world.IBlockAccess;
|
||||||
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
public class BlockBOPVine extends BlockVine implements IBOPBlock
|
public class BlockBOPVine extends BlockVine implements IBOPBlock
|
||||||
{
|
{
|
||||||
|
@ -25,11 +29,43 @@ public class BlockBOPVine extends BlockVine implements IBOPBlock
|
||||||
public IBlockState getNamedState(String name) {return this.namedStates.get(name);}
|
public IBlockState getNamedState(String name) {return this.namedStates.get(name);}
|
||||||
public Class<? extends ItemBlock> getItemClass() {return ItemBOPBlock.class;}
|
public Class<? extends ItemBlock> getItemClass() {return ItemBOPBlock.class;}
|
||||||
|
|
||||||
public BlockBOPVine()
|
// if set to true, (the default), use BlockVine getBlockColor(), getRenderColor() and colorMultiplier() functions to color the texture based on biome
|
||||||
|
// if set to false, use 0xFFFFFF for all the color functions so that the texture is used as it is
|
||||||
|
protected boolean useGreyScaleTextures;
|
||||||
|
|
||||||
|
public BlockBOPVine(boolean useGreyScaleTextures)
|
||||||
{
|
{
|
||||||
super();
|
super();
|
||||||
this.setHardness(0.2F);
|
this.setHardness(0.2F);
|
||||||
|
this.useGreyScaleTextures = useGreyScaleTextures;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public BlockBOPVine()
|
||||||
|
{
|
||||||
|
this(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
public int getBlockColor()
|
||||||
|
{
|
||||||
|
return (this.useGreyScaleTextures ? super.getBlockColor() : 0xFFFFFF);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
public int getRenderColor(IBlockState state)
|
||||||
|
{
|
||||||
|
return (this.useGreyScaleTextures ? super.getRenderColor(state) : 0xFFFFFF);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
public int colorMultiplier(IBlockAccess worldIn, BlockPos pos, int renderPass)
|
||||||
|
{
|
||||||
|
return (this.useGreyScaleTextures ? super.colorMultiplier(worldIn, pos, renderPass) : 0xFFFFFF);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -156,12 +156,12 @@ public class ModBlocks
|
||||||
dead_log = registerBlock( new BlockBOPLog(), "dead_log" ); // no planks, stairs, etc
|
dead_log = registerBlock( new BlockBOPLog(), "dead_log" ); // no planks, stairs, etc
|
||||||
|
|
||||||
//vines
|
//vines
|
||||||
// TODO: colors? rendering modes? special placement rules?
|
// TODO: special placement rules?
|
||||||
flower_vine = registerBlock( new BlockBOPVine(), "flower_vine" );
|
flower_vine = registerBlock( new BlockBOPVine(false), "flower_vine" );
|
||||||
ivy = registerBlock( new BlockBOPVine(), "ivy" );
|
ivy = registerBlock( new BlockBOPVine(true), "ivy" );
|
||||||
moss = registerBlock( new BlockBOPVine(), "moss" );
|
moss = registerBlock( new BlockBOPVine(true), "moss" );
|
||||||
tree_moss = registerBlock( new BlockBOPVine(), "tree_moss" );
|
tree_moss = registerBlock( new BlockBOPVine(false), "tree_moss" );
|
||||||
wisteria = registerBlock( new BlockBOPVine(), "wisteria" );
|
wisteria = registerBlock( new BlockBOPVine(false), "wisteria" );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue