类net.minecraftforge.common.EnumPlantType源码实例Demo

下面列出了怎么用net.minecraftforge.common.EnumPlantType的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: TFC2   文件: BlockFarmland.java
@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;
}
 
源代码2 项目: TFC2   文件: BlockVegetation.java
@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;
}
 
源代码3 项目: TFC2   文件: BlockGrass.java
@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;
}
 
源代码4 项目: customstuff4   文件: BlockMixin.java
@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);
    }
}
 
源代码5 项目: customstuff4   文件: EnumPlantTypeDeserializer.java
@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);
}
 
@Test
public void test()
{
    Map<String, EnumPlantType> map = gson.fromJson("{ \"plant\": \"Crop\" }", new TypeToken<Map<String, EnumPlantType>>() {}.getType());

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

    assertSame(EnumPlantType.Crop, plant);
}
 
源代码7 项目: ExNihiloAdscensio   文件: ItemSeedBase.java
public ItemSeedBase(String name, IBlockState plant) {
	super();
	this.setRegistryName("itemSeed" + StringUtils.capitalize(name));
	this.setUnlocalizedName("itemSeed" + StringUtils.capitalize(name));
	this.plant = plant;
	this.name = name;
	type = EnumPlantType.Plains;
	
	GameRegistry.<Item>register(this);
}
 
源代码8 项目: TFC2   文件: BlockStone.java
@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;
}
 
源代码9 项目: TFC2   文件: BlockDirt.java
/*******************************************************************************
 * 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;
}
 
源代码10 项目: TFC2   文件: BlockCactus.java
@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;
}
 
源代码11 项目: TFC2   文件: BlockVegDesert.java
@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;
}
 
源代码12 项目: GardenCollection   文件: BlockLargePot.java
@Override
public boolean canSustainPlant (IBlockAccess world, int x, int y, int z, ForgeDirection direction, IPlantable plantable) {
    TileEntityGarden gardenTile = getTileEntity(world, x, y, z);
    EnumPlantType plantType = plantable.getPlantType(world, x, y, z);

    if (plantType == EnumPlantType.Crop)
        return substrateSupportsCrops(gardenTile.getSubstrate());

    return false;
}
 
源代码13 项目: GardenCollection   文件: BlockGardenFarmland.java
@Override
public boolean canSustainPlant (IBlockAccess world, int x, int y, int z, ForgeDirection direction, IPlantable plantable) {
    EnumPlantType plantType = plantable.getPlantType(world, x, y, z);
    if (plantType == EnumPlantType.Crop)
        return true;

    return false;
}
 
源代码14 项目: TofuCraftReload   文件: ItemSoybeans.java
@Override
public EnumPlantType getPlantType(IBlockAccess world, BlockPos pos)
{
    return EnumPlantType.Crop;
}
 
源代码15 项目: TofuCraftReload   文件: ItemRiceSeed.java
@Override
public EnumPlantType getPlantType(IBlockAccess world, BlockPos pos)
{
    return EnumPlantType.Crop;
}
 
源代码16 项目: TofuCraftReload   文件: ItemSoybeansNether.java
@Override
public EnumPlantType getPlantType(IBlockAccess world, BlockPos pos)
{
    return EnumPlantType.Crop;
}
 
源代码17 项目: TofuCraftReload   文件: BlockLeek.java
@Override
public net.minecraftforge.common.EnumPlantType getPlantType(net.minecraft.world.IBlockAccess world, BlockPos pos) {
    return EnumPlantType.Plains;
}
 
源代码18 项目: TofuCraftReload   文件: BlockApricotSapling.java
@Override
public net.minecraftforge.common.EnumPlantType getPlantType(net.minecraft.world.IBlockAccess world, BlockPos pos) {
    return EnumPlantType.Plains;
}
 
源代码19 项目: TofuCraftReload   文件: BlockTofuSapling.java
@Override
public net.minecraftforge.common.EnumPlantType getPlantType(net.minecraft.world.IBlockAccess world, BlockPos pos) {
    return EnumPlantType.Plains;
}
 
源代码20 项目: TofuCraftReload   文件: BlockTofuFlower.java
@Override
public net.minecraftforge.common.EnumPlantType getPlantType(net.minecraft.world.IBlockAccess world, BlockPos pos) {
    return EnumPlantType.Plains;
}
 
源代码21 项目: Sakura_mod   文件: ItemRiceSeeds.java
@Override
public EnumPlantType getPlantType(IBlockAccess world, BlockPos pos) {
    return EnumPlantType.Crop;
}
 
源代码22 项目: Sakura_mod   文件: BlockPepperCrop.java
@Override
public EnumPlantType getPlantType(IBlockAccess world, BlockPos pos) {
	return EnumPlantType.Crop;
}
 
源代码23 项目: Sakura_mod   文件: BlockVanillaCrop.java
@Override
public EnumPlantType getPlantType(IBlockAccess world, BlockPos pos) {
	return EnumPlantType.Plains;
}
 
源代码24 项目: Sakura_mod   文件: BlockGrapeVine.java
@Override
public EnumPlantType getPlantType(IBlockAccess world, BlockPos pos) {
	return EnumPlantType.Plains;
}
 
源代码25 项目: Sakura_mod   文件: BlockGrapeLeaves.java
@Override
public EnumPlantType getPlantType(IBlockAccess world, BlockPos pos) {
	return EnumPlantType.Plains;
}
 
源代码26 项目: Sakura_mod   文件: BlockMapleSaplingGreen.java
@Override
public net.minecraftforge.common.EnumPlantType getPlantType(net.minecraft.world.IBlockAccess world, BlockPos pos) {
	return EnumPlantType.Plains;
}
 
源代码27 项目: Sakura_mod   文件: BlockSakuraSapling.java
@Override
public net.minecraftforge.common.EnumPlantType getPlantType(net.minecraft.world.IBlockAccess world, BlockPos pos) {
	return EnumPlantType.Plains;
}
 
源代码28 项目: Sakura_mod   文件: BlockMapleSaplingYellow.java
@Override
public net.minecraftforge.common.EnumPlantType getPlantType(net.minecraft.world.IBlockAccess world, BlockPos pos) {
	return EnumPlantType.Plains;
}
 
源代码29 项目: Sakura_mod   文件: BlockMapleSaplingRed.java
@Override
public net.minecraftforge.common.EnumPlantType getPlantType(net.minecraft.world.IBlockAccess world, BlockPos pos) {
	return EnumPlantType.Plains;
}
 
源代码30 项目: Sakura_mod   文件: BlockMapleSaplingOrange.java
@Override
public net.minecraftforge.common.EnumPlantType getPlantType(net.minecraft.world.IBlockAccess world, BlockPos pos) {
	return EnumPlantType.Plains;
}
 
 类方法
 同包方法