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, ShapedBlockBuilder

@ReturnsSelf public abstract class BlockBuilder extends ModelledBuilderBase<net.minecraft.world.level.block.Block>
  • 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

      public transient BlockRenderType renderType
    • tint

      public transient BlockTintFunction tint
    • itemBuilder

      public transient ItemBuilder itemBuilder
    • customShape

      public transient List<net.minecraft.world.phys.AABB> 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

      public Consumer<RandomTickCallback> randomTickCallback
    • drops

      public BlockDropSupplier 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

      public transient Consumer<BlockStateModifyCallback> defaultStateModification
    • placementStateModification

      public transient Consumer<BlockStateModifyPlacementCallback> placementStateModification
    • canBeReplacedFunction

      public transient Predicate<CanBeReplacedCallback> canBeReplacedFunction
    • insideCallback

      public transient Consumer<EntityBlockCallback> insideCallback
    • stepOnCallback

      public transient Consumer<EntityBlockCallback> stepOnCallback
    • fallOnCallback

      public transient Consumer<EntityFallenOnBlockCallback> fallOnCallback
    • afterFallenOnCallback

      public transient Consumer<AfterEntityFallenOnBlockCallback> afterFallenOnCallback
    • explodedCallback

      public transient Consumer<BlockExplodedCallback> explodedCallback
    • rotateStateModification

      public transient Consumer<BlockStateRotateCallback> rotateStateModification
    • mirrorStateModification

      public transient Consumer<BlockStateMirrorCallback> mirrorStateModification
    • rightClick

      public transient Consumer<BlockRightClickedKubeEvent> rightClick
    • blockEntityInfo

      public transient BlockEntityInfo 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:
      transformObject in class BuilderBase<net.minecraft.world.level.block.Block>
    • createAdditionalObjects

      public void createAdditionalObjects(AdditionalObjectRegistry registry)
      Overrides:
      createAdditionalObjects in class BuilderBase<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:
      displayName in class BuilderBase<net.minecraft.world.level.block.Block>
    • generateData

      public void generateData(KubeDataGenerator generator)
      Overrides:
      generateData in class BuilderBase<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

      public void generateAssets(KubeAssetGenerator generator)
      Overrides:
      generateAssets in class BuilderBase<net.minecraft.world.level.block.Block>
    • generateBlockModels

      protected void generateBlockModels(KubeAssetGenerator generator)
    • generateItemModel

      protected void generateItemModel(ModelGenerator m)
    • useMultipartBlockState

      protected boolean useMultipartBlockState()
    • generateBlockState

      protected void generateBlockState(VariantBlockStateGenerator bs)
    • generateMultipartBlockState

      protected void generateMultipartBlockState(MultipartBlockStateGenerator bs)
    • copyPropertiesFrom

      public BlockBuilder copyPropertiesFrom(net.minecraft.world.level.block.Block block)
    • soundType

      @Info("Sets the block\'s sound type. Defaults to wood.") public BlockBuilder soundType(net.minecraft.world.level.block.SoundType m)
    • noSoundType

      public BlockBuilder noSoundType()
    • woodSoundType

      public BlockBuilder woodSoundType()
    • stoneSoundType

      public BlockBuilder stoneSoundType()
    • gravelSoundType

      public BlockBuilder gravelSoundType()
    • grassSoundType

      public BlockBuilder grassSoundType()
    • sandSoundType

      public BlockBuilder sandSoundType()
    • cropSoundType

      public BlockBuilder cropSoundType()
    • glassSoundType

      public BlockBuilder 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

      @Info("Makes the block unbreakable.") public BlockBuilder 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

      @HideFromJS protected ItemBuilder getOrCreateItemBuilder()
    • noItem

      @Info("Set the block to have no corresponding item.\n") public BlockBuilder 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

      @Info("Makes the block not collide with entities.") public BlockBuilder noCollision()
    • notSolid

      @Info("Makes the block not be solid.") public BlockBuilder notSolid()
    • setWaterlogged

      @Deprecated(forRemoval=true) public BlockBuilder setWaterlogged(boolean waterlogged)
      Deprecated, for removal: This API element is subject to removal in a future version.
    • getWaterlogged

      @Deprecated(forRemoval=true) public boolean getWaterlogged()
      Deprecated, for removal: This API element is subject to removal in a future version.
    • waterlogged

      @Info("Makes the block can be waterlogged.") public BlockBuilder waterlogged()
    • canBeWaterlogged

      @Info("Checks if the block can be waterlogged.") public boolean canBeWaterlogged()
    • drops

      @Info("Change drops of this block") public BlockBuilder drops(BlockDropSupplier drops)
    • noDrops

      @Info("Clears all drops for the block.") public BlockBuilder noDrops()
    • slipperiness

      @Info("Set how slippery the block is.") public BlockBuilder slipperiness(float f)
    • 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

      @Info("Set how high you can jump on the block.") public BlockBuilder jumpFactor(float f)
    • 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

      @Info("Makes mobs not spawn on the block.") public BlockBuilder noValidSpawns(boolean b)
    • suffocating

      @Info("Makes the block suffocating.") public BlockBuilder suffocating(boolean b)
    • viewBlocking

      @Info("Makes the block view blocking.") public BlockBuilder viewBlocking(boolean b)
    • redstoneConductor

      @Info("Makes the block a redstone conductor.") public BlockBuilder redstoneConductor(boolean b)
    • transparent

      @Info("Makes the block transparent.") public BlockBuilder transparent(boolean b)
    • 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:
      tag in class BuilderBase<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()