Fix some leaf rendering problems, and a couple of other minor TODOs

This commit is contained in:
Cheeserolls 2015-05-23 23:47:23 +01:00
parent ebd6a98911
commit 5016917fb9
6 changed files with 82 additions and 13 deletions

View File

@ -32,6 +32,7 @@ import biomesoplenty.common.item.ItemBOPBlock;
public class BlockBOPDirt extends Block implements IBOPBlock
{
// TODO: make it ploughable into farmland
// add properties
public static enum BOPDirtType implements IStringSerializable

View File

@ -40,6 +40,8 @@ import net.minecraftforge.fml.relauncher.SideOnly;
public class BlockBOPGrass extends BlockGrass implements IBOPBlock
{
// TODO: make it ploughable into farmland
// add properties (note we also inherit the SNOWY property from BlockGrass)
public static enum BOPGrassType implements IStringSerializable
{

View File

@ -28,14 +28,16 @@ import net.minecraft.item.ItemStack;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumWorldBlockLayer;
import net.minecraft.world.ColorizerFoliage;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraft.world.biome.BiomeColorHelper;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
// TODO: sort out proper base color when using fast graphics
// TODO: flowers look tinted when using fast graphics
// TODO: inside surface not visible with fast graphics
// TODO: using fast graphics - transparent color is always rendered as black - can we override this somehow?
// TODO: using fast graphics - flowering leaves overlay seems to be tinted green - I think that is because it doesn't use distinct tintindexes on fast graphics
// In older versions a completely different single texture could be used for fast graphics, but I'm not sure that's an option any more
public class BlockBOPLeaves extends BlockLeaves implements IBOPBlock
{
@ -127,6 +129,68 @@ public class BlockBOPLeaves extends BlockLeaves implements IBOPBlock
return meta;
}
public enum ColoringType {PLAIN, TINTED, OVERLAY};
public static ColoringType getColoringType(BOPTrees tree)
{
switch (tree)
{
case BAMBOO: case DEAD: case ETHEREAL: case FIR: case HELLBARK: case JACARANDA: case MAGIC: case MAPLE: case ORANGE_AUTUMN: case ORIGIN: case PINK_CHERRY: case WHITE_CHERRY: case YELLOW_AUTUMN: case RED_BIG_FLOWER: case YELLOW_BIG_FLOWER:
return ColoringType.PLAIN;
case FLOWERING:
return ColoringType.OVERLAY;
case DARK: case MAHOGANY: case MANGROVE: case PALM: case PINE: case REDWOOD: case SACRED_OAK: case WILLOW: default:
return ColoringType.TINTED;
}
}
@Override
@SideOnly(Side.CLIENT)
public int getBlockColor()
{
return 0xFFFFFF;
}
@Override
@SideOnly(Side.CLIENT)
public int getRenderColor(IBlockState state)
{
switch (getColoringType((BOPTrees) state.getValue(this.variantProperty)))
{
case TINTED:
return ColorizerFoliage.getFoliageColorBasic();
case OVERLAY:
return ColorizerFoliage.getFoliageColorBasic();
case PLAIN: default:
return 0xFFFFFF;
}
}
@Override
@SideOnly(Side.CLIENT)
public int colorMultiplier(IBlockAccess worldIn, BlockPos pos, int tintIndex)
{
switch (getColoringType((BOPTrees) worldIn.getBlockState(pos).getValue(this.variantProperty)))
{
case TINTED:
return BiomeColorHelper.getFoliageColorAtPos(worldIn, pos);
case OVERLAY:
switch (tintIndex)
{
case 0:
return BiomeColorHelper.getFoliageColorAtPos(worldIn, pos);
case 1: default:
return 0xFFFFFF;
}
case PLAIN: default:
return 0xFFFFFF;
}
}
@Override
protected int getSaplingDropChance(IBlockState state)
{

View File

@ -70,7 +70,6 @@ public class BlockCoral extends BlockDecoration
// set some defaults
this.setHardness(0.6F);
this.setStepSound(Block.soundTypeSand);
this.setBlockBoundsByRadiusAndHeight(0.4F, 0.8F); // TODO: account for offset
this.setDefaultState( this.blockState.getBaseState().withProperty(LEVEL, 15).withProperty(VARIANT, CoralType.PINK) );
}
@ -87,6 +86,12 @@ public class BlockCoral extends BlockDecoration
{
return ((CoralType) state.getValue(VARIANT)).ordinal();
}
@Override
public void setBlockBoundsBasedOnState(IBlockAccess world, BlockPos pos)
{
this.setBlockBoundsByRadiusAndHeightWithXZOffset(0.4F, 0.8F, pos);
}
// glowing_coral emits light
@Override

View File

@ -49,9 +49,6 @@ public class EntityDart extends EntityArrow
super(world, x, y, z);
}
// TODO: figure out what this dataWatcher stuff is all about
@Override
protected void entityInit()
{

View File

@ -17,12 +17,12 @@
{ "from": [ 0, 0, 0 ],
"to": [ 16, 16, 16 ],
"faces": {
"down": { "uv": [ 0, 0, 16, 16 ], "texture": "#over", "cullface": "down" },
"up": { "uv": [ 0, 0, 16, 16 ], "texture": "#over", "cullface": "up" },
"north": { "uv": [ 0, 0, 16, 16 ], "texture": "#over", "cullface": "north" },
"south": { "uv": [ 0, 0, 16, 16 ], "texture": "#over", "cullface": "south" },
"west": { "uv": [ 0, 0, 16, 16 ], "texture": "#over", "cullface": "west" },
"east": { "uv": [ 0, 0, 16, 16 ], "texture": "#over", "cullface": "east" }
"down": { "uv": [ 0, 0, 16, 16 ], "texture": "#over", "cullface": "down", "tintindex": 1 },
"up": { "uv": [ 0, 0, 16, 16 ], "texture": "#over", "cullface": "up", "tintindex": 1 },
"north": { "uv": [ 0, 0, 16, 16 ], "texture": "#over", "cullface": "north", "tintindex": 1 },
"south": { "uv": [ 0, 0, 16, 16 ], "texture": "#over", "cullface": "south", "tintindex": 1 },
"west": { "uv": [ 0, 0, 16, 16 ], "texture": "#over", "cullface": "west", "tintindex": 1 },
"east": { "uv": [ 0, 0, 16, 16 ], "texture": "#over", "cullface": "east", "tintindex": 1 }
}
}
]