Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import org.bukkit.Material
class CobblestoneFactory(location: Location) : MaterialFactory(location, maxStorage = 4) {
companion object {
const val BLOCK_ID = "atlas:cobblestone_factory"
const val BLOCK_ID_ACTIVE = "atlas:cobblestone_factory_active"
const val POWER_COST = 2

val descriptor =
Expand All @@ -17,13 +16,19 @@ class CobblestoneFactory(location: Location) : MaterialFactory(location, maxStor
displayName = "Cobblestone Factory",
description = "Machine - consumes $POWER_COST power + water + lava → cobblestone",
placementType = PlacementType.SIMPLE,
additionalBlockIds = listOf(BLOCK_ID_ACTIVE),
constructor = { loc, _ -> CobblestoneFactory(loc) },
)
}

override val baseBlockId: String = BLOCK_ID
override val activeBlockId: String = BLOCK_ID_ACTIVE
override val activeBlockId: String = BLOCK_ID
override val powerCost: Int = POWER_COST
override val outputMaterial: Material = Material.COBBLESTONE

override fun getVisualStateBlockId(): String = BLOCK_ID

override fun powerUpdate() {
super.powerUpdate()
updatePoweredState()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import org.bukkit.Material
class ObsidianFactory(location: Location) : MaterialFactory(location, maxStorage = 50) {
companion object {
const val BLOCK_ID = "atlas:obsidian_factory"
const val BLOCK_ID_ACTIVE = "atlas:obsidian_factory_active"
const val POWER_COST = 25

val descriptor =
Expand All @@ -17,13 +16,19 @@ class ObsidianFactory(location: Location) : MaterialFactory(location, maxStorage
displayName = "Obsidian Factory",
description = "Machine - consumes $POWER_COST power + water + lava → obsidian",
placementType = PlacementType.SIMPLE,
additionalBlockIds = listOf(BLOCK_ID_ACTIVE),
constructor = { loc, _ -> ObsidianFactory(loc) },
)
}

override val baseBlockId: String = BLOCK_ID
override val activeBlockId: String = BLOCK_ID_ACTIVE
override val activeBlockId: String = BLOCK_ID
override val powerCost: Int = POWER_COST
override val outputMaterial: Material = Material.OBSIDIAN

override fun getVisualStateBlockId(): String = BLOCK_ID

override fun powerUpdate() {
super.powerUpdate()
updatePoweredState()
}
}
90 changes: 40 additions & 50 deletions src/main/resources/atlas/configuration/cobblestone_factory.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,10 @@ items:
settings:
hardness: 4.0
resistance: 4.0
is-suffocating: true
is-suffocating: false
is-view-blocking: false
is-redstone-conductor: false
can-occlude: false
push-reaction: push_only
tags: ["minecraft:mineable/pickaxe"]
sounds:
Expand All @@ -22,55 +24,43 @@ items:
place: minecraft:block.metal.place
hit: minecraft:block.metal.hit
fall: minecraft:block.metal.fall
state:
auto-state: solid
model:
path: minecraft:block/custom/cobblestone_factory
generation:
parent: minecraft:block/cube_bottom_top
textures:
top: minecraft:block/custom/cobblestone_factory_top
bottom: minecraft:block/custom/cobblestone_factory_bottom
side: minecraft:block/custom/cobblestone_factory_side

items#1:
atlas:cobblestone_factory_active:
material: paper
data:
item-name: "<!i><gradient:#808080:#A9A9A9>Cobblestone Factory"
model: minecraft:block/custom/cobblestone_factory_active
behavior:
type: block_item
block:
loot:
pools:
- rolls: 1
entries:
- type: item
item: atlas:cobblestone_factory
settings:
hardness: 4.0
resistance: 4.0
is-suffocating: true
is-redstone-conductor: false
push-reaction: push_only
tags: ["minecraft:mineable/pickaxe"]
sounds:
break: minecraft:block.metal.break
step: minecraft:block.metal.step
place: minecraft:block.metal.place
hit: minecraft:block.metal.hit
fall: minecraft:block.metal.fall
state:
auto-state: solid
model:
path: minecraft:block/custom/cobblestone_factory_active
generation:
parent: minecraft:block/cube_bottom_top
textures:
top: minecraft:block/custom/cobblestone_factory_top_active
bottom: minecraft:block/custom/cobblestone_factory_bottom
side: minecraft:block/custom/cobblestone_factory_side_active
states:
properties:
powered:
type: boolean
default: false
appearances:
idle:
auto-state: leaves
model:
path: minecraft:block/custom/cobblestone_factory
generation:
parent: minecraft:block/cube
textures:
north: minecraft:block/custom/cobblestone_factory_idle_north
south: minecraft:block/custom/cobblestone_factory_idle_south
east: minecraft:block/custom/cobblestone_factory_idle_east
west: minecraft:block/custom/cobblestone_factory_idle_west
up: minecraft:block/custom/cobblestone_factory_idle_up
down: minecraft:block/custom/cobblestone_factory_idle_down
active:
auto-state: leaves
model:
path: minecraft:block/custom/cobblestone_factory_active
generation:
parent: minecraft:block/cube
textures:
north: minecraft:block/custom/cobblestone_factory_active_north
south: minecraft:block/custom/cobblestone_factory_active_south
east: minecraft:block/custom/cobblestone_factory_active_east
west: minecraft:block/custom/cobblestone_factory_active_west
up: minecraft:block/custom/cobblestone_factory_active_up
down: minecraft:block/custom/cobblestone_factory_active_down
variants:
powered=false:
appearance: idle
powered=true:
appearance: active

recipes:
atlas:cobblestone_factory:
Expand Down
90 changes: 40 additions & 50 deletions src/main/resources/atlas/configuration/obsidian_factory.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,10 @@ items:
settings:
hardness: 4.0
resistance: 4.0
is-suffocating: true
is-suffocating: false
is-view-blocking: false
is-redstone-conductor: false
can-occlude: false
push-reaction: push_only
tags: ["minecraft:mineable/pickaxe"]
sounds:
Expand All @@ -22,55 +24,43 @@ items:
place: minecraft:block.metal.place
hit: minecraft:block.metal.hit
fall: minecraft:block.metal.fall
state:
auto-state: solid
model:
path: minecraft:block/custom/obsidian_factory
generation:
parent: minecraft:block/cube_bottom_top
textures:
top: minecraft:block/custom/obsidian_factory_top
bottom: minecraft:block/custom/obsidian_factory_bottom
side: minecraft:block/custom/obsidian_factory_side

items#1:
atlas:obsidian_factory_active:
material: paper
data:
item-name: "<!i><gradient:#1A0A2E:#4B0082>Obsidian Factory"
model: minecraft:block/custom/obsidian_factory_active
behavior:
type: block_item
block:
loot:
pools:
- rolls: 1
entries:
- type: item
item: atlas:obsidian_factory
settings:
hardness: 4.0
resistance: 4.0
is-suffocating: true
is-redstone-conductor: false
push-reaction: push_only
tags: ["minecraft:mineable/pickaxe"]
sounds:
break: minecraft:block.metal.break
step: minecraft:block.metal.step
place: minecraft:block.metal.place
hit: minecraft:block.metal.hit
fall: minecraft:block.metal.fall
state:
auto-state: solid
model:
path: minecraft:block/custom/obsidian_factory_active
generation:
parent: minecraft:block/cube_bottom_top
textures:
top: minecraft:block/custom/obsidian_factory_top_active
bottom: minecraft:block/custom/obsidian_factory_bottom
side: minecraft:block/custom/obsidian_factory_side_active
states:
properties:
powered:
type: boolean
default: false
appearances:
idle:
auto-state: leaves
model:
path: minecraft:block/custom/obsidian_factory
generation:
parent: minecraft:block/cube
textures:
north: minecraft:block/custom/obsidian_factory_idle_north
south: minecraft:block/custom/obsidian_factory_idle_south
east: minecraft:block/custom/obsidian_factory_idle_east
west: minecraft:block/custom/obsidian_factory_idle_west
up: minecraft:block/custom/obsidian_factory_idle_up
down: minecraft:block/custom/obsidian_factory_idle_down
active:
auto-state: leaves
model:
path: minecraft:block/custom/obsidian_factory_active
generation:
parent: minecraft:block/cube
textures:
north: minecraft:block/custom/obsidian_factory_active_north
south: minecraft:block/custom/obsidian_factory_active_south
east: minecraft:block/custom/obsidian_factory_active_east
west: minecraft:block/custom/obsidian_factory_active_west
up: minecraft:block/custom/obsidian_factory_active_up
down: minecraft:block/custom/obsidian_factory_active_down
variants:
powered=false:
appearance: idle
powered=true:
appearance: active

recipes:
atlas:obsidian_factory:
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
4 changes: 2 additions & 2 deletions src/test/kotlin/com/coderjoe/atlas/AtlasPluginTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ class AtlasPluginTest {
}

@Test
fun `power system initializes with 21 block types`() {
fun `power system initializes with 19 block types`() {
TestHelper.initPowerFactory()
assertEquals(21, PowerBlockFactory.getRegisteredBlockIds().size)
assertEquals(19, PowerBlockFactory.getRegisteredBlockIds().size)
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,14 @@ class PowerBlockInitializerTest {
// LavaGenerator: 2 (base + active)
// AutoSmelter: 1
// PowerSplitter: 1
// CobblestoneFactory: 2 (base + active)
// ObsidianFactory: 2 (base + active)
// CobblestoneFactory: 1
// ObsidianFactory: 1
// Crusher: 1
// PowerMerger: 1
// SoftTouchDrill: 1
// ExperienceExtractor: 2 (base + active)
// Total: 21
assertEquals(21, ids.size)
// Total: 19
assertEquals(19, ids.size)
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,20 +39,15 @@ class CobblestoneFactoryTest {
}

@Test
fun `visual state idle when insufficient power`() {
fun `visual state always returns base block id`() {
val gen = CobblestoneFactory(TestHelper.createLocation())
assertEquals(
"atlas:cobblestone_factory",
gen.getVisualStateBlockId(),
)
}

@Test
fun `visual state active when power at cost`() {
val gen = CobblestoneFactory(TestHelper.createLocation())
gen.currentPower = 2
assertEquals(
"atlas:cobblestone_factory_active",
"atlas:cobblestone_factory",
gen.getVisualStateBlockId(),
)
}
Expand Down Expand Up @@ -206,12 +201,7 @@ class CobblestoneFactoryTest {
val desc = CobblestoneFactory.descriptor
assertEquals("atlas:cobblestone_factory", desc.baseBlockId)
assertEquals("Cobblestone Factory", desc.displayName)
assertEquals(1, desc.additionalBlockIds.size)
assertTrue(
desc.additionalBlockIds.contains(
"atlas:cobblestone_factory_active",
),
)
assertTrue(desc.additionalBlockIds.isEmpty())
}

@Test
Expand Down
17 changes: 3 additions & 14 deletions src/test/kotlin/com/coderjoe/atlas/utility/ObsidianFactoryTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -39,21 +39,15 @@ class ObsidianFactoryTest {
}

@Test
fun `visual state idle when insufficient power`() {
fun `visual state always returns base block id`() {
val gen = ObsidianFactory(TestHelper.createLocation())
gen.currentPower = 24
assertEquals(
"atlas:obsidian_factory",
gen.getVisualStateBlockId(),
)
}

@Test
fun `visual state active when power at cost`() {
val gen = ObsidianFactory(TestHelper.createLocation())
gen.currentPower = 25
assertEquals(
"atlas:obsidian_factory_active",
"atlas:obsidian_factory",
gen.getVisualStateBlockId(),
)
}
Expand Down Expand Up @@ -207,12 +201,7 @@ class ObsidianFactoryTest {
val desc = ObsidianFactory.descriptor
assertEquals("atlas:obsidian_factory", desc.baseBlockId)
assertEquals("Obsidian Factory", desc.displayName)
assertEquals(1, desc.additionalBlockIds.size)
assertTrue(
desc.additionalBlockIds.contains(
"atlas:obsidian_factory_active",
),
)
assertTrue(desc.additionalBlockIds.isEmpty())
}

@Test
Expand Down
Loading