fix: dedicated server loading
This commit is contained in:
parent
27f64d17a3
commit
7e3611bc9e
@ -1,7 +1,9 @@
|
|||||||
package quaedam.projection.swarm
|
package quaedam.projection.swarm
|
||||||
|
|
||||||
|
import dev.architectury.platform.Platform
|
||||||
import dev.architectury.registry.client.level.entity.EntityRendererRegistry
|
import dev.architectury.registry.client.level.entity.EntityRendererRegistry
|
||||||
import dev.architectury.registry.level.entity.EntityAttributeRegistry
|
import dev.architectury.registry.level.entity.EntityAttributeRegistry
|
||||||
|
import net.fabricmc.api.EnvType
|
||||||
import net.minecraft.nbt.CompoundTag
|
import net.minecraft.nbt.CompoundTag
|
||||||
import net.minecraft.network.syncher.EntityDataAccessor
|
import net.minecraft.network.syncher.EntityDataAccessor
|
||||||
import net.minecraft.network.syncher.EntityDataSerializers
|
import net.minecraft.network.syncher.EntityDataSerializers
|
||||||
@ -40,7 +42,9 @@ class ProjectedPersonEntity(entityType: EntityType<out PathfinderMob>, level: Le
|
|||||||
|
|
||||||
init {
|
init {
|
||||||
EntityAttributeRegistry.register(entity, ::createAttributes)
|
EntityAttributeRegistry.register(entity, ::createAttributes)
|
||||||
EntityRendererRegistry.register(entity, ::ProjectedPersonRenderer)
|
if(Platform.getEnv() == EnvType.CLIENT) {
|
||||||
|
EntityRendererRegistry.register(entity, ::ProjectedPersonRenderer)
|
||||||
|
}
|
||||||
ProjectedPersonShape
|
ProjectedPersonShape
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
package quaedam.projection.swarm
|
package quaedam.projection.swarm
|
||||||
|
|
||||||
import dev.architectury.registry.ReloadListenerRegistry
|
import dev.architectury.registry.ReloadListenerRegistry
|
||||||
|
import net.fabricmc.api.EnvType
|
||||||
|
import net.fabricmc.api.Environment
|
||||||
import net.minecraft.nbt.CompoundTag
|
import net.minecraft.nbt.CompoundTag
|
||||||
import net.minecraft.resources.ResourceLocation
|
import net.minecraft.resources.ResourceLocation
|
||||||
import net.minecraft.server.packs.PackType
|
import net.minecraft.server.packs.PackType
|
||||||
@ -40,9 +42,9 @@ data class ProjectedPersonShape(
|
|||||||
fun create(seed: Long) = create(Random(seed))
|
fun create(seed: Long) = create(Random(seed))
|
||||||
|
|
||||||
fun create(rand: Random) = ProjectedPersonShape(
|
fun create(rand: Random) = ProjectedPersonShape(
|
||||||
scaleX = rand.nextInt(0..6) * 0.1f + 0.7f,
|
scaleX = rand.nextInt(0..6 * 4) * 0.025f + 0.7f,
|
||||||
scaleY = rand.nextInt(0..6) * 0.1f + 0.7f,
|
scaleY = rand.nextInt(0..6 * 4) * 0.025f + 0.7f,
|
||||||
scaleZ = rand.nextInt(0..2) * 0.1f + 0.9f,
|
scaleZ = rand.nextInt(0..2 * 4) * 0.025f + 0.9f,
|
||||||
name = Names.random(rand),
|
name = Names.random(rand),
|
||||||
skin = Skins.random(rand),
|
skin = Skins.random(rand),
|
||||||
)
|
)
|
||||||
@ -69,6 +71,7 @@ data class ProjectedPersonShape(
|
|||||||
|
|
||||||
val id = ResourceLocation("quaedam", "projected-person-names")
|
val id = ResourceLocation("quaedam", "projected-person-names")
|
||||||
|
|
||||||
|
@Environment(EnvType.SERVER)
|
||||||
var names = emptySet<String>()
|
var names = emptySet<String>()
|
||||||
|
|
||||||
init {
|
init {
|
||||||
@ -106,7 +109,7 @@ data class ProjectedPersonShape(
|
|||||||
|
|
||||||
val id = ResourceLocation("quaedam", "skins")
|
val id = ResourceLocation("quaedam", "skins")
|
||||||
|
|
||||||
// only available on client
|
@Environment(EnvType.CLIENT)
|
||||||
var skins = emptyList<ResourceLocation>()
|
var skins = emptyList<ResourceLocation>()
|
||||||
|
|
||||||
init {
|
init {
|
||||||
|
Loading…
Reference in New Issue
Block a user