本文整理汇总了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);
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
}
示例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);
}
示例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);
}
示例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;
}
}