mirror of
https://github.com/Sollace/Unicopia.git
synced 2024-11-27 23:27:59 +01:00
Fixed stacked sticks not inheriting flags from the base
This commit is contained in:
parent
2dc25f9d10
commit
9c884be31c
2 changed files with 14 additions and 11 deletions
|
@ -39,7 +39,7 @@ public class BlockTomatoPlant extends BlockCrops {
|
||||||
setTranslationKey(name);
|
setTranslationKey(name);
|
||||||
|
|
||||||
setDefaultState(getDefaultState().withProperty(TYPE, Type.NORMAL));
|
setDefaultState(getDefaultState().withProperty(TYPE, Type.NORMAL));
|
||||||
setHardness(3);
|
setHardness(0.2F);
|
||||||
setSoundType(SoundType.WOOD);
|
setSoundType(SoundType.WOOD);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -194,6 +194,18 @@ public class BlockTomatoPlant extends BlockCrops {
|
||||||
return withAge(age).withProperty(TYPE, Type.values()[half]);
|
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
|
@Override
|
||||||
public int getMetaFromState(IBlockState state) {
|
public int getMetaFromState(IBlockState state) {
|
||||||
int age = getAge(state);
|
int age = getAge(state);
|
||||||
|
|
|
@ -1,9 +1,6 @@
|
||||||
package com.minelittlepony.unicopia.item;
|
package com.minelittlepony.unicopia.item;
|
||||||
|
|
||||||
import com.minelittlepony.unicopia.UBlocks;
|
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.advancements.CriteriaTriggers;
|
||||||
import net.minecraft.block.SoundType;
|
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())) {
|
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();
|
worldIn.setBlockState(pos.up(), UBlocks.tomato_plant.getPlacedState(state));
|
||||||
|
|
||||||
if (state.getBlock() instanceof BlockCloudFarm) {
|
|
||||||
cropState = cropState.withProperty(BlockTomatoPlant.TYPE, Type.CLOUDSDALE);
|
|
||||||
}
|
|
||||||
|
|
||||||
worldIn.setBlockState(pos.up(), cropState);
|
|
||||||
|
|
||||||
SoundType sound = state.getBlock().getSoundType(state, worldIn, pos, player);
|
SoundType sound = state.getBlock().getSoundType(state, worldIn, pos, player);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue