null assert player

This commit is contained in:
DBotThePony 2024-08-12 22:23:58 +07:00
parent 0c47de93c1
commit 564622e6fa
Signed by: DBot
GPG Key ID: DCC23B5715498507
5 changed files with 10 additions and 10 deletions

View File

@ -72,7 +72,7 @@ abstract class BooleanRectangleButtonPanel<out S : Screen>(
override var isDisabled: Boolean
get() {
if (prop is IPlayerInputWithFeedback<Boolean>) {
return !prop.test(minecraft.player)
return !prop.test(minecraft.player!!)
} else {
return super.isDisabled
}

View File

@ -60,7 +60,7 @@ private fun <S : MatteryScreen<*>> makeRedstoneSettingButton(
prop = control,
) {
override var isDisabled: Boolean
get() = !control.test(minecraft.player)
get() = !control.test(minecraft.player!!)
set(value) {}
init {
@ -83,11 +83,11 @@ private class PullPushButton<out S : MatteryScreen<*>, T : Enum<T>>(
val pushProp: BooleanInputWithFeedback
) : LargeEnumRectangleButtonPanel<S, T>(screen, parent, x = x, y = y, enum = enum, prop = prop, defaultValue = defaultValue) {
init {
if (pullProp.test(minecraft.player)) {
if (pullProp.test(minecraft.player!!)) {
tooltips.add(TranslatableComponent("otm.gui.sides.pull_help").withStyle(ChatFormatting.GRAY))
}
if (pushProp.test(minecraft.player)) {
if (pushProp.test(minecraft.player!!)) {
tooltips.add(TranslatableComponent("otm.gui.sides.push_help").withStyle(ChatFormatting.GRAY))
}
}
@ -106,11 +106,11 @@ private class PullPushButton<out S : MatteryScreen<*>, T : Enum<T>>(
override fun onClick(mouseButton: Int) {
if (mouseButton != InputConstants.MOUSE_BUTTON_MIDDLE && minecraft.window.isShiftDown) {
if (pullProp.test(minecraft.player)) {
if (pullProp.test(minecraft.player!!)) {
pullProp.switchValue()
}
} else if (mouseButton != InputConstants.MOUSE_BUTTON_MIDDLE && minecraft.window.isCtrlDown) {
if (pushProp.test(minecraft.player)) {
if (pushProp.test(minecraft.player!!)) {
pushProp.switchValue()
}
} else {

View File

@ -15,6 +15,6 @@ open class CheckBoxInputPanel<out S : Screen>(
height: Float = REGULAR_DIMENSIONS
) : CheckBoxPanel<S>(screen, parent, x, y, width, height, isChecked = widget) {
override var isDisabled: Boolean
get() = !widget.test(minecraft.player)
get() = !widget.test(minecraft.player!!)
set(value) {}
}

View File

@ -37,7 +37,7 @@ abstract class EnumRectangleButtonPanel<out S : Screen, T : Enum<T>>(
override var isDisabled: Boolean
get() {
if (prop is IPlayerInputWithFeedback<T>) {
return !prop.test(minecraft.player)
return !prop.test(minecraft.player!!)
} else {
return super.isDisabled
}

View File

@ -17,13 +17,13 @@ open class NetworkedStringInputPanel<out S : Screen>(
height: Float = 11f,
) : TextInputPanel<S>(screen, parent, x, y, width, height) {
override var isActive: Boolean
get() = backend.test(minecraft.player)
get() = backend.test(minecraft.player!!)
set(value) {}
override fun onFocusChanged() {
super.onFocusChanged()
if (isFocusedThis && !backend.test(minecraft.player)) {
if (isFocusedThis && !backend.test(minecraft.player!!)) {
killFocus()
}
}