Package codechicken.microblock.part
Class MicroblockPart
java.lang.Object
codechicken.multipart.api.part.BaseMultipart
codechicken.microblock.part.MicroblockPart
- All Implemented Interfaces:
MultiPart
- Direct Known Subclasses:
PostMicroblockPart,StandardMicroblockPart
Created by covers1624 on 26/6/22.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddDestroyEffects(PartRayTraceResult hit, net.minecraft.client.particle.ParticleEngine engine) Add particles and other effects when a player finishes breaking this part.voidaddHitEffects(PartRayTraceResult hit, net.minecraft.client.particle.ParticleEngine engine) Add particles and other effects when a player is mining this part.voidaddLandingEffects(PartRayTraceResult hit, codechicken.lib.vec.Vector3 entity, int numberOfParticles) Add particles and other effects when a player lands on this part.voidaddRunningEffects(PartRayTraceResult hit, net.minecraft.world.entity.Entity entity) Add particles and other effects when a player runs over this part.abstract codechicken.lib.vec.Cuboid6net.minecraft.world.item.ItemStackReturn theItemStackfor pick-block(usually middle click) function.Iterable<net.minecraft.world.item.ItemStack> getDrops()Return a list ofItemStacks that should be dropped when this part is destroyed.floatgetExplosionResistance(net.minecraft.world.level.Explosion explosion) Get the explosion resistance for this part.abstract intThe Micro factory that controls placement from item stack form.intThe light level emitted by this part.abstract MicroblockPartFactoryabstract Iterable<MaskedCuboid> getRenderCuboids(boolean isInventory) final intfinal intgetSize()floatgetStrength(net.minecraft.world.entity.player.Player player, PartRayTraceResult hit) Return a value indicating how hard this part is to break.final MultipartType<?> getType()Returns theMultipartTyperegistry entry for this part.booleanvoidload(net.minecraft.nbt.CompoundTag tag, net.minecraft.core.HolderLookup.Provider registries) Load this part from aCompoundTag.voidreadDesc(codechicken.lib.data.MCDataInput packet) Fill out this part with the description information contained inpacket.voidreadUpdate(codechicken.lib.data.MCDataInput packet) Read a packet sent viaMultiPart.sendUpdate(java.util.function.Consumer<codechicken.lib.data.MCDataOutput>).voidsave(net.minecraft.nbt.CompoundTag tag, net.minecraft.core.HolderLookup.Provider registries) Save this part to aCompoundTag.voidvoidsetShape(int size, int slot) General purpose microblock description value.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.MultiPart
capCache, click, getBlockSupportShape, getCollisionShape, getInteractionShape, getModelData, getPlacementSound, getRenderBounds, getRenderOcclusionShape, getShape, getVisualShape, harvest, hasLevel, invalidateConvertedTile, level, occlusionTest, onAdded, onChunkLoad, onChunkUnload, onConverted, onEntityCollision, onEntityStanding, onMoved, onNeighborBlockChanged, onPartChanged, onRemoved, onWorldJoin, onWorldSeparate, pos, preRemove, scheduledTick, scheduleTick, sendUpdate, useItemOn, useWithoutItem
-
Field Details
-
material
-
shape
public byte shape
-
-
Constructor Details
-
MicroblockPart
-
-
Method Details
-
getMicroFactory
-
getSize
public final int getSize() -
getShapeSlot
public final int getShapeSlot() -
getMaterial
-
setShape
public void setShape(int size, int slot) General purpose microblock description value. These values are only used by subclass overrides in this class, so they can be whatever you would like.- Parameters:
size- A 28 bit value representing the current sizeslot- A 4 bit value representing the current slot
-
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.
- Parameters:
packet- The packet to write to.
-
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.
- Parameters:
packet- The packet to read from.
-
sendShapeUpdate
public void sendShapeUpdate() -
readUpdate
public void readUpdate(codechicken.lib.data.MCDataInput packet) Description copied from interface:MultiPartRead a packet sent viaMultiPart.sendUpdate(java.util.function.Consumer<codechicken.lib.data.MCDataOutput>).- Parameters:
packet- THe packet to read.
-
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.
- Parameters:
tag- The tag to write to.
-
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.
- Parameters:
tag- The tag to read from.
-
getBounds
public abstract codechicken.lib.vec.Cuboid6 getBounds() -
getItemFactoryId
public abstract int getItemFactoryId()The Micro factory that controls placement from item stack form.- Returns:
- The id of said factory.
-
getDrops
Description copied from interface:MultiPartReturn a list ofItemStacks that should be dropped when this part is destroyed.- Returns:
- The
ItemStacks.
-
getCloneStack
Description copied from interface:MultiPartReturn theItemStackfor pick-block(usually middle click) function.- Parameters:
hit- ThePartRayTraceResulthit result.- Returns:
- The
ItemStackpick result.
-
getRenderCuboids
-
getType
Description copied from interface:MultiPartReturns theMultipartTyperegistry entry for this part.- Returns:
- The
MultipartType. - See Also:
-
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- Parameters:
player- The player breaking the block.hit- ThePartRayTraceResulthit result.- Returns:
- The block strength.
-
isTransparent
public boolean isTransparent() -
getLightEmission
public int getLightEmission()Description copied from interface:MultiPartThe light level emitted by this part.- Returns:
- The light level.
-
getExplosionResistance
public float getExplosionResistance(net.minecraft.world.level.Explosion explosion) Description copied from interface:MultiPartGet the explosion resistance for this part.The explosion resistance for the host
TileMultipartis the maximum explosion resistance for all contained parts.- Parameters:
explosion- TheExplosion.- Returns:
- The resistance.
-
addHitEffects
public void addHitEffects(PartRayTraceResult hit, net.minecraft.client.particle.ParticleEngine engine) Description copied from interface:MultiPartAdd particles and other effects when a player is mining this part.- Parameters:
hit- ThePartRayTraceResulthit result.engine- TheParticleEngineto spawn particles.
-
addDestroyEffects
public void addDestroyEffects(PartRayTraceResult hit, net.minecraft.client.particle.ParticleEngine engine) Description copied from interface:MultiPartAdd particles and other effects when a player finishes breaking this part.- Parameters:
hit- ThePartRayTraceResulthit result.engine- TheParticleEngineto spawn particles.
-
addLandingEffects
public void addLandingEffects(PartRayTraceResult hit, codechicken.lib.vec.Vector3 entity, int numberOfParticles) Description copied from interface:MultiPartAdd particles and other effects when a player lands on this part.- Parameters:
hit- The hit directly bellow the entities feet.entity- The position of the entity.numberOfParticles- The number of particles to spawn.
-
addRunningEffects
Description copied from interface:MultiPartAdd particles and other effects when a player runs over this part.This is called on both the client and the server.
- Parameters:
hit- The hit directly bellow the players feet.entity- The entity running.
-