From 66aec5cfdfe287762b35d065d4d06463055f9fac Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Thu, 10 Nov 2016 16:38:37 +0100 Subject: [PATCH] Allow plants to be planted on blocks other than farmland with the farmer Closes #346 --- .../mod/tile/TileEntityFarmer.java | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFarmer.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFarmer.java index 048eef377..a2406956d 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFarmer.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFarmer.java @@ -12,7 +12,10 @@ package de.ellpeck.actuallyadditions.mod.tile; import cofh.api.energy.EnergyStorage; import de.ellpeck.actuallyadditions.mod.util.WorldUtil; -import net.minecraft.block.*; +import net.minecraft.block.Block; +import net.minecraft.block.BlockCrops; +import net.minecraft.block.BlockDirt; +import net.minecraft.block.BlockGrass; import net.minecraft.block.state.IBlockState; import net.minecraft.init.Blocks; import net.minecraft.init.SoundEvents; @@ -105,12 +108,10 @@ public class TileEntityFarmer extends TileEntityInventoryBase implements ICustom IBlockState farmlandState = this.worldObj.getBlockState(farmland); Block farmlandBlock = farmlandState.getBlock(); - if(farmlandBlock instanceof BlockFarmland){ - IBlockState toPlant = this.getFirstPlantablePlantFromSlots(plant); - if(toPlant != null){ - this.worldObj.setBlockState(plant, toPlant, 2); - didSomething = true; - } + IBlockState toPlant = this.getFirstPlantablePlantFromSlots(plant); + if(toPlant != null){ + this.worldObj.setBlockState(plant, toPlant, 3); + didSomething = true; } else if(farmlandBlock instanceof BlockDirt || farmlandBlock instanceof BlockGrass){ this.worldObj.setBlockState(farmland, Blocks.FARMLAND.getDefaultState(), 2);