forked from RebelKeithy/Aquaculture
-
Notifications
You must be signed in to change notification settings - Fork 66
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed farmland created by Neptunium Hoe, Closes #69
- Loading branch information
1 parent
1b74e0c
commit 2ba0ecd
Showing
1 changed file
with
15 additions
and
0 deletions.
There are no files selected for viewing
15 changes: 15 additions & 0 deletions
15
src/main/java/com/teammetallurgy/aquaculture/block/FarmlandMoistBlock.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} | ||
} |