Class MinecoloniesCropBlock

java.lang.Object
net.minecraft.world.level.block.state.BlockBehaviour
net.minecraft.world.level.block.Block
com.minecolonies.api.blocks.AbstractBlockMinecolonies<MinecoloniesCropBlock>
com.minecolonies.core.blocks.MinecoloniesCropBlock
All Implemented Interfaces:
IBlockMinecolonies<MinecoloniesCropBlock>, net.minecraft.world.flag.FeatureElement, net.minecraft.world.level.ItemLike, net.minecraftforge.common.extensions.IForgeBlock

public class MinecoloniesCropBlock extends AbstractBlockMinecolonies<MinecoloniesCropBlock>
Abstract Minecolonies crop type. We have our own to avoid cheesing the crop.s
  • Nested Class Summary

    Nested classes/interfaces inherited from class net.minecraft.world.level.block.Block

    net.minecraft.world.level.block.Block.BlockStatePairKey

    Nested classes/interfaces inherited from class net.minecraft.world.level.block.state.BlockBehaviour

    net.minecraft.world.level.block.state.BlockBehaviour.BlockStateBase, net.minecraft.world.level.block.state.BlockBehaviour.OffsetFunction, net.minecraft.world.level.block.state.BlockBehaviour.OffsetType, net.minecraft.world.level.block.state.BlockBehaviour.Properties, net.minecraft.world.level.block.state.BlockBehaviour.StateArgumentPredicate<A extends Object>, net.minecraft.world.level.block.state.BlockBehaviour.StatePredicate
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final net.minecraft.world.level.block.state.properties.IntegerProperty
     
    static String
     
    static String
     
    static String
     
    static String
     
    static String
     
    static String
     
    static String
     
    static String
     
    static String
     
    static String
     
    static String
     
    static String
     
    static String
     
    static String
     
    static String
     

    Fields inherited from class net.minecraft.world.level.block.Block

    BLOCK_STATE_REGISTRY, INDESTRUCTIBLE, INSTANT, stateDefinition, UPDATE_ALL, UPDATE_ALL_IMMEDIATE, UPDATE_CLIENTS, UPDATE_IMMEDIATE, UPDATE_INVISIBLE, UPDATE_KNOWN_SHAPE, UPDATE_LIMIT, UPDATE_MOVE_BY_PISTON, UPDATE_NEIGHBORS, UPDATE_NONE, UPDATE_SUPPRESS_DROPS

    Fields inherited from class net.minecraft.world.level.block.state.BlockBehaviour

    drops, dynamicShape, explosionResistance, friction, hasCollision, isRandomlyTicking, jumpFactor, properties, requiredFeatures, soundType, speedFactor, UPDATE_SHAPE_ORDER

    Fields inherited from interface net.minecraft.world.flag.FeatureElement

    FILTERED_REGISTRIES
  • Constructor Summary

    Constructors
    Constructor
    Description
    MinecoloniesCropBlock(String blockName, net.minecraft.world.level.block.Block preferredFarmland, List<net.minecraft.world.level.block.Block> droppedFrom, @Nullable net.minecraft.tags.TagKey<net.minecraft.world.level.biome.Biome> preferredBiome)
    Constructor to create a block of this type.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    attemptGrow(net.minecraft.world.level.block.state.BlockState state, net.minecraft.server.level.ServerLevel level, net.minecraft.core.BlockPos pos)
    Method to be called to attempt grow this crop.
    boolean
    canSurvive(@NotNull net.minecraft.world.level.block.state.BlockState state, net.minecraft.world.level.LevelReader level, @NotNull net.minecraft.core.BlockPos pos)
     
    protected void
    createBlockStateDefinition(net.minecraft.world.level.block.state.StateDefinition.Builder<net.minecraft.world.level.block.Block,net.minecraft.world.level.block.state.BlockState> creator)
     
    List<net.minecraft.world.level.block.Block>
    Get the blocks that this crop drops from.
    protected int
    Get the default max crop age.
    @Nullable net.minecraft.tags.TagKey<net.minecraft.world.level.biome.Biome>
    Get the preferred biome for this crop.
    net.minecraft.world.level.block.Block
    Get the preferred farmland for this crop.
    net.minecraft.resources.ResourceLocation
    Get the registry name of the block.
    @NotNull net.minecraft.world.phys.shapes.VoxelShape
    getShape(net.minecraft.world.level.block.state.BlockState state, @NotNull net.minecraft.world.level.BlockGetter level, @NotNull net.minecraft.core.BlockPos pos, @NotNull net.minecraft.world.phys.shapes.CollisionContext ctx)
     
    final boolean
    isMaxAge(net.minecraft.world.level.block.state.BlockState state)
    Check if the block is of max age.
    boolean
    isPathfindable(@NotNull net.minecraft.world.level.block.state.BlockState state, @NotNull net.minecraft.world.level.BlockGetter level, @NotNull net.minecraft.core.BlockPos pos, @NotNull net.minecraft.world.level.pathfinder.PathComputationType pathComputationType)
     
    boolean
    propagatesSkylightDown(net.minecraft.world.level.block.state.BlockState state, @NotNull net.minecraft.world.level.BlockGetter level, @NotNull net.minecraft.core.BlockPos pos)
     
    void
    registerBlockItem(net.minecraftforge.registries.IForgeRegistry<net.minecraft.world.item.Item> registry, net.minecraft.world.item.Item.Properties properties)
    Registery block at gameregistry.
    @NotNull net.minecraft.world.level.block.state.BlockState
    updateShape(net.minecraft.world.level.block.state.BlockState state, @NotNull net.minecraft.core.Direction dir, @NotNull net.minecraft.world.level.block.state.BlockState newState, @NotNull net.minecraft.world.level.LevelAccessor level, @NotNull net.minecraft.core.BlockPos pos, @NotNull net.minecraft.core.BlockPos neighborPos)
     
    net.minecraft.world.InteractionResult
    use(net.minecraft.world.level.block.state.BlockState state, net.minecraft.world.level.Level level, net.minecraft.core.BlockPos pos, net.minecraft.world.entity.player.Player player, net.minecraft.world.InteractionHand hand, net.minecraft.world.phys.BlockHitResult hitResult)
     

    Methods inherited from class com.minecolonies.api.blocks.AbstractBlockMinecolonies

    registerBlock

    Methods inherited from class net.minecraft.world.level.block.Block

    animateTick, appendHoverText, asBlock, asItem, box, builtInRegistryHolder, byItem, canSupportCenter, canSupportRigidBlock, canSustainPlant, defaultBlockState, destroy, dropFromExplosion, dropResources, dropResources, dropResources, dropResources, fallOn, getCloneItemStack, getDescriptionId, getDrops, getDrops, getExplosionResistance, getFriction, getId, getJumpFactor, getName, getRenderPropertiesInternal, getShapeForEachState, getSoundType, getSpeedFactor, getStateDefinition, getStateForPlacement, handlePrecipitation, hasDynamicShape, initializeClient, isExceptionForConnection, isFaceFull, isPossibleToRespawnInThis, isRandomlyTicking, isShapeFullBlock, playerDestroy, playerWillDestroy, popExperience, popResource, popResourceFromFace, pushEntitiesUp, registerDefaultState, setPlacedBy, shouldRenderFace, spawnDestroyParticles, stateById, stepOn, toString, tryDropExperience, updateEntityAfterFallOn, updateFromNeighbourShapes, updateOrDestroy, updateOrDestroy, wasExploded, withPropertiesOf

    Methods inherited from class net.minecraft.world.level.block.state.BlockBehaviour

    attack, canBeReplaced, canBeReplaced, defaultDestroyTime, defaultMapColor, entityInside, getAnalogOutputSignal, getBlockSupportShape, getCollisionShape, getDestroyProgress, getDirectSignal, getDrops, getFluidState, getInteractionShape, getLightBlock, getLootTable, getMaxHorizontalOffset, getMaxVerticalOffset, getMenuProvider, getOcclusionShape, getRenderShape, getSeed, getShadeBrightness, getSignal, getVisualShape, hasAnalogOutputSignal, isAir, isCollisionShapeFullBlock, isOcclusionShapeFullBlock, isSignalSource, mirror, neighborChanged, onPlace, onProjectileHit, onRemove, randomTick, requiredFeatures, rotate, skipRendering, spawnAfterBreak, tick, triggerEvent, updateIndirectNeighbourShapes, useShapeForLightOcclusion

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

    Methods inherited from interface net.minecraft.world.flag.FeatureElement

    isEnabled

    Methods inherited from interface net.minecraftforge.common.extensions.IForgeBlock

    addLandingEffects, addRunningEffects, canBeHydrated, canConnectRedstone, canDropFromExplosion, canEntityDestroy, canHarvestBlock, canStickTo, collisionExtendsVertically, getAdjacentBlockPathType, getAppearance, getBeaconColorMultiplier, getBedDirection, getBlockPathType, getCloneItemStack, getEnchantPowerBonus, getExpDrop, getExplosionResistance, getFireSpreadSpeed, getFlammability, getFriction, getLightEmission, getMapColor, getPistonPushReaction, getRespawnPosition, getSoundType, getStateAtViewpoint, getToolModifiedState, getWeakChanges, hidesNeighborFace, isBed, isBurning, isConduitFrame, isFertile, isFireSource, isFlammable, isLadder, isPortalFrame, isScaffolding, isSlimeBlock, isStickyBlock, isValidSpawn, makesOpenTrapdoorAboveClimbable, onBlockExploded, onBlockStateChange, onCaughtFire, onDestroyedByPlayer, onNeighborChange, onTreeGrow, rotate, setBedOccupied, shouldCheckWeakPower, shouldDisplayFluidOverlay, supportsExternalFaceHiding
  • Field Details

    • BELL_PEPPER

      public static String BELL_PEPPER
    • CABBAGE

      public static String CABBAGE
    • CHICKPEA

      public static String CHICKPEA
    • DURUM

      public static String DURUM
    • EGGPLANT

      public static String EGGPLANT
    • GARLIC

      public static String GARLIC
    • ONION

      public static String ONION
    • SOYBEAN

      public static String SOYBEAN
    • TOMATO

      public static String TOMATO
    • RICE

      public static String RICE
    • BUTTERNUT_SQUASH

      public static String BUTTERNUT_SQUASH
    • CORN

      public static String CORN
    • MINT

      public static String MINT
    • NETHER_PEPPER

      public static String NETHER_PEPPER
    • PEAS

      public static String PEAS
    • AGE

      public static final net.minecraft.world.level.block.state.properties.IntegerProperty AGE
  • Constructor Details

    • MinecoloniesCropBlock

      public MinecoloniesCropBlock(String blockName, net.minecraft.world.level.block.Block preferredFarmland, List<net.minecraft.world.level.block.Block> droppedFrom, @Nullable @Nullable net.minecraft.tags.TagKey<net.minecraft.world.level.biome.Biome> preferredBiome)
      Constructor to create a block of this type.
      Parameters:
      blockName - the block id.
  • Method Details

    • getShape

      @NotNull public @NotNull net.minecraft.world.phys.shapes.VoxelShape getShape(net.minecraft.world.level.block.state.BlockState state, @NotNull @NotNull net.minecraft.world.level.BlockGetter level, @NotNull @NotNull net.minecraft.core.BlockPos pos, @NotNull @NotNull net.minecraft.world.phys.shapes.CollisionContext ctx)
      Overrides:
      getShape in class net.minecraft.world.level.block.state.BlockBehaviour
    • isMaxAge

      public final boolean isMaxAge(net.minecraft.world.level.block.state.BlockState state)
      Check if the block is of max age.
      Parameters:
      state - the state its at.
      Returns:
      true if max age.
    • getMaxAge

      protected int getMaxAge()
      Get the default max crop age.
      Returns:
      the max age.
    • attemptGrow

      public void attemptGrow(net.minecraft.world.level.block.state.BlockState state, net.minecraft.server.level.ServerLevel level, net.minecraft.core.BlockPos pos)
      Method to be called to attempt grow this crop.
      Parameters:
      state - current state.
      level - level its in.
      pos - pos its at.
    • use

      public net.minecraft.world.InteractionResult use(net.minecraft.world.level.block.state.BlockState state, net.minecraft.world.level.Level level, net.minecraft.core.BlockPos pos, net.minecraft.world.entity.player.Player player, net.minecraft.world.InteractionHand hand, net.minecraft.world.phys.BlockHitResult hitResult)
      Overrides:
      use in class net.minecraft.world.level.block.state.BlockBehaviour
    • canSurvive

      public boolean canSurvive(@NotNull @NotNull net.minecraft.world.level.block.state.BlockState state, net.minecraft.world.level.LevelReader level, @NotNull @NotNull net.minecraft.core.BlockPos pos)
      Overrides:
      canSurvive in class net.minecraft.world.level.block.state.BlockBehaviour
    • createBlockStateDefinition

      protected void createBlockStateDefinition(net.minecraft.world.level.block.state.StateDefinition.Builder<net.minecraft.world.level.block.Block,net.minecraft.world.level.block.state.BlockState> creator)
      Overrides:
      createBlockStateDefinition in class net.minecraft.world.level.block.Block
    • updateShape

      @NotNull public @NotNull net.minecraft.world.level.block.state.BlockState updateShape(net.minecraft.world.level.block.state.BlockState state, @NotNull @NotNull net.minecraft.core.Direction dir, @NotNull @NotNull net.minecraft.world.level.block.state.BlockState newState, @NotNull @NotNull net.minecraft.world.level.LevelAccessor level, @NotNull @NotNull net.minecraft.core.BlockPos pos, @NotNull @NotNull net.minecraft.core.BlockPos neighborPos)
      Overrides:
      updateShape in class net.minecraft.world.level.block.state.BlockBehaviour
    • propagatesSkylightDown

      public boolean propagatesSkylightDown(net.minecraft.world.level.block.state.BlockState state, @NotNull @NotNull net.minecraft.world.level.BlockGetter level, @NotNull @NotNull net.minecraft.core.BlockPos pos)
      Overrides:
      propagatesSkylightDown in class net.minecraft.world.level.block.Block
    • isPathfindable

      public boolean isPathfindable(@NotNull @NotNull net.minecraft.world.level.block.state.BlockState state, @NotNull @NotNull net.minecraft.world.level.BlockGetter level, @NotNull @NotNull net.minecraft.core.BlockPos pos, @NotNull @NotNull net.minecraft.world.level.pathfinder.PathComputationType pathComputationType)
      Overrides:
      isPathfindable in class net.minecraft.world.level.block.state.BlockBehaviour
    • getRegistryName

      public net.minecraft.resources.ResourceLocation getRegistryName()
      Description copied from interface: IBlockMinecolonies
      Get the registry name of the block.
      Returns:
      the registry name.
    • registerBlockItem

      public void registerBlockItem(net.minecraftforge.registries.IForgeRegistry<net.minecraft.world.item.Item> registry, net.minecraft.world.item.Item.Properties properties)
      Description copied from interface: IBlockMinecolonies
      Registery block at gameregistry.
      Specified by:
      registerBlockItem in interface IBlockMinecolonies<MinecoloniesCropBlock>
      Overrides:
      registerBlockItem in class AbstractBlockMinecolonies<MinecoloniesCropBlock>
      Parameters:
      registry - the registry to use.
      properties - the item properties.
    • getPreferredFarmland

      public net.minecraft.world.level.block.Block getPreferredFarmland()
      Get the preferred farmland for this crop.
      Returns:
      the preferred farmland.
    • getDroppedFrom

      public List<net.minecraft.world.level.block.Block> getDroppedFrom()
      Get the blocks that this crop drops from.
    • getPreferredBiome

      @Nullable public @Nullable net.minecraft.tags.TagKey<net.minecraft.world.level.biome.Biome> getPreferredBiome()
      Get the preferred biome for this crop.
      Returns:
      the preferred biome, or null if not picky.