Class McStatePart
- All Implemented Interfaces:
IconHitEffectsPart,ModelRenderPart,MultiPart,NormalOcclusionPart
- Direct Known Subclasses:
McSidedStatePart
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract net.minecraft.world.level.block.state.BlockStatenet.minecraft.world.phys.shapes.VoxelShapeMaps toBlockBehaviour.getBlockSupportShape(BlockState, BlockGetter, BlockPos).codechicken.lib.vec.Cuboid6net.minecraft.client.renderer.texture.TextureAtlasSpritenet.minecraft.client.renderer.texture.TextureAtlasSpritegetBrokenIcon(int side) net.minecraft.world.item.ItemStackReturn theItemStackfor pick-block(usually middle click) function.net.minecraft.world.phys.shapes.VoxelShapegetCollisionShape(net.minecraft.world.phys.shapes.CollisionContext context) Maps toBlockBehaviour.getCollisionShape(BlockState, BlockGetter, BlockPos, CollisionContext).net.minecraft.world.level.block.state.BlockStateIterable<net.minecraft.world.item.ItemStack> getDrops()Return a list ofItemStacks that should be dropped when this part is destroyed.abstract net.minecraft.world.item.ItemStacknet.minecraft.world.phys.shapes.VoxelShapeMaps toBlockBehaviour.getInteractionShape(BlockState, BlockGetter, BlockPos).intThe light level emitted by this part.net.minecraft.world.phys.shapes.VoxelShapenet.minecraft.world.level.block.SoundTypegetPlacementSound(net.minecraft.world.item.context.UseOnContext context) Used to get the sound for this part when placed.net.minecraft.world.phys.shapes.VoxelShapeMaps toBlockBehaviour.getOcclusionShape(BlockState, BlockGetter, BlockPos).net.minecraft.world.phys.shapes.VoxelShapegetShape(net.minecraft.world.phys.shapes.CollisionContext context) Maps toBlockBehaviour.getShape(BlockState, BlockGetter, BlockPos, CollisionContext).floatgetStrength(net.minecraft.world.entity.player.Player player, PartRayTraceResult hit) Return a value indicating how hard this part is to break.net.minecraft.world.phys.shapes.VoxelShapegetVisualShape(net.minecraft.world.phys.shapes.CollisionContext context) Maps toBlockBehaviour.getVisualShape(BlockState, BlockGetter, BlockPos, CollisionContext).voidload(net.minecraft.nbt.CompoundTag tag, net.minecraft.core.HolderLookup.Provider registries) Load this part from aCompoundTag.booleanocclusionTest(MultiPart nPart) Perform an occlusion test to determine weather this part andnpartcan 'fit' into this block space.voidreadDesc(codechicken.lib.data.MCDataInput packet) Fill out this part with the description information contained inpacket.voidsave(net.minecraft.nbt.CompoundTag tag, net.minecraft.core.HolderLookup.Provider registries) Save this part to aCompoundTag.@Nullable MultiPartsetStateOnPlacement(net.minecraft.world.item.context.BlockPlaceContext context) voidwriteDesc(codechicken.lib.data.MCDataOutput packet) Write all the data required to describe a client version of this part to the packet.Methods inherited from class codechicken.multipart.api.part.BaseMultipart
bind, hasTile, tileMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface codechicken.multipart.api.part.IconHitEffectsPart
addDestroyEffects, addHitEffectsMethods inherited from interface codechicken.multipart.api.part.ModelRenderPart
getModelDataMethods inherited from interface codechicken.multipart.api.part.MultiPart
addLandingEffects, addRunningEffects, capCache, click, getExplosionResistance, getRenderBounds, getType, harvest, hasLevel, hasTile, invalidateConvertedTile, level, onAdded, onChunkLoad, onChunkUnload, onConverted, onEntityCollision, onEntityStanding, onMoved, onNeighborBlockChanged, onPartChanged, onRemoved, onWorldJoin, onWorldSeparate, pos, preRemove, readUpdate, scheduledTick, scheduleTick, sendUpdate, tile, useItemOn, useWithoutItem
-
Field Details
-
state
public net.minecraft.world.level.block.state.BlockState state
-
-
Constructor Details
-
McStatePart
public McStatePart() -
McStatePart
public McStatePart(net.minecraft.world.level.block.state.BlockState state)
-
-
Method Details
-
defaultBlockState
public abstract net.minecraft.world.level.block.state.BlockState defaultBlockState() -
getDropStack
public abstract net.minecraft.world.item.ItemStack getDropStack() -
getDrops
Description copied from interface:MultiPartReturn a list ofItemStacks that should be dropped when this part is destroyed. -
getCloneStack
Description copied from interface:MultiPartReturn theItemStackfor pick-block(usually middle click) function.- Specified by:
getCloneStackin interfaceMultiPart- Parameters:
hit- ThePartRayTraceResulthit result.- Returns:
- The
ItemStackpick result.
-
save
public void save(net.minecraft.nbt.CompoundTag tag, net.minecraft.core.HolderLookup.Provider registries) Description copied from interface:MultiPartSave this part to aCompoundTag.Only called server-side.
-
load
public void load(net.minecraft.nbt.CompoundTag tag, net.minecraft.core.HolderLookup.Provider registries) Description copied from interface:MultiPartLoad this part from aCompoundTag.Only called server-side.
-
writeDesc
public void writeDesc(codechicken.lib.data.MCDataOutput packet) Description copied from interface:MultiPartWrite all the data required to describe a client version of this part to the packet.Called server-side, when a client loads a part for the first time.
-
readDesc
public void readDesc(codechicken.lib.data.MCDataInput packet) Description copied from interface:MultiPartFill out this part with the description information contained inpacket.Companion method to
MultiPart.writeDesc(MCDataOutput).Called client-side when the client loads this part for the first time.
-
getCurrentState
public net.minecraft.world.level.block.state.BlockState getCurrentState()- Specified by:
getCurrentStatein interfaceModelRenderPart
-
setStateOnPlacement
@Nullable public @Nullable MultiPart setStateOnPlacement(net.minecraft.world.item.context.BlockPlaceContext context) -
getStrength
Description copied from interface:MultiPartReturn a value indicating how hard this part is to break.By default, MC calculates this as (sudo code):
player.digSpeedZeroToOne / block.hardness / canHarvest ? 30 : 100- Specified by:
getStrengthin interfaceMultiPart- Parameters:
player- The player breaking the block.hit- ThePartRayTraceResulthit result.- Returns:
- The block strength.
-
getLightEmission
public int getLightEmission()Description copied from interface:MultiPartThe light level emitted by this part.- Specified by:
getLightEmissionin interfaceMultiPart- Returns:
- The light level.
-
getShape
public net.minecraft.world.phys.shapes.VoxelShape getShape(net.minecraft.world.phys.shapes.CollisionContext context) Description copied from interface:MultiPartMaps toBlockBehaviour.getShape(BlockState, BlockGetter, BlockPos, CollisionContext).If this shape changes after initial placement, call
TileMultipart.markShapeChange(). -
getCollisionShape
public net.minecraft.world.phys.shapes.VoxelShape getCollisionShape(net.minecraft.world.phys.shapes.CollisionContext context) Description copied from interface:MultiPartMaps toBlockBehaviour.getCollisionShape(BlockState, BlockGetter, BlockPos, CollisionContext).If this shape changes after initial placement, call
TileMultipart.markShapeChange().- Specified by:
getCollisionShapein interfaceMultiPart
-
getRenderOcclusionShape
public net.minecraft.world.phys.shapes.VoxelShape getRenderOcclusionShape()Description copied from interface:MultiPartMaps toBlockBehaviour.getOcclusionShape(BlockState, BlockGetter, BlockPos).If this shape changes after initial placement, call
TileMultipart.markShapeChange().- Specified by:
getRenderOcclusionShapein interfaceMultiPart
-
getInteractionShape
public net.minecraft.world.phys.shapes.VoxelShape getInteractionShape()Description copied from interface:MultiPartMaps toBlockBehaviour.getInteractionShape(BlockState, BlockGetter, BlockPos).If this shape changes after initial placement, call
TileMultipart.markShapeChange().- Specified by:
getInteractionShapein interfaceMultiPart
-
getOcclusionShape
public net.minecraft.world.phys.shapes.VoxelShape getOcclusionShape()- Specified by:
getOcclusionShapein interfaceNormalOcclusionPart
-
getBlockSupportShape
public net.minecraft.world.phys.shapes.VoxelShape getBlockSupportShape()Description copied from interface:MultiPartMaps toBlockBehaviour.getBlockSupportShape(BlockState, BlockGetter, BlockPos).If this shape changes after initial placement, call
TileMultipart.markShapeChange().- Specified by:
getBlockSupportShapein interfaceMultiPart
-
getVisualShape
public net.minecraft.world.phys.shapes.VoxelShape getVisualShape(net.minecraft.world.phys.shapes.CollisionContext context) Description copied from interface:MultiPartMaps toBlockBehaviour.getVisualShape(BlockState, BlockGetter, BlockPos, CollisionContext).If this shape changes after initial placement, call
TileMultipart.markShapeChange().- Specified by:
getVisualShapein interfaceMultiPart
-
occlusionTest
Description copied from interface:MultiPartPerform an occlusion test to determine weather this part andnpartcan 'fit' into this block space.- Specified by:
occlusionTestin interfaceMultiPart- Specified by:
occlusionTestin interfaceNormalOcclusionPart- Parameters:
nPart- The part to run the test against.- Returns:
trueif both this part andnpartare able to share this block space.
-
getPlacementSound
public net.minecraft.world.level.block.SoundType getPlacementSound(net.minecraft.world.item.context.UseOnContext context) Description copied from interface:MultiPartUsed to get the sound for this part when placed.- Specified by:
getPlacementSoundin interfaceMultiPart- Parameters:
context- The placement context.- Returns:
- The sound, or
nullfor no sound.
-
getBounds
public codechicken.lib.vec.Cuboid6 getBounds()- Specified by:
getBoundsin interfaceIconHitEffectsPart
-
getBreakingIcon
public net.minecraft.client.renderer.texture.TextureAtlasSprite getBreakingIcon(PartRayTraceResult hit) - Specified by:
getBreakingIconin interfaceIconHitEffectsPart
-
getBrokenIcon
public net.minecraft.client.renderer.texture.TextureAtlasSprite getBrokenIcon(int side) - Specified by:
getBrokenIconin interfaceIconHitEffectsPart
-