Search in sources :

Example 1 with BlockCropPlant

use of com.infinityraider.agricraft.content.core.BlockCropPlant in project AgriCraft by AgriCraft.

the class AgriProbeCropBlockDisplayOverride method overrideStandardInfo.

@Override
public boolean overrideStandardInfo(ProbeMode mode, IProbeInfo info, PlayerEntity playerEntity, World world, BlockState state, IProbeHitData hitData) {
    if (state.getBlock() instanceof BlockCropPlant) {
        TileEntity tile = world.getTileEntity(hitData.getPos());
        if (tile instanceof TileEntityCropPlant) {
            TileEntityCropPlant crop = (TileEntityCropPlant) tile;
            IAgriPlant plant = crop.getPlant();
            if (plant.isPlant()) {
                this.addData(info, plant);
                return true;
            }
        }
    }
    return false;
}
Also used : TileEntity(net.minecraft.tileentity.TileEntity) IAgriPlant(com.infinityraider.agricraft.api.v1.plant.IAgriPlant) BlockCropPlant(com.infinityraider.agricraft.content.core.BlockCropPlant) TileEntityCropPlant(com.infinityraider.agricraft.content.core.TileEntityCropPlant)

Example 2 with BlockCropPlant

use of com.infinityraider.agricraft.content.core.BlockCropPlant in project AgriCraft by AgriCraft.

the class AgriWailaCropBlockInfoProvider method getStack.

@Override
public ItemStack getStack(IDataAccessor accessor, IPluginConfig config) {
    if (accessor.getBlock() instanceof BlockCropPlant) {
        TileEntity tile = accessor.getTileEntity();
        if (tile instanceof TileEntityCropPlant) {
            TileEntityCropPlant crop = (TileEntityCropPlant) tile;
            IAgriPlant plant = crop.getPlant();
            if (plant.isPlant()) {
                return plant.toItemStack();
            }
        }
    }
    return ItemStack.EMPTY;
}
Also used : TileEntity(net.minecraft.tileentity.TileEntity) IAgriPlant(com.infinityraider.agricraft.api.v1.plant.IAgriPlant) BlockCropPlant(com.infinityraider.agricraft.content.core.BlockCropPlant) TileEntityCropPlant(com.infinityraider.agricraft.content.core.TileEntityCropPlant)

Aggregations

IAgriPlant (com.infinityraider.agricraft.api.v1.plant.IAgriPlant)2 BlockCropPlant (com.infinityraider.agricraft.content.core.BlockCropPlant)2 TileEntityCropPlant (com.infinityraider.agricraft.content.core.TileEntityCropPlant)2 TileEntity (net.minecraft.tileentity.TileEntity)2