Update tirtanium doors and pressure plate
This commit is contained in:
parent
8c78bef33c
commit
d3e9bfe579
@ -1,11 +1,14 @@
|
||||
package ru.dbotthepony.mc.otm.block.decorative
|
||||
|
||||
import com.mojang.serialization.MapCodec
|
||||
import com.mojang.serialization.codecs.RecordCodecBuilder
|
||||
import net.minecraft.ChatFormatting
|
||||
import net.minecraft.core.BlockPos
|
||||
import net.minecraft.network.chat.Component
|
||||
import net.minecraft.world.entity.Entity
|
||||
import net.minecraft.world.entity.monster.Zombie
|
||||
import net.minecraft.world.item.DyeColor
|
||||
import net.minecraft.world.item.Item
|
||||
import net.minecraft.world.item.ItemStack
|
||||
import net.minecraft.world.item.TooltipFlag
|
||||
import net.minecraft.world.level.BlockGetter
|
||||
@ -16,19 +19,37 @@ import net.minecraft.world.level.material.PushReaction
|
||||
import ru.dbotthepony.mc.otm.core.TooltipList
|
||||
import ru.dbotthepony.mc.otm.core.TranslatableComponent
|
||||
import ru.dbotthepony.mc.otm.core.collect.iteratorOf
|
||||
import java.util.*
|
||||
import kotlin.jvm.optionals.getOrNull
|
||||
|
||||
class TritaniumDoorBlock(val color: DyeColor?) : DoorBlock(
|
||||
Properties.of()
|
||||
class TritaniumDoorBlock(
|
||||
val color: DyeColor?,
|
||||
properties: Properties = Properties.of()
|
||||
.mapColor(color ?: DyeColor.LIGHT_BLUE)
|
||||
.explosionResistance(80f)
|
||||
.noOcclusion()
|
||||
.destroyTime(3f)
|
||||
.pushReaction(PushReaction.DESTROY)
|
||||
.requiresCorrectToolForDrops(),
|
||||
BlockSetType.IRON
|
||||
) {
|
||||
blockSetType: BlockSetType = BlockSetType.IRON,
|
||||
) : DoorBlock(blockSetType, properties) {
|
||||
val tooltips = TooltipList()
|
||||
|
||||
private val codec: MapCodec<TritaniumDoorBlock> = RecordCodecBuilder.mapCodec {
|
||||
it.group(
|
||||
DyeColor.CODEC
|
||||
.optionalFieldOf("color")
|
||||
.xmap({ it.getOrNull() }, { Optional.ofNullable(it) })
|
||||
.forGetter(TritaniumDoorBlock::color),
|
||||
propertiesCodec(),
|
||||
BlockSetType.CODEC.fieldOf("block_set_type").forGetter(TritaniumDoorBlock::type)
|
||||
).apply(it, ::TritaniumDoorBlock)
|
||||
}
|
||||
|
||||
override fun codec(): MapCodec<out TritaniumDoorBlock> {
|
||||
return codec
|
||||
}
|
||||
|
||||
init {
|
||||
tooltips.add { TranslatableComponent("$descriptionId.description0").withStyle(ChatFormatting.DARK_GRAY) }
|
||||
tooltips.add { TranslatableComponent("$descriptionId.description1").withStyle(ChatFormatting.DARK_GRAY) }
|
||||
@ -37,12 +58,12 @@ class TritaniumDoorBlock(val color: DyeColor?) : DoorBlock(
|
||||
|
||||
override fun appendHoverText(
|
||||
p_49816_: ItemStack,
|
||||
p_49817_: BlockGetter?,
|
||||
p_339606_: Item.TooltipContext,
|
||||
p_49818_: MutableList<Component>,
|
||||
p_49819_: TooltipFlag
|
||||
) {
|
||||
super.appendHoverText(p_49816_, p_49817_, p_49818_, p_49819_)
|
||||
tooltips.assemble(p_49816_, p_49818_)
|
||||
super.appendHoverText(p_49816_, p_339606_, p_49818_, p_49819_)
|
||||
tooltips.assemble(p_49816_, p_339606_, p_49818_)
|
||||
}
|
||||
|
||||
override fun canEntityDestroy(
|
||||
|
@ -1,6 +1,7 @@
|
||||
package ru.dbotthepony.mc.otm.block.decorative
|
||||
|
||||
import com.mojang.serialization.MapCodec
|
||||
import com.mojang.serialization.codecs.RecordCodecBuilder
|
||||
import net.minecraft.ChatFormatting
|
||||
import net.minecraft.core.BlockPos
|
||||
import net.minecraft.network.chat.Component
|
||||
@ -13,6 +14,7 @@ import net.minecraft.world.level.Level
|
||||
import net.minecraft.world.level.block.BasePressurePlateBlock
|
||||
import net.minecraft.world.level.block.Block
|
||||
import net.minecraft.world.level.block.SoundType
|
||||
import net.minecraft.world.level.block.state.BlockBehaviour
|
||||
import net.minecraft.world.level.block.state.BlockState
|
||||
import net.minecraft.world.level.block.state.StateDefinition
|
||||
import net.minecraft.world.level.block.state.properties.BlockSetType
|
||||
@ -20,10 +22,39 @@ import net.minecraft.world.level.block.state.properties.BlockStateProperties
|
||||
import ru.dbotthepony.mc.otm.core.TooltipList
|
||||
import ru.dbotthepony.mc.otm.core.TranslatableComponent
|
||||
import ru.dbotthepony.mc.otm.core.get
|
||||
import java.util.Optional
|
||||
import kotlin.jvm.optionals.getOrNull
|
||||
|
||||
class TritaniumPressurePlate(color: DyeColor?) : BasePressurePlateBlock(Properties.of().mapColor(color ?: DyeColor.LIGHT_BLUE).sound(SoundType.METAL).explosionResistance(80f).noOcclusion().destroyTime(3f).requiresCorrectToolForDrops().forceSolidOn().noCollission(), BlockSetType.IRON) {
|
||||
class TritaniumPressurePlate(
|
||||
val color: DyeColor?,
|
||||
properties: Properties = Properties.of()
|
||||
.mapColor(color ?: DyeColor.LIGHT_BLUE)
|
||||
.sound(SoundType.METAL)
|
||||
.explosionResistance(80f)
|
||||
.noOcclusion()
|
||||
.destroyTime(3f)
|
||||
.requiresCorrectToolForDrops()
|
||||
.forceSolidOn()
|
||||
.noCollission(),
|
||||
typeSet: BlockSetType = BlockSetType.IRON,
|
||||
) : BasePressurePlateBlock(properties, typeSet) {
|
||||
val tooltips = TooltipList()
|
||||
|
||||
private val codec: MapCodec<TritaniumPressurePlate> = RecordCodecBuilder.mapCodec {
|
||||
it.group(
|
||||
DyeColor.CODEC
|
||||
.optionalFieldOf("color")
|
||||
.xmap({ it.getOrNull() }, { Optional.ofNullable(it) })
|
||||
.forGetter(TritaniumPressurePlate::color),
|
||||
propertiesCodec(),
|
||||
BlockSetType.CODEC.fieldOf("block_set_type").forGetter(TritaniumPressurePlate::type)
|
||||
).apply(it, ::TritaniumPressurePlate)
|
||||
}
|
||||
|
||||
override fun codec(): MapCodec<out TritaniumPressurePlate> {
|
||||
return codec
|
||||
}
|
||||
|
||||
override fun appendHoverText(
|
||||
itemStack: ItemStack,
|
||||
context: Item.TooltipContext,
|
||||
|
@ -1,5 +1,7 @@
|
||||
package ru.dbotthepony.mc.otm.block.decorative
|
||||
|
||||
import com.mojang.serialization.MapCodec
|
||||
import com.mojang.serialization.codecs.RecordCodecBuilder
|
||||
import net.minecraft.ChatFormatting
|
||||
import net.minecraft.core.BlockPos
|
||||
import net.minecraft.network.chat.Component
|
||||
@ -7,6 +9,7 @@ import net.minecraft.world.entity.Entity
|
||||
import net.minecraft.world.entity.EntityType
|
||||
import net.minecraft.world.entity.monster.Zombie
|
||||
import net.minecraft.world.item.DyeColor
|
||||
import net.minecraft.world.item.Item
|
||||
import net.minecraft.world.item.ItemStack
|
||||
import net.minecraft.world.item.TooltipFlag
|
||||
import net.minecraft.world.level.BlockGetter
|
||||
@ -16,18 +19,36 @@ import net.minecraft.world.level.block.state.properties.BlockSetType
|
||||
import ru.dbotthepony.mc.otm.core.TooltipList
|
||||
import ru.dbotthepony.mc.otm.core.TranslatableComponent
|
||||
import ru.dbotthepony.mc.otm.core.collect.iteratorOf
|
||||
import java.util.*
|
||||
import kotlin.jvm.optionals.getOrNull
|
||||
|
||||
class TritaniumTrapdoorBlock(val color: DyeColor?) : TrapDoorBlock(
|
||||
Properties.of()
|
||||
class TritaniumTrapdoorBlock(
|
||||
val color: DyeColor?,
|
||||
properties: Properties = Properties.of()
|
||||
.mapColor(color ?: DyeColor.LIGHT_BLUE)
|
||||
.explosionResistance(80f)
|
||||
.noOcclusion().destroyTime(3f)
|
||||
.requiresCorrectToolForDrops()
|
||||
.isValidSpawn { _: BlockState, _: BlockGetter, _: BlockPos, _: EntityType<*>? -> false },
|
||||
BlockSetType.IRON
|
||||
) {
|
||||
typeSetType: BlockSetType = BlockSetType.IRON
|
||||
) : TrapDoorBlock(typeSetType, properties) {
|
||||
val tooltips = TooltipList()
|
||||
|
||||
private val codec: MapCodec<TritaniumTrapdoorBlock> = RecordCodecBuilder.mapCodec {
|
||||
it.group(
|
||||
DyeColor.CODEC
|
||||
.optionalFieldOf("color")
|
||||
.xmap({ it.getOrNull() }, { Optional.ofNullable(it) })
|
||||
.forGetter(TritaniumTrapdoorBlock::color),
|
||||
propertiesCodec(),
|
||||
BlockSetType.CODEC.fieldOf("block_set_type").forGetter(TritaniumTrapdoorBlock::getType)
|
||||
).apply(it, ::TritaniumTrapdoorBlock)
|
||||
}
|
||||
|
||||
override fun codec(): MapCodec<out TritaniumTrapdoorBlock> {
|
||||
return codec
|
||||
}
|
||||
|
||||
init {
|
||||
tooltips.add { TranslatableComponent("$descriptionId.description0").withStyle(ChatFormatting.DARK_GRAY) }
|
||||
tooltips.add { TranslatableComponent("$descriptionId.description1").withStyle(ChatFormatting.DARK_GRAY) }
|
||||
@ -35,13 +56,13 @@ class TritaniumTrapdoorBlock(val color: DyeColor?) : TrapDoorBlock(
|
||||
}
|
||||
|
||||
override fun appendHoverText(
|
||||
p_49816_: ItemStack,
|
||||
p_49817_: BlockGetter?,
|
||||
p_49818_: MutableList<Component>,
|
||||
p_49819_: TooltipFlag
|
||||
itemStack: ItemStack,
|
||||
context: Item.TooltipContext,
|
||||
lines: MutableList<Component>,
|
||||
tooltipType: TooltipFlag
|
||||
) {
|
||||
super.appendHoverText(p_49816_, p_49817_, p_49818_, p_49819_)
|
||||
tooltips.assemble(p_49816_, p_49818_)
|
||||
super.appendHoverText(itemStack, context, lines, tooltipType)
|
||||
tooltips.assemble(itemStack, context, lines)
|
||||
}
|
||||
|
||||
override fun canEntityDestroy(
|
||||
|
Loading…
Reference in New Issue
Block a user