mirror of
https://github.com/barkeser2002/CatServer.git
synced 2026-09-25 05:19:55 +03:00
40 lines
1.7 KiB
Diff
40 lines
1.7 KiB
Diff
--- ../src-base/minecraft/net/minecraft/item/ItemSeedFood.java
|
|
+++ ../src-work/minecraft/net/minecraft/item/ItemSeedFood.java
|
|
@@ -8,7 +8,7 @@
|
|
import net.minecraft.util.math.BlockPos;
|
|
import net.minecraft.world.World;
|
|
|
|
-public class ItemSeedFood extends ItemFood
|
|
+public class ItemSeedFood extends ItemFood implements net.minecraftforge.common.IPlantable
|
|
{
|
|
private final Block crops;
|
|
private final Block soilId;
|
|
@@ -23,8 +23,8 @@
|
|
public EnumActionResult onItemUse(EntityPlayer player, World worldIn, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ)
|
|
{
|
|
ItemStack itemstack = player.getHeldItem(hand);
|
|
-
|
|
- if (facing == EnumFacing.UP && player.canPlayerEdit(pos.offset(facing), facing, itemstack) && worldIn.getBlockState(pos).getBlock() == this.soilId && worldIn.isAirBlock(pos.up()))
|
|
+ net.minecraft.block.state.IBlockState state = worldIn.getBlockState(pos);
|
|
+ if (facing == EnumFacing.UP && player.canPlayerEdit(pos.offset(facing), facing, itemstack) && state.getBlock().canSustainPlant(state, worldIn, pos, EnumFacing.UP, this) && worldIn.isAirBlock(pos.up()))
|
|
{
|
|
worldIn.setBlockState(pos.up(), this.crops.getDefaultState(), 11);
|
|
itemstack.shrink(1);
|
|
@@ -35,4 +35,16 @@
|
|
return EnumActionResult.FAIL;
|
|
}
|
|
}
|
|
+
|
|
+ @Override
|
|
+ public net.minecraftforge.common.EnumPlantType getPlantType(net.minecraft.world.IBlockAccess world, BlockPos pos)
|
|
+ {
|
|
+ return net.minecraftforge.common.EnumPlantType.Crop;
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public net.minecraft.block.state.IBlockState getPlant(net.minecraft.world.IBlockAccess world, BlockPos pos)
|
|
+ {
|
|
+ return this.crops.getDefaultState();
|
|
+ }
|
|
}
|