-
-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This commit introduces the first iteration of the new world format, along with model generation, some refactoring and a bunch of minor changes. Both of these features are partially unfinished, and some other things (such as tile-entity networks) are non-functional right now.
- Loading branch information
1 parent
15d2bd7
commit 5976329
Showing
1,655 changed files
with
13,539 additions
and
13,353 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 8 additions & 5 deletions
13
nova/src/main/kotlin/xyz/xenondevs/nova/addon/registry/BlockRegistry.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,17 @@ | ||
package xyz.xenondevs.nova.addon.registry | ||
|
||
import xyz.xenondevs.nova.world.block.NovaBlock | ||
import xyz.xenondevs.nova.world.block.NovaBlockBuilder | ||
import xyz.xenondevs.nova.world.block.NovaTileEntityBlock | ||
import xyz.xenondevs.nova.world.block.NovaTileEntityBlockBuilder | ||
import xyz.xenondevs.nova.world.block.TileEntityConstructor | ||
import xyz.xenondevs.nova.world.block.TileEntityNovaBlockBuilder | ||
|
||
interface BlockRegistry : AddonGetter { | ||
|
||
fun tileEntity(name: String, tileEntity: TileEntityConstructor) = | ||
TileEntityNovaBlockBuilder(addon, name, tileEntity) | ||
fun tileEntity(name: String, constructor: TileEntityConstructor, tileEntity: NovaTileEntityBlockBuilder.() -> Unit): NovaTileEntityBlock = | ||
NovaTileEntityBlockBuilder(addon, name, constructor).apply(tileEntity).register() | ||
|
||
fun block(name: String, block: NovaBlockBuilder.() -> Unit): NovaBlock = | ||
NovaBlockBuilder(addon, name).apply(block).register() | ||
|
||
fun block(name: String): NovaBlockBuilder = | ||
NovaBlockBuilder(addon, name) | ||
} |
75 changes: 13 additions & 62 deletions
75
nova/src/main/kotlin/xyz/xenondevs/nova/addon/registry/ItemRegistry.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,89 +1,40 @@ | ||
package xyz.xenondevs.nova.addon.registry | ||
|
||
import net.kyori.adventure.text.Component | ||
import net.kyori.adventure.text.format.Style | ||
import xyz.xenondevs.nova.item.NovaItem | ||
import xyz.xenondevs.nova.item.NovaItemBuilder | ||
import xyz.xenondevs.nova.item.behavior.ItemBehaviorHolder | ||
import xyz.xenondevs.nova.registry.NovaRegistries | ||
import xyz.xenondevs.nova.util.ResourceLocation | ||
import xyz.xenondevs.nova.util.set | ||
import xyz.xenondevs.nova.world.block.NovaBlock | ||
|
||
interface ItemRegistry : AddonGetter { | ||
|
||
fun item(name: String): NovaItemBuilder = | ||
NovaItemBuilder(addon, name) | ||
fun item(name: String, init: NovaItemBuilder.() -> Unit): NovaItem = | ||
NovaItemBuilder(addon, name).apply(init).register() | ||
|
||
fun item(block: NovaBlock): NovaItemBuilder { | ||
fun item(block: NovaBlock, init: NovaItemBuilder.() -> Unit): NovaItem { | ||
require(block.id.namespace == addon.description.id) { "The block must be from the same addon (${block.id})!" } | ||
return NovaItemBuilder.fromBlock(block) | ||
return NovaItemBuilder.fromBlock(block).apply(init).register() | ||
} | ||
|
||
fun registerItem( | ||
name: String, | ||
vararg behaviors: ItemBehaviorHolder, | ||
localizedName: String = "item.${addon.description.id}.$name", | ||
localizedName: String? = null, | ||
isHidden: Boolean = false | ||
): NovaItem { | ||
val item = NovaItem( | ||
ResourceLocation(addon, name), | ||
Component.translatable(localizedName), | ||
Style.empty(), | ||
behaviors.asList(), | ||
isHidden = isHidden | ||
) | ||
NovaRegistries.ITEM[item.id] = item | ||
return item | ||
): NovaItem = item(name) { | ||
behaviors(*behaviors) | ||
localizedName?.let(::localizedName) | ||
hidden(isHidden) | ||
} | ||
|
||
fun registerItem( | ||
block: NovaBlock, | ||
vararg behaviors: ItemBehaviorHolder, | ||
localizedName: String? = null, | ||
isHidden: Boolean = false | ||
): NovaItem { | ||
require(block.id.namespace == addon.description.id) { "The block must be from the same addon (${block.id})!" } | ||
val item = NovaItem( | ||
block.id, | ||
localizedName?.let(Component::translatable) ?: block.name, | ||
Style.empty(), | ||
behaviors.asList(), | ||
isHidden = isHidden, | ||
block = block | ||
) | ||
block.item = item | ||
NovaRegistries.ITEM[item.id] = item | ||
return item | ||
} | ||
|
||
fun registerUnnamedItem( | ||
name: String, | ||
isHidden: Boolean = false | ||
): NovaItem { | ||
val item = NovaItem( | ||
ResourceLocation(addon, name), | ||
Component.empty(), | ||
Style.empty(), | ||
emptyList(), | ||
isHidden = isHidden | ||
) | ||
NovaRegistries.ITEM[item.id] = item | ||
return item | ||
): NovaItem = item(block) { | ||
behaviors(*behaviors) | ||
localizedName?.let(::localizedName) | ||
hidden(isHidden) | ||
} | ||
|
||
fun registerUnnamedHiddenItem( | ||
name: String | ||
): NovaItem { | ||
val item = NovaItem( | ||
ResourceLocation(addon, name), | ||
Component.empty(), | ||
Style.empty(), | ||
emptyList(), | ||
isHidden = true | ||
) | ||
NovaRegistries.ITEM[item.id] = item | ||
return item | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.