null assert player
This commit is contained in:
parent
0c47de93c1
commit
564622e6fa
@ -72,7 +72,7 @@ abstract class BooleanRectangleButtonPanel<out S : Screen>(
|
|||||||
override var isDisabled: Boolean
|
override var isDisabled: Boolean
|
||||||
get() {
|
get() {
|
||||||
if (prop is IPlayerInputWithFeedback<Boolean>) {
|
if (prop is IPlayerInputWithFeedback<Boolean>) {
|
||||||
return !prop.test(minecraft.player)
|
return !prop.test(minecraft.player!!)
|
||||||
} else {
|
} else {
|
||||||
return super.isDisabled
|
return super.isDisabled
|
||||||
}
|
}
|
||||||
|
@ -60,7 +60,7 @@ private fun <S : MatteryScreen<*>> makeRedstoneSettingButton(
|
|||||||
prop = control,
|
prop = control,
|
||||||
) {
|
) {
|
||||||
override var isDisabled: Boolean
|
override var isDisabled: Boolean
|
||||||
get() = !control.test(minecraft.player)
|
get() = !control.test(minecraft.player!!)
|
||||||
set(value) {}
|
set(value) {}
|
||||||
|
|
||||||
init {
|
init {
|
||||||
@ -83,11 +83,11 @@ private class PullPushButton<out S : MatteryScreen<*>, T : Enum<T>>(
|
|||||||
val pushProp: BooleanInputWithFeedback
|
val pushProp: BooleanInputWithFeedback
|
||||||
) : LargeEnumRectangleButtonPanel<S, T>(screen, parent, x = x, y = y, enum = enum, prop = prop, defaultValue = defaultValue) {
|
) : LargeEnumRectangleButtonPanel<S, T>(screen, parent, x = x, y = y, enum = enum, prop = prop, defaultValue = defaultValue) {
|
||||||
init {
|
init {
|
||||||
if (pullProp.test(minecraft.player)) {
|
if (pullProp.test(minecraft.player!!)) {
|
||||||
tooltips.add(TranslatableComponent("otm.gui.sides.pull_help").withStyle(ChatFormatting.GRAY))
|
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))
|
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) {
|
override fun onClick(mouseButton: Int) {
|
||||||
if (mouseButton != InputConstants.MOUSE_BUTTON_MIDDLE && minecraft.window.isShiftDown) {
|
if (mouseButton != InputConstants.MOUSE_BUTTON_MIDDLE && minecraft.window.isShiftDown) {
|
||||||
if (pullProp.test(minecraft.player)) {
|
if (pullProp.test(minecraft.player!!)) {
|
||||||
pullProp.switchValue()
|
pullProp.switchValue()
|
||||||
}
|
}
|
||||||
} else if (mouseButton != InputConstants.MOUSE_BUTTON_MIDDLE && minecraft.window.isCtrlDown) {
|
} else if (mouseButton != InputConstants.MOUSE_BUTTON_MIDDLE && minecraft.window.isCtrlDown) {
|
||||||
if (pushProp.test(minecraft.player)) {
|
if (pushProp.test(minecraft.player!!)) {
|
||||||
pushProp.switchValue()
|
pushProp.switchValue()
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -15,6 +15,6 @@ open class CheckBoxInputPanel<out S : Screen>(
|
|||||||
height: Float = REGULAR_DIMENSIONS
|
height: Float = REGULAR_DIMENSIONS
|
||||||
) : CheckBoxPanel<S>(screen, parent, x, y, width, height, isChecked = widget) {
|
) : CheckBoxPanel<S>(screen, parent, x, y, width, height, isChecked = widget) {
|
||||||
override var isDisabled: Boolean
|
override var isDisabled: Boolean
|
||||||
get() = !widget.test(minecraft.player)
|
get() = !widget.test(minecraft.player!!)
|
||||||
set(value) {}
|
set(value) {}
|
||||||
}
|
}
|
||||||
|
@ -37,7 +37,7 @@ abstract class EnumRectangleButtonPanel<out S : Screen, T : Enum<T>>(
|
|||||||
override var isDisabled: Boolean
|
override var isDisabled: Boolean
|
||||||
get() {
|
get() {
|
||||||
if (prop is IPlayerInputWithFeedback<T>) {
|
if (prop is IPlayerInputWithFeedback<T>) {
|
||||||
return !prop.test(minecraft.player)
|
return !prop.test(minecraft.player!!)
|
||||||
} else {
|
} else {
|
||||||
return super.isDisabled
|
return super.isDisabled
|
||||||
}
|
}
|
||||||
|
@ -17,13 +17,13 @@ open class NetworkedStringInputPanel<out S : Screen>(
|
|||||||
height: Float = 11f,
|
height: Float = 11f,
|
||||||
) : TextInputPanel<S>(screen, parent, x, y, width, height) {
|
) : TextInputPanel<S>(screen, parent, x, y, width, height) {
|
||||||
override var isActive: Boolean
|
override var isActive: Boolean
|
||||||
get() = backend.test(minecraft.player)
|
get() = backend.test(minecraft.player!!)
|
||||||
set(value) {}
|
set(value) {}
|
||||||
|
|
||||||
override fun onFocusChanged() {
|
override fun onFocusChanged() {
|
||||||
super.onFocusChanged()
|
super.onFocusChanged()
|
||||||
|
|
||||||
if (isFocusedThis && !backend.test(minecraft.player)) {
|
if (isFocusedThis && !backend.test(minecraft.player!!)) {
|
||||||
killFocus()
|
killFocus()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user