Skip to content

Commit

Permalink
update to create 0.5.1.h
Browse files Browse the repository at this point in the history
  • Loading branch information
PssbleTrngle committed Sep 9, 2024
1 parent 095f27e commit b76c1e9
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 35 deletions.
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ mod_author=possible_triangle
maven_group=com.possible-triangle

jei_version=9.7.0.209
flywheel_version=0.6.10-105
create_version=0.5.1.f-332
flywheel_version=0.6.11-107
create_version=0.5.1.h-427
registrate_version=MC1.18.2-1.1.3
flightlib_version=0.3.0
kotlin_forge_version=3.12.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,11 @@ import com.possible_triangle.create_jetpack.item.JetpackItem
import com.simibubi.create.AllCreativeModeTabs
import com.simibubi.create.AllTags.AllItemTags
import com.simibubi.create.Create
import com.simibubi.create.content.equipment.armor.*
import com.simibubi.create.content.equipment.armor.AllArmorMaterials
import com.simibubi.create.content.equipment.armor.BacktankBlockEntity
import com.simibubi.create.content.equipment.armor.BacktankInstance
import com.simibubi.create.content.equipment.armor.BacktankItem.BacktankBlockItem
import com.simibubi.create.content.equipment.armor.BacktankRenderer
import com.simibubi.create.content.kinetics.BlockStressDefaults
import com.simibubi.create.foundation.data.CreateRegistrate
import com.simibubi.create.foundation.data.SharedProperties
Expand Down Expand Up @@ -80,7 +83,7 @@ object Content {
.register()

val JETPACK_BLOCK: BlockEntry<JetpackBlock> = REGISTRATE
.block<JetpackBlock>("jetpack") { JetpackBlock({ JETPACK_ITEM.get() }, it) }
.block<JetpackBlock>("jetpack") { JetpackBlock(it) }
.initialProperties { SharedProperties.copperMetal() }
.jetpackTransforms { JETPACK_ITEM.get() }
.register()
Expand All @@ -98,7 +101,7 @@ object Content {
.register()

val NETHERITE_JETPACK_BLOCK: BlockEntry<JetpackBlock> = REGISTRATE
.block<JetpackBlock>("netherite_jetpack") { JetpackBlock({ NETHERITE_JETPACK_ITEM.get() }, it) }
.block<JetpackBlock>("netherite_jetpack") { JetpackBlock(it) }
.initialProperties { SharedProperties.netheriteMetal() }
.jetpackTransforms { NETHERITE_JETPACK_ITEM.get() }
.register()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,38 +3,9 @@ package com.possible_triangle.create_jetpack.block
import com.possible_triangle.create_jetpack.Content
import com.simibubi.create.content.equipment.armor.BacktankBlock
import com.simibubi.create.content.equipment.armor.BacktankBlockEntity
import net.minecraft.core.BlockPos
import net.minecraft.nbt.ListTag
import net.minecraft.world.item.ItemStack
import net.minecraft.world.level.BlockGetter
import net.minecraft.world.level.ItemLike
import net.minecraft.world.level.block.entity.BlockEntityType
import net.minecraft.world.level.block.state.BlockState

class JetpackBlock(private val item: ItemLike, properties: Properties) : BacktankBlock(properties) {

override fun getCloneItemStack(
world: BlockGetter,
pos: BlockPos,
state: BlockState
): ItemStack {
val item = ItemStack(item)
val tile = getBlockEntityOptional(world, pos)

val air = tile.map { it.getAirLevel() }.orElse(0) as Int
item.orCreateTag.putInt("Air", air)

val enchants = tile.map { it.enchantmentTag }.orElse(ListTag())
if (!enchants.isEmpty()) {
val enchantmentTagList = item.enchantmentTags
enchantmentTagList.addAll(enchants)
item.orCreateTag.put("Enchantments", enchantmentTagList)
}

tile.map { it.customName }.ifPresent { item.hoverName = it }

return item
}
class JetpackBlock(properties: Properties) : BacktankBlock(properties) {

override fun getBlockEntityType(): BlockEntityType<out BacktankBlockEntity> {
return Content.JETPACK_BLOCK_ENTITY.get()
Expand Down

0 comments on commit b76c1e9

Please sign in to comment.