Fixed turnips not acting as a crop, and allowed normal plants to be placed on our farmland blocks

This commit is contained in:
Forstride 2016-02-07 18:42:04 -05:00
parent a40a83ecd5
commit 3fd93d83db
5 changed files with 15 additions and 4 deletions

View file

@ -66,7 +66,7 @@ public class BlockBOPBamboo extends BlockBOPDecoration
return true;
}
// can place on various soil blocks
if (groundBlock == Blocks.dirt || groundBlock == Blocks.farmland || groundBlock == BOPBlocks.dirt || groundBlock == Blocks.grass)
if (groundBlock == Blocks.dirt || groundBlock == Blocks.farmland || groundBlock == BOPBlocks.farmland_0 || groundBlock == BOPBlocks.farmland_1 || groundBlock == BOPBlocks.dirt || groundBlock == Blocks.grass)
{
return true;
}

View file

@ -195,6 +195,8 @@ public class BlockBOPFarmland extends BlockFarmland implements IBOPBlock
{
case Crop:
return true;
case Plains:
return true;
default:
return super.canSustainPlant(world, pos, direction, plantable);
}

View file

@ -252,7 +252,7 @@ public class BlockBOPFlower extends BlockBOPDecoration implements IShearable
IBlockState groundState = world.getBlockState(pos.down());
Block groundBlock = groundState.getBlock();
boolean onFertile = (groundBlock == Blocks.dirt || groundBlock == Blocks.farmland || groundBlock == BOPBlocks.dirt || groundBlock == Blocks.grass);
boolean onFertile = (groundBlock == Blocks.dirt || groundBlock == Blocks.farmland || groundBlock == BOPBlocks.farmland_0 || groundBlock == BOPBlocks.farmland_1 || groundBlock == BOPBlocks.dirt || groundBlock == Blocks.grass);
boolean onDry = (groundBlock == Blocks.hardened_clay || groundBlock == BOPBlocks.sand || groundBlock == Blocks.sand);
boolean onNetherrack = (groundBlock == Blocks.netherrack);
boolean onStone = (groundBlock == Blocks.stone);

View file

@ -14,6 +14,9 @@ import net.minecraft.block.properties.IProperty;
import net.minecraft.block.state.IBlockState;
import net.minecraft.item.Item;
import net.minecraft.item.ItemBlock;
import net.minecraft.util.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraftforge.common.EnumPlantType;
import biomesoplenty.api.block.IBOPBlock;
import biomesoplenty.api.item.BOPItems;
import biomesoplenty.common.item.ItemBOPBlock;
@ -46,5 +49,10 @@ public class BlockBOPTurnip extends BlockCrops implements IBOPBlock
{
return BOPItems.turnip;
}
@Override
public EnumPlantType getPlantType(IBlockAccess world, BlockPos pos) {
return EnumPlantType.Crop;
}
}

View file

@ -17,6 +17,7 @@ import java.util.Set;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import biomesoplenty.api.block.BOPBlocks;
import biomesoplenty.api.block.BlockQueries;
import biomesoplenty.api.block.ISustainsPlantType;
@ -301,9 +302,9 @@ public class BlockQuery
{
case Desert: return block == Blocks.sand || block == Blocks.hardened_clay || block == Blocks.stained_hardened_clay || block == Blocks.dirt;
case Nether: return block == Blocks.soul_sand;
case Crop: return block == Blocks.farmland;
case Crop: return block == Blocks.farmland || block == BOPBlocks.farmland_0 || block == BOPBlocks.farmland_1;
case Cave: return block.isSideSolid(world, pos, EnumFacing.UP);
case Plains: return block == Blocks.grass || block == Blocks.dirt || block == Blocks.farmland || block == Blocks.mycelium;
case Plains: return block == Blocks.grass || block == Blocks.dirt || block == Blocks.farmland || block == BOPBlocks.farmland_0 || block == BOPBlocks.farmland_1 || block == Blocks.mycelium;
case Water: return block.getMaterial() == Material.water && ((Integer)state.getValue(BlockLiquid.LEVEL)) == 0;
case Beach:
boolean isBeach = block == Blocks.grass || block == Blocks.dirt || block == Blocks.sand || block == Blocks.mycelium;