Package dev.latvian.mods.kubejs.block
Class BlockBuilder
java.lang.Object
dev.latvian.mods.kubejs.registry.BuilderBase<net.minecraft.world.level.block.Block>
dev.latvian.mods.kubejs.registry.ModelledBuilderBase<net.minecraft.world.level.block.Block>
dev.latvian.mods.kubejs.block.BlockBuilder
- All Implemented Interfaces:
Supplier<net.minecraft.world.level.block.Block>
- Direct Known Subclasses:
BasicKubeBlock.Builder,CardinalBlockBuilder,CropBlockBuilder,DetectorBlock.Builder,FallingBlockBuilder,FluidBlockBuilder,PillarBlockBuilder,ShapedBlockBuilder
@ReturnsSelf
public abstract class BlockBuilder
extends ModelledBuilderBase<net.minecraft.world.level.block.Block>
-
Field Summary
FieldsModifier and TypeFieldDescriptionSet<net.minecraft.world.level.block.state.properties.Property<?>> net.minecraft.world.level.block.BlockList<net.minecraft.world.phys.AABB> booleanfloatnet.minecraft.world.level.block.state.properties.NoteBlockInstrumentfloatfloatFunction<net.minecraft.world.level.block.state.BlockState, net.minecraft.world.level.material.MapColor> booleanbooleanbooleanbooleanbooleanbooleanfloatfloatnet.minecraft.world.level.block.SoundTypefloatbooleanbooleanbooleanFields inherited from class dev.latvian.mods.kubejs.registry.ModelledBuilderBase
baseTexture, modelGenerator, parentModel, texturesFields inherited from class dev.latvian.mods.kubejs.registry.BuilderBase
defaultTags, displayName, dummyBuilder, formattedDisplayName, id, object, registryKey, sourceLine, translationKey -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionafterFallenOn(Consumer<AfterEntityFallenOnBlockCallback> callbackJS) blockEntity(Consumer<BlockEntityInfo> callback) bounciness(float bounciness) box(double x0, double y0, double z0, double x1, double y1, double z1) box(double x0, double y0, double z0, double x1, double y1, double z1, boolean scale16) canBeReplaced(Predicate<CanBeReplacedCallback> callbackJS) booleancolor(int index, BlockTintFunction color) color(BlockTintFunction color) copyPropertiesFrom(net.minecraft.world.level.block.Block block) voidnet.minecraft.world.level.block.state.BlockBehaviour.Propertiesstatic net.minecraft.world.phys.shapes.VoxelShapecreateShape(List<net.minecraft.world.phys.AABB> boxes) defaultState(Consumer<BlockStateModifyCallback> callbackJS) BuilderBase<net.minecraft.world.level.block.Block> displayName(net.minecraft.network.chat.Component name) drops(BlockDropSupplier drops) dynamicMapColor(@Nullable Function<net.minecraft.world.level.block.state.BlockState, Object> m) entityInside(Consumer<EntityBlockCallback> callbackJS) exploded(Consumer<BlockExplodedCallback> callbackJS) fallenOn(Consumer<EntityFallenOnBlockCallback> callbackJS) fullBlock(boolean f) voidgenerateAssets(KubeAssetGenerator generator) protected voidgenerateBlockModels(KubeAssetGenerator generator) protected voidvoidgenerateData(KubeDataGenerator generator) protected voidnet.minecraft.world.level.storage.loot.LootTableDeprecated, for removal: This API element is subject to removal in a future version.Use the version with additional datagen parameter (used for registry access etc.)@Nullable net.minecraft.world.level.storage.loot.LootTablegenerateLootTable(KubeDataGenerator generator) protected voidprotected ItemBuilderbooleanDeprecated, for removal: This API element is subject to removal in a future version.hardness(float h) instrument(net.minecraft.world.level.block.state.properties.NoteBlockInstrument i) item(@Nullable Consumer<ItemBuilder> i) jumpFactor(float f) lightLevel(float light) mapColor(net.minecraft.world.level.material.MapColor m) mirrorState(Consumer<BlockStateMirrorCallback> callbackJS) noDrops()noItem()notSolid()noValidSpawns(boolean b) opaque(boolean o) placementState(Consumer<BlockStateModifyPlacementCallback> callbackJS) property(net.minecraft.world.level.block.state.properties.Property<?> property) randomTick(@Nullable Consumer<RandomTickCallback> randomTickCallback) Sets random tick callback for this black.redstoneConductor(boolean b) requiresTool(boolean f) resistance(float r) rightClick(Consumer<BlockRightClickedKubeEvent> callbackJS) rotateState(Consumer<BlockStateRotateCallback> callbackJS) setWaterlogged(boolean waterlogged) Deprecated, for removal: This API element is subject to removal in a future version.slipperiness(float f) soundType(net.minecraft.world.level.block.SoundType m) speedFactor(float f) steppedOn(Consumer<EntityBlockCallback> callbackJS) suffocating(boolean b) tag(net.minecraft.resources.ResourceLocation[] tag) tagBlock(net.minecraft.resources.ResourceLocation[] tag) tagBoth(net.minecraft.resources.ResourceLocation[] tag) tagItem(net.minecraft.resources.ResourceLocation[] tag) net.minecraft.world.level.block.BlocktransformObject(net.minecraft.world.level.block.Block obj) transparent(boolean b) protected booleanviewBlocking(boolean b) Methods inherited from class dev.latvian.mods.kubejs.registry.ModelledBuilderBase
modelGenerator, parentModel, texture, texture, texturesMethods inherited from class dev.latvian.mods.kubejs.registry.BuilderBase
createObject, createTransformedObject, formattedDisplayName, formattedDisplayName, generateLang, get, getBuilderTranslationKey, getTranslationKeyGroup, newID, toString, translationKey
-
Field Details
-
copyPropertiesFrom
public transient net.minecraft.world.level.block.Block copyPropertiesFrom -
soundType
public transient net.minecraft.world.level.block.SoundType soundType -
mapColorFn
public transient Function<net.minecraft.world.level.block.state.BlockState,net.minecraft.world.level.material.MapColor> mapColorFn -
hardness
public transient float hardness -
resistance
public transient float resistance -
lightLevel
public transient float lightLevel -
opaque
public transient boolean opaque -
fullBlock
public transient boolean fullBlock -
requiresTool
public transient boolean requiresTool -
renderType
-
tint
-
itemBuilder
-
customShape
-
noCollision
public transient boolean noCollision -
notSolid
public transient boolean notSolid -
slipperiness
public transient float slipperiness -
speedFactor
public transient float speedFactor -
jumpFactor
public transient float jumpFactor -
randomTickCallback
-
drops
-
noValidSpawns
public transient boolean noValidSpawns -
suffocating
public transient boolean suffocating -
viewBlocking
public transient boolean viewBlocking -
redstoneConductor
public transient boolean redstoneConductor -
transparent
public transient boolean transparent -
instrument
public transient net.minecraft.world.level.block.state.properties.NoteBlockInstrument instrument -
blockStateProperties
public transient Set<net.minecraft.world.level.block.state.properties.Property<?>> blockStateProperties -
defaultStateModification
-
placementStateModification
-
canBeReplacedFunction
-
insideCallback
-
stepOnCallback
-
fallOnCallback
-
afterFallenOnCallback
-
explodedCallback
-
rotateStateModification
-
mirrorStateModification
-
rightClick
-
blockEntityInfo
-
-
Constructor Details
-
BlockBuilder
public BlockBuilder(net.minecraft.resources.ResourceLocation id)
-
-
Method Details
-
transformObject
public net.minecraft.world.level.block.Block transformObject(net.minecraft.world.level.block.Block obj) - Overrides:
transformObjectin classBuilderBase<net.minecraft.world.level.block.Block>
-
createAdditionalObjects
- Overrides:
createAdditionalObjectsin classBuilderBase<net.minecraft.world.level.block.Block>
-
displayName
@Info("Sets the display name for this object, e.g. `Stone`.\n\nThis will be overridden by a lang file if it exists.\n") public BuilderBase<net.minecraft.world.level.block.Block> displayName(net.minecraft.network.chat.Component name) - Overrides:
displayNamein classBuilderBase<net.minecraft.world.level.block.Block>
-
generateData
- Overrides:
generateDatain classBuilderBase<net.minecraft.world.level.block.Block>
-
generateLootTable
@Deprecated(forRemoval=true) @NonExtendable public net.minecraft.world.level.storage.loot.LootTable generateLootTable()Deprecated, for removal: This API element is subject to removal in a future version.Use the version with additional datagen parameter (used for registry access etc.) -
generateLootTable
@Nullable public @Nullable net.minecraft.world.level.storage.loot.LootTable generateLootTable(KubeDataGenerator generator) -
generateAssets
- Overrides:
generateAssetsin classBuilderBase<net.minecraft.world.level.block.Block>
-
generateBlockModels
-
generateItemModel
-
useMultipartBlockState
protected boolean useMultipartBlockState() -
generateBlockState
-
generateMultipartBlockState
-
copyPropertiesFrom
-
soundType
@Info("Sets the block\'s sound type. Defaults to wood.") public BlockBuilder soundType(net.minecraft.world.level.block.SoundType m) -
noSoundType
-
woodSoundType
-
stoneSoundType
-
gravelSoundType
-
grassSoundType
-
sandSoundType
-
cropSoundType
-
glassSoundType
-
mapColor
@Info("Sets the block\'s map color. Defaults to NONE.") public BlockBuilder mapColor(net.minecraft.world.level.material.MapColor m) -
dynamicMapColor
@Info("Sets the block\'s map color dynamically per block state. If unset, defaults to NONE.") public BlockBuilder dynamicMapColor(@Nullable @Nullable Function<net.minecraft.world.level.block.state.BlockState, Object> m) -
hardness
@Info("Sets the hardness of the block. Defaults to 1.5.\n\nSetting this to -1 will make the block unbreakable like bedrock.\n") public BlockBuilder hardness(float h) -
resistance
@Info("Sets the blast resistance of the block. Defaults to 3.\n") public BlockBuilder resistance(float r) -
unbreakable
-
lightLevel
@Info("Sets the light level of the block. Defaults to 0 (no light).") public BlockBuilder lightLevel(float light) -
opaque
@Info("Sets the opacity of the block. Opaque blocks do not let light through.") public BlockBuilder opaque(boolean o) -
fullBlock
@Info("Sets the block should be a full block or not, like cactus or doors.") public BlockBuilder fullBlock(boolean f) -
requiresTool
@Info("Makes the block require a tool to have drops when broken.") public BlockBuilder requiresTool(boolean f) -
requiresTool
@Info("Makes the block require a tool to have drops when broken.") public BlockBuilder requiresTool() -
renderType
@Info("Sets the render type of the block. Can be `cutout`, `cutout_mipped`, `translucent`, or `basic`.\n") public BlockBuilder renderType(BlockRenderType l) -
color
@Info("Set the color of a specific layer of the block.\n") public BlockBuilder color(int index, BlockTintFunction color) -
color
@Info("Set the color of a specific layer of the block.\n") public BlockBuilder color(BlockTintFunction color) -
item
@Info("Modifies the block\'s item representation.\n") public BlockBuilder item(@Nullable @Nullable Consumer<ItemBuilder> i) -
getOrCreateItemBuilder
-
noItem
-
box
@Info("Set the shape of the block.") public BlockBuilder box(double x0, double y0, double z0, double x1, double y1, double z1, boolean scale16) -
box
@Info("Set the shape of the block.") public BlockBuilder box(double x0, double y0, double z0, double x1, double y1, double z1) -
createShape
public static net.minecraft.world.phys.shapes.VoxelShape createShape(List<net.minecraft.world.phys.AABB> boxes) -
noCollision
-
notSolid
-
setWaterlogged
Deprecated, for removal: This API element is subject to removal in a future version. -
getWaterlogged
Deprecated, for removal: This API element is subject to removal in a future version. -
waterlogged
-
canBeWaterlogged
-
drops
-
noDrops
-
slipperiness
-
speedFactor
@Info("Set how fast you can walk on the block.\n\nAny value above 1 will make you walk insanely fast as your speed is multiplied by this value each tick.\n\nRecommended values are between 0.1 and 1, useful for mimicking soul sand or ice.\n") public BlockBuilder speedFactor(float f) -
jumpFactor
-
randomTick
@Info("Sets random tick callback for this black.") public BlockBuilder randomTick(@Nullable @Nullable Consumer<RandomTickCallback> randomTickCallback) Sets random tick callback for this black.- Parameters:
randomTickCallback- A callback using a block container and a random.
-
noValidSpawns
-
suffocating
-
viewBlocking
-
redstoneConductor
-
transparent
-
defaultCutout
@Info("Helper method for setting the render type of the block to `cutout` correctly.") public BlockBuilder defaultCutout() -
defaultTranslucent
@Info("Helper method for setting the render type of the block to `translucent` correctly.") public BlockBuilder defaultTranslucent() -
instrument
@Info("Note block instrument.") public BlockBuilder instrument(net.minecraft.world.level.block.state.properties.NoteBlockInstrument i) -
tag
@Info("Tags both the block and the item with the given tag.") public BlockBuilder tag(net.minecraft.resources.ResourceLocation[] tag) - Overrides:
tagin classBuilderBase<net.minecraft.world.level.block.Block>
-
tagBoth
@Info("Tags both the block and the item with the given tag.") public BlockBuilder tagBoth(net.minecraft.resources.ResourceLocation[] tag) -
tagBlock
@Info("Tags the block with the given tag.") public BlockBuilder tagBlock(net.minecraft.resources.ResourceLocation[] tag) -
tagItem
@Info("Tags the item with the given tag.") public BlockBuilder tagItem(net.minecraft.resources.ResourceLocation[] tag) -
defaultState
@Info("Set the default state of the block.") public BlockBuilder defaultState(Consumer<BlockStateModifyCallback> callbackJS) -
placementState
@Info("Set the callback for determining the blocks state when placed.") public BlockBuilder placementState(Consumer<BlockStateModifyPlacementCallback> callbackJS) -
canBeReplaced
@Info("Set if the block can be replaced by something else.") public BlockBuilder canBeReplaced(Predicate<CanBeReplacedCallback> callbackJS) -
entityInside
@Info("Set what happens when an entity is inside the block\nThis is called every tick for every entity inside the block, so be careful what you do here.\nThis will only be called if the entity\'s bounding box overlaps with the block\'s collision.\n") public BlockBuilder entityInside(Consumer<EntityBlockCallback> callbackJS) -
steppedOn
@Info("Set what happens when an entity steps on the block\nThis is called every tick for every entity standing on the block, so be careful what you do here.\n") public BlockBuilder steppedOn(Consumer<EntityBlockCallback> callbackJS) -
fallenOn
@Info("Set what happens when an entity falls on the block. Do not use this for moving them, use bounce instead!") public BlockBuilder fallenOn(Consumer<EntityFallenOnBlockCallback> callbackJS) -
bounciness
@Info("Bounces entities that land on this block by bounciness * their fall velocity.\nDo not make bounciness negative, as that is a recipe for a long and laggy trip to the void\n") public BlockBuilder bounciness(float bounciness) -
afterFallenOn
@Info("Set how this block bounces/moves entities that land on top of this. Do not use this to modify the block, use fallOn instead!\nUse ctx.bounce(height) or ctx.setVelocity(x, y, z) to change the entities velocity.\n") public BlockBuilder afterFallenOn(Consumer<AfterEntityFallenOnBlockCallback> callbackJS) -
exploded
@Info("Set how this block reacts after an explosion. Note the block has already been destroyed at this point") public BlockBuilder exploded(Consumer<BlockExplodedCallback> callbackJS) -
property
@Info("Add a blockstate property to the block.\n\nFor example, facing, lit, etc.\n") public BlockBuilder property(net.minecraft.world.level.block.state.properties.Property<?> property) -
rotateState
@Info("Set the callback used for determining how the block rotates") public BlockBuilder rotateState(Consumer<BlockStateRotateCallback> callbackJS) -
mirrorState
@Info("Set the callback used for determining how the block is mirrored") public BlockBuilder mirrorState(Consumer<BlockStateMirrorCallback> callbackJS) -
rightClick
@Info("Set the callback used for right-clicking on the block") public BlockBuilder rightClick(Consumer<BlockRightClickedKubeEvent> callbackJS) -
blockEntity
@Info("Creates a Block Entity for this block") public BlockBuilder blockEntity(Consumer<BlockEntityInfo> callback) -
createProperties
public net.minecraft.world.level.block.state.BlockBehaviour.Properties createProperties()
-