Class MicroblockPart

java.lang.Object
codechicken.multipart.api.part.BaseMultipart
codechicken.microblock.part.MicroblockPart
All Implemented Interfaces:
MultiPart
Direct Known Subclasses:
PostMicroblockPart, StandardMicroblockPart

public abstract class MicroblockPart extends BaseMultipart
Created by covers1624 on 26/6/22.
  • Field Details

    • material

      public MicroMaterial material
    • shape

      public byte shape
  • Constructor Details

  • Method Details

    • getMicroFactory

      public abstract MicroblockPartFactory getMicroFactory()
    • getSize

      public final int getSize()
    • getShapeSlot

      public final int getShapeSlot()
    • getMaterial

      public MicroMaterial 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 size
      slot - A 4 bit value representing the current slot
    • writeDesc

      public void writeDesc(codechicken.lib.data.MCDataOutput packet)
      Description copied from interface: MultiPart
      Write 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: MultiPart
      Fill out this part with the description information contained in packet.

      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: MultiPart
      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: MultiPart
      Save this part to a CompoundTag.

      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: MultiPart
      Load this part from a CompoundTag.

      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

      public Iterable<net.minecraft.world.item.ItemStack> getDrops()
      Description copied from interface: MultiPart
      Return a list of ItemStacks that should be dropped when this part is destroyed.
      Returns:
      The ItemStacks.
    • getCloneStack

      public net.minecraft.world.item.ItemStack getCloneStack(PartRayTraceResult hit)
      Description copied from interface: MultiPart
      Return the ItemStack for pick-block(usually middle click) function.
      Parameters:
      hit - The PartRayTraceResult hit result.
      Returns:
      The ItemStack pick result.
    • getRenderCuboids

      public abstract Iterable<MaskedCuboid> getRenderCuboids(boolean isInventory)
    • getType

      public final MultipartType<?> getType()
      Description copied from interface: MultiPart
      Returns the MultipartType registry entry for this part.
      Returns:
      The MultipartType.
      See Also:
    • getStrength

      public float getStrength(net.minecraft.world.entity.player.Player player, PartRayTraceResult hit)
      Description copied from interface: MultiPart
      Return 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 - The PartRayTraceResult hit result.
      Returns:
      The block strength.
    • isTransparent

      public boolean isTransparent()
    • getLightEmission

      public int getLightEmission()
      Description copied from interface: MultiPart
      The light level emitted by this part.
      Returns:
      The light level.
    • getExplosionResistance

      public float getExplosionResistance(net.minecraft.world.level.Explosion explosion)
      Description copied from interface: MultiPart
      Get the explosion resistance for this part.

      The explosion resistance for the host TileMultipart is the maximum explosion resistance for all contained parts.

      Parameters:
      explosion - The Explosion.
      Returns:
      The resistance.
    • addHitEffects

      public void addHitEffects(PartRayTraceResult hit, net.minecraft.client.particle.ParticleEngine engine)
      Description copied from interface: MultiPart
      Add particles and other effects when a player is mining this part.
      Parameters:
      hit - The PartRayTraceResult hit result.
      engine - The ParticleEngine to spawn particles.
    • addDestroyEffects

      public void addDestroyEffects(PartRayTraceResult hit, net.minecraft.client.particle.ParticleEngine engine)
      Description copied from interface: MultiPart
      Add particles and other effects when a player finishes breaking this part.
      Parameters:
      hit - The PartRayTraceResult hit result.
      engine - The ParticleEngine to spawn particles.
    • addLandingEffects

      public void addLandingEffects(PartRayTraceResult hit, codechicken.lib.vec.Vector3 entity, int numberOfParticles)
      Description copied from interface: MultiPart
      Add 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

      public void addRunningEffects(PartRayTraceResult hit, net.minecraft.world.entity.Entity entity)
      Description copied from interface: MultiPart
      Add 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.