当前位置: 首页>>代码示例>>Java>>正文


Java EnumPlantType类代码示例

本文整理汇总了Java中net.minecraftforge.common.EnumPlantType的典型用法代码示例。如果您正苦于以下问题:Java EnumPlantType类的具体用法?Java EnumPlantType怎么用?Java EnumPlantType使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


EnumPlantType类属于net.minecraftforge.common包,在下文中一共展示了EnumPlantType类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: canSustainPlant

import net.minecraftforge.common.EnumPlantType; //导入依赖的package包/类
@Override
  public boolean canSustainPlant(IBlockState state, IBlockAccess world, BlockPos pos, EnumFacing direction, net.minecraftforge.common.IPlantable plantable)
  {
      EnumPlantType plantType = plantable.getPlantType(world, pos.offset(direction));

      switch (plantType)
      {
      	case Plains: return true;
      	case Beach: 
              boolean hasWater = (world.getBlockState(pos.east()).getMaterial() == Material.WATER ||
              world.getBlockState(pos.west()).getMaterial() == Material.WATER ||
              world.getBlockState(pos.north()).getMaterial() == Material.WATER ||
              world.getBlockState(pos.south()).getMaterial() == Material.WATER);
              return hasWater;
default:
	break;
      }

  	return super.canSustainPlant(state, world, pos, direction, plantable);
  }
 
开发者ID:Modding-Legacy,项目名称:Aether-Legacy,代码行数:21,代码来源:BlockAetherGrass.java

示例2: getPlantType

import net.minecraftforge.common.EnumPlantType; //导入依赖的package包/类
@Override
  public EnumPlantType getPlantType(IBlockAccess world, int x, int y, int z)
  {
      EnumPlantType Custom;
      EnumPlantType Jen;
      EnumPlantType Pat;
//if (this == Blocks.wheat)          return Crop;
      //if (this == Blocks.carrots)        return Crop;
      //if (this == Blocks.potatoes)       return Crop;
      //if (this == Blocks.melon_stem)     return Crop;
      //if (this == Blocks.pumpkin_stem)   return Crop;
      //if (this == Blocks.deadbush)       return Desert;
      //if (this == Blocks.waterlily)      return Water;
      //if (this == Blocks.red_mushroom)   return Cave;
      //if (this == Blocks.brown_mushroom) return Cave;
      //if (this == Blocks.nether_wart)    return Nether;
      //if (this == Blocks.sapling)        return Plains;
      //if (this == Blocks.tallgrass)      return Plains;
  	if (this == BlockLoader.BlockJenGrass_Plant) return Plains;
  	if (this == BlockLoader.BlockPatGrass_Plant) return Plains;
  	if (this == BlockLoader.BlockJenGrassTall_Plant) return Plains;
  	if (this == BlockLoader.BlockPatGrassTall_Plant) return Plains;

return Plains;
  }
 
开发者ID:jtrent238,项目名称:PopularMMOS-EpicProportions-Mod,代码行数:26,代码来源:BlockModBush.java

示例3: canSustainPlant

import net.minecraftforge.common.EnumPlantType; //导入依赖的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;
}
 
开发者ID:Deadrik,项目名称:TFC2,代码行数:18,代码来源:BlockFarmland.java

示例4: canSustainPlant

import net.minecraftforge.common.EnumPlantType; //导入依赖的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;
}
 
开发者ID:Deadrik,项目名称:TFC2,代码行数:17,代码来源:BlockVegetation.java

示例5: canSustainPlant

import net.minecraftforge.common.EnumPlantType; //导入依赖的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;
}
 
开发者ID:Deadrik,项目名称:TFC2,代码行数:17,代码来源:BlockGrass.java

示例6: canSustainPlant

import net.minecraftforge.common.EnumPlantType; //导入依赖的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;
}
 
开发者ID:MikeLydeamore,项目名称:IlluminatedBows,代码行数:27,代码来源:BlockIlluminatedFarmland.java

示例7: canSustainPlant

import net.minecraftforge.common.EnumPlantType; //导入依赖的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;
   }
 
开发者ID:RamiLego4Game,项目名称:GalacticraftPixelGalaxy,代码行数:26,代码来源:PixelItemSeed.java

示例8: getPlantType

import net.minecraftforge.common.EnumPlantType; //导入依赖的package包/类
@Override
public EnumPlantType getPlantType(IBlockAccess world, int x, int y, int z)
{
    /*if (this == Blocks.wheat)          return Crop;
    if (this == Blocks.carrots)        return Crop;
    if (this == Blocks.potatoes)       return Crop;
    if (this == Blocks.melon_stem)     return Crop;
    if (this == Blocks.pumpkin_stem)   return Crop;
    if (this == Blocks.deadbush)       return Desert;
    if (this == Blocks.waterlily)      return Water;
    if (this == Blocks.red_mushroom)   return Cave;
    if (this == Blocks.brown_mushroom) return Cave;
    if (this == Blocks.nether_wart)    return Nether;
    if (this == Blocks.sapling)        return Plains;
    if (this == Blocks.tallgrass)      return Plains;
    if (this == Blocks.double_plant)   return Plains;
    if (this == Blocks.red_flower)     return Plains;
    if (this == Blocks.yellow_flower)  return Plains;*/     
    return Plains;
}
 
开发者ID:MythicTeam,项目名称:Myth,代码行数:21,代码来源:MythHerb.java

示例9: getPlantType

import net.minecraftforge.common.EnumPlantType; //导入依赖的package包/类
@Override
public EnumPlantType getPlantType(IBlockAccess world, int x, int y, int z)
{
    if (this == Blocks.wheat)          return Crop;
    if (this == Blocks.carrots)        return Crop;
    if (this == Blocks.potatoes)       return Crop;
    if (this == Blocks.melon_stem)     return Crop;
    if (this == Blocks.pumpkin_stem)   return Crop;
    if (this == Blocks.deadbush)       return Desert;
    if (this == Blocks.waterlily)      return Water;
    if (this == Blocks.red_mushroom)   return Cave;
    if (this == Blocks.brown_mushroom) return Cave;
    if (this == Blocks.nether_wart)    return Nether;
    if (this == Blocks.sapling)        return Plains;
    if (this == Blocks.tallgrass)      return Plains;
    if (this == Blocks.double_plant)   return Plains;
    if (this == Blocks.red_flower)     return Plains;
    if (this == Blocks.yellow_flower)  return Plains;        
    return Plains;
}
 
开发者ID:xtrafrancyz,项目名称:Cauldron,代码行数:21,代码来源:BlockBush.java

示例10: canSustainPlant

import net.minecraftforge.common.EnumPlantType; //导入依赖的package包/类
@Override
public boolean canSustainPlant(IBlockState state, IBlockAccess world, BlockPos pos, EnumFacing direction, net.minecraftforge.common.IPlantable plantable) {
	EnumPlantType plantType = plantable.getPlantType(world, pos);
	
	if (plantType==EnumPlantType.Nether) return true; //Nether plants grow extremely well on meat
	if (plantType==EnumPlantType.Cave) return true; //Cave plants like mushrooms will grow on bare stone
	
	return false;
}
 
开发者ID:elytra,项目名称:ThermionicsWorld,代码行数:10,代码来源:BlockMeat.java

示例11: BlockCropsBase

import net.minecraftforge.common.EnumPlantType; //导入依赖的package包/类
public BlockCropsBase(String unlocalizedName, String modId, Item seed, Item crop, Collection<Block> canGrowOn,
                        EnumPlantType plantType) {
      super();
      setUnlocalizedName(unlocalizedName);
      setRegistryName(new ResourceLocation(modId, unlocalizedName));
      this.seed = seed;
      this.crop = crop;
      this.canGrowOn = canGrowOn;
this.plantType = plantType;
  }
 
开发者ID:sedlak477,项目名称:MrglgaghCore,代码行数:11,代码来源:BlockCropsBase.java

示例12: canSustainPlant

import net.minecraftforge.common.EnumPlantType; //导入依赖的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);
    }
}
 
开发者ID:cubex2,项目名称:customstuff4,代码行数:15,代码来源:BlockMixin.java

示例13: deserialize

import net.minecraftforge.common.EnumPlantType; //导入依赖的package包/类
@Override
public EnumPlantType deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException
{
    if (json.isJsonPrimitive())
    {
        JsonPrimitive primitive = json.getAsJsonPrimitive();
        if (primitive.isString())
        {
            return EnumPlantType.getPlantType(json.getAsString());
        }
    }

    throw new JsonParseException("Invalid plant type: " + json);
}
 
开发者ID:cubex2,项目名称:customstuff4,代码行数:15,代码来源:EnumPlantTypeDeserializer.java

示例14: test

import net.minecraftforge.common.EnumPlantType; //导入依赖的package包/类
@Test
public void test() throws Exception
{
    Map<String, EnumPlantType> map = gson.fromJson("{ \"plant\": \"Crop\" }", new TypeToken<Map<String, EnumPlantType>>() {}.getType());

    EnumPlantType plant = map.get("plant");

    assertSame(EnumPlantType.Crop, plant);
}
 
开发者ID:cubex2,项目名称:customstuff4,代码行数:10,代码来源:EnumPlantTypeDeserializerTest.java

示例15: canSustainPlantType

import net.minecraftforge.common.EnumPlantType; //导入依赖的package包/类
public boolean canSustainPlantType(IBlockAccess world, BlockPos pos, EnumPlantType plantType)
{

    IBlockState state = world.getBlockState(pos);

    switch ((ExtraGrassType) state.getValue(VARIANT))
    {
        case FARM:
            if (plantType == EnumPlantType.Crop) {return true;}
            break;
        case SAND:
        case REDSAND:
            if (plantType == EnumPlantType.Desert) {return true;}
            break;

        default: break;
    }

    switch (plantType)
    {
        // support plains and cave plants
        case Plains: case Cave:
            return true;
        // support beach plants if there's water alongside
        case Beach:
            return (
                    (!world.isAirBlock(pos.east()) && world.getBlockState(pos.east()).getMaterial() == Material.WATER) ||
                            (!world.isAirBlock(pos.west()) && world.getBlockState(pos.west()).getMaterial() == Material.WATER) ||
                            (!world.isAirBlock(pos.north()) && world.getBlockState(pos.north()).getMaterial() == Material.WATER) ||
                            (!world.isAirBlock(pos.south()) && world.getBlockState(pos.south()).getMaterial() == Material.WATER)
            );
        // don't support nether plants, water plants, or crops (require farmland), or anything else by default
        default:
            return false;
    }
}
 
开发者ID:DaedalusGame,项目名称:BetterWithAddons,代码行数:37,代码来源:BlockExtraGrass.java


注:本文中的net.minecraftforge.common.EnumPlantType类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。