From 3fa19ac90cf3807155da59aff2d06666c16abe6c Mon Sep 17 00:00:00 2001 From: Cheeserolls Date: Sat, 11 Apr 2015 23:52:03 +0100 Subject: [PATCH] Add tall cattail, rename BlockDoubleFoliage to BlockBOPDoublePlant for consistency --- .../biomesoplenty/api/block/BOPBlocks.java | 2 +- ...eFoliage.java => BlockBOPDoublePlant.java} | 44 ++++++++++++++---- .../common/block/BlockBOPPlant.java | 1 - .../biomesoplenty/common/init/ModBlocks.java | 4 +- .../blockstates/double_foliage.json | 6 --- .../blockstates/double_plant.json | 8 ++++ .../models/block/tall_cattail_lower.json | 6 +++ .../models/block/tall_cattail_upper.json | 6 +++ .../models/item/tall_cattail.json | 19 ++++++++ .../textures/blocks/tall_cattail_lower.png | Bin 0 -> 528 bytes .../textures/blocks/tall_cattail_upper.png | Bin 0 -> 649 bytes 11 files changed, 77 insertions(+), 19 deletions(-) rename src/main/java/biomesoplenty/common/block/{BlockDoubleFoliage.java => BlockBOPDoublePlant.java} (84%) delete mode 100644 src/main/resources/assets/biomesoplenty/blockstates/double_foliage.json create mode 100644 src/main/resources/assets/biomesoplenty/blockstates/double_plant.json create mode 100644 src/main/resources/assets/biomesoplenty/models/block/tall_cattail_lower.json create mode 100644 src/main/resources/assets/biomesoplenty/models/block/tall_cattail_upper.json create mode 100644 src/main/resources/assets/biomesoplenty/models/item/tall_cattail.json create mode 100644 src/main/resources/assets/biomesoplenty/textures/blocks/tall_cattail_lower.png create mode 100644 src/main/resources/assets/biomesoplenty/textures/blocks/tall_cattail_upper.png diff --git a/src/main/java/biomesoplenty/api/block/BOPBlocks.java b/src/main/java/biomesoplenty/api/block/BOPBlocks.java index 9dbbcacd3..b1210341a 100644 --- a/src/main/java/biomesoplenty/api/block/BOPBlocks.java +++ b/src/main/java/biomesoplenty/api/block/BOPBlocks.java @@ -126,7 +126,7 @@ public class BOPBlocks public static Block plant_0; public static Block plant_1; - public static Block double_foliage; + public static Block double_plant; public static Block honey_block; diff --git a/src/main/java/biomesoplenty/common/block/BlockDoubleFoliage.java b/src/main/java/biomesoplenty/common/block/BlockBOPDoublePlant.java similarity index 84% rename from src/main/java/biomesoplenty/common/block/BlockDoubleFoliage.java rename to src/main/java/biomesoplenty/common/block/BlockBOPDoublePlant.java index 3d8129891..1d37ee4df 100644 --- a/src/main/java/biomesoplenty/common/block/BlockDoubleFoliage.java +++ b/src/main/java/biomesoplenty/common/block/BlockBOPDoublePlant.java @@ -21,6 +21,7 @@ import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; import net.minecraft.util.BlockPos; import net.minecraft.util.IStringSerializable; +import net.minecraft.world.ColorizerFoliage; import net.minecraft.world.ColorizerGrass; import net.minecraft.world.IBlockAccess; 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.SideOnly; -public class BlockDoubleFoliage extends BlockDoubleDecoration implements IShearable +public class BlockBOPDoublePlant extends BlockDoubleDecoration implements IShearable { // add properties (note we inherit HALF from BlockDoubleDecoration) public static enum FoliageType implements IStringSerializable { - FLAX; + FLAX, TALL_CATTAIL; @Override public String getName() { @@ -65,7 +66,7 @@ public class BlockDoubleFoliage extends BlockDoubleDecoration implements ISheara } - public BlockDoubleFoliage() + public BlockBOPDoublePlant() { super(); 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 @SideOnly(Side.CLIENT) public int getBlockColor() { - return ColorizerGrass.getGrassColor(0.5D, 1.0D); + return 0xFFFFFF; } @Override @SideOnly(Side.CLIENT) 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 @SideOnly(Side.CLIENT) 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); + case PLAIN: default: + return 0xFFFFFF; } } @@ -125,6 +150,7 @@ public class BlockDoubleFoliage extends BlockDoubleDecoration implements ISheara } + // different variants have different sizes @Override public void setBlockBoundsBasedOnState(IBlockAccess worldIn, BlockPos pos) @@ -199,7 +225,7 @@ public class BlockDoubleFoliage extends BlockDoubleDecoration implements ISheara // add items based on the VARIANT switch ((FoliageType) lowerState.getValue(VARIANT)) - { + { default: // default is to get the (lower) block unaltered ret.add(new ItemStack(this, 1, this.getMetaFromState(lowerState.withProperty(HALF, Half.LOWER) ))); diff --git a/src/main/java/biomesoplenty/common/block/BlockBOPPlant.java b/src/main/java/biomesoplenty/common/block/BlockBOPPlant.java index 6e37267bd..82cdeaf5d 100644 --- a/src/main/java/biomesoplenty/common/block/BlockBOPPlant.java +++ b/src/main/java/biomesoplenty/common/block/BlockBOPPlant.java @@ -52,7 +52,6 @@ import net.minecraftforge.common.util.FakePlayer; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -// TODO: shrub needs custom item texture // TODO: double cattail // TODO: pick block? diff --git a/src/main/java/biomesoplenty/common/init/ModBlocks.java b/src/main/java/biomesoplenty/common/init/ModBlocks.java index 4024a7030..0617342a0 100644 --- a/src/main/java/biomesoplenty/common/init/ModBlocks.java +++ b/src/main/java/biomesoplenty/common/init/ModBlocks.java @@ -60,7 +60,7 @@ import biomesoplenty.common.block.BlockBamboo; import biomesoplenty.common.block.BlockBones; import biomesoplenty.common.block.BlockCoral; import biomesoplenty.common.block.BlockCrystal; -import biomesoplenty.common.block.BlockDoubleFoliage; +import biomesoplenty.common.block.BlockBOPDoublePlant; import biomesoplenty.common.block.BlockFlesh; import biomesoplenty.common.block.BlockBOPPlant0; import biomesoplenty.common.block.BlockBOPPlant1; @@ -223,7 +223,7 @@ public class ModBlocks plant_0 = registerBlock( new BlockBOPPlant0(), "plant_0" ); 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" ); diff --git a/src/main/resources/assets/biomesoplenty/blockstates/double_foliage.json b/src/main/resources/assets/biomesoplenty/blockstates/double_foliage.json deleted file mode 100644 index 3e645d109..000000000 --- a/src/main/resources/assets/biomesoplenty/blockstates/double_foliage.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "variants": { - "half=upper,variant=flax": { "model": "biomesoplenty:flax_upper" }, - "half=lower,variant=flax": { "model": "biomesoplenty:flax_lower" } - } -} \ No newline at end of file diff --git a/src/main/resources/assets/biomesoplenty/blockstates/double_plant.json b/src/main/resources/assets/biomesoplenty/blockstates/double_plant.json new file mode 100644 index 000000000..055487112 --- /dev/null +++ b/src/main/resources/assets/biomesoplenty/blockstates/double_plant.json @@ -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" } + } +} \ No newline at end of file diff --git a/src/main/resources/assets/biomesoplenty/models/block/tall_cattail_lower.json b/src/main/resources/assets/biomesoplenty/models/block/tall_cattail_lower.json new file mode 100644 index 000000000..85454f5b8 --- /dev/null +++ b/src/main/resources/assets/biomesoplenty/models/block/tall_cattail_lower.json @@ -0,0 +1,6 @@ +{ + "parent": "block/crop", + "textures": { + "crop": "biomesoplenty:blocks/tall_cattail_lower" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/biomesoplenty/models/block/tall_cattail_upper.json b/src/main/resources/assets/biomesoplenty/models/block/tall_cattail_upper.json new file mode 100644 index 000000000..b7c5df83e --- /dev/null +++ b/src/main/resources/assets/biomesoplenty/models/block/tall_cattail_upper.json @@ -0,0 +1,6 @@ +{ + "parent": "block/crop", + "textures": { + "crop": "biomesoplenty:blocks/tall_cattail_upper" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/biomesoplenty/models/item/tall_cattail.json b/src/main/resources/assets/biomesoplenty/models/item/tall_cattail.json new file mode 100644 index 000000000..47b584488 --- /dev/null +++ b/src/main/resources/assets/biomesoplenty/models/item/tall_cattail.json @@ -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 ] + } + } +} + diff --git a/src/main/resources/assets/biomesoplenty/textures/blocks/tall_cattail_lower.png b/src/main/resources/assets/biomesoplenty/textures/blocks/tall_cattail_lower.png new file mode 100644 index 0000000000000000000000000000000000000000..a18d10e3b1c8dd06a5db66844058da268e2c0d50 GIT binary patch literal 528 zcmV+r0`L8aP)N2bPDNB8 zb~7$DE-^7j^FlWO00E3iL_t(IPhFGgP69y?gy$u^Pe3j~G*RLe4c_+?sPT%%_uqu& zSZMj$)MoTYGcz?c-PP4g==b}<%tGaL&qkwB7>~z(Ry4nkt@yAt*;?p!yE&J2>ALYt zTE1yo^=;q5!C>In;?=s5tp0K6D;Nb>i%&bYde?G142MI{OjaI2AhIkAE4Ld~dTyIk z&Yo3VC0OBp(LK7d5NB zA2>$%51>r^uOe1P0RoKH2`6Dj`DNEo)9dxzEScH(JaTVhBf&79b3Qi4g|qAxoMS~i zX8q%VHkvJ=q&$u%L*NA-z#*Z7Y^a8OoEMq#(U#hQ$3xVL<3CfKk`eS3Pl5*+j1nGd zVrl_yNYm8GlA9!nyGt@2kwBH<(E=EIJ|+i|EwdnN5=u(K>610TC%|V;%YJr1mDp2( zRl(=WUECV#RM4wq7XLVXZ6bm57^xJ2%Ze)YsLK0=$f^VcBvoS%hLKWbX5j}^j%*Q^ Sk@A250000N2bPDNB8 zb~7$DE-^7j^FlWO00IR`L_t(IPi0cuPFhhAJ=_T&&@|pElq!^q*eak@DN?YCB(288 zc%h=AKKRy$dI?F>^r1h(HF7K_DjI-SPP(+z=`-EKG9?KW!=Yqgpw z&}AF+u`F;O=04 zoOg&3=<;=IR!Xx0QT724A@U|Msz*3oPRNh)oT%Lp`}vrhtt4e}-20!kh1l>vqPy9M zKqMa-6qn0oCgI@wc19|>F>O_0VE!p{gReu3?+Y=Gg~e)N*ulng;Q{TSFK3SP?*;BHDcB9M$6q_se|3nMyU jw7VVY