Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ done
<img alt="standalone" src="https://img.shields.io/badge/dynamic/xml?color=A97BFF&label=%20&query=/metadata/versioning/versions/version[not(contains(text(),'%2B'))][last()]&url=https://repo.essential.gg/repository/maven-releases/gg/essential/universalcraft-standalone/maven-metadata.xml">
</td>
</tr>
<tr><td>1.21.9</td><td>fabric</td><td><img alt="1.21.9-fabric" src="https://img.shields.io/badge/dynamic/xml?color=A97BFF&label=%20&query=/metadata/versioning/versions/version[not(contains(text(),'%2B'))][last()]&url=https://repo.essential.gg/repository/maven-releases/gg/essential/universalcraft-1.21.9-fabric/maven-metadata.xml"></td></tr>
<tr><td>1.21.7</td><td>neoforge</td><td><img alt="1.21.7-neoforge" src="https://img.shields.io/badge/dynamic/xml?color=A97BFF&label=%20&query=/metadata/versioning/versions/version[not(contains(text(),'%2B'))][last()]&url=https://repo.essential.gg/repository/maven-releases/gg/essential/universalcraft-1.21.7-neoforge/maven-metadata.xml"></td></tr>
<tr><td>1.21.7</td><td>forge</td><td><img alt="1.21.7-forge" src="https://img.shields.io/badge/dynamic/xml?color=A97BFF&label=%20&query=/metadata/versioning/versions/version[not(contains(text(),'%2B'))][last()]&url=https://repo.essential.gg/repository/maven-releases/gg/essential/universalcraft-1.21.7-forge/maven-metadata.xml"></td></tr>
<tr><td>1.21.7</td><td>fabric</td><td><img alt="1.21.7-fabric" src="https://img.shields.io/badge/dynamic/xml?color=A97BFF&label=%20&query=/metadata/versioning/versions/version[not(contains(text(),'%2B'))][last()]&url=https://repo.essential.gg/repository/maven-releases/gg/essential/universalcraft-1.21.7-fabric/maven-metadata.xml"></td></tr>
Expand Down
166 changes: 92 additions & 74 deletions api/UniversalCraft.api

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion root.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import gg.essential.gradle.util.*

plugins {
kotlin("jvm") version "1.9.23" apply false
id("gg.essential.loom") version "1.7.28" apply false
id("gg.essential.loom") version "1.7.35" apply false
id("gg.essential.multi-version.root")
id("gg.essential.multi-version.api-validation")
}
Expand All @@ -12,6 +12,7 @@ version = versionFromBuildIdAndBranch()
preprocess {
strictExtraMappings.set(true)

val fabric12109 = createNode("1.21.9-fabric", 12109, "srg")
val neoForge12107 = createNode("1.21.7-neoforge", 12107, "srg")
val forge12107 = createNode("1.21.7-forge", 12107, "srg")
val fabric12107 = createNode("1.21.7-fabric", 12107, "srg")
Expand Down Expand Up @@ -56,6 +57,7 @@ preprocess {
val forge11202 = createNode("1.12.2-forge", 11202, "srg")
val forge10809 = createNode("1.8.9-forge", 10809, "srg")

fabric12109.link(fabric12107)
neoForge12107.link(fabric12107)
forge12107.link(fabric12107)
fabric12107.link(fabric12106)
Expand Down
1 change: 1 addition & 0 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ listOf(
"1.21.7-fabric",
"1.21.7-forge",
"1.21.7-neoforge",
"1.21.9-fabric",
).forEach { version ->
include(":$version")
project(":$version").apply {
Expand Down
25 changes: 24 additions & 1 deletion src/main/java/gg/essential/universal/UGraphics.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,11 @@
import static org.lwjgl.opengl.GL13.GL_ACTIVE_TEXTURE;
import static org.lwjgl.opengl.GL13.GL_TEXTURE0;

//#if MC>=12109
//$$ import net.minecraft.client.font.TextDrawable;
//$$ import net.minecraft.text.StyleSpriteSource;
//#endif

//#if MC>=12106
//$$ import com.mojang.blaze3d.systems.RenderPass;
//$$ import com.mojang.blaze3d.textures.GpuTextureView;
Expand Down Expand Up @@ -164,7 +169,9 @@ public class UGraphics {
//$$ private DefaultShader shader;
//#else

//#if MC>=12100
//#if MC>=12109
//$$ public static Style EMPTY_WITH_FONT_ID = Style.EMPTY.withFont(new StyleSpriteSource.Font(Identifier.of("minecraft", "alt")));
//#elseif MC>=12100
//$$ public static Style EMPTY_WITH_FONT_ID = Style.EMPTY.withFont(Identifier.of("minecraft", "alt"));
//#elseif MC>=11602
//$$ public static Style EMPTY_WITH_FONT_ID = Style.EMPTY.setFontId(new ResourceLocation("minecraft", "alt"));
Expand Down Expand Up @@ -492,6 +499,8 @@ public static void setActiveTexture(int glId) {
public static void bindTexture(int glTextureId) {
//#if STANDALONE
//$$ glBindTexture(GL_TEXTURE_2D, glTextureId);
//#elseif MC>=12109
//$$ bindTexture(getActiveTexture() - GL_TEXTURE0, glTextureId);
//#elseif MC>=11700
//$$ bindTexture(GlStateManager._getActiveTexture() - GL_TEXTURE0, glTextureId);
//#else
Expand Down Expand Up @@ -686,6 +695,19 @@ public static void drawString(UMatrixStack stack, String text, float x, float y,
//$$ }
//$$ }
//$$
//#if MC>=12109
//$$ private void draw(TextDrawable drawable) {
//$$ if (pipeline != drawable.getPipeline() || texture != drawable.textureView()) {
//$$ flush();
//$$ pipeline = drawable.getPipeline();
//$$ texture = drawable.textureView();
//$$ bufferBuilder = Tessellator.getInstance().begin(pipeline.getVertexFormatMode(), pipeline.getVertexFormat());
//$$ }
//$$ drawable.render(matrix, bufferBuilder, LIGHT, false);
//$$ }
//$$ @Override public void drawGlyph(TextDrawable drawable) { draw(drawable); }
//$$ @Override public void drawRectangle(TextDrawable drawable) { draw(drawable); }
//#else
//$$ private void setupBuffer(BakedGlyph bakedGlyph) {
//$$ if (pipeline == bakedGlyph.getPipeline() && texture == bakedGlyph.getTexture()) {
//$$ return;
Expand All @@ -709,6 +731,7 @@ public static void drawString(UMatrixStack stack, String text, float x, float y,
//$$ if (bakedGlyph.getTexture() == null) return;
//$$ bakedGlyph.drawRectangle(rectangle, matrix, bufferBuilder, LIGHT, false);
//$$ }
//#endif
//$$ }
//#endif

Expand Down
2 changes: 2 additions & 0 deletions src/main/kotlin/gg/essential/universal/UMinecraft.kt
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ object UMinecraft {
val isRunningOnMac: Boolean =
//#if STANDALONE
//$$ UDesktop.isMac
//#elseif MC>=12109
//$$ net.minecraft.client.input.SystemKeycodes.IS_MAC_OS
//#else
Minecraft.isRunningOnMac
//#endif
Expand Down
89 changes: 84 additions & 5 deletions src/main/kotlin/gg/essential/universal/UScreen.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@ package gg.essential.universal

import net.minecraft.client.gui.GuiScreen

//#if MC>=12109
//$$ import net.minecraft.client.gui.Click
//$$ import net.minecraft.client.input.CharInput
//$$ import net.minecraft.client.input.KeyInput
//$$ import net.minecraft.client.input.MouseInput
//#endif

//#if MC>=12106
//$$ import com.mojang.blaze3d.systems.RenderSystem
//#endif
Expand Down Expand Up @@ -127,6 +134,57 @@ abstract class UScreen(
//#endif
//$$ }
//$$
//#if MC>=12109
//$$ final override fun keyPressed(input: KeyInput): Boolean {
//$$ onKeyPressed(input.key, 0.toChar(), input.modifiers.toModifiers())
//$$ return false
//$$ }
//$$
//$$ final override fun keyReleased(input: KeyInput): Boolean {
//$$ onKeyReleased(input.key, 0.toChar(), input.modifiers.toModifiers())
//$$ return false
//$$ }
//$$
//$$ final override fun charTyped(input: CharInput): Boolean {
//$$ val codepoint = input.codepoint
//$$ if (Character.isBmpCodePoint(codepoint)) {
//$$ onKeyPressed(0, input.codepoint.toChar(), input.modifiers.toModifiers())
//$$ } else if (Character.isValidCodePoint(codepoint)) {
//$$ onKeyPressed(0, Character.highSurrogate(input.codepoint), input.modifiers.toModifiers())
//$$ onKeyPressed(0, Character.lowSurrogate(input.codepoint), input.modifiers.toModifiers())
//$$ }
//$$ return false
//$$ }
//$$
//$$ private var lastMouseInput: MouseInput? = null
//$$ private var lastDoubled: Boolean? = null
//$$
//$$ final override fun mouseClicked(click: Click, doubled: Boolean): Boolean {
//$$ lastMouseInput = click.buttonInfo
//$$ lastDoubled = doubled
//$$ if (click.button() == 1) lastClick = UMinecraft.getTime()
//$$ onMouseClicked(click.x, click.y, click.button())
//$$ lastMouseInput = null
//$$ lastDoubled = null
//$$ return false
//$$ }
//$$
//$$ final override fun mouseReleased(click: Click): Boolean {
//$$ lastMouseInput = click.buttonInfo
//$$ onMouseReleased(click.x, click.y, click.button())
//$$ lastMouseInput = null
//$$ return false
//$$ }
//$$
//$$ override fun mouseDragged(click: Click, offsetX: Double, offsetY: Double): Boolean {
//$$ lastMouseInput = click.buttonInfo
//$$ lastDraggedDx = offsetX
//$$ lastDraggedDy = offsetY
//$$ onMouseDragged(click.x, click.y, click.button(), UMinecraft.getTime() - lastClick)
//$$ lastMouseInput = null
//$$ return false
//$$ }
//#else
//$$ final override fun keyPressed(keyCode: Int, scanCode: Int, modifierCode: Int): Boolean {
//$$ onKeyPressed(keyCode, 0.toChar(), modifierCode.toModifiers())
//$$ return false
Expand Down Expand Up @@ -160,6 +218,7 @@ abstract class UScreen(
//$$ onMouseDragged(x, y, mouseButton, UMinecraft.getTime() - lastClick)
//$$ return false
//$$ }
//#endif
//$$
//#if MC>=12002
//$$ override fun mouseScrolled(mouseX: Double, mouseY: Double, horizontalAmount: Double, delta: Double): Boolean {
Expand Down Expand Up @@ -341,10 +400,18 @@ abstract class UScreen(
open fun onKeyPressed(keyCode: Int, typedChar: Char, modifiers: UKeyboard.Modifiers?) {
//#if MC>=11502
//$$ if (keyCode != 0) {
//$$ super.keyPressed(keyCode, 0, modifiers.toInt())
//#if MC>=12109
//$$ super.keyPressed(KeyInput(keyCode, 0, modifiers.toInt()))
//#else
//$$ super.keyPressed(keyCode, 0, modifiers.toInt())
//#endif
//$$ }
//$$ if (typedChar != 0.toChar()) {
//$$ super.charTyped(typedChar, modifiers.toInt())
//#if MC>=12109
//$$ super.charTyped(CharInput(typedChar.code, modifiers.toInt()))
//#else
//$$ super.charTyped(typedChar, modifiers.toInt())
//#endif
//$$ }
//#else
try {
Expand All @@ -358,7 +425,11 @@ abstract class UScreen(
open fun onKeyReleased(keyCode: Int, typedChar: Char, modifiers: UKeyboard.Modifiers?) {
//#if MC>=11502
//$$ if (keyCode != 0) {
//$$ super.keyReleased(keyCode, 0, modifiers.toInt())
//#if MC>=12109
//$$ super.keyReleased(KeyInput(keyCode, 0, modifiers.toInt()))
//#else
//$$ super.keyReleased(keyCode, 0, modifiers.toInt())
//#endif
//$$ }
//#endif
}
Expand All @@ -367,7 +438,11 @@ abstract class UScreen(
//#if MC>=11502
//$$ if (mouseButton == 1)
//$$ lastClick = UMinecraft.getTime()
//#if MC>=12109
//$$ super.mouseClicked(Click(mouseX, mouseY, MouseInput(mouseButton, lastMouseInput?.modifiers ?: 0)), lastDoubled ?: false)
//#else
//$$ super.mouseClicked(mouseX, mouseY, mouseButton)
//#endif
//#else
try {
super.mouseClicked(mouseX.toInt(), mouseY.toInt(), mouseButton)
Expand All @@ -378,15 +453,19 @@ abstract class UScreen(
}

open fun onMouseReleased(mouseX: Double, mouseY: Double, state: Int) {
//#if MC>=11502
//#if MC>=12109
//$$ super.mouseReleased(Click(mouseX, mouseY, MouseInput(state, lastMouseInput?.modifiers ?: 0)))
//#elseif MC>=11502
//$$ super.mouseReleased(mouseX, mouseY, state)
//#else
super.mouseReleased(mouseX.toInt(), mouseY.toInt(), state)
//#endif
}

open fun onMouseDragged(x: Double, y: Double, clickedButton: Int, timeSinceLastClick: Long) {
//#if MC>=11502
//#if MC>=12109
//$$ super.mouseDragged(Click(x, y, MouseInput(clickedButton, lastMouseInput?.modifiers ?: 0)), lastDraggedDx, lastDraggedDy)
//#elseif MC>=11502
//$$ super.mouseDragged(x, y, clickedButton, lastDraggedDx, lastDraggedDy)
//#else
super.mouseClickMove(x.toInt(), y.toInt(), clickedButton, timeSinceLastClick)
Expand Down
4 changes: 4 additions & 0 deletions src/main/kotlin/gg/essential/universal/render/URenderPass.kt
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,11 @@ internal class URenderPass : AutoCloseable {
//$$ val dynamicUniforms = RenderSystem.getDynamicUniforms().write(
//$$ RenderSystem.getModelViewMatrix(),
//$$ org.joml.Vector4f(1f, 1f, 1f, 1f),
//#if MC>=12109
//$$ org.joml.Vector3f(),
//#else
//$$ RenderSystem.getModelOffset(),
//#endif
//$$ RenderSystem.getTextureMatrix(),
//$$ RenderSystem.getShaderLineWidth(),
//$$ )
Expand Down
4 changes: 4 additions & 0 deletions versions/1.21.9-fabric/gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
essential.defaults.loom.minecraft=com.mojang:minecraft:1.21.9-rc1
essential.defaults.loom.mappings=net.fabricmc:yarn:1.21.9-rc1+build.2:v2
# Required because our Loom doesn't yet support the unpick version included in the above yarn version
essential.loom.disableUnpick=true