Fixed stacked sticks not inheriting flags from the base

This commit is contained in:
Sollace 2019-01-09 16:59:14 +02:00
parent 2dc25f9d10
commit 9c884be31c
2 changed files with 14 additions and 11 deletions

View file

@ -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);

View file

@ -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);