Package com.minecolonies.core.blocks
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.neoforged.neoforge.common.extensions.IBlockExtension
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.BlockStatePairKeyNested 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>, net.minecraft.world.level.block.state.BlockBehaviour.StatePredicate -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final net.minecraft.world.level.block.state.properties.IntegerPropertystatic Stringstatic Stringstatic Stringstatic Stringstatic Stringstatic Stringstatic Stringstatic Stringstatic Stringstatic Stringstatic Stringstatic Stringstatic Stringstatic Stringstatic StringFields inherited from class net.minecraft.world.level.block.Block
BLOCK_STATE_REGISTRY, CODEC, 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_DROPSFields inherited from class net.minecraft.world.level.block.state.BlockBehaviour
drops, dynamicShape, explosionResistance, friction, hasCollision, isRandomlyTicking, jumpFactor, properties, requiredFeatures, soundType, speedFactor, UPDATE_SHAPE_ORDERFields inherited from interface net.minecraft.world.flag.FeatureElement
FILTERED_REGISTRIES -
Constructor Summary
ConstructorsConstructorDescriptionMinecoloniesCropBlock(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 TypeMethodDescriptionvoidattemptGrow(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.booleancanSurvive(@NotNull net.minecraft.world.level.block.state.BlockState state, net.minecraft.world.level.LevelReader level, @NotNull net.minecraft.core.BlockPos pos) protected voidcreateBlockStateDefinition(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 intGet 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.BlockGet the preferred farmland for this crop.net.minecraft.resources.ResourceLocationGet the registry name of the block.@NotNull net.minecraft.world.phys.shapes.VoxelShapegetShape(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 booleanisMaxAge(net.minecraft.world.level.block.state.BlockState state) Check if the block is of max age.booleanisPathfindable(@NotNull net.minecraft.world.level.block.state.BlockState state, @NotNull net.minecraft.world.level.pathfinder.PathComputationType pathComputationType) booleanpropagatesSkylightDown(net.minecraft.world.level.block.state.BlockState state, @NotNull net.minecraft.world.level.BlockGetter level, @NotNull net.minecraft.core.BlockPos pos) voidregisterBlockItem(net.minecraft.core.Registry<net.minecraft.world.item.Item> registry, net.minecraft.world.item.Item.Properties properties) Registery block at gameregistry.@NotNull net.minecraft.world.level.block.state.BlockStateupdateShape(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) protected net.minecraft.world.ItemInteractionResultuseItemOn(net.minecraft.world.item.ItemStack stack, 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 result) Methods inherited from class com.minecolonies.api.blocks.AbstractBlockMinecolonies
registerBlockMethods inherited from class net.minecraft.world.level.block.Block
animateTick, appendHoverText, asBlock, asItem, box, builtInRegistryHolder, byItem, canSupportCenter, canSupportRigidBlock, codec, defaultBlockState, destroy, dropFromExplosion, dropResources, dropResources, dropResources, fallOn, getCloneItemStack, getDescriptionId, getDrops, getDrops, getExplosionResistance, getFriction, getId, getJumpFactor, getName, getShapeForEachState, getSpeedFactor, getStateDefinition, getStateForPlacement, handlePrecipitation, hasDynamicShape, initializeClient, isExceptionForConnection, isFaceFull, isPossibleToRespawnInThis, isShapeFullBlock, playerDestroy, playerWillDestroy, popExperience, popResource, popResourceFromFace, pushEntitiesUp, registerDefaultState, setPlacedBy, shouldRenderFace, spawnDestroyParticles, stateById, stepOn, toString, tryDropExperience, updateEntityAfterFallOn, updateFromNeighbourShapes, updateOrDestroy, updateOrDestroy, wasExploded, withPropertiesOfMethods 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, getSoundType, getVisualShape, hasAnalogOutputSignal, isAir, isCollisionShapeFullBlock, isOcclusionShapeFullBlock, isRandomlyTicking, isSignalSource, mirror, neighborChanged, onExplosionHit, onPlace, onProjectileHit, onRemove, properties, propertiesCodec, randomTick, requiredFeatures, rotate, simpleCodec, skipRendering, spawnAfterBreak, tick, triggerEvent, updateIndirectNeighbourShapes, useShapeForLightOcclusion, useWithoutItemMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface net.minecraft.world.flag.FeatureElement
isEnabledMethods inherited from interface net.neoforged.neoforge.common.extensions.IBlockExtension
addLandingEffects, addRunningEffects, canBeHydrated, canConnectRedstone, canDropFromExplosion, canEntityDestroy, canHarvestBlock, canStickTo, canSustainPlant, collisionExtendsVertically, getAdjacentBlockPathType, getAppearance, getBeaconColorMultiplier, getBedDirection, getBlockPathType, getBubbleColumnDirection, getCloneItemStack, getEnchantPowerBonus, getExpDrop, getExplosionResistance, getFireSpreadSpeed, getFlammability, getFriction, getLightEmission, getMapColor, getPistonPushReaction, getRespawnPosition, getSoundType, getStateAtViewpoint, getToolModifiedState, getWeakChanges, hasDynamicLightEmission, hidesNeighborFace, isBed, isBurning, isConduitFrame, isEmpty, isFertile, isFireSource, isFlammable, isLadder, isPortalFrame, isScaffolding, isSlimeBlock, isStickyBlock, makesOpenTrapdoorAboveClimbable, onBlockExploded, onBlockStateChange, onCaughtFire, onDestroyedByPlayer, onDestroyedByPushReaction, onNeighborChange, onTreeGrow, rotate, setBedOccupied, shouldCheckWeakPower, shouldDisplayFluidOverlay, supportsExternalFaceHiding
-
Field Details
-
BELL_PEPPER
-
CABBAGE
-
CHICKPEA
-
DURUM
-
EGGPLANT
-
GARLIC
-
ONION
-
SOYBEAN
-
TOMATO
-
RICE
-
BUTTERNUT_SQUASH
-
CORN
-
MINT
-
NETHER_PEPPER
-
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:
getShapein classnet.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.
-
useItemOn
protected net.minecraft.world.ItemInteractionResult useItemOn(net.minecraft.world.item.ItemStack stack, 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 result) - Overrides:
useItemOnin classnet.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:
canSurvivein classnet.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:
createBlockStateDefinitionin classnet.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:
updateShapein classnet.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:
propagatesSkylightDownin classnet.minecraft.world.level.block.state.BlockBehaviour
-
isPathfindable
public boolean isPathfindable(@NotNull @NotNull net.minecraft.world.level.block.state.BlockState state, @NotNull @NotNull net.minecraft.world.level.pathfinder.PathComputationType pathComputationType) - Overrides:
isPathfindablein classnet.minecraft.world.level.block.state.BlockBehaviour
-
getRegistryName
public net.minecraft.resources.ResourceLocation getRegistryName()Description copied from interface:IBlockMinecoloniesGet the registry name of the block.- Returns:
- the registry name.
-
registerBlockItem
public void registerBlockItem(net.minecraft.core.Registry<net.minecraft.world.item.Item> registry, net.minecraft.world.item.Item.Properties properties) Description copied from interface:IBlockMinecoloniesRegistery block at gameregistry.- Specified by:
registerBlockItemin interfaceIBlockMinecolonies<MinecoloniesCropBlock>- Overrides:
registerBlockItemin classAbstractBlockMinecolonies<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
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.
-