From bc64a13d9ce0edc6543df536a98f6d5517453045 Mon Sep 17 00:00:00 2001 From: xtex Date: Wed, 26 Jul 2023 21:07:52 +0800 Subject: [PATCH] style: use Quaedam#resource for resource locations --- .../src/main/kotlin/quaedam/projection/ProjectionEffect.kt | 5 +++-- .../main/kotlin/quaedam/projection/SimpleProjectionUpdate.kt | 3 +-- .../kotlin/quaedam/projection/swarm/ProjectedPersonShape.kt | 4 ++-- .../kotlin/quaedam/projection/swarm/ai/ProjectedPersonAI.kt | 4 ++-- common/src/main/kotlin/quaedam/shell/ProjectionShell.kt | 2 +- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/common/src/main/kotlin/quaedam/projection/ProjectionEffect.kt b/common/src/main/kotlin/quaedam/projection/ProjectionEffect.kt index ad3420c..34d621d 100644 --- a/common/src/main/kotlin/quaedam/projection/ProjectionEffect.kt +++ b/common/src/main/kotlin/quaedam/projection/ProjectionEffect.kt @@ -9,6 +9,7 @@ import net.minecraft.resources.ResourceLocation import net.minecraft.server.level.ServerLevel import net.minecraft.world.level.Level import net.minecraft.world.level.block.state.BlockState +import quaedam.Quaedam abstract class ProjectionEffect : Cloneable { @@ -37,11 +38,11 @@ data class ProjectionEffectType(val constructor: () -> T) companion object { val registryKey: ResourceKey>> = - ResourceKey.createRegistryKey(ResourceLocation("quaedam", "projection_effect")) + ResourceKey.createRegistryKey(Quaedam.resource("projection_effect")) val registry: Registry> = BuiltInRegistries.registerSimple(registryKey) { null } val nopEffect: ProjectionEffectType = - Registry.register(registry, ResourceLocation("quaedam", "nop"), ProjectionEffectType { NopEffect }) + Registry.register(registry, Quaedam.resource("nop"), ProjectionEffectType { NopEffect }) } diff --git a/common/src/main/kotlin/quaedam/projection/SimpleProjectionUpdate.kt b/common/src/main/kotlin/quaedam/projection/SimpleProjectionUpdate.kt index c6930d6..fa2cc59 100644 --- a/common/src/main/kotlin/quaedam/projection/SimpleProjectionUpdate.kt +++ b/common/src/main/kotlin/quaedam/projection/SimpleProjectionUpdate.kt @@ -7,14 +7,13 @@ import net.minecraft.core.BlockPos import net.minecraft.nbt.CompoundTag import net.minecraft.network.FriendlyByteBuf import net.minecraft.network.chat.Component -import net.minecraft.resources.ResourceLocation import net.minecraft.server.level.ServerPlayer import quaedam.Quaedam import quaedam.utils.sendBlockUpdated object SimpleProjectionUpdate { - val id = ResourceLocation("quaedam", "simple_projection_update") + val id = Quaedam.resource("simple_projection_update") init { NetworkManager.registerReceiver(NetworkManager.Side.C2S, id, ::handle) diff --git a/common/src/main/kotlin/quaedam/projection/swarm/ProjectedPersonShape.kt b/common/src/main/kotlin/quaedam/projection/swarm/ProjectedPersonShape.kt index 4e160dc..cc769e4 100644 --- a/common/src/main/kotlin/quaedam/projection/swarm/ProjectedPersonShape.kt +++ b/common/src/main/kotlin/quaedam/projection/swarm/ProjectedPersonShape.kt @@ -72,7 +72,7 @@ data class ProjectedPersonShape( object Names { - val id = ResourceLocation("quaedam", "projected-person-names") + val id = Quaedam.resource("projected-person-names") var names = emptySet() @@ -109,7 +109,7 @@ data class ProjectedPersonShape( object Skins { - val id = ResourceLocation("quaedam", "skins") + val id = Quaedam.resource("skins") var skins = emptyList() diff --git a/common/src/main/kotlin/quaedam/projection/swarm/ai/ProjectedPersonAI.kt b/common/src/main/kotlin/quaedam/projection/swarm/ai/ProjectedPersonAI.kt index 84e64aa..c0bd47e 100644 --- a/common/src/main/kotlin/quaedam/projection/swarm/ai/ProjectedPersonAI.kt +++ b/common/src/main/kotlin/quaedam/projection/swarm/ai/ProjectedPersonAI.kt @@ -24,8 +24,8 @@ import kotlin.jvm.optionals.getOrNull object ProjectedPersonAI { - val tagEnemy = TagKey.create(Registries.ENTITY_TYPE, ResourceLocation("quaedam", "projected_person/enemy")) - val tagNoAttack = TagKey.create(Registries.ENTITY_TYPE, ResourceLocation("quaedam", "projected_person/no_attack")) + val tagEnemy = TagKey.create(Registries.ENTITY_TYPE, Quaedam.resource("projected_person/enemy")) + val tagNoAttack = TagKey.create(Registries.ENTITY_TYPE, Quaedam.resource("projected_person/no_attack")) val defaultSchedule = Quaedam.schedules.register("projected_person_default") { ScheduleBuilder(Schedule()).changeActivityAt(10, Activity.IDLE) diff --git a/common/src/main/kotlin/quaedam/shell/ProjectionShell.kt b/common/src/main/kotlin/quaedam/shell/ProjectionShell.kt index 91f57de..0a228e1 100644 --- a/common/src/main/kotlin/quaedam/shell/ProjectionShell.kt +++ b/common/src/main/kotlin/quaedam/shell/ProjectionShell.kt @@ -14,7 +14,7 @@ object ProjectionShell { val item = Quaedam.items.register(ID) { ProjectionShellItem }!! - val channel = NetworkChannel.create(ResourceLocation("quaedam", ID)) + val channel = NetworkChannel.create(Quaedam.resource(ID)) init { ServerboundPSHLockAcquirePacket