mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-11-22 23:28:35 +01:00
Allow plants to be planted on blocks other than farmland with the farmer
Closes #346
This commit is contained in:
parent
20664fccf4
commit
66aec5cfdf
1 changed files with 8 additions and 7 deletions
|
@ -12,7 +12,10 @@ package de.ellpeck.actuallyadditions.mod.tile;
|
||||||
|
|
||||||
import cofh.api.energy.EnergyStorage;
|
import cofh.api.energy.EnergyStorage;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.WorldUtil;
|
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.block.state.IBlockState;
|
||||||
import net.minecraft.init.Blocks;
|
import net.minecraft.init.Blocks;
|
||||||
import net.minecraft.init.SoundEvents;
|
import net.minecraft.init.SoundEvents;
|
||||||
|
@ -105,13 +108,11 @@ public class TileEntityFarmer extends TileEntityInventoryBase implements ICustom
|
||||||
IBlockState farmlandState = this.worldObj.getBlockState(farmland);
|
IBlockState farmlandState = this.worldObj.getBlockState(farmland);
|
||||||
Block farmlandBlock = farmlandState.getBlock();
|
Block farmlandBlock = farmlandState.getBlock();
|
||||||
|
|
||||||
if(farmlandBlock instanceof BlockFarmland){
|
|
||||||
IBlockState toPlant = this.getFirstPlantablePlantFromSlots(plant);
|
IBlockState toPlant = this.getFirstPlantablePlantFromSlots(plant);
|
||||||
if(toPlant != null){
|
if(toPlant != null){
|
||||||
this.worldObj.setBlockState(plant, toPlant, 2);
|
this.worldObj.setBlockState(plant, toPlant, 3);
|
||||||
didSomething = true;
|
didSomething = true;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else if(farmlandBlock instanceof BlockDirt || farmlandBlock instanceof BlockGrass){
|
else if(farmlandBlock instanceof BlockDirt || farmlandBlock instanceof BlockGrass){
|
||||||
this.worldObj.setBlockState(farmland, Blocks.FARMLAND.getDefaultState(), 2);
|
this.worldObj.setBlockState(farmland, Blocks.FARMLAND.getDefaultState(), 2);
|
||||||
this.worldObj.setBlockToAir(plant);
|
this.worldObj.setBlockToAir(plant);
|
||||||
|
|
Loading…
Reference in a new issue