entity easter egg: flipped

This commit is contained in:
Moritz Zwerger 2023-10-30 17:29:35 +01:00
parent 7d7207bfb2
commit 9e0b9d47fb
No known key found for this signature in database
GPG Key ID: 5CAD791931B09AC4
2 changed files with 39 additions and 0 deletions

View File

@ -0,0 +1,33 @@
/*
* Minosoft
* Copyright (C) 2020-2023 Moritz Zwerger
*
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
*
* This software is not affiliated with Mojang AB, the original developer of Minecraft.
*/
package de.bixilon.minosoft.gui.rendering.entities.easteregg
import de.bixilon.minosoft.data.entities.entities.Entity
import de.bixilon.minosoft.data.entities.entities.player.PlayerEntity
import de.bixilon.minosoft.data.entities.entities.player.SkinParts
object EntityEasterEggs {
private val FLIPPED = setOf("Dinnerbone", "Grumm")
fun Entity.isFlipped(): Boolean {
var name = this.customName?.message
if (name == null && this is PlayerEntity) {
name = additional.name
}
if (name == null) return false
if (name !in FLIPPED) return false
if (this is PlayerEntity) return SkinParts.CAPE in this.skinParts
return true
}
}

View File

@ -19,10 +19,12 @@ import de.bixilon.minosoft.data.entities.entities.Entity
import de.bixilon.minosoft.data.text.formatting.color.ChatColors
import de.bixilon.minosoft.data.text.formatting.color.ColorUtil
import de.bixilon.minosoft.gui.rendering.entities.EntitiesRenderer
import de.bixilon.minosoft.gui.rendering.entities.easteregg.EntityEasterEggs.isFlipped
import de.bixilon.minosoft.gui.rendering.entities.feature.EntityRenderFeature
import de.bixilon.minosoft.gui.rendering.entities.feature.FeatureManager
import de.bixilon.minosoft.gui.rendering.entities.hitbox.HitboxFeature
import de.bixilon.minosoft.gui.rendering.util.mat.mat4.Mat4Util.reset
import de.bixilon.minosoft.gui.rendering.util.mat.mat4.Mat4Util.rotateDegreesAssign
import de.bixilon.minosoft.util.interpolate.Interpolator
abstract class EntityRenderer<E : Entity>(
@ -48,6 +50,10 @@ abstract class EntityRenderer<E : Entity>(
val position = Vec3(entity.renderInfo.position - renderer.context.camera.offset.offset)
matrix.reset()
matrix.translateAssign(position)
if (entity.isFlipped()) {
matrix.rotateDegreesAssign(Vec3(180.0f, 0.0f, 0.0f)) // TODO: verify
}
}
open fun update(millis: Long) {