Package net.anawesomguy.wsmlmb.block
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
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 block to create a functional custom crafting table.
-
Nested Class Summary
Nested classes/interfaces inherited from class net.minecraft.block.Block
net.minecraft.block.Block.NeighborGroupNested classes/interfaces inherited from class net.minecraft.block.AbstractBlock
net.minecraft.block.AbstractBlock.AbstractBlockState, net.minecraft.block.AbstractBlock.ContextPredicate, net.minecraft.block.AbstractBlock.OffsetType, net.minecraft.block.AbstractBlock.Settings, net.minecraft.block.AbstractBlock.TypedContextPredicate<A extends Object> -
Field Summary
FieldsFields inherited from class net.minecraft.block.Block
field_31022, field_31023, field_31024, field_31025, field_31035, FORCE_STATE, MOVED, NO_REDRAW, NOTIFY_ALL, NOTIFY_LISTENERS, NOTIFY_NEIGHBORS, REDRAW_ON_MAIN_THREAD, SKIP_DROPS, SKIP_LIGHTING_UPDATES, STATE_IDS, stateManagerFields inherited from class net.minecraft.block.AbstractBlock
collidable, DIRECTIONS, dynamicBounds, jumpVelocityMultiplier, lootTableId, material, randomTicks, resistance, settings, slipperiness, soundGroup, velocityMultiplier -
Constructor Summary
ConstructorsConstructorDescriptionCustomCraftingTableBlock(net.minecraft.block.AbstractBlock.Settings settings) Creates a new instance ofCustomCraftingTableBlockwith the specified block settings and a defaulttitleTextof "container.crafting".CustomCraftingTableBlock(net.minecraft.block.AbstractBlock.Settings settings, String titleText) Creates a new instance ofCustomCraftingTableBlockwith the specified block settings andtitleText.CustomCraftingTableBlock(net.minecraft.block.AbstractBlock.Settings settings, net.minecraft.text.MutableText titleText) Creates a new instance ofCustomCraftingTableBlockwith the specified block settings andtitleText. -
Method Summary
Modifier and TypeMethodDescriptionnet.minecraft.screen.NamedScreenHandlerFactorycreateScreenHandlerFactory(net.minecraft.block.BlockState state, net.minecraft.world.World world, net.minecraft.util.math.BlockPos pos) net.minecraft.text.MutableTextMethods inherited from class net.minecraft.block.CraftingTableBlock
onUseMethods inherited from class net.minecraft.block.Block
afterBreak, appendProperties, appendStacks, appendTooltip, asBlock, asItem, canMobSpawnInside, cannotConnect, createCuboidShape, dropExperience, dropExperienceWhenMined, dropStack, dropStack, dropStacks, 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, isTranslucent, onBreak, onBroken, onDestroyedByExplosion, onEntityLand, onLandedUpon, onPlaced, onSteppedOn, postProcessState, precipitationTick, pushEntitiesUpBeforeBlockChange, randomDisplayTick, replace, replace, setDefaultState, shouldDrawSide, shouldDropItemsOnExplosion, sideCoversSmallSquare, spawnBreakParticles, toStringMethods inherited from class net.minecraft.block.AbstractBlock
calcBlockBreakingDelta, canBucketPlace, canPathfindThrough, canPlaceAt, canReplace, emitsRedstonePower, getAmbientOcclusionLightLevel, getCameraCollisionShape, getCollisionShape, getComparatorOutput, getCullingShape, getDefaultMapColor, getDroppedStacks, getFluidState, getHardness, getLootTableId, getMaxHorizontalModelOffset, getOpacity, getOutlineShape, getPistonBehavior, getRaycastShape, getRenderingSeed, getRenderType, getSidesShape, getStateForNeighborUpdate, getStrongRedstonePower, getVerticalModelOffsetMultiplier, getWeakRedstonePower, hasComparatorOutput, hasSidedTransparency, isCullingShapeFullCube, isShapeFullCube, isSideInvisible, mirror, neighborUpdate, onBlockAdded, onBlockBreakStart, onEntityCollision, onProjectileHit, onStacksDropped, onStateReplaced, onSyncedBlockEvent, prepare, randomTick, rotate, scheduledTickMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface net.fabricmc.fabric.api.block.v1.FabricBlock
getAppearance
-
Field Details
-
titleText
protected final net.minecraft.text.MutableText titleText
-
-
Constructor Details
-
CustomCraftingTableBlock
public CustomCraftingTableBlock(net.minecraft.block.AbstractBlock.Settings settings) Creates a new instance ofCustomCraftingTableBlockwith the specified block settings and a defaulttitleTextof "container.crafting".- Parameters:
settings- the block settings to make this block have.
-
CustomCraftingTableBlock
public CustomCraftingTableBlock(net.minecraft.block.AbstractBlock.Settings settings, String titleText) Creates a new instance ofCustomCraftingTableBlockwith the specified block settings andtitleText.- Parameters:
settings- the block settings to make this block have.titleText- the lang key of this block's screen's title.
-
CustomCraftingTableBlock
public CustomCraftingTableBlock(net.minecraft.block.AbstractBlock.Settings settings, net.minecraft.text.MutableText titleText) Creates a new instance ofCustomCraftingTableBlockwith the specified block settings andtitleText.- 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.MutableText 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:
createScreenHandlerFactoryin classnet.minecraft.block.CraftingTableBlock
-