mirror of
https://gitlab.bixilon.de/bixilon/minosoft.git
synced 2025-09-17 19:35:00 -04:00
forbid server to update local skin layers
This commit is contained in:
parent
aa9533712f
commit
789e8834e3
@ -14,6 +14,8 @@
|
|||||||
package de.bixilon.minosoft.config.profile.profiles.connection.skin
|
package de.bixilon.minosoft.config.profile.profiles.connection.skin
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonIgnore
|
import com.fasterxml.jackson.annotation.JsonIgnore
|
||||||
|
import de.bixilon.kutil.observer.DataObserver.Companion.observe
|
||||||
|
import de.bixilon.kutil.observer.set.SetObserver.Companion.observedSet
|
||||||
import de.bixilon.minosoft.config.profile.delegate.primitive.BooleanDelegate
|
import de.bixilon.minosoft.config.profile.delegate.primitive.BooleanDelegate
|
||||||
import de.bixilon.minosoft.config.profile.profiles.connection.ConnectionProfile
|
import de.bixilon.minosoft.config.profile.profiles.connection.ConnectionProfile
|
||||||
import de.bixilon.minosoft.data.entities.entities.player.SkinParts
|
import de.bixilon.minosoft.data.entities.entities.player.SkinParts
|
||||||
@ -62,30 +64,24 @@ class SkinC(profile: ConnectionProfile) {
|
|||||||
var hat by BooleanDelegate(profile, true)
|
var hat by BooleanDelegate(profile, true)
|
||||||
|
|
||||||
|
|
||||||
@get:JsonIgnore val skinParts: Array<SkinParts>
|
@get:JsonIgnore val parts: MutableSet<SkinParts> by observedSet(mutableSetOf())
|
||||||
get() {
|
|
||||||
val parts: MutableSet<SkinParts> = mutableSetOf()
|
private fun updateParts(part: SkinParts, add: Boolean) {
|
||||||
if (cape) {
|
if (add) {
|
||||||
parts += SkinParts.CAPE
|
parts += part
|
||||||
|
} else {
|
||||||
|
parts -= part
|
||||||
}
|
}
|
||||||
if (jacket) {
|
|
||||||
parts += SkinParts.JACKET
|
|
||||||
}
|
}
|
||||||
if (leftSleeve) {
|
|
||||||
parts += SkinParts.LEFT_SLEEVE
|
|
||||||
}
|
init {
|
||||||
if (rightSleeve) {
|
this::cape.observe(this, true) { updateParts(SkinParts.CAPE, it) }
|
||||||
parts += SkinParts.RIGHT_SLEEVE
|
this::jacket.observe(this, true) { updateParts(SkinParts.JACKET, it) }
|
||||||
}
|
this::leftSleeve.observe(this, true) { updateParts(SkinParts.LEFT_SLEEVE, it) }
|
||||||
if (leftPants) {
|
this::rightSleeve.observe(this, true) { updateParts(SkinParts.RIGHT_SLEEVE, it) }
|
||||||
parts += SkinParts.LEFT_PANTS
|
this::leftPants.observe(this, true) { updateParts(SkinParts.LEFT_PANTS, it) }
|
||||||
}
|
this::rightPants.observe(this, true) { updateParts(SkinParts.RIGHT_PANTS, it) }
|
||||||
if (rightPants) {
|
this::hat.observe(this, true) { updateParts(SkinParts.HAT, it) }
|
||||||
parts += SkinParts.RIGHT_PANTS
|
|
||||||
}
|
|
||||||
if (hat) {
|
|
||||||
parts += SkinParts.HAT
|
|
||||||
}
|
|
||||||
return parts.toTypedArray()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -82,13 +82,7 @@ abstract class PlayerEntity(
|
|||||||
val skinParts: MutableSet<SkinParts> by observedSet(mutableSetOf())
|
val skinParts: MutableSet<SkinParts> by observedSet(mutableSetOf())
|
||||||
|
|
||||||
|
|
||||||
init {
|
protected open fun updateSkinParts(flags: Int) {
|
||||||
data.observe(SKIN_PARTS_DATA) { raw: Any? ->
|
|
||||||
if (raw == null) {
|
|
||||||
skinParts.clear()
|
|
||||||
return@observe
|
|
||||||
}
|
|
||||||
val flags = raw.toInt()
|
|
||||||
for (part in SkinParts.VALUES) {
|
for (part in SkinParts.VALUES) {
|
||||||
if (!flags.isBitMask(part.bitmask)) {
|
if (!flags.isBitMask(part.bitmask)) {
|
||||||
skinParts -= part
|
skinParts -= part
|
||||||
@ -96,6 +90,9 @@ abstract class PlayerEntity(
|
|||||||
skinParts += part
|
skinParts += part
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
init {
|
||||||
|
data.observe(SKIN_PARTS_DATA) { raw: Any? -> updateSkinParts(raw?.toInt() ?: 0) }
|
||||||
}
|
}
|
||||||
|
|
||||||
@get:SynchronizedEntityData
|
@get:SynchronizedEntityData
|
||||||
|
@ -30,6 +30,7 @@ import de.bixilon.kutil.collections.map.bi.SynchronizedBiMap
|
|||||||
import de.bixilon.kutil.math.interpolation.DoubleInterpolation.interpolateLinear
|
import de.bixilon.kutil.math.interpolation.DoubleInterpolation.interpolateLinear
|
||||||
import de.bixilon.kutil.observer.DataObserver.Companion.observe
|
import de.bixilon.kutil.observer.DataObserver.Companion.observe
|
||||||
import de.bixilon.kutil.observer.DataObserver.Companion.observed
|
import de.bixilon.kutil.observer.DataObserver.Companion.observed
|
||||||
|
import de.bixilon.kutil.observer.set.SetObserver.Companion.observeSet
|
||||||
import de.bixilon.kutil.primitive.BooleanUtil.decide
|
import de.bixilon.kutil.primitive.BooleanUtil.decide
|
||||||
import de.bixilon.kutil.time.TimeUtil.millis
|
import de.bixilon.kutil.time.TimeUtil.millis
|
||||||
import de.bixilon.minosoft.data.Axes
|
import de.bixilon.minosoft.data.Axes
|
||||||
@ -105,6 +106,7 @@ class LocalPlayerEntity(
|
|||||||
equipment.remove(EquipmentSlots.MAIN_HAND)
|
equipment.remove(EquipmentSlots.MAIN_HAND)
|
||||||
equipment[EquipmentSlots.MAIN_HAND] = inventory.getHotbarSlot(it) ?: return@observe
|
equipment[EquipmentSlots.MAIN_HAND] = inventory.getHotbarSlot(it) ?: return@observe
|
||||||
}
|
}
|
||||||
|
connection.profiles.connection.skin::parts.observeSet(this, true) { skinParts += it.adds; skinParts -= it.removes }
|
||||||
}
|
}
|
||||||
|
|
||||||
var openedContainer: Container? = null
|
var openedContainer: Container? = null
|
||||||
@ -593,6 +595,9 @@ class LocalPlayerEntity(
|
|||||||
override val pushableByFluids: Boolean
|
override val pushableByFluids: Boolean
|
||||||
get() = !baseAbilities.isFlying
|
get() = !baseAbilities.isFlying
|
||||||
|
|
||||||
|
|
||||||
|
override fun updateSkinParts(flags: Int) = Unit
|
||||||
|
|
||||||
override fun tick() {
|
override fun tick() {
|
||||||
if (connection.world[positionInfo.blockPosition.chunkPosition] == null) {
|
if (connection.world[positionInfo.blockPosition.chunkPosition] == null) {
|
||||||
// chunk not loaded, so we don't tick?
|
// chunk not loaded, so we don't tick?
|
||||||
|
@ -56,6 +56,7 @@ class ArmOverlay(private val renderWindow: RenderWindow) : Overlay {
|
|||||||
private fun poll() {
|
private fun poll() {
|
||||||
val model = renderWindow.connection.player.model.nullCast<PlayerModel>()
|
val model = renderWindow.connection.player.model.nullCast<PlayerModel>()
|
||||||
val skin = model?.skin
|
val skin = model?.skin
|
||||||
|
// TODO: check skin parts
|
||||||
if (this.model == model && this.skin == skin) {
|
if (this.model == model && this.skin == skin) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -44,15 +44,6 @@ class ClientSettingsManager(
|
|||||||
profile::mainArm.observe(this) { sendClientSettings() }
|
profile::mainArm.observe(this) { sendClientSettings() }
|
||||||
profile::playerListing.observe(this) { sendClientSettings() }
|
profile::playerListing.observe(this) { sendClientSettings() }
|
||||||
|
|
||||||
val skin = profile.skin
|
|
||||||
skin::cape.observe(this) { sendClientSettings() }
|
|
||||||
skin::jacket.observe(this) { sendClientSettings() }
|
|
||||||
skin::leftSleeve.observe(this) { sendClientSettings() }
|
|
||||||
skin::rightSleeve.observe(this) { sendClientSettings() }
|
|
||||||
skin::leftPants.observe(this) { sendClientSettings() }
|
|
||||||
skin::rightPants.observe(this) { sendClientSettings() }
|
|
||||||
skin::hat.observe(this) { sendClientSettings() }
|
|
||||||
|
|
||||||
profile::language.observe(this) { sendLanguage() }
|
profile::language.observe(this) { sendLanguage() }
|
||||||
connection.profiles.eros.general::language.observe(this) { sendLanguage() }
|
connection.profiles.eros.general::language.observe(this) { sendLanguage() }
|
||||||
}
|
}
|
||||||
@ -72,15 +63,17 @@ class ClientSettingsManager(
|
|||||||
if (connection.network.state != ProtocolStates.PLAY) {
|
if (connection.network.state != ProtocolStates.PLAY) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
connection.sendPacket(SettingsC2SP(
|
connection.sendPacket(
|
||||||
|
SettingsC2SP(
|
||||||
locale = language,
|
locale = language,
|
||||||
chatColors = connection.profiles.gui.chat.chatColors,
|
chatColors = connection.profiles.gui.chat.chatColors,
|
||||||
viewDistance = connection.profiles.block.viewDistance,
|
viewDistance = connection.profiles.block.viewDistance,
|
||||||
chatMode = connection.profiles.gui.chat.chatMode,
|
chatMode = connection.profiles.gui.chat.chatMode,
|
||||||
skinParts = profile.skin.skinParts,
|
skinParts = profile.skin.parts.toTypedArray(),
|
||||||
mainArm = profile.mainArm,
|
mainArm = profile.mainArm,
|
||||||
disableTextFiltering = !connection.profiles.gui.chat.textFiltering,
|
disableTextFiltering = !connection.profiles.gui.chat.textFiltering,
|
||||||
allowListing = profile.playerListing,
|
allowListing = profile.playerListing,
|
||||||
))
|
)
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user