-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
workaround for incompatibility with REI which made tootips render und…
…er RAI UI.
- Loading branch information
Showing
14 changed files
with
162 additions
and
129 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
shared-sources/src/main/java/org/anti_ad/mc/ipnext/gui/inject/base/CheckBoxWidget.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package org.anti_ad.mc.ipnext.gui.inject.base | ||
|
||
import org.anti_ad.mc.ipnext.config.ModSettings | ||
|
||
class CheckBoxWidget : SortButtonWidget { | ||
constructor(clickEvent: (button: Int) -> Unit) : super(clickEvent) | ||
constructor(clickEvent: () -> Unit) : super(clickEvent) | ||
constructor() : super() | ||
|
||
var highlightTx = 0 | ||
var highlightTy = 0 | ||
var highlightTooltip: String = "" | ||
|
||
override fun render(mouseX: Int, | ||
mouseY: Int, | ||
partialTicks: Float) { | ||
val oldTx = tx | ||
val oldTy = ty | ||
val oldTooltipText = tooltipText | ||
if (ModSettings.INCLUDE_HOTBAR_MODIFIER.isPressing()) { | ||
tx = highlightTx | ||
ty = highlightTy | ||
tooltipText = highlightTooltip | ||
} | ||
super.render(mouseX, | ||
mouseY, | ||
partialTicks) | ||
tx = oldTx | ||
ty = oldTy | ||
tooltipText = oldTooltipText | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
shared-sources/src/main/java/org/anti_ad/mc/ipnext/gui/inject/base/InsertableWidget.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package org.anti_ad.mc.ipnext.gui.inject.base | ||
|
||
import org.anti_ad.mc.common.gui.widgets.Widget | ||
import org.anti_ad.mc.common.vanilla.alias.ContainerScreen | ||
|
||
abstract class InsertableWidget: Widget() { | ||
|
||
abstract fun postBackgroundRender(mouseX: Int, | ||
mouseY: Int, | ||
partialTicks: Float); | ||
|
||
abstract val screen: ContainerScreen<*> | ||
|
||
} |
13 changes: 13 additions & 0 deletions
13
shared-sources/src/main/java/org/anti_ad/mc/ipnext/gui/inject/base/ProfileButtonWidget.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package org.anti_ad.mc.ipnext.gui.inject.base | ||
|
||
open class ProfileButtonWidget: SortButtonWidget { | ||
constructor(clickEvent: (button: Int) -> Unit) : super(clickEvent) | ||
constructor(clickEvent: () -> Unit) : super(clickEvent) | ||
constructor() : super() | ||
|
||
override fun mouseClicked(x: Int, | ||
y: Int, | ||
button: Int): Boolean { | ||
return super.mouseClicked(x,y,button) && visible | ||
} | ||
} |
48 changes: 48 additions & 0 deletions
48
shared-sources/src/main/java/org/anti_ad/mc/ipnext/gui/inject/base/SortButtonWidget.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
package org.anti_ad.mc.ipnext.gui.inject.base | ||
|
||
import org.anti_ad.mc.common.gui.Tooltips | ||
import org.anti_ad.mc.common.math2d.Point | ||
import org.anti_ad.mc.common.math2d.Size | ||
import org.anti_ad.mc.common.vanilla.render.glue.IdentifierHolder | ||
import org.anti_ad.mc.ipnext.config.GuiSettings | ||
|
||
open class SortButtonWidget : TexturedButtonWidget { | ||
|
||
companion object { | ||
private val TEXTURE = IdentifierHolder("inventoryprofilesnext", | ||
"textures/gui/gui_buttons.png") | ||
} | ||
|
||
init { | ||
size = Size(10, | ||
10) | ||
} | ||
|
||
constructor(clickEvent: (button: Int) -> Unit) : super(clickEvent) | ||
constructor(clickEvent: () -> Unit) : super(clickEvent) | ||
constructor() : super() | ||
|
||
override val texture: IdentifierHolder | ||
get() = TEXTURE | ||
|
||
override val texturePt: Point | ||
get() = Point(tx, ty) | ||
|
||
override val hoveringTexturePt: Point | ||
get() = Point(tx, ty + 10) | ||
|
||
override fun render(mouseX: Int, | ||
mouseY: Int, | ||
partialTicks: Float) { | ||
super.render(mouseX, | ||
mouseY, | ||
partialTicks) | ||
if (GuiSettings.SHOW_BUTTON_TOOLTIPS.booleanValue && contains(mouseX, | ||
mouseY) && tooltipText.isNotEmpty()) { | ||
Tooltips.addTooltip(tooltipText, | ||
mouseX, | ||
mouseY) | ||
} | ||
} | ||
|
||
} |
40 changes: 40 additions & 0 deletions
40
shared-sources/src/main/java/org/anti_ad/mc/ipnext/gui/inject/base/TexturedButtonWidget.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package org.anti_ad.mc.ipnext.gui.inject.base | ||
|
||
import org.anti_ad.mc.common.gui.widgets.ButtonWidget | ||
import org.anti_ad.mc.common.integration.HintsManager | ||
import org.anti_ad.mc.common.math2d.Point | ||
import org.anti_ad.mc.common.math2d.Rectangle | ||
import org.anti_ad.mc.common.vanilla.render.glue.IdentifierHolder | ||
import org.anti_ad.mc.common.vanilla.render.glue.Sprite | ||
import org.anti_ad.mc.common.vanilla.render.glue.rDrawSprite | ||
|
||
abstract class TexturedButtonWidget : ButtonWidget { | ||
constructor(clickEvent: (button: Int) -> Unit) : super(clickEvent) | ||
constructor(clickEvent: () -> Unit) : super(clickEvent) | ||
constructor() : super() | ||
|
||
abstract val texture: IdentifierHolder | ||
abstract val texturePt: Point | ||
abstract val hoveringTexturePt: Point | ||
|
||
open var tx = 0 | ||
open var ty = 0 | ||
open var hints = HintsManager.zeroZero | ||
open var tooltipText: String = "" | ||
|
||
override fun renderButton(hovered: Boolean) { | ||
val textureLocation = if (hovered) hoveringTexturePt else texturePt | ||
rDrawSprite(Sprite(texture, | ||
Rectangle(textureLocation, | ||
size)), | ||
screenX, | ||
screenY) | ||
} | ||
|
||
override fun mouseClicked(x: Int, | ||
y: Int, | ||
button: Int): Boolean { | ||
return super.mouseClicked(x,y,button) && visible | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters