Skip to content

Commit

Permalink
feat: add more blocktypes
Browse files Browse the repository at this point in the history
  • Loading branch information
Boy0000 committed Jun 29, 2024
1 parent 6709d7c commit 56a877c
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import org.bukkit.block.BlockFace
import org.bukkit.block.data.BlockData
import org.bukkit.block.data.type.CaveVines
import org.bukkit.block.data.type.NoteBlock
import org.bukkit.block.data.type.Slab
import org.bukkit.block.data.type.Tripwire
import kotlin.math.min

Expand Down Expand Up @@ -74,11 +75,22 @@ class Block2Prefab {
}
}.toTypedArray().let { putIfAbsent(SetBlock.BlockType.CAVEVINE, it) }

//Calculates slab states & stair states
/*for (n in 1..4) {
putIfAbsent(BLOCKY_SLABS.elementAt(n - 1).createBlockData() as Slab, n)
putIfAbsent(BLOCKY_STAIRS.elementAt(n - 1).createBlockData() as Stairs, n)
}*/
//Calculates slab, stair, door, trapdoor & grate states
// We add AIR first to offset all the ids to 1-4
listOf(Material.AIR, Material.WAXED_CUT_COPPER_SLAB, Material.WAXED_EXPOSED_CUT_COPPER_SLAB, Material.WAXED_OXIDIZED_CUT_COPPER_SLAB, Material.WAXED_WEATHERED_CUT_COPPER_SLAB)
.map(Material::createBlockData).toTypedArray().let { putIfAbsent(SetBlock.BlockType.SLAB, it) }

listOf(Material.AIR, Material.WAXED_CUT_COPPER_STAIRS, Material.WAXED_EXPOSED_CUT_COPPER_STAIRS, Material.WAXED_OXIDIZED_CUT_COPPER_STAIRS, Material.WAXED_WEATHERED_CUT_COPPER_STAIRS)
.map(Material::createBlockData).toTypedArray().let { putIfAbsent(SetBlock.BlockType.STAIR, it) }

listOf(Material.AIR, Material.WAXED_COPPER_DOOR, Material.WAXED_EXPOSED_COPPER_DOOR, Material.WAXED_OXIDIZED_COPPER_DOOR, Material.WAXED_WEATHERED_COPPER_DOOR)
.map(Material::createBlockData).toTypedArray().let { putIfAbsent(SetBlock.BlockType.DOOR, it) }

listOf(Material.AIR, Material.WAXED_COPPER_TRAPDOOR, Material.WAXED_EXPOSED_COPPER_TRAPDOOR, Material.WAXED_OXIDIZED_COPPER_TRAPDOOR, Material.WAXED_WEATHERED_COPPER_TRAPDOOR)
.map(Material::createBlockData).toTypedArray().let { putIfAbsent(SetBlock.BlockType.TRAPDOOR, it) }

listOf(Material.AIR, Material.WAXED_COPPER_GRATE, Material.WAXED_EXPOSED_COPPER_GRATE, Material.WAXED_OXIDIZED_COPPER_GRATE, Material.WAXED_WEATHERED_COPPER_GRATE)
.map(Material::createBlockData).toTypedArray().let { putIfAbsent(SetBlock.BlockType.GRATE, it) }
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ class SetBlock (
val blockId: Int,
) {
enum class BlockType {
NOTEBLOCK, WIRE, CAVEVINE, SLAB, STAIR
NOTEBLOCK, WIRE, CAVEVINE, SLAB, STAIR, DOOR, TRAPDOOR, GRATE;

val isCopper get() = this in setOf(SLAB, STAIR, DOOR, TRAPDOOR, GRATE)
}
}
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ kotlin.code.style=official
group=com.mineinabyss
version=0.30
idofrontVersion=0.24.10
gearyVersion=0.26.0
gearyVersion=0.26-dev

0 comments on commit 56a877c

Please sign in to comment.