-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
rewrite in kotlin and reorient entirely for temporary worlds
- Loading branch information
Showing
25 changed files
with
775 additions
and
837 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,16 @@ | ||
org.gradle.jvmargs=-Xmx2G | ||
org.gradle.parallel=true | ||
|
||
minecraft_version=1.20-rc1 | ||
yarn_build=2 | ||
minecraft_version=1.20.1 | ||
yarn_build=5 | ||
loader_version=0.14.21 | ||
|
||
version_id=0.1.2 | ||
mod_version=0.1.2 | ||
|
||
mod_id=bubble | ||
maven_group=dev.andante | ||
major_version=1.20 | ||
|
||
fabric_api_version=0.83.0+1.20 | ||
fabric_version=0.84.0+1.20.1 | ||
|
||
kotlin_version=1.8.22 | ||
fabric_kotlin_version=1.9.5+kotlin.1.8.22 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,60 @@ | ||
package dev.andante.bubble; | ||
|
||
import dev.andante.bubble.command.BubbleCommand; | ||
import dev.andante.bubble.world.VoidChunkGenerator; | ||
import net.fabricmc.api.ModInitializer; | ||
import net.fabricmc.fabric.api.command.v2.CommandRegistrationCallback; | ||
import net.fabricmc.fabric.api.event.lifecycle.v1.ServerLifecycleEvents; | ||
import net.fabricmc.fabric.api.event.lifecycle.v1.ServerTickEvents; | ||
import net.minecraft.registry.Registries; | ||
import net.minecraft.registry.Registry; | ||
import net.minecraft.registry.RegistryKey; | ||
import net.minecraft.registry.RegistryKeys; | ||
import net.minecraft.util.Identifier; | ||
import net.minecraft.world.dimension.DimensionType; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
|
||
public class Bubble implements ModInitializer { | ||
public static final String MOD_ID = "bubble"; | ||
public static final String MOD_NAME = "Bubble"; | ||
public static final Logger LOGGER = LoggerFactory.getLogger(MOD_ID); | ||
|
||
public static final RegistryKey<DimensionType> DEFAULT_DIMENSION_TYPE = RegistryKey.of(RegistryKeys.DIMENSION_TYPE, new Identifier(MOD_ID, "default")); | ||
|
||
@Override | ||
public void onInitialize() { | ||
LOGGER.info("Initializing {}", MOD_NAME); | ||
|
||
CommandRegistrationCallback.EVENT.register((dispatcher, registryAccess, environment) -> { | ||
BubbleCommand.register(dispatcher); | ||
}); | ||
|
||
Registry.register(Registries.CHUNK_GENERATOR, new Identifier(MOD_ID, "void"), VoidChunkGenerator.CODEC); | ||
|
||
ServerTickEvents.START_SERVER_TICK.register(BubbleManager::tick); | ||
ServerLifecycleEvents.SERVER_STOPPING.register(BubbleManager::onServerStopping); | ||
package dev.andante.bubble | ||
|
||
import com.mojang.brigadier.context.CommandContext | ||
import com.mojang.brigadier.suggestion.Suggestions | ||
import com.mojang.brigadier.suggestion.SuggestionsBuilder | ||
import dev.andante.bubble.command.BubbleCommand | ||
import dev.andante.bubble.world.BubbleWorld | ||
import dev.andante.bubble.world.property.VoidChunkGenerator | ||
import net.fabricmc.api.ModInitializer | ||
import net.fabricmc.fabric.api.command.v2.CommandRegistrationCallback | ||
import net.minecraft.command.CommandSource | ||
import net.minecraft.registry.Registries | ||
import net.minecraft.registry.Registry | ||
import net.minecraft.registry.RegistryKey | ||
import net.minecraft.registry.RegistryKeys | ||
import net.minecraft.server.command.ServerCommandSource | ||
import net.minecraft.util.Identifier | ||
import net.minecraft.world.dimension.DimensionType | ||
import org.slf4j.Logger | ||
import org.slf4j.LoggerFactory | ||
import java.util.concurrent.CompletableFuture | ||
|
||
/** | ||
* The Bubble entry point. | ||
*/ | ||
object Bubble : ModInitializer { | ||
const val MOD_ID = "bubble" | ||
const val MOD_NAME = "Bubble" | ||
|
||
val LOGGER: Logger = LoggerFactory.getLogger(MOD_ID) | ||
val DEFAULT_DIMENSION_TYPE: RegistryKey<DimensionType> = RegistryKey.of(RegistryKeys.DIMENSION_TYPE, Identifier(MOD_ID, "default")) | ||
|
||
override fun onInitialize() { | ||
LOGGER.info("Initializing $MOD_NAME") | ||
|
||
// chunk generator | ||
Registry.register(Registries.CHUNK_GENERATOR, Identifier(MOD_ID, "void"), VoidChunkGenerator.CODEC) | ||
|
||
// initialize | ||
BubbleManager | ||
|
||
// register commands | ||
CommandRegistrationCallback.EVENT.register { dispatcher, _, _ -> BubbleCommand.register(dispatcher) } | ||
} | ||
|
||
/** | ||
* Suggests bubble worlds to a command context. | ||
*/ | ||
fun suggestBubbleDimensions(context: CommandContext<ServerCommandSource>, builder: SuggestionsBuilder): CompletableFuture<Suggestions> { | ||
CommandSource.suggestIdentifiers( | ||
context.source.server.worlds | ||
.filterValues { it is BubbleWorld } | ||
.keys | ||
.map(RegistryKey<*>::getValue), | ||
builder | ||
) | ||
|
||
return builder.buildFuture() | ||
} | ||
} |
Oops, something went wrong.