mirror of
https://gitlab.bixilon.de/bixilon/minosoft.git
synced 2025-09-13 09:26:11 -04:00
don't render local hitbox
This commit is contained in:
parent
5ee928ac87
commit
3f3d34d100
@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Minosoft
|
* Minosoft
|
||||||
* Copyright (C) 2020-2022 Moritz Zwerger
|
* 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 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.
|
||||||
*
|
*
|
||||||
@ -22,11 +22,6 @@ class HitboxC(profile: EntityProfile) {
|
|||||||
*/
|
*/
|
||||||
var enabled by BooleanDelegate(profile, true)
|
var enabled by BooleanDelegate(profile, true)
|
||||||
|
|
||||||
/**
|
|
||||||
* Shows your own hit-box when in first person view
|
|
||||||
*/
|
|
||||||
var showLocal by BooleanDelegate(profile, false)
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Shows hit-boxes from invisible entities
|
* Shows hit-boxes from invisible entities
|
||||||
*/
|
*/
|
||||||
|
@ -36,6 +36,9 @@ import de.bixilon.minosoft.data.registries.item.items.dye.DyeableItem
|
|||||||
import de.bixilon.minosoft.data.registries.shapes.aabb.AABB
|
import de.bixilon.minosoft.data.registries.shapes.aabb.AABB
|
||||||
import de.bixilon.minosoft.data.text.formatting.color.ChatColors
|
import de.bixilon.minosoft.data.text.formatting.color.ChatColors
|
||||||
import de.bixilon.minosoft.data.text.formatting.color.RGBColor
|
import de.bixilon.minosoft.data.text.formatting.color.RGBColor
|
||||||
|
import de.bixilon.minosoft.gui.rendering.entities.EntitiesRenderer
|
||||||
|
import de.bixilon.minosoft.gui.rendering.entities.renderer.EntityRenderer
|
||||||
|
import de.bixilon.minosoft.gui.rendering.entities.renderer.player.PlayerRenderer
|
||||||
import de.bixilon.minosoft.gui.rendering.util.vec.vec3.Vec3dUtil.EMPTY
|
import de.bixilon.minosoft.gui.rendering.util.vec.vec3.Vec3dUtil.EMPTY
|
||||||
import de.bixilon.minosoft.physics.entities.living.player.PlayerPhysics
|
import de.bixilon.minosoft.physics.entities.living.player.PlayerPhysics
|
||||||
import de.bixilon.minosoft.protocol.network.connection.play.PlayConnection
|
import de.bixilon.minosoft.protocol.network.connection.play.PlayConnection
|
||||||
@ -136,7 +139,7 @@ abstract class PlayerEntity(
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun createPhysics(): PlayerPhysics<*> = PlayerPhysics(this)
|
override fun createPhysics(): PlayerPhysics<*> = PlayerPhysics(this)
|
||||||
|
override fun createRenderer(renderer: EntitiesRenderer): EntityRenderer<*> = PlayerRenderer(renderer, this)
|
||||||
|
|
||||||
fun swingHand(hand: Hands) {
|
fun swingHand(hand: Hands) {
|
||||||
val arm = hand.getArm(mainArm)
|
val arm = hand.getArm(mainArm)
|
||||||
|
@ -27,6 +27,9 @@ import de.bixilon.minosoft.data.entities.entities.player.PlayerEntity
|
|||||||
import de.bixilon.minosoft.data.entities.entities.player.additional.PlayerAdditional
|
import de.bixilon.minosoft.data.entities.entities.player.additional.PlayerAdditional
|
||||||
import de.bixilon.minosoft.data.entities.entities.player.compass.CompassPosition
|
import de.bixilon.minosoft.data.entities.entities.player.compass.CompassPosition
|
||||||
import de.bixilon.minosoft.data.registries.effects.attributes.integrated.IntegratedAttributeModifiers
|
import de.bixilon.minosoft.data.registries.effects.attributes.integrated.IntegratedAttributeModifiers
|
||||||
|
import de.bixilon.minosoft.gui.rendering.entities.EntitiesRenderer
|
||||||
|
import de.bixilon.minosoft.gui.rendering.entities.renderer.EntityRenderer
|
||||||
|
import de.bixilon.minosoft.gui.rendering.entities.renderer.player.LocalPlayerRenderer
|
||||||
import de.bixilon.minosoft.gui.rendering.util.vec.vec3.Vec3dUtil.EMPTY
|
import de.bixilon.minosoft.gui.rendering.util.vec.vec3.Vec3dUtil.EMPTY
|
||||||
import de.bixilon.minosoft.input.camera.MovementInputActions
|
import de.bixilon.minosoft.input.camera.MovementInputActions
|
||||||
import de.bixilon.minosoft.input.camera.PlayerMovementInput
|
import de.bixilon.minosoft.input.camera.PlayerMovementInput
|
||||||
@ -109,4 +112,6 @@ class LocalPlayerEntity(
|
|||||||
|
|
||||||
override fun createPhysics() = LocalPlayerPhysics(this)
|
override fun createPhysics() = LocalPlayerPhysics(this)
|
||||||
override fun physics(): LocalPlayerPhysics = super.physics().unsafeCast()
|
override fun physics(): LocalPlayerPhysics = super.physics().unsafeCast()
|
||||||
|
|
||||||
|
override fun createRenderer(renderer: EntitiesRenderer): EntityRenderer<*> = LocalPlayerRenderer(renderer, this)
|
||||||
}
|
}
|
||||||
|
@ -24,6 +24,11 @@ class FeatureManager(val renderer: EntityRenderer<*>) : Iterable<EntityRenderFea
|
|||||||
this.features += feature
|
this.features += feature
|
||||||
}
|
}
|
||||||
|
|
||||||
|
operator fun minusAssign(feature: EntityRenderFeature) = remove(feature)
|
||||||
|
fun remove(feature: EntityRenderFeature) {
|
||||||
|
this.features -= feature
|
||||||
|
}
|
||||||
|
|
||||||
fun update(millis: Long) {
|
fun update(millis: Long) {
|
||||||
for (feature in features) {
|
for (feature in features) {
|
||||||
feature.update(millis)
|
feature.update(millis)
|
||||||
|
@ -43,6 +43,7 @@ class HitboxFeature(renderer: EntityRenderer<*>) : EntityRenderFeature(renderer)
|
|||||||
|
|
||||||
override fun update(millis: Long) {
|
override fun update(millis: Long) {
|
||||||
if (!manager.enabled) return unload()
|
if (!manager.enabled) return unload()
|
||||||
|
if (!enabled) return unload()
|
||||||
|
|
||||||
val offset = renderer.renderer.context.camera.offset.offset
|
val offset = renderer.renderer.context.camera.offset.offset
|
||||||
|
|
||||||
|
@ -37,8 +37,7 @@ class HitboxManager(private val renderer: EntitiesRenderer) {
|
|||||||
renderer.context.input.bindings.register(TOGGLE, KeyBinding(
|
renderer.context.input.bindings.register(TOGGLE, KeyBinding(
|
||||||
KeyActions.MODIFIER to setOf(KeyCodes.KEY_F3),
|
KeyActions.MODIFIER to setOf(KeyCodes.KEY_F3),
|
||||||
KeyActions.STICKY to setOf(KeyCodes.KEY_B),
|
KeyActions.STICKY to setOf(KeyCodes.KEY_B),
|
||||||
), pressed = enabled
|
), pressed = enabled) {
|
||||||
) {
|
|
||||||
profile.enabled = it
|
profile.enabled = it
|
||||||
renderer.connection.util.sendDebugMessage("Entity hit boxes: ${it.format()}")
|
renderer.connection.util.sendDebugMessage("Entity hit boxes: ${it.format()}")
|
||||||
enabled = it
|
enabled = it
|
||||||
|
@ -22,7 +22,7 @@ import de.bixilon.minosoft.gui.rendering.entities.visibility.EntityVisibility
|
|||||||
|
|
||||||
abstract class EntityRenderer<E : Entity>(
|
abstract class EntityRenderer<E : Entity>(
|
||||||
val renderer: EntitiesRenderer,
|
val renderer: EntitiesRenderer,
|
||||||
val entity: Entity,
|
val entity: E,
|
||||||
) {
|
) {
|
||||||
val features = FeatureManager(this)
|
val features = FeatureManager(this)
|
||||||
val visibility = EntityVisibility(this)
|
val visibility = EntityVisibility(this)
|
||||||
|
@ -0,0 +1,25 @@
|
|||||||
|
/*
|
||||||
|
* 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.renderer.player
|
||||||
|
|
||||||
|
import de.bixilon.kutil.observer.DataObserver.Companion.observe
|
||||||
|
import de.bixilon.minosoft.data.entities.entities.player.local.LocalPlayerEntity
|
||||||
|
import de.bixilon.minosoft.gui.rendering.entities.EntitiesRenderer
|
||||||
|
|
||||||
|
open class LocalPlayerRenderer(renderer: EntitiesRenderer, entity: LocalPlayerEntity) : PlayerRenderer<LocalPlayerEntity>(renderer, entity) {
|
||||||
|
|
||||||
|
init {
|
||||||
|
renderer.context.camera.view::view.observe(this, instant = true) { hitbox.enabled = it.renderSelf }
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,20 @@
|
|||||||
|
/*
|
||||||
|
* 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.renderer.player
|
||||||
|
|
||||||
|
import de.bixilon.minosoft.data.entities.entities.player.PlayerEntity
|
||||||
|
import de.bixilon.minosoft.gui.rendering.entities.EntitiesRenderer
|
||||||
|
import de.bixilon.minosoft.gui.rendering.entities.renderer.EntityRenderer
|
||||||
|
|
||||||
|
open class PlayerRenderer<E : PlayerEntity>(renderer: EntitiesRenderer, entity: E) : EntityRenderer<E>(renderer, entity)
|
Loading…
x
Reference in New Issue
Block a user