Class CustomCraftingTableBlock

java.lang.Object
net.minecraft.block.AbstractBlock
net.minecraft.block.Block
net.minecraft.block.CraftingTableBlock
net.anawesomguy.wsmlmb.block.CustomCraftingTableBlock
All Implemented Interfaces:
net.fabricmc.fabric.api.block.v1.FabricBlock, net.minecraft.item.ItemConvertible, net.minecraft.resource.featuretoggle.ToggleableFeature

public class CustomCraftingTableBlock extends net.minecraft.block.CraftingTableBlock
This is an implementation of CraftingTableBlock that overrides createScreenHandlerFactory to return a custom CraftingScreenHandler that always works for this block.

So, you can just use this to create a functional custom crafting table.

  • Nested Class Summary

    Nested classes/interfaces inherited from class net.minecraft.block.Block

    net.minecraft.block.Block.NeighborGroup

    Nested classes/interfaces inherited from class net.minecraft.block.AbstractBlock

    net.minecraft.block.AbstractBlock.AbstractBlockState, net.minecraft.block.AbstractBlock.ContextPredicate, net.minecraft.block.AbstractBlock.Offsetter, net.minecraft.block.AbstractBlock.OffsetType, net.minecraft.block.AbstractBlock.Settings, net.minecraft.block.AbstractBlock.TypedContextPredicate<A extends Object>
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final com.mojang.serialization.MapCodec<CustomCraftingTableBlock>
     
    protected final net.minecraft.text.Text
     

    Fields inherited from class net.minecraft.block.Block

    field_31023, field_31024, field_31025, field_31035, FORCE_STATE, MOVED, NO_REDRAW, NOTIFY_ALL, NOTIFY_ALL_AND_REDRAW, NOTIFY_LISTENERS, NOTIFY_NEIGHBORS, REDRAW_ON_MAIN_THREAD, SKIP_DROPS, STATE_IDS, stateManager

    Fields inherited from class net.minecraft.block.AbstractBlock

    collidable, DIRECTIONS, dynamicBounds, jumpVelocityMultiplier, lootTableId, randomTicks, requiredFeatures, resistance, settings, slipperiness, soundGroup, velocityMultiplier

    Fields inherited from interface net.minecraft.resource.featuretoggle.ToggleableFeature

    FEATURE_ENABLED_REGISTRY_KEYS
  • Constructor Summary

    Constructors
    Constructor
    Description
    CustomCraftingTableBlock(net.minecraft.block.AbstractBlock.Settings settings)
    Creates a new instance of CustomCraftingTableBlock with the specified block settings and a default titleText of "container.crafting".
    CustomCraftingTableBlock(net.minecraft.block.AbstractBlock.Settings settings, String titleTextLangKey)
    Creates a new instance of CustomCraftingTableBlock with the specified block settings and titleText.
    CustomCraftingTableBlock(net.minecraft.block.AbstractBlock.Settings settings, net.minecraft.text.Text titleText)
    Creates a new instance of CustomCraftingTableBlock with the specified block settings and titleText.
  • Method Summary

    Modifier and Type
    Method
    Description
    net.minecraft.screen.NamedScreenHandlerFactory
    createScreenHandlerFactory(net.minecraft.block.BlockState state, net.minecraft.world.World world, net.minecraft.util.math.BlockPos pos)
     
    com.mojang.serialization.MapCodec<? extends net.minecraft.block.CraftingTableBlock>
     
    net.minecraft.text.Text
     

    Methods inherited from class net.minecraft.block.CraftingTableBlock

    onUse

    Methods inherited from class net.minecraft.block.Block

    afterBreak, appendProperties, appendTooltip, asBlock, asItem, canMobSpawnInside, cannotConnect, createCuboidShape, dropExperience, dropExperienceWhenMined, dropStack, dropStack, dropStacks, dropStacks, dropStacks, getBlastResistance, getBlockFromItem, getDefaultState, getDroppedStacks, getDroppedStacks, getJumpVelocityMultiplier, getName, getPickStack, getPlacementState, getRawIdFromState, getRegistryEntry, getShapesForStates, getSlipperiness, getSoundGroup, getStateFromRawId, getStateManager, getStateWithProperties, getTranslationKey, getVelocityMultiplier, hasDynamicBounds, hasRandomTicks, hasTopRim, isFaceFullSquare, isShapeFullCube, isTransparent, onBreak, onBroken, onDestroyedByExplosion, onEntityLand, onLandedUpon, onPlaced, onSteppedOn, postProcessState, precipitationTick, pushEntitiesUpBeforeBlockChange, randomDisplayTick, replace, replace, setDefaultState, shouldDrawSide, shouldDropItemsOnExplosion, sideCoversSmallSquare, spawnBreakParticles, toString

    Methods inherited from class net.minecraft.block.AbstractBlock

    calcBlockBreakingDelta, canBucketPlace, canPathfindThrough, canPlaceAt, canReplace, createCodec, createSettingsCodec, emitsRedstonePower, getAmbientOcclusionLightLevel, getCameraCollisionShape, getCollisionShape, getComparatorOutput, getCullingShape, getDefaultMapColor, getDroppedStacks, getFluidState, getHardness, getLootTableId, getMaxHorizontalModelOffset, getOpacity, getOutlineShape, getRaycastShape, getRenderingSeed, getRenderType, getRequiredFeatures, getSettings, getSidesShape, getStateForNeighborUpdate, getStrongRedstonePower, getVerticalModelOffsetMultiplier, getWeakRedstonePower, hasComparatorOutput, hasSidedTransparency, isCullingShapeFullCube, isShapeFullCube, isSideInvisible, mirror, neighborUpdate, onBlockAdded, onBlockBreakStart, onEntityCollision, onExploded, onProjectileHit, onStacksDropped, onStateReplaced, onSyncedBlockEvent, prepare, randomTick, rotate, scheduledTick

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

    Methods inherited from interface net.fabricmc.fabric.api.block.v1.FabricBlock

    getAppearance

    Methods inherited from interface net.minecraft.resource.featuretoggle.ToggleableFeature

    isEnabled
  • Field Details

    • CODEC

      public static final com.mojang.serialization.MapCodec<CustomCraftingTableBlock> CODEC
    • titleText

      protected final net.minecraft.text.Text titleText
  • Constructor Details

    • CustomCraftingTableBlock

      public CustomCraftingTableBlock(net.minecraft.block.AbstractBlock.Settings settings)
      Creates a new instance of CustomCraftingTableBlock with the specified block settings and a default titleText of "container.crafting".
      Parameters:
      settings - the block settings to make this block have.
    • CustomCraftingTableBlock

      public CustomCraftingTableBlock(net.minecraft.block.AbstractBlock.Settings settings, String titleTextLangKey)
      Creates a new instance of CustomCraftingTableBlock with the specified block settings and titleText.
      Parameters:
      settings - the block settings to make this block have.
      titleTextLangKey - the lang key of this block's screen's title.
    • CustomCraftingTableBlock

      public CustomCraftingTableBlock(net.minecraft.block.AbstractBlock.Settings settings, net.minecraft.text.Text titleText)
      Creates a new instance of CustomCraftingTableBlock with the specified block settings and titleText.
      Parameters:
      settings - the block settings to make this block have.
      titleText - the text of this block's screen's title.
  • Method Details

    • getTitleText

      public net.minecraft.text.Text getTitleText()
    • createScreenHandlerFactory

      public net.minecraft.screen.NamedScreenHandlerFactory createScreenHandlerFactory(net.minecraft.block.BlockState state, net.minecraft.world.World world, net.minecraft.util.math.BlockPos pos)
      Overrides:
      createScreenHandlerFactory in class net.minecraft.block.CraftingTableBlock
    • getCodec

      public com.mojang.serialization.MapCodec<? extends net.minecraft.block.CraftingTableBlock> getCodec()
      Overrides:
      getCodec in class net.minecraft.block.CraftingTableBlock