From 2dc25f9d10c305f08090f8cb8cd0b3f59305bcc2 Mon Sep 17 00:00:00 2001 From: Sollace Date: Wed, 9 Jan 2019 16:58:52 +0200 Subject: [PATCH] Fixed cloud farmland dropping as dirt --- .../unicopia/block/BlockCloudFarm.java | 2 +- .../unicopia/block/UFarmland.java | 17 ++++++++++++++++- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/minelittlepony/unicopia/block/BlockCloudFarm.java b/src/main/java/com/minelittlepony/unicopia/block/BlockCloudFarm.java index 074b7fc6..e03fa797 100644 --- a/src/main/java/com/minelittlepony/unicopia/block/BlockCloudFarm.java +++ b/src/main/java/com/minelittlepony/unicopia/block/BlockCloudFarm.java @@ -122,7 +122,7 @@ public class BlockCloudFarm extends UFarmland implements ICloudBlock { } @Override - protected IBlockState getDirtState(World world, BlockPos pos, IBlockState state) { + protected IBlockState getDroppedState(IBlockState state) { return UBlocks.cloud.getDefaultState(); } } diff --git a/src/main/java/com/minelittlepony/unicopia/block/UFarmland.java b/src/main/java/com/minelittlepony/unicopia/block/UFarmland.java index 16d3cbb0..004d1ccc 100644 --- a/src/main/java/com/minelittlepony/unicopia/block/UFarmland.java +++ b/src/main/java/com/minelittlepony/unicopia/block/UFarmland.java @@ -6,10 +6,12 @@ import com.minelittlepony.util.PosHelper; import net.minecraft.block.Block; import net.minecraft.block.BlockFarmland; +import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.Entity; import net.minecraft.init.Blocks; +import net.minecraft.item.Item; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; @@ -23,6 +25,8 @@ public abstract class UFarmland extends BlockFarmland { public UFarmland(String domain, String name) { setTranslationKey(name); setRegistryName(domain, name); + setHardness(0.6F); + setSoundType(SoundType.GROUND); } @Override @@ -81,6 +85,13 @@ public abstract class UFarmland extends BlockFarmland { || 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. */ @@ -118,10 +129,14 @@ public abstract class UFarmland extends BlockFarmland { 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. */ protected IBlockState getDirtState(World world, BlockPos pos, IBlockState state) { - return Blocks.DIRT.getDefaultState(); + return getDroppedState(state); } }