Skip to content

Commit

Permalink
Update to Polyester 0.2.1 (+ wood type API) and increase cupboard con…
Browse files Browse the repository at this point in the history
…tainer size
  • Loading branch information
Juuxel committed Apr 30, 2019
1 parent cd953b0 commit 29d62f9
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 32 deletions.
8 changes: 4 additions & 4 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ base {
archivesBaseName = "Adorn"
}

version = "0.1.2+1.14"
version = "0.1.3+1.14"

allprojects {
apply(plugin = "java")
Expand All @@ -31,7 +31,7 @@ allprojects {
// For polyester
maven(url = "https://jitpack.io")

// For towelette
// For polyester and towelette
maven(url = "https://minecraft.curseforge.com/api/maven") {
name = "CurseForge"
}
Expand Down Expand Up @@ -71,13 +71,13 @@ dependencies {
mappings("net.fabricmc:yarn:1.14+build.1")

// Fabric
modCompile("net.fabricmc:fabric-loader:0.4.2+build.132")
modCompile("net.fabricmc:fabric-loader:0.4.6+build.141")
modCompile("net.fabricmc:fabric:0.2.7+build.127")
modCompile("net.fabricmc:fabric-language-kotlin:1.3.30-SNAPSHOT")
compileOnly("net.fabricmc:fabric-language-kotlin:1.3.30-SNAPSHOT")

// Other mods
modCompileAndInclude("com.github.Juuxel:Polyester:0.1.0")
modCompileAndInclude("polyester:Polyester:0.2.1+1.14")
modCompileAndInclude("towelette:Towelette:1.5.2")
modCompileAndInclude("alexiil.mc.lib:libblockattributes:0.4.0")
modCompileAndInclude("io.github.cottonmc:cotton:0.6.1+1.14-SNAPSHOT")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ package juuxel.adorn.block.entity

import juuxel.adorn.block.KitchenCupboardBlock

class KitchenCupboardBlockEntity : BaseInventoryBlockEntity(KitchenCupboardBlock.BLOCK_ENTITY_TYPE, 9)
class KitchenCupboardBlockEntity : BaseInventoryBlockEntity(KitchenCupboardBlock.BLOCK_ENTITY_TYPE, 15)
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,12 @@ abstract class BaseAdornController(syncId: Int, playerInv: PlayerInventory, cont

for (row in 0 until invHeight) {
for (col in 0 until invWidth) {
val hasEvenWidth = invWidth % 2 == 0
val xOffset =
if (hasEvenWidth && col + 1 > invWidth / 2) 1
else 0
val slot = WItemSlot.of(blockInventory, col + row * invWidth)
add(slot, col + (9 - invWidth) / 2, row + 1)
add(slot, col + (9 - invWidth) / 2 + xOffset, row + 1)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import net.minecraft.container.BlockContext
import net.minecraft.entity.player.PlayerInventory

class KitchenCupboardController(syncId: Int, playerInv: PlayerInventory, context: BlockContext) :
BaseAdornController(syncId, playerInv, context, 3, 3) {
BaseAdornController(syncId, playerInv, context, 5, 3) {
override fun addPainters() {
rootPanel.setBackgroundPainter(BackgroundPainter.createColorful(color(0x99B2B7)))
}
Expand Down
33 changes: 22 additions & 11 deletions src/main/kotlin/juuxel/adorn/lib/ModBlocks.kt
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
package juuxel.adorn.lib

import io.github.juuxel.polyester.block.WoodType
import io.github.juuxel.polyester.plugin.PolyesterPluginManager
import io.github.juuxel.polyester.registry.PolyesterRegistry
import juuxel.adorn.Adorn
import juuxel.adorn.block.*
import juuxel.adorn.util.WoodType
import net.minecraft.util.DyeColor
import net.minecraft.util.registry.Registry

Expand All @@ -12,31 +13,41 @@ object ModBlocks : PolyesterRegistry(Adorn.NAMESPACE) {
registerBlock(SofaBlock(it.getName()))
}

val CHAIRS: List<ChairBlock> = WoodType.values().map {
registerBlock(ChairBlock(it.id))
private val WOOD_TYPES = PolyesterPluginManager.plugins.flatMap { it.woodTypes }.map {
getVariantContentName(it)
}

val TABLES: List<TableBlock> = WoodType.values().map {
registerBlock(TableBlock(it.id))
val CHAIRS: List<ChairBlock> = WOOD_TYPES.map {
registerBlock(ChairBlock(it))
}

val KITCHEN_COUNTERS: List<KitchenCounterBlock> = WoodType.values().map {
registerBlock(KitchenCounterBlock(it.id))
val TABLES: List<TableBlock> = WOOD_TYPES.map {
registerBlock(TableBlock(it))
}

val KITCHEN_CUPBOARDS: List<KitchenCupboardBlock> = WoodType.values().map {
registerBlock(KitchenCupboardBlock(it.id))
val KITCHEN_COUNTERS: List<KitchenCounterBlock> = WOOD_TYPES.map {
registerBlock(KitchenCounterBlock(it))
}

val KITCHEN_CUPBOARDS: List<KitchenCupboardBlock> = WOOD_TYPES.map {
registerBlock(KitchenCupboardBlock(it))
}

val CHIMNEY: ChimneyBlock = registerBlock(ChimneyBlock())

val DRAWERS: List<DrawerBlock> = WoodType.values().map {
registerBlock(DrawerBlock(it.id))
val DRAWERS: List<DrawerBlock> = WOOD_TYPES.map {
registerBlock(DrawerBlock(it))
}

fun init() {
// Register here so they're only registered once
register(Registry.BLOCK_ENTITY, "kitchen_cupboard", KitchenCupboardBlock.BLOCK_ENTITY_TYPE)
register(Registry.BLOCK_ENTITY, "drawer", DrawerBlock.BLOCK_ENTITY_TYPE)
}

private fun getVariantContentName(woodType: WoodType): String =
when (woodType.id.namespace) {
"minecraft" -> woodType.id.path
else -> woodType.id.namespace + '_' + woodType.id.path
}
}
12 changes: 0 additions & 12 deletions src/main/kotlin/juuxel/adorn/util/WoodType.kt

This file was deleted.

4 changes: 2 additions & 2 deletions src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@
},

"depends": {
"fabric": ">=0.2.0",
"fabric": ">=0.2.7",
"fabricloader": ">=0.4.0",
"fabric-language-kotlin": ">=1.3.30",
"towelette": ">=1.5.0",
"polyester": "=0.1.0",
"polyester": ">=0.2.0",
"cotton": ">=0.6.1",
"libblockattributes": ">=0.4.0"
}
Expand Down

0 comments on commit 29d62f9

Please sign in to comment.