Java 类org.bukkit.material.CocoaPlant 实例源码

项目:CropControl    文件:CropControlEventHandler.java   
public String getCropState(BlockState blockState) {
    switch (blockState.getType()) { // .getBlock().getType()) {
    case COCOA:
        return ((CocoaPlant) blockState.getData()).getSize().toString();
    case NETHER_WARTS:
        return ((NetherWarts) blockState.getData()).getState().toString();
    case MELON_STEM:
        return (int) blockState.getBlock().getData() + "";
    case PUMPKIN_STEM:
        return (int) blockState.getBlock().getData() + "";
    case CACTUS:
        return null;
    case BROWN_MUSHROOM:
        return null;
    case RED_MUSHROOM:
        return null;
    case SUGAR_CANE_BLOCK:
        return null;
    default:
        //CropControl.getPlugin().debug("Unable to find CropState match for {0}", blockState);
        return ((Crops) blockState.getData()).getState().toString();
    }
}
项目:StarQuestCode    文件:CropCocoa.java   
@Override
public boolean useBonemeal(BlockLocation crop) {
    try {
        BlockState state = crop.getBlock().getState();
        CocoaPlant cocoaPlant = (CocoaPlant) state.getData();
        CocoaPlant.CocoaPlantSize size = cocoaPlant.getSize();
        if (cocoaPlant.getSize() == CocoaPlant.CocoaPlantSize.LARGE) {
            return false;
        }
        switch (size) {
        case SMALL:
            cocoaPlant.setSize(CocoaPlant.CocoaPlantSize.MEDIUM);
            break;
        case MEDIUM:
            cocoaPlant.setSize(CocoaPlant.CocoaPlantSize.LARGE);
            break;
        default:
        }
        state.setData(cocoaPlant);
        return state.update();
    } catch (ClassCastException e) {
        return false;
    }
}
项目:SwornRPG    文件:Herbalism.java   
private boolean isApplicable(Block block)
{
    BlockState state = block.getState();
    switch (state.getType())
    {
        case CACTUS:
        case MELON_BLOCK:
        case PUMPKIN:
            return true;
        case CROPS:
            return ((Crops) state.getData()).getState() == CropState.RIPE;
        case NETHER_WARTS:
            return ((NetherWarts) state.getData()).getState() == NetherWartsState.RIPE;
        case COCOA:
            return ((CocoaPlant) state.getData()).getSize() == CocoaPlantSize.LARGE;
        default:
            return false;
    }
}
项目:StarQuestCode    文件:CropCocoa.java   
@Override
public boolean isRipe(BlockLocation crop) {
    try {
        CocoaPlant cocoaPlant = (CocoaPlant) crop.getBlock().getState().getData();
        return cocoaPlant.getSize() == CocoaPlant.CocoaPlantSize.LARGE;
    } catch (ClassCastException e) {
        return false;
    }
}
项目:StarQuestCode    文件:CropCocoa.java   
@Override
public void plant(BlockLocation crop, boolean usedBonemeal) {
    BlockRotation rotation = findJungleLog(crop);
    if (rotation == null)
        return;
    Block block = crop.getBlock();
    block.setType(getHarvestableMaterial());
    BlockState state = block.getState();
    state.setData(new CocoaPlant(CocoaPlant.CocoaPlantSize.SMALL, rotation.getYawFace()));
    state.update();
}
项目:McMMOPlus    文件:BlockUtils.java   
/**
 * Determine if a given block should be affected by Green Terra
 *
 * @param blockState The {@link BlockState} of the block to check
 * @return true if the block should affected by Green Terra, false otherwise
 */
public static boolean affectedByGreenTerra(BlockState blockState) {
    switch (blockState.getType()) {
        case BROWN_MUSHROOM:
        case CACTUS:
        case DOUBLE_PLANT:
        case MELON_BLOCK:
        case LONG_GRASS:
        case PUMPKIN:
        case RED_MUSHROOM:
        case RED_ROSE:
        case SUGAR_CANE_BLOCK:
        case VINE:
        case WATER_LILY:
        case YELLOW_FLOWER:
            return true;

        case CARROT:
        case POTATO:
            return blockState.getRawData() == CropState.RIPE.getData();

        case CROPS:
            return ((Crops) blockState.getData()).getState() == CropState.RIPE;

        case NETHER_WARTS:
            return ((NetherWarts) blockState.getData()).getState() == NetherWartsState.RIPE;

        case COCOA:
            return ((CocoaPlant) blockState.getData()).getSize() == CocoaPlantSize.LARGE;

        default:
            return mcMMO.getModManager().isCustomHerbalismBlock(blockState);
    }
}
项目:SwornRPG    文件:Herbalism.java   
private boolean isGrowable(Block block)
{
    BlockState state = block.getState();
    Material material = block.getType();
    MaterialData data = state.getData();

    return data instanceof NetherWarts || data instanceof Crops || data instanceof CocoaPlant
            || material == Material.SAPLING || material == Material.RED_MUSHROOM || material == Material.BROWN_MUSHROOM;
}
项目:McMMOPlus    文件:HerbalismManager.java   
private boolean handleBlockState(BlockState blockState, boolean greenTerra) {
    byte greenThumbStage = getGreenThumbStage();

    blockState.setMetadata(mcMMO.greenThumbDataKey, new FixedMetadataValue(mcMMO.p, (int) (System.currentTimeMillis() / Misc.TIME_CONVERSION_FACTOR)));

    switch (blockState.getType()) {
        case CROPS:
            Crops crops = (Crops) blockState.getData();

            if (greenTerra) {
                crops.setState(CropState.MEDIUM);
            }
            else {
                switch (greenThumbStage) {
                    case 4:
                        crops.setState(CropState.SMALL);
                        break;
                    case 3:
                        crops.setState(CropState.VERY_SMALL);
                        break;
                    case 2:
                        crops.setState(CropState.GERMINATED);
                        break;
                    default:
                        crops.setState(CropState.SEEDED);
                        break;
                }
            }

            return true;

        case CARROT:
        case POTATO:
            if (greenTerra) {
                blockState.setRawData(CropState.MEDIUM.getData());
            }
            else {
                blockState.setRawData(greenThumbStage);
            }

            return true;

        case NETHER_WARTS:
            NetherWarts warts = (NetherWarts) blockState.getData();

            if (greenTerra || greenThumbStage > 2) {
                warts.setState(NetherWartsState.STAGE_TWO);
            }
            else if (greenThumbStage == 2) {
                warts.setState(NetherWartsState.STAGE_ONE);
            }
            else {
                warts.setState(NetherWartsState.SEEDED);
            }

            return true;

        case COCOA:
            CocoaPlant plant = (CocoaPlant) blockState.getData();

            if (greenTerra || getGreenThumbStage() > 1) {
                plant.setSize(CocoaPlantSize.MEDIUM);
            }
            else {
                plant.setSize(CocoaPlantSize.SMALL);
            }

            return true;

        default:
            return false;
    }
}
项目:BedrockAPI    文件:CocoaPlant.java   
public CocoaPlant() {
}
项目:BedrockAPI    文件:CocoaPlant.java   
@Deprecated public CocoaPlant(int type) {
}
项目:BedrockAPI    文件:CocoaPlant.java   
@Deprecated public CocoaPlant(int type, byte data) {
}
项目:BedrockAPI    文件:CocoaPlant.java   
public CocoaPlant(CocoaPlant.CocoaPlantSize sz) {
}
项目:BedrockAPI    文件:CocoaPlant.java   
public CocoaPlant(CocoaPlant.CocoaPlantSize sz, BlockFace dir) {
}
项目:BedrockAPI    文件:CocoaPlant.java   
public CocoaPlant.CocoaPlantSize getSize() {
    return null;
}
项目:BedrockAPI    文件:CocoaPlant.java   
public void setSize(CocoaPlant.CocoaPlantSize sz) {
}
项目:BedrockAPI    文件:CocoaPlant.java   
public CocoaPlant clone() {
    return null;
}