當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。