本文整理汇总了Java中net.minecraftforge.common.IPlantable.getPlantType方法的典型用法代码示例。如果您正苦于以下问题:Java IPlantable.getPlantType方法的具体用法?Java IPlantable.getPlantType怎么用?Java IPlantable.getPlantType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraftforge.common.IPlantable
的用法示例。
在下文中一共展示了IPlantable.getPlantType方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: canSustainPlant
import net.minecraftforge.common.IPlantable; //导入方法依赖的package包/类
@Override
public boolean canSustainPlant(IBlockState state, IBlockAccess world, BlockPos pos, EnumFacing direction, IPlantable plantable) {
IBlockState plant = plantable.getPlant(world, pos.offset(direction));
net.minecraftforge.common.EnumPlantType plantType = plantable.getPlantType(world, pos.offset(direction));
switch (plantType) {
case Crop:
case Plains:
return true;
case Desert:
case Nether:
case Cave:
case Water:
case Beach:
default:
return false;
}
}
示例2: canSustainPlant
import net.minecraftforge.common.IPlantable; //导入方法依赖的package包/类
@Override
public boolean canSustainPlant(IBlockState state, IBlockAccess world, BlockPos pos, EnumFacing direction, IPlantable plantable)
{
IBlockState plant = plantable.getPlant(world, pos.offset(direction));
net.minecraftforge.common.EnumPlantType plantType = plantable.getPlantType(world, pos.offset(direction));
if(plantType == EnumPlantType.Crop)
return true;
if(plantType == EnumPlantType.Plains)
return true;
if(plantable == TFCBlocks.Sapling)
return true;
return false;
}
示例3: canSustainPlant
import net.minecraftforge.common.IPlantable; //导入方法依赖的package包/类
@Override
public boolean canSustainPlant(IBlockState state, IBlockAccess world, BlockPos pos, EnumFacing direction, IPlantable plantable)
{
IBlockState plant = plantable.getPlant(world, pos.offset(direction));
EnumPlantType plantType = plantable.getPlantType(world, pos.offset(direction));
VegType veg = (VegType)state.getValue(META_PROPERTY);
if(plant.getBlock() == this)
{
if(veg == VegType.DoubleGrassBottom && plant.getValue(META_PROPERTY) == VegType.DoubleGrassTop)
return true;
if(veg == VegType.DoubleGrassBottomLush && plant.getValue(META_PROPERTY) == VegType.DoubleGrassTopLush)
return true;
}
return false;
}
示例4: canSustainPlant
import net.minecraftforge.common.IPlantable; //导入方法依赖的package包/类
@Override
public boolean canSustainPlant(IBlockState state, IBlockAccess world, BlockPos pos, EnumFacing direction, IPlantable plantable)
{
IBlockState plant = plantable.getPlant(world, pos.offset(direction));
net.minecraftforge.common.EnumPlantType plantType = plantable.getPlantType(world, pos.offset(direction));
if(plant.getBlock() == Blocks.SAPLING)
return false;//This may break some cross mod compatability but for now its needed to prevent vanilla and some pam trees from generating
if(plantType == EnumPlantType.Plains)
return true;
if(plant.getBlock() == TFCBlocks.VegDesert)
return true;
return false;
}
示例5: canSustainPlant
import net.minecraftforge.common.IPlantable; //导入方法依赖的package包/类
@Override
public boolean canSustainPlant(IBlockAccess world, int x, int y, int z, ForgeDirection direction, IPlantable plantable)
{
Block plant = plantable.getPlant(world, x, y + 1, z);
EnumPlantType plantType = plantable.getPlantType(world, x, y + 1, z);
switch (plantType)
{
case Desert:
return false;
case Nether:
return false;
case Crop:
return true;
case Cave:
return false;
case Plains:
return false;
case Water:
return false;
case Beach:
return false;
}
return false;
}
示例6: canSustainPlant
import net.minecraftforge.common.IPlantable; //导入方法依赖的package包/类
public boolean canSustainPlant(IBlockAccess world, int x, int y, int z, ForgeDirection direction, IPlantable plantable)
{
Block plant = plantable.getPlant(world, x, y + 1, z);
EnumPlantType plantType = plantable.getPlantType(world, x, y + 1, z);
switch (plantType)
{
case Beach:
break;
case Cave:
break;
case Crop:
break;
case Desert:
break;
case Nether:
break;
case Plains:
break;
case Water:
break;
default:
break;
}
return false;
}
示例7: canSustainPlant
import net.minecraftforge.common.IPlantable; //导入方法依赖的package包/类
@Override
public boolean canSustainPlant (IBlockAccess world, int x, int y, int z, ForgeDirection direction, IPlantable plantable) {
TileEntityLargePot te = getTileEntity(world, x, y, z);
if (te == null || te.getSubstrate() == null)
return false;
EnumPlantType plantType = plantable.getPlantType(world, x, y + 1, z);
Block plant = plantable.getPlant(world, x, y + 1, z);
Block substrate = Block.getBlockFromItem(te.getSubstrate());
ItemStack plantItem = new ItemStack(plant, 1, plantable.getPlantMetadata(world, x, y, z));
if (PlantRegistry.instance().isBlacklisted(plantItem))
return false;
if (plant == Blocks.cactus)
return substrate == Blocks.sand;
return plantType == EnumPlantType.Crop && substrate == Blocks.farmland;
}
示例8: canSustainPlant
import net.minecraftforge.common.IPlantable; //导入方法依赖的package包/类
@Override
public boolean canSustainPlant(IBlockState state, IBlockAccess world, BlockPos pos, EnumFacing direction, IPlantable plantable)
{
EnumPlantType type = plantable.getPlantType(world, pos.offset(direction));
EnumPlantType[] sustainedPlants = getContent().sustainedPlants.get(getSubtype(state)).orElse(null);
if (sustainedPlants != null)
{
return ArrayUtils.contains(sustainedPlants, type);
} else
{
return super.canSustainPlant(state, world, pos, direction, plantable);
}
}
示例9: acceptsInputStack
import net.minecraftforge.common.IPlantable; //导入方法依赖的package包/类
@Override
protected boolean acceptsInputStack(int slot, ItemStack stack) {
if (ItemStackUtil.isEmpty(stack)) {
return false;
}
if (stack.getItem() instanceof IPlantable) {
IPlantable plant = (IPlantable) stack.getItem();
if (plant.getPlantType(this.getWorld(), this.getPos()) == EnumPlantType.Crop) {
return true;
}
}
return false;
}
示例10: canSustainPlant
import net.minecraftforge.common.IPlantable; //导入方法依赖的package包/类
@Override
public boolean canSustainPlant(IBlockState state, IBlockAccess world, BlockPos pos,
EnumFacing direction, IPlantable plantable) {
final BlockPos plantPos = new BlockPos(pos.getX(), pos.getY() + 1, pos.getZ());
final EnumPlantType plantType = plantable.getPlantType(world, plantPos);
switch (plantType) {
case Desert: {
return true;
}
case Water: {
return world.getBlockState(pos).getMaterial() == Material.WATER &&
world.getBlockState(pos) == getDefaultState();
}
case Beach: {
return (
(world.getBlockState(new BlockPos(pos.getX() - 1, pos.getY(), pos.getZ())).getMaterial()
== Material.WATER) ||
(world.getBlockState(new BlockPos(pos.getX() + 1, pos.getY(), pos.getZ())).getMaterial()
== Material.WATER) ||
(world.getBlockState(new BlockPos(pos.getX(), pos.getY(), pos.getZ() - 1)).getMaterial()
== Material.WATER) ||
(world.getBlockState(new BlockPos(pos.getX(), pos.getY(), pos.getZ() + 1)).getMaterial()
== Material.WATER));
}
}
return false;
}
示例11: canSustainPlant
import net.minecraftforge.common.IPlantable; //导入方法依赖的package包/类
@Override
public boolean canSustainPlant(IBlockState state, IBlockAccess world, BlockPos pos, EnumFacing direction, IPlantable plantable)
{
IBlockState plant = plantable.getPlant(world, pos.offset(direction));
EnumPlantType plantType = plantable.getPlantType(world, pos.offset(direction));
if(plantable == TFCBlocks.Vegetation && (VegType)plant.getValue(BlockVegetation.META_PROPERTY) == VegType.Grass)
return true;
return false;
}
示例12: canSustainPlant
import net.minecraftforge.common.IPlantable; //导入方法依赖的package包/类
/*******************************************************************************
* 1. Content
*******************************************************************************/
@Override
public boolean canSustainPlant(IBlockState state, IBlockAccess world, BlockPos pos, EnumFacing direction, IPlantable plantable)
{
IBlockState plant = plantable.getPlant(world, pos.offset(direction));
net.minecraftforge.common.EnumPlantType plantType = plantable.getPlantType(world, pos.offset(direction));
if(plantType == EnumPlantType.Plains)
return true;
return false;
}
示例13: canSustainPlant
import net.minecraftforge.common.IPlantable; //导入方法依赖的package包/类
@Override
public boolean canSustainPlant(IBlockState state, IBlockAccess world, BlockPos pos, EnumFacing direction, IPlantable plantable)
{
IBlockState plant = plantable.getPlant(world, pos.offset(direction));
EnumPlantType plantType = plantable.getPlantType(world, pos.offset(direction));
DesertCactusType veg = (DesertCactusType)state.getValue(META_PROPERTY);
if(plant.getBlock() == this)
{
}
return false;
}
示例14: canSustainPlant
import net.minecraftforge.common.IPlantable; //导入方法依赖的package包/类
@Override
public boolean canSustainPlant(IBlockState state, IBlockAccess world, BlockPos pos, EnumFacing direction, IPlantable plantable)
{
IBlockState plant = plantable.getPlant(world, pos.offset(direction));
EnumPlantType plantType = plantable.getPlantType(world, pos.offset(direction));
DesertVegType veg = (DesertVegType)state.getValue(META_PROPERTY);
if(plant.getBlock() == this)
{
if(veg == DesertVegType.DoubleGrassBottomSparse && plant.getValue(META_PROPERTY) == DesertVegType.DoubleGrassTopSparse)
return true;
}
return false;
}
示例15: canSustainPlant
import net.minecraftforge.common.IPlantable; //导入方法依赖的package包/类
public boolean canSustainPlant(final IBlockAccess world, final int x,
final int y, final int z, final ForgeDirection direction,
final IPlantable plantable) {
final EnumPlantType plant = plantable.getPlantType(world, x, y + 1, z);
// Crops or reeds
return plant == EnumPlantType.Crop || plant == EnumPlantType.Beach;
}