當前位置: 首頁>>代碼示例>>Java>>正文


Java EnumPlantType.Crop方法代碼示例

本文整理匯總了Java中net.minecraftforge.common.EnumPlantType.Crop方法的典型用法代碼示例。如果您正苦於以下問題:Java EnumPlantType.Crop方法的具體用法?Java EnumPlantType.Crop怎麽用?Java EnumPlantType.Crop使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在net.minecraftforge.common.EnumPlantType的用法示例。


在下文中一共展示了EnumPlantType.Crop方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: 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

示例2: 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

示例3: acceptsInputStack

import net.minecraftforge.common.EnumPlantType; //導入方法依賴的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;
}
 
開發者ID:faceofcat,項目名稱:Mekfarm,代碼行數:15,代碼來源:CropClonerEntity.java

示例4: canSustainPlant

import net.minecraftforge.common.EnumPlantType; //導入方法依賴的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;
}
 
開發者ID:OreCruncher,項目名稱:ThermalRecycling,代碼行數:8,代碼來源:FertileLand.java

示例5: canSustainPlant

import net.minecraftforge.common.EnumPlantType; //導入方法依賴的package包/類
@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;
}
 
開發者ID:jaquadro,項目名稱:GardenCollection,代碼行數:11,代碼來源:BlockLargePot.java

示例6: getPlantType

import net.minecraftforge.common.EnumPlantType; //導入方法依賴的package包/類
@Override
public EnumPlantType getPlantType(IBlockAccess world, BlockPos pos) {
    return EnumPlantType.Crop;
}
 
開發者ID:BenjaminSutter,項目名稱:genera,代碼行數:5,代碼來源:ItemSeedNightshade.java

示例7: getPlantType

import net.minecraftforge.common.EnumPlantType; //導入方法依賴的package包/類
@Override
public EnumPlantType getPlantType(IBlockAccess world, BlockPos pos) {
	return soil == Blocks.FARMLAND ? EnumPlantType.Crop : EnumPlantType.Water;
}
 
開發者ID:Um-Mitternacht,項目名稱:Bewitchment,代碼行數:5,代碼來源:ItemSeed.java

示例8: BlockCropsBase

import net.minecraftforge.common.EnumPlantType; //導入方法依賴的package包/類
public BlockCropsBase(String unlocalizedName, String modId, Item seed, Item crop) {
    this(unlocalizedName, modId, seed, crop, EnumPlantType.Crop);
}
 
開發者ID:sedlak477,項目名稱:MrglgaghCore,代碼行數:4,代碼來源:BlockCropsBase.java

示例9: getPlantType

import net.minecraftforge.common.EnumPlantType; //導入方法依賴的package包/類
@Override
public EnumPlantType getPlantType(IBlockAccess world, BlockPos pos) {

	return EnumPlantType.Crop;
}
 
開發者ID:bafomdad,項目名稱:uniquecrops,代碼行數:6,代碼來源:ItemSeedsUC.java

示例10: 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));
	return direction == EnumFacing.UP && (type == EnumPlantType.Crop || type == EnumPlantType.Plains);
}
 
開發者ID:V0idWa1k3r,項目名稱:ExPetrum,代碼行數:7,代碼來源:BlockFarmland.java

示例11: getPlantType

import net.minecraftforge.common.EnumPlantType; //導入方法依賴的package包/類
@Override
public EnumPlantType getPlantType(IBlockAccess world, BlockPos pos)
{
	return world.getTileEntity(pos).hasCapability(ExPCropCapability.cropCap, null) && IExPCrop.of(world.getTileEntity(pos)).isWild() ? EnumPlantType.Plains : EnumPlantType.Crop;
}
 
開發者ID:V0idWa1k3r,項目名稱:ExPetrum,代碼行數:6,代碼來源:BlockCrop.java

示例12: getPlantType

import net.minecraftforge.common.EnumPlantType; //導入方法依賴的package包/類
@Override
public EnumPlantType getPlantType(IBlockAccess world, BlockPos pos)
{
    return EnumPlantType.Crop;
}
 
開發者ID:DaedalusGame,項目名稱:BetterWithAddons,代碼行數:6,代碼來源:BlockCropRush.java

示例13: getPlantType

import net.minecraftforge.common.EnumPlantType; //導入方法依賴的package包/類
@Override
public EnumPlantType getPlantType(IBlockAccess world, BlockPos pos) {
	return EnumPlantType.Crop;
}
 
開發者ID:KillBait,項目名稱:PrimordialCrops,代碼行數:5,代碼來源:CropBlocksSpecial.java

示例14: performWork

import net.minecraftforge.common.EnumPlantType; //導入方法依賴的package包/類
@Override
    protected float performWork() {
        float result = 0.0f;
        // EnumFacing facing = super.getFacing();

        if (this.plantedThing != null) {
            PropertyInteger ageProperty = this.getAgeProperty(this.plantedThing);
            if (ageProperty != null) {
                int age = this.plantedThing.getValue(ageProperty);
                Integer[] ages = ageProperty.getAllowedValues().toArray(new Integer[0]);
                if (age == ages[ages.length - 1]) {
                    List<ItemStack> stacks = this.plantedThing.getBlock().getDrops(this.getWorld(), this.getPos(), this.plantedThing, 0);
//                    if (stacks != null) {
//                        for (ItemStack s : stacks) {
//                            ItemStack remaining = ItemHandlerHelper.insertItem(this.outStackHandler, s, false);
//                            if (!ItemStackUtil.isEmpty(remaining)) {
////                                BlockPos spawnPos = this.pos.offset(facing);
////                                world.spawnEntity(new EntityItem(this.getWorld(), spawnPos.getX(), spawnPos.getY(), spawnPos.getZ(), remaining));
//                                super.spawnOverloadedItem(remaining);
//                            }
//                        }
//                    }
                    if (super.outputItems(stacks)) {
                        this.plantedThing = null;
                        result += .85f;
                    }
                } else {
                    this.plantedThing = this.plantedThing.withProperty(ageProperty, ++age);
                    result += .85f;
                }
                this.onPlantedThingChanged();
            }
//            result += .85f;
        }

        if ((this.plantedThing == null) && (this.waterTank != null) && (this.waterTank.getFluidAmount() >= 250)) {
            ItemStack stack = this.inStackHandler.getStackInSlot(0);
            if (!ItemStackUtil.isEmpty(stack) && (stack.getItem() instanceof IPlantable)) {
                IPlantable plantable = (IPlantable) stack.getItem();
                if (plantable.getPlantType(this.getWorld(), this.getPos()) == EnumPlantType.Crop) {
                    this.plantedThing = plantable.getPlant(this.getWorld(), this.getPos());
                    this.waterTank.drain(250, true); // TODO: <-- do this better
                    this.onPlantedThingChanged();
                }
            }
            result += .15f;
        }

        return result;
    }
 
開發者ID:faceofcat,項目名稱:Mekfarm,代碼行數:51,代碼來源:CropClonerEntity.java

示例15: canPlantHere

import net.minecraftforge.common.EnumPlantType; //導入方法依賴的package包/類
@Override
public boolean canPlantHere(World world, BlockPos pos) {
    return (world.getBlockState(pos.down()).getBlock() == Blocks.FARMLAND)
            && this.plantable.getPlantType(world, pos) == EnumPlantType.Crop;
}
 
開發者ID:faceofcat,項目名稱:Mekfarm,代碼行數:6,代碼來源:VanillaGenericSeed.java


注:本文中的net.minecraftforge.common.EnumPlantType.Crop方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。