Class DecaySurfaceMyceliumBlock
java.lang.Object
net.minecraft.world.level.block.state.BlockBehaviour
net.minecraft.world.level.block.Block
etithespirit.orimod.common.block.decay.world.DecaySurfaceMyceliumBlock
- All Implemented Interfaces:
IDecayBlock
,IDecayBlockIdentifier
,IBlockItemPropertiesProvider
,net.minecraft.world.level.ItemLike
,net.minecraftforge.common.extensions.IForgeBlock
public class DecaySurfaceMyceliumBlock
extends net.minecraft.world.level.block.Block
implements IDecayBlock
A unique block that represents a thin film of Decay mycelium. It grows over the surface of blocks.
- Author:
- Eti
-
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.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
FieldsModifier and TypeFieldDescriptionprotected final List<net.minecraft.world.level.block.state.BlockState>
Every block that is specifically replaced by Decay Surface Mycelium, which is tracked because of its special directional handling.protected static final net.minecraft.world.phys.shapes.VoxelShape[]
Every possible combination of occupied surfaces.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, UPDATE_SUPPRESS_LIGHT
Fields inherited from class net.minecraft.world.level.block.state.BlockBehaviour
drops, dynamicShape, explosionResistance, friction, hasCollision, isRandomlyTicking, jumpFactor, material, properties, soundType, speedFactor, UPDATE_SHAPE_ORDER
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic boolean
canSpreadSurfaceMyceliumTo
(net.minecraft.world.level.Level worldIn, net.minecraft.core.BlockPos at, net.minecraft.world.level.block.state.BlockState existingBlock) Determines if a surface mycelium block (this block) can spread to the given position.void
createBlockStateDefinition
(net.minecraft.world.level.block.state.StateDefinition.Builder builder) void
doAdjacentSpread
(net.minecraft.world.level.block.state.StateHolder<?, ?> state, net.minecraft.server.level.ServerLevel worldIn, net.minecraft.core.BlockPos pos, net.minecraft.util.RandomSource random) The default routine for spreading to / infecting adjacent blocks.void
doDiagonalSpread
(net.minecraft.world.level.block.state.StateHolder<?, ?> state, net.minecraft.server.level.ServerLevel worldIn, net.minecraft.core.BlockPos pos, net.minecraft.util.RandomSource random) The default routine for spreading to / infecting diagonally oriented blocks (2D or 3D).net.minecraft.world.level.block.state.StateHolder<?,
?> getDecayReplacementFor
(net.minecraft.world.level.block.state.StateHolder<?, ?> existingBlock) When Decay blocks are registered, they define which block states or fluid states they replace, and what state to replace those with.
This method can be used to look up what a block's block replacement is, e.g.net.minecraft.world.phys.shapes.VoxelShape
getShape
(net.minecraft.world.level.block.state.BlockState state, net.minecraft.world.level.BlockGetter worldIn, net.minecraft.core.BlockPos pos, net.minecraft.world.phys.shapes.CollisionContext context) Returns the shape of the collision box.boolean
hasDecayReplacementFor
(net.minecraft.world.level.Level worldIn, net.minecraft.core.BlockPos at, net.minecraft.world.level.block.state.StateHolder<?, ?> existingBlock) Returns whether or not a replacement for the given state exists.net.minecraft.world.level.block.state.BlockState
healsInto
(net.minecraft.world.level.block.state.BlockState thisState) When this Decay block is cured, this is theBlockState
(of some vanilla or mod block) that it should heal into.void
neighborChanged
(net.minecraft.world.level.block.state.BlockState state, net.minecraft.world.level.Level worldIn, net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.Block blockIn, net.minecraft.core.BlockPos fromPos, boolean isMoving) void
onPlace
(net.minecraft.world.level.block.state.BlockState state, net.minecraft.world.level.Level worldIn, net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState oldState, boolean isMoving) void
randomTick
(net.minecraft.world.level.block.state.BlockState state, net.minecraft.server.level.ServerLevel worldIn, net.minecraft.core.BlockPos pos, net.minecraft.util.RandomSource random) void
registerReplacements
(List<net.minecraft.world.level.block.state.StateHolder<?, ?>> blocksToReplaceWithSelf) Register all of the blocks or fluids that this decay block will replace with itself once those blocks are infected.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, fillItemCategory, 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, propagatesSkylightDown, 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, canSurvive, defaultDestroyTime, defaultMaterialColor, entityInside, getAnalogOutputSignal, getBlockSupportShape, getCollisionShape, getDestroyProgress, getDirectSignal, getDrops, getFluidState, getInteractionShape, getLightBlock, getLootTable, getMaxHorizontalOffset, getMaxVerticalOffset, getMenuProvider, getOcclusionShape, getPistonPushReaction, getRenderShape, getSeed, getShadeBrightness, getSignal, getVisualShape, hasAnalogOutputSignal, isAir, isCollisionShapeFullBlock, isOcclusionShapeFullBlock, isPathfindable, isSignalSource, mirror, onProjectileHit, onRemove, rotate, skipRendering, spawnAfterBreak, tick, triggerEvent, updateIndirectNeighbourShapes, updateShape, use, useShapeForLightOcclusion
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface etithespirit.orimod.common.block.decay.IDecayBlock
defaultNeighborChanged, defaultOnEntityWalked, defaultRandomTick, getNonDecayableAdjacents, mutateReplacementState, needsToDoEdgeCheck, needsToSpread, randomUnoccupiedDiagonal, randomUnoccupiedDirection, shouldSpreadByRNG
Methods inherited from interface etithespirit.orimod.common.block.decay.IDecayBlockIdentifier
getPropertiesOfItem
Methods inherited from interface net.minecraftforge.common.extensions.IForgeBlock
addLandingEffects, addRunningEffects, canBeHydrated, canConnectRedstone, canDropFromExplosion, canEntityDestroy, canHarvestBlock, canStickTo, collisionExtendsVertically, getAdjacentBlockPathType, getBeaconColorMultiplier, getBedDirection, getBlockPathType, getCloneItemStack, getEnchantPowerBonus, getExpDrop, getExplosionResistance, getFireSpreadSpeed, getFlammability, getFriction, getLightEmission, getMapColor, getRespawnPosition, getSoundType, getStateAtViewpoint, getToolModifiedState, getWeakChanges, hidesNeighborFace, isBed, isBurning, isConduitFrame, isFertile, isFireSource, isFlammable, isLadder, isPortalFrame, isScaffolding, isSlimeBlock, isStickyBlock, isValidSpawn, makesOpenTrapdoorAboveClimbable, onBlockExploded, onBlockStateChange, onCaughtFire, onDestroyedByPlayer, onNeighborChange, rotate, setBedOccupied, shouldCheckWeakPower, shouldDisplayFluidOverlay, supportsExternalFaceHiding
-
Field Details
-
COLLISION_SHAPES
protected static final net.minecraft.world.phys.shapes.VoxelShape[] COLLISION_SHAPESEvery possible combination of occupied surfaces. -
blocksToReplaceWithMycelium
Every block that is specifically replaced by Decay Surface Mycelium, which is tracked because of its special directional handling.
-
-
Constructor Details
-
DecaySurfaceMyceliumBlock
public DecaySurfaceMyceliumBlock()
-
-
Method Details
-
createBlockStateDefinition
public void createBlockStateDefinition(net.minecraft.world.level.block.state.StateDefinition.Builder builder) - Overrides:
createBlockStateDefinition
in classnet.minecraft.world.level.block.Block
-
getShape
public net.minecraft.world.phys.shapes.VoxelShape getShape(net.minecraft.world.level.block.state.BlockState state, net.minecraft.world.level.BlockGetter worldIn, net.minecraft.core.BlockPos pos, net.minecraft.world.phys.shapes.CollisionContext context) Returns the shape of the collision box.- Overrides:
getShape
in classnet.minecraft.world.level.block.state.BlockBehaviour
-
registerReplacements
public void registerReplacements(List<net.minecraft.world.level.block.state.StateHolder<?, ?>> blocksToReplaceWithSelf) Description copied from interface:IDecayBlock
Register all of the blocks or fluids that this decay block will replace with itself once those blocks are infected.- Specified by:
registerReplacements
in interfaceIDecayBlock
- Parameters:
blocksToReplaceWithSelf
- A list of every block that is replaced by this upon infection.
-
hasDecayReplacementFor
public boolean hasDecayReplacementFor(net.minecraft.world.level.Level worldIn, net.minecraft.core.BlockPos at, net.minecraft.world.level.block.state.StateHolder<?, ?> existingBlock) Description copied from interface:IDecayBlock
Returns whether or not a replacement for the given state exists. This works for block and fluid states.- Specified by:
hasDecayReplacementFor
in interfaceIDecayBlock
- Parameters:
worldIn
- TheLevel
that this block exists in.at
- The location of this block in the world.existingBlock
- The block that may be replaced.- Returns:
- Whether or not this block actually has a replacement.
-
healsInto
public net.minecraft.world.level.block.state.BlockState healsInto(net.minecraft.world.level.block.state.BlockState thisState) Description copied from interface:IDecayBlock
When this Decay block is cured, this is theBlockState
(of some vanilla or mod block) that it should heal into.- Specified by:
healsInto
in interfaceIDecayBlock
- Returns:
- The vanilla or mod block that this decay block turns into once cured.
-
getDecayReplacementFor
public net.minecraft.world.level.block.state.StateHolder<?,?> getDecayReplacementFor(net.minecraft.world.level.block.state.StateHolder<?, ?> existingBlock) Description copied from interface:IDecayBlock
When Decay blocks are registered, they define which block states or fluid states they replace, and what state to replace those with.
This method can be used to look up what a block's block replacement is, e.g. pass inBlocks.STONE.getDefaultState()
to receive the Decay-equivalent of stone.
Returns null if there is no substitute.
This is a per-instance sensitive variant of the function and should always be called if an instance of the spreading Decay block is available.- Specified by:
getDecayReplacementFor
in interfaceIDecayBlock
- Parameters:
existingBlock
- The block that will be replaced.- Returns:
- The replacement blockstate, or null if there is no replacement.
-
doDiagonalSpread
public void doDiagonalSpread(net.minecraft.world.level.block.state.StateHolder<?, ?> state, net.minecraft.server.level.ServerLevel worldIn, net.minecraft.core.BlockPos pos, net.minecraft.util.RandomSource random) Description copied from interface:IDecayBlock
The default routine for spreading to / infecting diagonally oriented blocks (2D or 3D). This can be imagined with the current block being the center of a 3x3x3 cube. It applies to all blocks that are not directly adjacent to one of the six faces of this block.- Specified by:
doDiagonalSpread
in interfaceIDecayBlock
- Parameters:
state
- The block that is responsible for the spreading.worldIn
- TheLevel
that this spread is occurring in.pos
- The location at which this block exists.random
- The pseudorandomizer of this world.
-
doAdjacentSpread
public void doAdjacentSpread(net.minecraft.world.level.block.state.StateHolder<?, ?> state, net.minecraft.server.level.ServerLevel worldIn, net.minecraft.core.BlockPos pos, net.minecraft.util.RandomSource random) Description copied from interface:IDecayBlock
The default routine for spreading to / infecting adjacent blocks.- Specified by:
doAdjacentSpread
in interfaceIDecayBlock
- Parameters:
state
- The block that is responsible for the spreading.worldIn
- TheLevel
that this spread is occurring in.pos
- The location at which this block exists.random
- The pseudorandomizer of this world.
-
randomTick
public void randomTick(net.minecraft.world.level.block.state.BlockState state, net.minecraft.server.level.ServerLevel worldIn, net.minecraft.core.BlockPos pos, net.minecraft.util.RandomSource random) - Overrides:
randomTick
in classnet.minecraft.world.level.block.state.BlockBehaviour
-
neighborChanged
public void neighborChanged(net.minecraft.world.level.block.state.BlockState state, net.minecraft.world.level.Level worldIn, net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.Block blockIn, net.minecraft.core.BlockPos fromPos, boolean isMoving) - Overrides:
neighborChanged
in classnet.minecraft.world.level.block.state.BlockBehaviour
-
onPlace
public void onPlace(net.minecraft.world.level.block.state.BlockState state, net.minecraft.world.level.Level worldIn, net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState oldState, boolean isMoving) - Overrides:
onPlace
in classnet.minecraft.world.level.block.state.BlockBehaviour
-
canSpreadSurfaceMyceliumTo
public static boolean canSpreadSurfaceMyceliumTo(net.minecraft.world.level.Level worldIn, net.minecraft.core.BlockPos at, net.minecraft.world.level.block.state.BlockState existingBlock) Determines if a surface mycelium block (this block) can spread to the given position. This should NOT return true for any other Decay replacements, only surface mycelium replacements should return true.- Parameters:
worldIn
- The world this is spreading in.at
- The location this wants to spread to.existingBlock
- The block that is already there.- Returns:
- Whether or not this block can spread to the given block position.
-