Merge pull request #32 from Lumitani-pixel/master

Port to 1.21.10
This commit is contained in:
cattyn
2025-11-13 18:09:37 +04:00
committed by GitHub
19 changed files with 69 additions and 72 deletions
+12 -25
View File
@@ -1,5 +1,5 @@
plugins {
id 'fabric-loom' version '1.10-SNAPSHOT'
id 'fabric-loom' version '1.13-SNAPSHOT'
id 'maven-publish'
}
@@ -7,13 +7,8 @@ version = project.mod_version
group = project.maven_group
repositories {
// Add repositories to retrieve artifacts from in here.
// You should only use this when depending on other mods because
// Loom adds the essential maven repositories to download Minecraft and libraries from automatically.
// See https://docs.gradle.org/current/userguide/declaring_repositories.html
// for more information about repositories.
mavenCentral()
maven { url "https://jitpack.io" }
maven { url "https://jitpack.io" }
}
loom {
@@ -21,12 +16,11 @@ loom {
}
dependencies {
// To change the versions see the gradle.properties file
minecraft "com.mojang:minecraft:${project.minecraft_version}"
mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2"
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"
// Fabric API. This is technically optional, but you probably want it anyway.
// Fabric API
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"
include implementation("com.github.cattyngmd.catformat:catformat-core:${project.catformat_version}")
@@ -48,10 +42,6 @@ processResources {
def targetJavaVersion = 21
tasks.withType(JavaCompile).configureEach {
// ensure that the encoding is set to UTF-8, no matter what the system default is
// this fixes some edge cases with special characters not displaying correctly
// see http://yodaconditions.net/blog/fix-for-java-file-encoding-problems-with-gradle.html
// If Javadoc is generated, this must be specified in that task too.
it.options.encoding = "UTF-8"
if (targetJavaVersion >= 10 || JavaVersion.current().isJava10Compatible()) {
it.options.release = targetJavaVersion
@@ -63,20 +53,21 @@ java {
if (JavaVersion.current() < javaVersion) {
toolchain.languageVersion = JavaLanguageVersion.of(targetJavaVersion)
}
archivesBaseName = project.archives_base_name
// Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task
// if it is present.
// If you remove this line, sources will not be generated.
// (was: archivesBaseName = project.archives_base_name)
withSourcesJar()
}
base {
archivesName = project.archives_base_name
}
jar {
from("LICENSE") {
rename { "${it}_${project.archivesBaseName}"}
rename { "${it}_${project.archives_base_name}" }
}
}
// configure the maven publication
publishing {
publications {
mavenJava(MavenPublication) {
@@ -84,11 +75,7 @@ publishing {
}
}
// See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing.
repositories {
// Add repositories to publish to here.
// Notice: This block does NOT have the same function as the block in the top level.
// The repositories here will be used for publishing your artifact, not for
// retrieving dependencies.
// Add publish targets here if needed
}
}
}
+4 -4
View File
@@ -3,9 +3,9 @@ org.gradle.jvmargs=-Xmx1G
# Fabric Properties
# check these on https://modmuss50.me/fabric.html
minecraft_version=1.21.8
yarn_mappings=1.21.8+build.1
loader_version=0.16.14
minecraft_version=1.21.10
yarn_mappings=1.21.10+build.2
loader_version=0.17.3
# Mod Properties
mod_version = 1.0-SNAPSHOT
@@ -14,5 +14,5 @@ loader_version=0.16.14
# Dependencies
# check this on https://modmuss50.me/fabric.html
fabric_version=0.136.0+1.21.8
fabric_version=0.138.3+1.21.10
catformat_version=2.1.0
+1 -1
View File
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.12-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-9.1.0-bin.zip
networkTimeout=10000
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
@@ -112,7 +112,7 @@ public class Component
this.getItems().forEach(item -> item.mouseReleased(mouseX, mouseY, releaseButton));
}
public void onKeyTyped(char typedChar, int keyCode) {
public void onKeyTyped(String typedChar, int keyCode) {
if (!this.open) {
return;
}
@@ -5,8 +5,11 @@ import me.alpha432.oyvey.features.Feature;
import me.alpha432.oyvey.features.gui.items.buttons.ModuleButton;
import me.alpha432.oyvey.features.modules.Module;
import me.alpha432.oyvey.features.modules.client.HudModule;
import net.minecraft.client.gui.Click;
import net.minecraft.client.gui.DrawContext;
import net.minecraft.client.gui.screen.Screen;
import net.minecraft.client.input.CharInput;
import net.minecraft.client.input.KeyInput;
import net.minecraft.text.Text;
import java.util.ArrayList;
@@ -39,15 +42,15 @@ public class HudEditorScreen extends Screen {
}
@Override
public boolean mouseClicked(double mouseX, double mouseY, int clickedButton) {
this.components.forEach(component -> component.mouseClicked((int) mouseX, (int) mouseY, clickedButton));
return super.mouseClicked(mouseX, mouseY, clickedButton);
public boolean mouseClicked(Click click, boolean doubled) {
this.components.forEach(component -> component.mouseClicked((int) click.x(), (int) click.y(), click.button()));
return super.mouseClicked(click, doubled);
}
@Override
public boolean mouseReleased(double mouseX, double mouseY, int releaseButton) {
this.components.forEach(component -> component.mouseReleased((int) mouseX, (int) mouseY, releaseButton));
return super.mouseReleased(mouseX, mouseY, releaseButton);
public boolean mouseReleased(Click click) {
this.components.forEach(component -> component.mouseReleased((int) click.x(), (int) click.y(), click.button()));
return super.mouseReleased(click);
}
@Override
@@ -61,15 +64,15 @@ public class HudEditorScreen extends Screen {
}
@Override
public boolean keyPressed(int keyCode, int scanCode, int modifiers) {
this.components.forEach(component -> component.onKeyPressed(keyCode));
return super.keyPressed(keyCode, scanCode, modifiers);
public boolean keyPressed(KeyInput input) {
this.components.forEach(component -> component.onKeyPressed(input.getKeycode()));
return super.keyPressed(input);
}
@Override
public boolean charTyped(char chr, int modifiers) {
this.components.forEach(component -> component.onKeyTyped(chr, modifiers));
return super.charTyped(chr, modifiers);
public boolean charTyped(CharInput input) {
this.components.forEach(component -> component.onKeyTyped(input.asString(), input.modifiers()));
return super.charTyped(input);
}
@Override
@@ -5,8 +5,11 @@ import me.alpha432.oyvey.features.Feature;
import me.alpha432.oyvey.features.gui.items.Item;
import me.alpha432.oyvey.features.gui.items.buttons.ModuleButton;
import me.alpha432.oyvey.features.modules.Module;
import net.minecraft.client.gui.Click;
import net.minecraft.client.gui.DrawContext;
import net.minecraft.client.gui.screen.Screen;
import net.minecraft.client.input.CharInput;
import net.minecraft.client.input.KeyInput;
import net.minecraft.text.Text;
import java.awt.*;
@@ -66,15 +69,15 @@ public class OyVeyGui extends Screen {
}
@Override
public boolean mouseClicked(double mouseX, double mouseY, int clickedButton) {
this.components.forEach(components -> components.mouseClicked((int) mouseX, (int) mouseY, clickedButton));
return super.mouseClicked(mouseX, mouseY, clickedButton);
public boolean mouseClicked(Click click, boolean doubled) {
this.components.forEach(components -> components.mouseClicked((int) click.x(), (int) click.y(), click.button()));
return super.mouseClicked(click, doubled);
}
@Override
public boolean mouseReleased(double mouseX, double mouseY, int releaseButton) {
this.components.forEach(components -> components.mouseReleased((int) mouseX, (int) mouseY, releaseButton));
return super.mouseReleased(mouseX, mouseY, releaseButton);
public boolean mouseReleased(Click click) {
this.components.forEach(components -> components.mouseReleased((int) click.x(), (int) click.y(), click.button()));
return super.mouseReleased(click);
}
@Override
@@ -88,15 +91,15 @@ public class OyVeyGui extends Screen {
}
@Override
public boolean keyPressed(int keyCode, int scanCode, int modifiers) {
this.components.forEach(component -> component.onKeyPressed(keyCode));
return super.keyPressed(keyCode, scanCode, modifiers);
public boolean keyPressed(KeyInput input) {
this.components.forEach(component -> component.onKeyPressed(input.getKeycode()));
return super.keyPressed(input);
}
@Override
public boolean charTyped(char chr, int modifiers) {
this.components.forEach(component -> component.onKeyTyped(chr, modifiers));
return super.charTyped(chr, modifiers);
public boolean charTyped(CharInput input) {
this.components.forEach(component -> component.onKeyTyped(input.asString(), input.modifiers()));
return super.charTyped(input);
}
@Override
@@ -35,7 +35,7 @@ public class Item
public void update() {
}
public void onKeyTyped(char typedChar, int keyCode) {
public void onKeyTyped(String typedChar, int keyCode) {
}
public void onKeyPressed(int key) {
@@ -101,7 +101,7 @@ public class ModuleButton
}
@Override
public void onKeyTyped(char typedChar, int keyCode) {
public void onKeyTyped(String typedChar, int keyCode) {
super.onKeyTyped(typedChar, keyCode);
if (!this.items.isEmpty() && this.subOpen) {
for (Item item : this.items) {
@@ -53,7 +53,7 @@ public class StringButton
}
@Override
public void onKeyTyped(char typedChar, int keyCode) {
public void onKeyTyped(String typedChar, int keyCode) {
if (this.isListening) {
this.setString(this.currentString.string() + typedChar);
}
@@ -25,10 +25,10 @@ public class Coordinates extends HudModule {
mc.player.getBlockZ());
if (nether.getValue()) {
int netherX = mc.player.getWorld().getRegistryKey().getValue().getPath().equals("the_nether")
int netherX = mc.player.getEntityWorld().getRegistryKey().getValue().getPath().equals("the_nether")
? mc.player.getBlockX() * 8
: mc.player.getBlockX() / 8;
int netherZ = mc.player.getWorld().getRegistryKey().getValue().getPath().equals("the_nether")
int netherZ = mc.player.getEntityWorld().getRegistryKey().getValue().getPath().equals("the_nether")
? mc.player.getBlockZ() * 8
: mc.player.getBlockZ() / 8;
coordsStr += String.format(" [%d, %d]", netherX, netherZ);
@@ -27,7 +27,7 @@ public class MCF extends Module {
private void click() {
Entity targetedEntity = mc.targetedEntity;
if (!(targetedEntity instanceof PlayerEntity)) return;
String name = ((PlayerEntity) targetedEntity).getGameProfile().getName();
String name = ((PlayerEntity) targetedEntity).getGameProfile().name();
if (OyVey.friendManager.isFriend(name)) {
OyVey.friendManager.removeFriend(name);
@@ -4,6 +4,7 @@ import com.google.common.base.Converter;
import com.google.gson.JsonElement;
import com.google.gson.JsonPrimitive;
import me.alpha432.oyvey.util.traits.Util;
import net.minecraft.client.input.KeyInput;
import net.minecraft.client.util.InputUtil;
import org.lwjgl.glfw.GLFW;
@@ -33,7 +34,7 @@ public class Bind implements Util {
public String toString() {
return this.isEmpty() ? "None" : (this.key < 0
? "None"
: this.capitalise(InputUtil.fromKeyCode(this.key, 0).getTranslationKey()));
: this.capitalise(InputUtil.fromKeyCode(new KeyInput(this.key, 0, 0)).getTranslationKey()));
}
public boolean isDown() {
@@ -17,7 +17,7 @@ public class FriendManager implements Jsonable {
}
public boolean isFriend(PlayerEntity player) {
return this.isFriend(player.getGameProfile().getName());
return this.isFriend(player.getGameProfile().name());
}
public void addFriend(String name) {
@@ -80,7 +80,7 @@ public class ServerManager
return 0;
}
try {
return mc.getNetworkHandler().getPlayerListEntry(mc.player.getGameProfile().getName()).getLatency();
return mc.getNetworkHandler().getPlayerListEntry(mc.player.getGameProfile().name()).getLatency();
} catch (Throwable e) {
return 0;
}
@@ -2,6 +2,7 @@ package me.alpha432.oyvey.mixin;
import me.alpha432.oyvey.event.impl.KeyEvent;
import net.minecraft.client.Keyboard;
import net.minecraft.client.input.KeyInput;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
@@ -12,9 +13,9 @@ import static me.alpha432.oyvey.util.traits.Util.EVENT_BUS;
@Mixin(Keyboard.class)
public class MixinKeyboard {
@Inject(method = "onKey", at = @At("TAIL"), cancellable = true)
private void onKey(long windowPointer, int key, int scanCode, int action, int modifiers, CallbackInfo ci) {
private void onKey(long window, int action, KeyInput input, CallbackInfo ci) {
if (action != 1) return;
KeyEvent event = new KeyEvent(key);
KeyEvent event = new KeyEvent(input.key());
EVENT_BUS.post(event);
if (event.isCancelled()) ci.cancel();
}
@@ -2,6 +2,7 @@ package me.alpha432.oyvey.mixin;
import me.alpha432.oyvey.event.impl.MouseEvent;
import net.minecraft.client.Mouse;
import net.minecraft.client.input.MouseInput;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
@@ -12,8 +13,8 @@ import static me.alpha432.oyvey.util.traits.Util.EVENT_BUS;
@Mixin(Mouse.class)
public class MixinMouse {
@Inject(method = "onMouseButton", at = @At("HEAD"), cancellable = true)
private void onMouseButton(long window, int button, int action, int mods, CallbackInfo ci) {
MouseEvent event = new MouseEvent(button, action);
private void onMouseButton(long window, MouseInput input, int action, CallbackInfo ci) {
MouseEvent event = new MouseEvent(input.button(), action);
EVENT_BUS.post(event);
if (event.isCancelled()) {
ci.cancel();
@@ -24,8 +24,9 @@ import static me.alpha432.oyvey.util.traits.Util.mc;
public class MixinWorldRenderer {
@Inject(method = "render", at = @At("RETURN"))
private void render(ObjectAllocator allocator, RenderTickCounter tickCounter, boolean renderBlockOutline,
Camera camera, Matrix4f positionMatrix, Matrix4f projectionMatrix, GpuBufferSlice gpuBufferSlice, Vector4f viewArea, boolean someFlag,
CallbackInfo ci, @Local Profiler profiler) {
Camera camera, Matrix4f positionMatrix, Matrix4f matrix4f, Matrix4f projectionMatrix,
GpuBufferSlice fogBuffer, Vector4f fogColor, boolean renderSky, CallbackInfo ci, @Local Profiler profiler) {
MatrixStack stack = new MatrixStack();
stack.push();
stack.multiply(RotationAxis.POSITIVE_X.rotationDegrees(mc.gameRenderer.getCamera().getPitch()));
@@ -183,7 +183,7 @@ public class MathUtil
vec3ds.add(new Vec3d(minX, y, maxZ));
return vec3ds;
}
vec3ds.add(entity.getPos());
vec3ds.add(entity.getEntityPos());
return vec3ds;
}
@@ -230,7 +230,7 @@ public class RenderUtil implements Util {
BufferBuilder bufferBuilder = Tessellator.getInstance()
.begin(VertexFormat.DrawMode.LINES, VertexFormats.POSITION_COLOR_NORMAL);
VertexRendering.drawBox(stack, bufferBuilder, minX, minY, minZ, maxX, maxY, maxZ,
VertexRendering.drawBox(stack.peek(), bufferBuilder, minX, minY, minZ, maxX, maxY, maxZ,
c.getRed() / 255f, c.getGreen() / 255f, c.getBlue() / 255f, c.getAlpha() / 255f);
Layers.getGlobalLines(lineWidth).draw(bufferBuilder.end());