Fixed cloud farmland dropping as dirt

This commit is contained in:
Sollace 2019-01-09 16:58:52 +02:00
parent 37cad29e0d
commit 2dc25f9d10
2 changed files with 17 additions and 2 deletions

View file

@ -122,7 +122,7 @@ public class BlockCloudFarm extends UFarmland implements ICloudBlock {
} }
@Override @Override
protected IBlockState getDirtState(World world, BlockPos pos, IBlockState state) { protected IBlockState getDroppedState(IBlockState state) {
return UBlocks.cloud.getDefaultState(); return UBlocks.cloud.getDefaultState();
} }
} }

View file

@ -6,10 +6,12 @@ import com.minelittlepony.util.PosHelper;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.BlockFarmland; import net.minecraft.block.BlockFarmland;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState; import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.init.Blocks; import net.minecraft.init.Blocks;
import net.minecraft.item.Item;
import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
@ -23,6 +25,8 @@ public abstract class UFarmland extends BlockFarmland {
public UFarmland(String domain, String name) { public UFarmland(String domain, String name) {
setTranslationKey(name); setTranslationKey(name);
setRegistryName(domain, name); setRegistryName(domain, name);
setHardness(0.6F);
setSoundType(SoundType.GROUND);
} }
@Override @Override
@ -81,6 +85,13 @@ public abstract class UFarmland extends BlockFarmland {
|| plantable.getPlantType(world, pos.offset(direction)) == EnumPlantType.Crop; || plantable.getPlantType(world, pos.offset(direction)) == EnumPlantType.Crop;
} }
@Override
public Item getItemDropped(IBlockState state, Random rand, int fortune) {
IBlockState dirtState = getDroppedState(state);
return dirtState.getBlock().getItemDropped(dirtState, rand, fortune);
}
/** /**
* Determines if this farmland should be trampled when an entity walks on it. * Determines if this farmland should be trampled when an entity walks on it.
*/ */
@ -118,10 +129,14 @@ public abstract class UFarmland extends BlockFarmland {
return field_194405_c.offset(pos); return field_194405_c.offset(pos);
} }
protected IBlockState getDroppedState(IBlockState state) {
return Blocks.DIRT.getDefaultState();
}
/** /**
* Gets the state used to represent this block as a piece of dirt. * Gets the state used to represent this block as a piece of dirt.
*/ */
protected IBlockState getDirtState(World world, BlockPos pos, IBlockState state) { protected IBlockState getDirtState(World world, BlockPos pos, IBlockState state) {
return Blocks.DIRT.getDefaultState(); return getDroppedState(state);
} }
} }