From 9c884be31c5f151ff72b17309c0aa0913b88e17c Mon Sep 17 00:00:00 2001 From: Sollace Date: Wed, 9 Jan 2019 16:59:14 +0200 Subject: [PATCH] Fixed stacked sticks not inheriting flags from the base --- .../unicopia/block/BlockTomatoPlant.java | 14 +++++++++++++- .../minelittlepony/unicopia/item/ItemStick.java | 11 +---------- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/src/main/java/com/minelittlepony/unicopia/block/BlockTomatoPlant.java b/src/main/java/com/minelittlepony/unicopia/block/BlockTomatoPlant.java index 585f8704..068295f9 100644 --- a/src/main/java/com/minelittlepony/unicopia/block/BlockTomatoPlant.java +++ b/src/main/java/com/minelittlepony/unicopia/block/BlockTomatoPlant.java @@ -39,7 +39,7 @@ public class BlockTomatoPlant extends BlockCrops { setTranslationKey(name); setDefaultState(getDefaultState().withProperty(TYPE, Type.NORMAL)); - setHardness(3); + setHardness(0.2F); setSoundType(SoundType.WOOD); } @@ -194,6 +194,18 @@ public class BlockTomatoPlant extends BlockCrops { return withAge(age).withProperty(TYPE, Type.values()[half]); } + public IBlockState getPlacedState(IBlockState state) { + if (state.getBlock() instanceof BlockCloudFarm) { + return getDefaultState().withProperty(TYPE, Type.CLOUDSDALE); + } + + if (state.getBlock() instanceof BlockTomatoPlant) { + return getDefaultState().withProperty(TYPE, state.getValue(TYPE)); + } + + return getDefaultState(); + } + @Override public int getMetaFromState(IBlockState state) { int age = getAge(state); diff --git a/src/main/java/com/minelittlepony/unicopia/item/ItemStick.java b/src/main/java/com/minelittlepony/unicopia/item/ItemStick.java index c7e26566..bc354513 100644 --- a/src/main/java/com/minelittlepony/unicopia/item/ItemStick.java +++ b/src/main/java/com/minelittlepony/unicopia/item/ItemStick.java @@ -1,9 +1,6 @@ package com.minelittlepony.unicopia.item; import com.minelittlepony.unicopia.UBlocks; -import com.minelittlepony.unicopia.block.BlockCloudFarm; -import com.minelittlepony.unicopia.block.BlockTomatoPlant; -import com.minelittlepony.unicopia.block.BlockTomatoPlant.Type; import net.minecraft.advancements.CriteriaTriggers; import net.minecraft.block.SoundType; @@ -38,13 +35,7 @@ public class ItemStick extends ItemSeeds { if (facing == EnumFacing.UP && player.canPlayerEdit(pos.offset(facing), facing, itemstack) && state.getBlock().canSustainPlant(state, worldIn, pos, EnumFacing.UP, this) && worldIn.isAirBlock(pos.up())) { - IBlockState cropState = UBlocks.tomato_plant.getDefaultState(); - - if (state.getBlock() instanceof BlockCloudFarm) { - cropState = cropState.withProperty(BlockTomatoPlant.TYPE, Type.CLOUDSDALE); - } - - worldIn.setBlockState(pos.up(), cropState); + worldIn.setBlockState(pos.up(), UBlocks.tomato_plant.getPlacedState(state)); SoundType sound = state.getBlock().getSoundType(state, worldIn, pos, player);