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 public class BlockBOPDirt extends Block implements IBOPBlock
{ {
// TODO: make it ploughable into farmland
// add properties // add properties
public static enum BOPDirtType implements IStringSerializable 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 public class BlockBOPGrass extends BlockGrass implements IBOPBlock
{ {
// TODO: make it ploughable into farmland
// add properties (note we also inherit the SNOWY property from BlockGrass) // add properties (note we also inherit the SNOWY property from BlockGrass)
public static enum BOPGrassType implements IStringSerializable 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.BlockPos;
import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumWorldBlockLayer; import net.minecraft.util.EnumWorldBlockLayer;
import net.minecraft.world.ColorizerFoliage;
import net.minecraft.world.IBlockAccess; import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraft.world.biome.BiomeColorHelper;
import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly; import net.minecraftforge.fml.relauncher.SideOnly;
// TODO: sort out proper base color when using fast graphics // TODO: using fast graphics - transparent color is always rendered as black - can we override this somehow?
// TODO: flowers look tinted when using fast graphics // 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
// TODO: inside surface not visible with 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 public class BlockBOPLeaves extends BlockLeaves implements IBOPBlock
{ {
@ -127,6 +129,68 @@ public class BlockBOPLeaves extends BlockLeaves implements IBOPBlock
return meta; 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 @Override
protected int getSaplingDropChance(IBlockState state) protected int getSaplingDropChance(IBlockState state)
{ {

View file

@ -70,7 +70,6 @@ public class BlockCoral extends BlockDecoration
// set some defaults // set some defaults
this.setHardness(0.6F); this.setHardness(0.6F);
this.setStepSound(Block.soundTypeSand); 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) ); 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(); 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 // glowing_coral emits light
@Override @Override

View file

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

View file

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