Skip to content

Commit

Permalink
Fixed farmland created by Neptunium Hoe, Closes #69
Browse files Browse the repository at this point in the history
  • Loading branch information
GirafiStudios committed Nov 9, 2019
1 parent 1b74e0c commit 2ba0ecd
Showing 1 changed file with 15 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,14 +1,29 @@
package com.teammetallurgy.aquaculture.block;

import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.FarmlandBlock;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.util.Direction;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockReader;
import net.minecraftforge.common.IPlantable;
import net.minecraftforge.common.PlantType;

import javax.annotation.Nonnull;

public class FarmlandMoistBlock extends FarmlandBlock {

public FarmlandMoistBlock() {
super(Block.Properties.create(Material.EARTH).hardnessAndResistance(0.6F).sound(SoundType.GROUND));
this.setDefaultState(this.stateContainer.getBaseState().with(MOISTURE, 7));
}

@Override
public boolean canSustainPlant(@Nonnull BlockState state, @Nonnull IBlockReader world, BlockPos pos, @Nonnull Direction facing, IPlantable plantable) {
PlantType type = plantable.getPlantType(world, pos.offset(facing));

return type == PlantType.Crop || type == PlantType.Plains;
}
}

0 comments on commit 2ba0ecd

Please sign in to comment.