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.ItemStackIterable<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 MicroblockPartFactorynet.neoforged.neoforge.model.data.ModelDataCompanion toIBlockEntityExtension.getModelData(), except for this part.abstract com.google.common.collect.ImmutableSet<MaskedCuboid> getRenderCuboids(boolean isInventory) Get all the boxes this part wishes to render as.final intfinal intgetSize()@Nullable net.minecraft.world.level.block.SoundTypegetSound(@Nullable net.minecraft.world.item.context.UseOnContext useOnContext) Used to get the sound for this part.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.world.level.storage.ValueInput input) Load this part from aValueInput.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.world.level.storage.ValueOutput output) Save this part to aValueOutput.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, entityInside, getBlockSupportShape, getCloneStack, getCollisionShape, getInteractionShape, getPlacementSound, getRenderBounds, getRenderOcclusionShape, getShape, getVisualShape, harvest, hasLevel, invalidateConvertedTile, level, occlusionTest, onAdded, onChunkLoad, onChunkUnload, onConverted, 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.world.level.storage.ValueOutput output) Description copied from interface:MultiPartSave this part to aValueOutput.Only called server-side.
- Parameters:
output- The tag to write to.
-
load
public void load(net.minecraft.world.level.storage.ValueInput input) Description copied from interface:MultiPartLoad this part from aValueInput.Only called server-side.
- Parameters:
input- 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
-
getRenderCuboids
public abstract com.google.common.collect.ImmutableSet<MaskedCuboid> getRenderCuboids(boolean isInventory) Get all the boxes this part wishes to render as.It is HIGHLY recommended that implementors cache these returned sets.
- Parameters:
isInventory- If the intent is to be rendered in inventory.- Returns:
- The boxes to render as.
-
getModelData
public net.neoforged.neoforge.model.data.ModelData getModelData()Description copied from interface:MultiPartCompanion toIBlockEntityExtension.getModelData(), except for this part.Called to obtain any model data for this part.
Call
MultiPart.tile().TileMultipart.markRender()to ask for your model data to be re-queried.- Returns:
- The model data.
-
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.
-
getSound
@Nullable public @Nullable net.minecraft.world.level.block.SoundType getSound(@Nullable @Nullable net.minecraft.world.item.context.UseOnContext useOnContext) Description copied from interface:MultiPartUsed to get the sound for this part.- Parameters:
useOnContext- The placement context if part is being placed- Returns:
- The sound, or
nullfor no sound.
-
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.
-