Class BlockMicroMaterial

java.lang.Object
codechicken.microblock.api.MicroMaterial
codechicken.microblock.api.BlockMicroMaterial

public class BlockMicroMaterial extends MicroMaterial
Created by covers1624 on 26/6/22.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    final net.minecraft.world.level.block.state.BlockState
     

    Fields inherited from class codechicken.microblock.api.MicroMaterial

    CODEC, MULTIPART_TYPES, REGISTRY, STREAM_CODEC
  • Constructor Summary

    Constructors
    Constructor
    Description
    BlockMicroMaterial(net.minecraft.world.level.block.Block block)
     
    BlockMicroMaterial(net.minecraft.world.level.block.state.BlockState state)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    float
    getExplosionResistance(net.minecraft.world.level.BlockGetter level, net.minecraft.core.BlockPos pos, net.minecraft.world.level.Explosion explosion)
    Get the resistance of this material for the given explosion.
    net.minecraft.world.item.ItemStack
    Gets ItemStack this material can be cut from.
    int
    Gets the light level emitted by this micro material.
    net.minecraft.network.chat.Component
    Gets the localized name for this material.
    net.minecraft.world.level.block.SoundType
    Get the breaking/waking sound.
    float
    getStrength(net.minecraft.world.entity.player.Player player)
    Gets the Strength of this material when being broken by the given player.
    void
    Initialize any client-side properties for this MicroMaterial.
    boolean
    isCuttableBySaw(net.minecraft.world.item.ItemStack saw)
    Checks if a given saw can cut this material.
    boolean
     
    static net.minecraft.resources.ResourceLocation
    makeMaterialKey(net.minecraft.world.level.block.state.BlockState state)
    Builds a BlockMicroMaterial registry name for the given BlockState.

    Methods inherited from class codechicken.microblock.api.MicroMaterial

    getRegistryName

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • state

      public final net.minecraft.world.level.block.state.BlockState state
  • Constructor Details

    • BlockMicroMaterial

      public BlockMicroMaterial(net.minecraft.world.level.block.Block block)
    • BlockMicroMaterial

      public BlockMicroMaterial(net.minecraft.world.level.block.state.BlockState state)
  • Method Details

    • isTransparent

      public boolean isTransparent()
      Specified by:
      isTransparent in class MicroMaterial
      Returns:
      If this material is not opaque. (Glass, Ice, etc.)
    • getLightEmission

      public int getLightEmission()
      Description copied from class: MicroMaterial
      Gets the light level emitted by this micro material.
      Specified by:
      getLightEmission in class MicroMaterial
      Returns:
      The light emission.
    • getStrength

      public float getStrength(net.minecraft.world.entity.player.Player player)
      Description copied from class: MicroMaterial
      Gets the Strength of this material when being broken by the given player.
      Specified by:
      getStrength in class MicroMaterial
      Parameters:
      player - The player.
      Returns:
      The strength value.
    • getLocalizedName

      public net.minecraft.network.chat.Component getLocalizedName()
      Description copied from class: MicroMaterial
      Gets the localized name for this material.
      Specified by:
      getLocalizedName in class MicroMaterial
      Returns:
      The localized name.
    • getItem

      public net.minecraft.world.item.ItemStack getItem()
      Description copied from class: MicroMaterial
      Gets ItemStack this material can be cut from.
      Specified by:
      getItem in class MicroMaterial
      Returns:
      The ItemStack.
    • getSound

      public net.minecraft.world.level.block.SoundType getSound()
      Description copied from class: MicroMaterial
      Get the breaking/waking sound.
      Specified by:
      getSound in class MicroMaterial
      Returns:
      The SoundType.
    • getExplosionResistance

      public float getExplosionResistance(net.minecraft.world.level.BlockGetter level, net.minecraft.core.BlockPos pos, net.minecraft.world.level.Explosion explosion)
      Description copied from class: MicroMaterial
      Get the resistance of this material for the given explosion.
      Specified by:
      getExplosionResistance in class MicroMaterial
      Parameters:
      level - The level.
      pos - The position.
      explosion - The explosion.
      Returns:
      The resistance.
    • isCuttableBySaw

      public boolean isCuttableBySaw(net.minecraft.world.item.ItemStack saw)
      Description copied from class: MicroMaterial
      Checks if a given saw can cut this material.
      Overrides:
      isCuttableBySaw in class MicroMaterial
      Parameters:
      saw - The saw
      Returns:
      True if this material can be cut by saw
    • initializeClient

      public void initializeClient(Consumer<MicroMaterialClient> cons)
      Description copied from class: MicroMaterial
      Initialize any client-side properties for this MicroMaterial.
      Overrides:
      initializeClient in class MicroMaterial
      Parameters:
      cons - Consumer to set this material's MicroMaterialClient.
    • makeMaterialKey

      public static net.minecraft.resources.ResourceLocation makeMaterialKey(net.minecraft.world.level.block.state.BlockState state)
      Builds a BlockMicroMaterial registry name for the given BlockState.

      Due to the restrictions imposed by ResourceLocation, the following format is used:
      mod_id:block_name//property1.value1/property2.value2/property3.value3

      Parameters:
      state - The BlockState to create a name for.
      Returns:
      The name.