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,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.NeighborGroupNested 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
FieldsModifier and TypeFieldDescriptionstatic final com.mojang.serialization.MapCodec<CustomCraftingTableBlock>protected final net.minecraft.text.TextFields 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, stateManagerFields inherited from class net.minecraft.block.AbstractBlock
collidable, DIRECTIONS, dynamicBounds, jumpVelocityMultiplier, lootTableId, randomTicks, requiredFeatures, resistance, settings, slipperiness, soundGroup, velocityMultiplierFields inherited from interface net.minecraft.resource.featuretoggle.ToggleableFeature
FEATURE_ENABLED_REGISTRY_KEYS -
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 titleTextLangKey) Creates a new instance ofCustomCraftingTableBlockwith the specified block settings andtitleText.CustomCraftingTableBlock(net.minecraft.block.AbstractBlock.Settings settings, net.minecraft.text.Text 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) com.mojang.serialization.MapCodec<? extends net.minecraft.block.CraftingTableBlock>getCodec()net.minecraft.text.TextMethods inherited from class net.minecraft.block.CraftingTableBlock
onUseMethods 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, toStringMethods 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, 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
getAppearanceMethods inherited from interface net.minecraft.resource.featuretoggle.ToggleableFeature
isEnabled
-
Field Details
-
CODEC
-
titleText
protected final net.minecraft.text.Text 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 titleTextLangKey) Creates a new instance ofCustomCraftingTableBlockwith the specified block settings andtitleText.- 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 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.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:
createScreenHandlerFactoryin classnet.minecraft.block.CraftingTableBlock
-
getCodec
public com.mojang.serialization.MapCodec<? extends net.minecraft.block.CraftingTableBlock> getCodec()- Overrides:
getCodecin classnet.minecraft.block.CraftingTableBlock
-