Fix render colors for some plants
This commit is contained in:
parent
e767ee0274
commit
930ae1f79f
1 changed files with 34 additions and 13 deletions
|
@ -41,6 +41,7 @@ import net.minecraft.util.BlockPos;
|
||||||
import net.minecraft.util.DamageSource;
|
import net.minecraft.util.DamageSource;
|
||||||
import net.minecraft.util.EnumFacing;
|
import net.minecraft.util.EnumFacing;
|
||||||
import net.minecraft.util.EnumParticleTypes;
|
import net.minecraft.util.EnumParticleTypes;
|
||||||
|
import net.minecraft.world.ColorizerFoliage;
|
||||||
import net.minecraft.world.ColorizerGrass;
|
import net.minecraft.world.ColorizerGrass;
|
||||||
import net.minecraft.world.IBlockAccess;
|
import net.minecraft.world.IBlockAccess;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
@ -284,45 +285,65 @@ public abstract class BlockBOPPlant extends BlockDecoration implements IShearabl
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public enum ColoringType {PLAIN, LIKE_LEAVES, LIKE_GRASS};
|
||||||
|
|
||||||
|
public static ColoringType getColoringType(AllPlants plant)
|
||||||
|
{
|
||||||
|
switch (plant)
|
||||||
|
{
|
||||||
|
case SHRUB: case LEAFPILE: case POISONIVY: case BUSH: case BERRYBUSH:
|
||||||
|
return ColoringType.LIKE_LEAVES;
|
||||||
|
case SHORTGRASS: case MEDIUMGRASS: case SPROUT: case KORU: case CLOVERPATCH:
|
||||||
|
return ColoringType.LIKE_GRASS;
|
||||||
|
default:
|
||||||
|
return ColoringType.PLAIN;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// TODO: comment these
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public int getBlockColor()
|
public int getBlockColor()
|
||||||
{
|
{
|
||||||
return ColorizerGrass.getGrassColor(0.5D, 1.0D);
|
return 0xFFFFFF;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public int getRenderColor(IBlockState state)
|
public int getRenderColor(IBlockState state)
|
||||||
{
|
{
|
||||||
return this.getBlockColor();
|
switch (getColoringType((AllPlants) state.getValue(getMyVariantProperty())))
|
||||||
|
{
|
||||||
|
case LIKE_LEAVES:
|
||||||
|
return ColorizerFoliage.getFoliageColorBasic();
|
||||||
|
case LIKE_GRASS:
|
||||||
|
return ColorizerGrass.getGrassColor(0.5D, 1.0D);
|
||||||
|
case PLAIN: default:
|
||||||
|
return 0xFFFFFF;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public int colorMultiplier(IBlockAccess worldIn, BlockPos pos, int renderPass)
|
public int colorMultiplier(IBlockAccess worldIn, BlockPos pos, int renderPass)
|
||||||
{
|
{
|
||||||
IBlockState state = worldIn.getBlockState(pos);
|
switch (getColoringType((AllPlants) worldIn.getBlockState(pos).getValue(getMyVariantProperty())))
|
||||||
switch ((AllPlants) state.getValue(getMyVariantProperty()))
|
|
||||||
{
|
{
|
||||||
case SHRUB: case LEAFPILE:
|
case LIKE_LEAVES:
|
||||||
return BiomeColorHelper.getFoliageColorAtPos(worldIn, pos);
|
return BiomeColorHelper.getFoliageColorAtPos(worldIn, pos);
|
||||||
case DEADLEAFPILE:
|
case LIKE_GRASS:
|
||||||
return 0xFFFFFF;
|
|
||||||
default:
|
|
||||||
return BiomeColorHelper.getGrassColorAtPos(worldIn, pos);
|
return BiomeColorHelper.getGrassColorAtPos(worldIn, pos);
|
||||||
|
case PLAIN: default:
|
||||||
|
return 0xFFFFFF;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// berrybush item should not be tinted, even though the model is
|
// berrybush / shrub item should not be tinted, even though the model is
|
||||||
@Override
|
@Override
|
||||||
public int getItemRenderColor(IBlockState state, int tintIndex)
|
public int getItemRenderColor(IBlockState state, int tintIndex)
|
||||||
{
|
{
|
||||||
switch ((AllPlants) state.getValue(getMyVariantProperty()))
|
switch ((AllPlants) state.getValue(getMyVariantProperty()))
|
||||||
{
|
{
|
||||||
case BERRYBUSH:
|
case BERRYBUSH: case SHRUB:
|
||||||
return 0xFFFFFF;
|
return 0xFFFFFF;
|
||||||
default:
|
default:
|
||||||
return this.getRenderColor(state);
|
return this.getRenderColor(state);
|
||||||
|
|
Loading…
Reference in a new issue