-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Preliminary addition of Server Settings: Disabled features will return an empty list to client Added IconEntry, now some Evolution conditions have a lil icon (more icons coming soon) Fixed some bugs
- Loading branch information
1 parent
e91b13f
commit f880168
Showing
18 changed files
with
283 additions
and
95 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
5 changes: 5 additions & 0 deletions
5
common/src/main/kotlin-templates/CobbledexBuildDetails.kt.peb
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,5 @@ | ||
package com.rafacasari.mod.cobbledex | ||
|
||
object CobbledexBuildDetails { | ||
const val VERSION = "{{ version }}" | ||
} |
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
23 changes: 23 additions & 0 deletions
23
common/src/main/kotlin/com/rafacasari/mod/cobbledex/CobbledexConfig.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,23 @@ | ||
package com.rafacasari.mod.cobbledex | ||
|
||
import com.google.gson.Gson | ||
import com.google.gson.GsonBuilder | ||
|
||
class CobbledexConfig { | ||
|
||
|
||
companion object { | ||
val GSON: Gson = GsonBuilder() | ||
.disableHtmlEscaping() | ||
.setPrettyPrinting() | ||
.create() | ||
} | ||
|
||
var lastSavedVersion: String = "0.0.1" | ||
|
||
var howToFindEnabled = true | ||
var showEvolutions = true | ||
var itemDropsEnabled = true | ||
|
||
|
||
} |
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
57 changes: 57 additions & 0 deletions
57
common/src/main/kotlin/com/rafacasari/mod/cobbledex/client/widget/entries/IconEntry.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,57 @@ | ||
package com.rafacasari.mod.cobbledex.client.widget.entries | ||
|
||
import com.cobblemon.mod.common.api.gui.blitk | ||
import com.rafacasari.mod.cobbledex.client.widget.LongTextDisplay | ||
import net.minecraft.client.MinecraftClient | ||
import net.minecraft.client.gui.DrawContext | ||
import net.minecraft.text.OrderedText | ||
import net.minecraft.util.Colors | ||
import net.minecraft.util.Identifier | ||
|
||
class IconEntry(val icon: Identifier, val text: OrderedText, val xOffset: Number, val yOffset: Number, val iconOriginalWidth: Int, val iconOriginalHeight: Int, val iconScale: Float = 1f) : LongTextDisplay.TextDisplayEntry() { | ||
private fun drawItemName(context: DrawContext, text: OrderedText, x: Number, y: Number, pMouseX: Int? = null, pMouseY: Int? = null): Boolean { | ||
val textRenderer = MinecraftClient.getInstance().textRenderer | ||
val width = textRenderer.getWidth(text) | ||
|
||
context.drawText(textRenderer, text, x.toInt(), y.toInt(), Colors.WHITE, false) | ||
|
||
// Return isHovered | ||
return pMouseY != null && pMouseX != null && | ||
pMouseX.toInt() >= x.toInt() && pMouseX.toInt() <= x.toInt() + width && | ||
pMouseY.toInt() >= y.toInt() && pMouseY.toInt() <= y.toInt() + textRenderer.fontHeight | ||
} | ||
|
||
private fun drawItem(context: DrawContext, x: Int, y: Int) { | ||
blitk( | ||
matrixStack = context.matrices, | ||
texture = icon, | ||
x = x / iconScale + xOffset.toFloat(), | ||
y = y / iconScale + yOffset.toFloat(), | ||
height = iconOriginalHeight, | ||
width = iconOriginalWidth, | ||
scale = iconScale | ||
) | ||
} | ||
|
||
|
||
override fun render( | ||
context: DrawContext?, | ||
index: Int, | ||
y: Int, | ||
x: Int, | ||
entryWidth: Int, | ||
entryHeight: Int, | ||
mouseX: Int, | ||
mouseY: Int, | ||
hovered: Boolean, | ||
tickDelta: Float | ||
) { | ||
if (context == null) return | ||
|
||
drawItem(context, x, y) | ||
drawItemName(context, text, x + 10.5f, y, mouseX, mouseY) | ||
} | ||
|
||
override fun drawTooltip(context: DrawContext, mouseX: Int, mouseY: Int) { | ||
} | ||
} |
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
Oops, something went wrong.