aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/moe/nea/firmament/gui/entity
diff options
context:
space:
mode:
authorLinnea Gräf <nea@nea.moe>2024-04-26 18:04:45 +0200
committerLinnea Gräf <nea@nea.moe>2024-04-26 18:15:54 +0200
commit7e0151569477df63601be50c82177ecfd21e5deb (patch)
treef30e5440a1855de92d2b424ef79339d3d6cf5f34 /src/main/kotlin/moe/nea/firmament/gui/entity
parent041da7c7d179df01c4048a81ddf40a9f13c3ce77 (diff)
downloadfirmament-7e0151569477df63601be50c82177ecfd21e5deb.tar.gz
firmament-7e0151569477df63601be50c82177ecfd21e5deb.tar.bz2
firmament-7e0151569477df63601be50c82177ecfd21e5deb.zip
Bump to 1.20.5
Diffstat (limited to 'src/main/kotlin/moe/nea/firmament/gui/entity')
-rw-r--r--src/main/kotlin/moe/nea/firmament/gui/entity/EntityRenderer.kt4
-rw-r--r--src/main/kotlin/moe/nea/firmament/gui/entity/FakeWorld.kt70
-rw-r--r--src/main/kotlin/moe/nea/firmament/gui/entity/ModifyEquipment.kt7
3 files changed, 40 insertions, 41 deletions
diff --git a/src/main/kotlin/moe/nea/firmament/gui/entity/EntityRenderer.kt b/src/main/kotlin/moe/nea/firmament/gui/entity/EntityRenderer.kt
index 65b5d7d..44fd538 100644
--- a/src/main/kotlin/moe/nea/firmament/gui/entity/EntityRenderer.kt
+++ b/src/main/kotlin/moe/nea/firmament/gui/entity/EntityRenderer.kt
@@ -136,7 +136,7 @@ object EntityRenderer {
posY,
posX + 50,
posY + 80,
- (minOf(2F / maxSize, 1F) * 30).toInt(),
+ minOf(2F / maxSize, 1F) * 30,
-bottomOffset,
mouseX,
mouseY,
@@ -155,7 +155,7 @@ object EntityRenderer {
y1: Int,
x2: Int,
y2: Int,
- size: Int,
+ size: Float,
bottomOffset: Float,
mouseX: Float,
mouseY: Float,
diff --git a/src/main/kotlin/moe/nea/firmament/gui/entity/FakeWorld.kt b/src/main/kotlin/moe/nea/firmament/gui/entity/FakeWorld.kt
index 4cdfc45..ac1b33b 100644
--- a/src/main/kotlin/moe/nea/firmament/gui/entity/FakeWorld.kt
+++ b/src/main/kotlin/moe/nea/firmament/gui/entity/FakeWorld.kt
@@ -16,11 +16,13 @@ import kotlin.jvm.optionals.getOrNull
import kotlin.streams.asSequence
import net.minecraft.block.Block
import net.minecraft.block.BlockState
-import net.minecraft.client.world.ClientWorld
+import net.minecraft.component.type.MapIdComponent
import net.minecraft.entity.Entity
import net.minecraft.entity.player.PlayerEntity
import net.minecraft.fluid.Fluid
import net.minecraft.item.map.MapState
+import net.minecraft.recipe.BrewingRecipeRegistry
+import net.minecraft.recipe.Ingredient
import net.minecraft.recipe.RecipeManager
import net.minecraft.registry.BuiltinRegistries
import net.minecraft.registry.DynamicRegistryManager
@@ -29,10 +31,10 @@ import net.minecraft.registry.RegistryKey
import net.minecraft.registry.RegistryKeys
import net.minecraft.registry.RegistryWrapper
import net.minecraft.registry.entry.RegistryEntry
+import net.minecraft.registry.entry.RegistryEntryInfo
import net.minecraft.registry.entry.RegistryEntryList
import net.minecraft.registry.entry.RegistryEntryOwner
import net.minecraft.registry.tag.TagKey
-import net.minecraft.resource.featuretoggle.FeatureFlag
import net.minecraft.resource.featuretoggle.FeatureFlags
import net.minecraft.resource.featuretoggle.FeatureSet
import net.minecraft.scoreboard.Scoreboard
@@ -119,6 +121,10 @@ fun <T> makeRegistry(registryWrapper: RegistryWrapper.Impl<T>, key: RegistryKey<
return key
}
+ override fun getEntryInfo(key: RegistryKey<T>?): Optional<RegistryEntryInfo> {
+ TODO("Not yet implemented")
+ }
+
override fun getLifecycle(): Lifecycle {
return Lifecycle.stable()
}
@@ -194,18 +200,18 @@ fun <T> makeRegistry(registryWrapper: RegistryWrapper.Impl<T>, key: RegistryKey<
return registryWrapper.getOptional(key ?: return Optional.empty())
}
+ override fun getEntry(id: Identifier?): Optional<RegistryEntry.Reference<T>> {
+ TODO("Not yet implemented")
+ }
+
override fun createEntry(value: T): RegistryEntry.Reference<T> {
- TODO()
+ TODO("Not yet implemented")
}
override fun contains(key: RegistryKey<T>?): Boolean {
return getEntry(key).isPresent
}
- override fun getEntryLifecycle(entry: T): Lifecycle {
- return Lifecycle.stable()
- }
-
override fun getId(value: T): Identifier? {
return (inverseLookup[value] ?: return null).value
}
@@ -236,7 +242,9 @@ fun createDynamicRegistry(): DynamicRegistryManager.Immutable {
}
}
-class FakeWorld(registries: DynamicRegistryManager.Immutable = createDynamicRegistry()) : World(
+class FakeWorld(
+ registries: DynamicRegistryManager.Immutable = createDynamicRegistry(),
+) : World(
Properties,
RegistryKey.of(RegistryKeys.WORLD, Identifier.of("firmament", "fakeworld")),
registries,
@@ -252,16 +260,8 @@ class FakeWorld(registries: DynamicRegistryManager.Immutable = createDynamicRegi
0, 0
) {
object Properties : MutableWorldProperties {
- override fun getSpawnX(): Int {
- return 0
- }
-
- override fun getSpawnY(): Int {
- return 0
- }
-
- override fun getSpawnZ(): Int {
- return 0
+ override fun getSpawnPos(): BlockPos {
+ return BlockPos.ORIGIN
}
override fun getSpawnAngle(): Float {
@@ -303,17 +303,7 @@ class FakeWorld(registries: DynamicRegistryManager.Immutable = createDynamicRegi
return false
}
- override fun setSpawnX(spawnX: Int) {
- }
-
- override fun setSpawnY(spawnY: Int) {
- }
-
- override fun setSpawnZ(spawnZ: Int) {
- }
-
- override fun setSpawnAngle(spawnAngle: Float) {
- }
+ override fun setSpawnPos(pos: BlockPos?, angle: Float) {}
}
override fun getPlayers(): List<PlayerEntity> {
@@ -361,7 +351,11 @@ class FakeWorld(registries: DynamicRegistryManager.Immutable = createDynamicRegi
class FakeChunkManager(val world: FakeWorld) : ChunkManager() {
override fun getChunk(x: Int, z: Int, leastStatus: ChunkStatus?, create: Boolean): Chunk {
- return EmptyChunk(world, ChunkPos(x,z), world.registryManager.get(RegistryKeys.BIOME).entryOf(BiomeKeys.PLAINS))
+ return EmptyChunk(
+ world,
+ ChunkPos(x, z),
+ world.registryManager.get(RegistryKeys.BIOME).entryOf(BiomeKeys.PLAINS)
+ )
}
override fun getWorld(): BlockView {
@@ -406,7 +400,7 @@ class FakeWorld(registries: DynamicRegistryManager.Immutable = createDynamicRegi
override fun syncWorldEvent(player: PlayerEntity?, eventId: Int, pos: BlockPos?, data: Int) {
}
- override fun emitGameEvent(event: GameEvent?, emitterPos: Vec3d?, emitter: GameEvent.Emitter?) {
+ override fun emitGameEvent(event: RegistryEntry<GameEvent>?, emitterPos: Vec3d?, emitter: GameEvent.Emitter?) {
}
override fun updateListeners(pos: BlockPos?, oldState: BlockState?, newState: BlockState?, flags: Int) {
@@ -435,15 +429,15 @@ class FakeWorld(registries: DynamicRegistryManager.Immutable = createDynamicRegi
return TickManager()
}
- override fun getMapState(id: String?): MapState? {
+ override fun getMapState(id: MapIdComponent?): MapState? {
return null
}
- override fun putMapState(id: String?, state: MapState?) {
+ override fun putMapState(id: MapIdComponent?, state: MapState?) {
}
- override fun getNextMapId(): Int {
- return 0
+ override fun getNextMapId(): MapIdComponent {
+ return MapIdComponent(0)
}
override fun setBlockBreakingInfo(entityId: Int, pos: BlockPos?, progress: Int) {
@@ -454,7 +448,7 @@ class FakeWorld(registries: DynamicRegistryManager.Immutable = createDynamicRegi
}
override fun getRecipeManager(): RecipeManager {
- return RecipeManager()
+ return RecipeManager(registryManager)
}
object FakeEntityLookup : EntityLookup<Entity> {
@@ -488,4 +482,8 @@ class FakeWorld(registries: DynamicRegistryManager.Immutable = createDynamicRegi
override fun getEntityLookup(): EntityLookup<Entity> {
return FakeEntityLookup
}
+
+ override fun getBrewingRecipeRegistry(): BrewingRecipeRegistry {
+ return BrewingRecipeRegistry.EMPTY
+ }
}
diff --git a/src/main/kotlin/moe/nea/firmament/gui/entity/ModifyEquipment.kt b/src/main/kotlin/moe/nea/firmament/gui/entity/ModifyEquipment.kt
index e438f59..261b8f5 100644
--- a/src/main/kotlin/moe/nea/firmament/gui/entity/ModifyEquipment.kt
+++ b/src/main/kotlin/moe/nea/firmament/gui/entity/ModifyEquipment.kt
@@ -7,9 +7,11 @@
package moe.nea.firmament.gui.entity
import com.google.gson.JsonObject
+import net.minecraft.component.DataComponentTypes
+import net.minecraft.component.type.DyedColorComponent
import net.minecraft.entity.EquipmentSlot
import net.minecraft.entity.LivingEntity
-import net.minecraft.item.DyeableArmorItem
+import net.minecraft.item.ArmorItem
import net.minecraft.item.Item
import net.minecraft.item.ItemStack
import net.minecraft.item.Items
@@ -51,9 +53,8 @@ object ModifyEquipment : EntityModifier {
}
private fun coloredLeatherArmor(leatherArmor: Item, data: String): ItemStack {
- require(leatherArmor is DyeableArmorItem)
val stack = ItemStack(leatherArmor)
- leatherArmor.setColor(stack, data.toInt(16))
+ stack.set(DataComponentTypes.DYED_COLOR, DyedColorComponent(data.toInt(16), false))
return stack
}
}