mirror of
https://github.com/barkeser2002/CatServer.git
synced 2026-09-25 02:20:01 +03:00
40 lines
1.8 KiB
Diff
40 lines
1.8 KiB
Diff
--- ../src-base/minecraft/net/minecraft/item/ItemSeeds.java
|
|
+++ ../src-work/minecraft/net/minecraft/item/ItemSeeds.java
|
|
@@ -11,7 +11,7 @@
|
|
import net.minecraft.util.math.BlockPos;
|
|
import net.minecraft.world.World;
|
|
|
|
-public class ItemSeeds extends Item
|
|
+public class ItemSeeds extends Item implements net.minecraftforge.common.IPlantable
|
|
{
|
|
private final Block crops;
|
|
private final Block soilBlockID;
|
|
@@ -26,8 +26,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.soilBlockID && 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());
|
|
|
|
@@ -44,4 +44,16 @@
|
|
return EnumActionResult.FAIL;
|
|
}
|
|
}
|
|
+
|
|
+ @Override
|
|
+ public net.minecraftforge.common.EnumPlantType getPlantType(net.minecraft.world.IBlockAccess world, BlockPos pos)
|
|
+ {
|
|
+ return this.crops == net.minecraft.init.Blocks.NETHER_WART ? net.minecraftforge.common.EnumPlantType.Nether : net.minecraftforge.common.EnumPlantType.Crop;
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public net.minecraft.block.state.IBlockState getPlant(net.minecraft.world.IBlockAccess world, BlockPos pos)
|
|
+ {
|
|
+ return this.crops.getDefaultState();
|
|
+ }
|
|
}
|