Add tall cattail, rename BlockDoubleFoliage to BlockBOPDoublePlant for consistency
This commit is contained in:
parent
25075b9d89
commit
3fa19ac90c
11 changed files with 77 additions and 19 deletions
|
@ -126,7 +126,7 @@ public class BOPBlocks
|
||||||
|
|
||||||
public static Block plant_0;
|
public static Block plant_0;
|
||||||
public static Block plant_1;
|
public static Block plant_1;
|
||||||
public static Block double_foliage;
|
public static Block double_plant;
|
||||||
|
|
||||||
public static Block honey_block;
|
public static Block honey_block;
|
||||||
|
|
||||||
|
|
|
@ -21,6 +21,7 @@ import net.minecraft.init.Blocks;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.util.BlockPos;
|
import net.minecraft.util.BlockPos;
|
||||||
import net.minecraft.util.IStringSerializable;
|
import net.minecraft.util.IStringSerializable;
|
||||||
|
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;
|
||||||
|
@ -30,13 +31,13 @@ import net.minecraftforge.common.IShearable;
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
public class BlockDoubleFoliage extends BlockDoubleDecoration implements IShearable
|
public class BlockBOPDoublePlant extends BlockDoubleDecoration implements IShearable
|
||||||
{
|
{
|
||||||
|
|
||||||
// add properties (note we inherit HALF from BlockDoubleDecoration)
|
// add properties (note we inherit HALF from BlockDoubleDecoration)
|
||||||
public static enum FoliageType implements IStringSerializable
|
public static enum FoliageType implements IStringSerializable
|
||||||
{
|
{
|
||||||
FLAX;
|
FLAX, TALL_CATTAIL;
|
||||||
@Override
|
@Override
|
||||||
public String getName()
|
public String getName()
|
||||||
{
|
{
|
||||||
|
@ -65,7 +66,7 @@ public class BlockDoubleFoliage extends BlockDoubleDecoration implements ISheara
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public BlockDoubleFoliage()
|
public BlockBOPDoublePlant()
|
||||||
{
|
{
|
||||||
super();
|
super();
|
||||||
this.setDefaultState( this.blockState.getBaseState().withProperty(HALF, Half.LOWER) .withProperty(VARIANT, FoliageType.FLAX) );
|
this.setDefaultState( this.blockState.getBaseState().withProperty(HALF, Half.LOWER) .withProperty(VARIANT, FoliageType.FLAX) );
|
||||||
|
@ -85,29 +86,53 @@ public class BlockDoubleFoliage extends BlockDoubleDecoration implements ISheara
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// TODO: comment these
|
public enum ColoringType {PLAIN, LIKE_LEAVES, LIKE_GRASS};
|
||||||
|
|
||||||
|
public static ColoringType getColoringType(FoliageType plant)
|
||||||
|
{
|
||||||
|
switch (plant)
|
||||||
|
{
|
||||||
|
case FLAX:
|
||||||
|
return ColoringType.LIKE_GRASS;
|
||||||
|
default:
|
||||||
|
return ColoringType.PLAIN;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@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((FoliageType) state.getValue(VARIANT)))
|
||||||
|
{
|
||||||
|
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)
|
||||||
{
|
{
|
||||||
switch ((FoliageType) worldIn.getBlockState(pos).getValue(VARIANT))
|
switch (getColoringType((FoliageType) worldIn.getBlockState(pos).getValue(VARIANT)))
|
||||||
{
|
{
|
||||||
default:
|
case LIKE_LEAVES:
|
||||||
|
return BiomeColorHelper.getFoliageColorAtPos(worldIn, pos);
|
||||||
|
case LIKE_GRASS:
|
||||||
return BiomeColorHelper.getGrassColorAtPos(worldIn, pos);
|
return BiomeColorHelper.getGrassColorAtPos(worldIn, pos);
|
||||||
|
case PLAIN: default:
|
||||||
|
return 0xFFFFFF;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -125,6 +150,7 @@ public class BlockDoubleFoliage extends BlockDoubleDecoration implements ISheara
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// different variants have different sizes
|
// different variants have different sizes
|
||||||
@Override
|
@Override
|
||||||
public void setBlockBoundsBasedOnState(IBlockAccess worldIn, BlockPos pos)
|
public void setBlockBoundsBasedOnState(IBlockAccess worldIn, BlockPos pos)
|
||||||
|
@ -199,7 +225,7 @@ public class BlockDoubleFoliage extends BlockDoubleDecoration implements ISheara
|
||||||
|
|
||||||
// add items based on the VARIANT
|
// add items based on the VARIANT
|
||||||
switch ((FoliageType) lowerState.getValue(VARIANT))
|
switch ((FoliageType) lowerState.getValue(VARIANT))
|
||||||
{
|
{
|
||||||
default:
|
default:
|
||||||
// default is to get the (lower) block unaltered
|
// default is to get the (lower) block unaltered
|
||||||
ret.add(new ItemStack(this, 1, this.getMetaFromState(lowerState.withProperty(HALF, Half.LOWER) )));
|
ret.add(new ItemStack(this, 1, this.getMetaFromState(lowerState.withProperty(HALF, Half.LOWER) )));
|
|
@ -52,7 +52,6 @@ import net.minecraftforge.common.util.FakePlayer;
|
||||||
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: shrub needs custom item texture
|
|
||||||
// TODO: double cattail
|
// TODO: double cattail
|
||||||
// TODO: pick block?
|
// TODO: pick block?
|
||||||
|
|
||||||
|
|
|
@ -60,7 +60,7 @@ import biomesoplenty.common.block.BlockBamboo;
|
||||||
import biomesoplenty.common.block.BlockBones;
|
import biomesoplenty.common.block.BlockBones;
|
||||||
import biomesoplenty.common.block.BlockCoral;
|
import biomesoplenty.common.block.BlockCoral;
|
||||||
import biomesoplenty.common.block.BlockCrystal;
|
import biomesoplenty.common.block.BlockCrystal;
|
||||||
import biomesoplenty.common.block.BlockDoubleFoliage;
|
import biomesoplenty.common.block.BlockBOPDoublePlant;
|
||||||
import biomesoplenty.common.block.BlockFlesh;
|
import biomesoplenty.common.block.BlockFlesh;
|
||||||
import biomesoplenty.common.block.BlockBOPPlant0;
|
import biomesoplenty.common.block.BlockBOPPlant0;
|
||||||
import biomesoplenty.common.block.BlockBOPPlant1;
|
import biomesoplenty.common.block.BlockBOPPlant1;
|
||||||
|
@ -223,7 +223,7 @@ public class ModBlocks
|
||||||
|
|
||||||
plant_0 = registerBlock( new BlockBOPPlant0(), "plant_0" );
|
plant_0 = registerBlock( new BlockBOPPlant0(), "plant_0" );
|
||||||
plant_1 = registerBlock( new BlockBOPPlant1(), "plant_1" );
|
plant_1 = registerBlock( new BlockBOPPlant1(), "plant_1" );
|
||||||
double_foliage = registerBlock( new BlockDoubleFoliage(), "double_foliage" );
|
double_plant = registerBlock( new BlockBOPDoublePlant(), "double_plant" );
|
||||||
|
|
||||||
honey_block = registerBlock( new BlockHoney(), "honey_block" );
|
honey_block = registerBlock( new BlockHoney(), "honey_block" );
|
||||||
|
|
||||||
|
|
|
@ -1,6 +0,0 @@
|
||||||
{
|
|
||||||
"variants": {
|
|
||||||
"half=upper,variant=flax": { "model": "biomesoplenty:flax_upper" },
|
|
||||||
"half=lower,variant=flax": { "model": "biomesoplenty:flax_lower" }
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
{
|
||||||
|
"variants": {
|
||||||
|
"half=upper,variant=flax": { "model": "biomesoplenty:flax_upper" },
|
||||||
|
"half=lower,variant=flax": { "model": "biomesoplenty:flax_lower" },
|
||||||
|
"half=upper,variant=tall_cattail": { "model": "biomesoplenty:tall_cattail_upper" },
|
||||||
|
"half=lower,variant=tall_cattail": { "model": "biomesoplenty:tall_cattail_lower" }
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
"parent": "block/crop",
|
||||||
|
"textures": {
|
||||||
|
"crop": "biomesoplenty:blocks/tall_cattail_lower"
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
"parent": "block/crop",
|
||||||
|
"textures": {
|
||||||
|
"crop": "biomesoplenty:blocks/tall_cattail_upper"
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,19 @@
|
||||||
|
{
|
||||||
|
"parent": "builtin/generated",
|
||||||
|
"textures": {
|
||||||
|
"layer0": "biomesoplenty:blocks/tall_cattail_upper"
|
||||||
|
},
|
||||||
|
"display": {
|
||||||
|
"thirdperson": {
|
||||||
|
"rotation": [ -90, 0, 0 ],
|
||||||
|
"translation": [ 0, 1, -3 ],
|
||||||
|
"scale": [ 0.55, 0.55, 0.55 ]
|
||||||
|
},
|
||||||
|
"firstperson": {
|
||||||
|
"rotation": [ 0, -135, 25 ],
|
||||||
|
"translation": [ 0, 4, 2 ],
|
||||||
|
"scale": [ 1.7, 1.7, 1.7 ]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Binary file not shown.
After Width: | Height: | Size: 528 B |
Binary file not shown.
After Width: | Height: | Size: 649 B |
Loading…
Reference in a new issue