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
25 changes: 14 additions & 11 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -129,17 +129,20 @@ configure(

// Fix unimined runs bug
afterEvaluate {
runClient.doFirst {
var classPathFile = null
if (project.name.startsWith("forge")) classPathFile = "legacy_classpath"
if (project.name.startsWith("fabric")) classPathFile = "remapClasspath"

if (classPathFile != null) {
logger.lifecycle("Fixing ${classPathFile}")
copy {
from "${rootProject.buildDir}/unimined/classpaths/${classPathFile}-${project.name}.txt"
into "${rootProject.buildDir}/unimined"
rename { "${classPathFile}.txt" }
def runClientTask = project.tasks.findByName('runClient')
if (runClientTask != null) {
runClientTask.doFirst {
var classPathFile = null
if (project.name.startsWith("forge")) classPathFile = "legacy_classpath"
if (project.name.startsWith("fabric")) classPathFile = "remapClasspath"

if (classPathFile != null) {
logger.lifecycle("Fixing ${classPathFile}")
copy {
from "${rootProject.buildDir}/unimined/classpaths/${classPathFile}-${project.name}.txt"
into "${rootProject.buildDir}/unimined"
rename { "${classPathFile}.txt" }
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ protected void updateDataPoints() {
}

int movementCount = p.deltaMouseX.length;
if (movementCount == 0) return;
if (movementCount == 0 || dataPoints.isEmpty()) return;

int x = dataPoints.getFirst().x[dataPoints.getFirst().x.length - 1];
int y = dataPoints.getFirst().y[dataPoints.getFirst().y.length - 1];
Expand Down
2 changes: 1 addition & 1 deletion fabric-26.3/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
id 'net.fabricmc.fabric-loom' version "1.15-SNAPSHOT"
id 'net.fabricmc.fabric-loom' version "1.18-SNAPSHOT"

id "me.modmuss50.mod-publish-plugin" version "1.1.0"
}
Expand Down
2 changes: 1 addition & 1 deletion fabric-26.3/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ minecraft_version=26.3
loader_version=0.19.5

# Fabric API
fabric_version=0.160.5+26.3
fabric_version=0.162.0+26.3

jdkVersion=25
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-9.2.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-9.7.0-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
49 changes: 49 additions & 0 deletions ornithe-1.8.9/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
plugins {
id 'net.fabricmc.fabric-loom-remap' version '1.18.3'
id 'ploceus' version '1.18.1'
id "me.modmuss50.mod-publish-plugin" version "1.1.0"
}

loom {
runs.client.runDir = "../runs/run"
}

dependencies {
minecraft "com.mojang:minecraft:${project.minecraft_version}"
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"

mappings ploceus.featherMappings(project.feather_build)

ploceus.dependOsl(project.osl_version)

modImplementation "com.terraformersmc:modmenu:0.5.0+mc1.8.9"

implementation "com.github.MPKMod.MPKNetworkAPI:common:${project.networkApiVersion}"
}

processResources {
inputs.property 'version', version

filesMatching('fabric.mod.json') {
expand 'version': version
}
}

publishMods {
file = remapJar.archiveFile
changelog = ""
type = STABLE
version = project.version
modLoaders.add("ornithe")

modrinth {
projectId = "412tAvWq"
accessToken = providers.environmentVariable("MODRINTH_TOKEN")
minecraftVersions.add("1.8.9")
}
/*github {
repository = "MPKMod/MPKMod2"
accessToken = providers.environmentVariable("GITHUB_TOKEN")
commitish = "main"
}*/
}
11 changes: 11 additions & 0 deletions ornithe-1.8.9/gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Done to increase the memory available to gradle.
org.gradle.jvmargs=-Xmx3G
org.gradle.parallel=true

minecraft_version=1.8.9
loader_version=0.19.5
osl_version = 0.22.1

feather_build = 2

jdkVersion=8
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
package io.github.kurrycat.mpkmod.compatibility.ornithe_1_8_9;

import io.github.kurrycat.mpkmod.compatibility.API;
import io.github.kurrycat.mpkmod.compatibility.MCClasses.InputConstants;
import io.github.kurrycat.mpkmod.compatibility.MCClasses.Player;
import io.github.kurrycat.mpkmod.ticks.ButtonMS;
import io.github.kurrycat.mpkmod.ticks.ButtonMSList;
import io.github.kurrycat.mpkmod.util.BoundingBox3D;
import io.github.kurrycat.mpkmod.util.Mouse;
import io.github.kurrycat.mpkmod.util.Vector3D;
import net.minecraft.client.Minecraft;
import net.minecraft.client.options.GameOptions;
import net.minecraft.client.options.KeyBinding;
import net.minecraft.entity.Entity;
import net.minecraft.entity.living.player.PlayerEntity;
import net.minecraft.util.math.Box;
import net.ornithemc.osl.networking.api.client.ClientConnectionEvents;
import org.lwjgl.input.Keyboard;

import java.util.Map;

@SuppressWarnings("unused")
public class EventListener {
private static final ButtonMSList timeQueue = new ButtonMSList();

public static void onKey() {
int keyCode = Keyboard.getEventKey();
String key = Keyboard.getKeyName(keyCode);
boolean pressed = Keyboard.getEventKeyState();

if (keyCode == 0) {
char c = Keyboard.getEventCharacter();
keyCode = 256 + c;
key = String.valueOf(c);
}

GameOptions gameSettings = Minecraft.getInstance().options;

int[] keys = {
gameSettings.forwardKey.getKeyCode(),
gameSettings.leftKey.getKeyCode(),
gameSettings.backKey.getKeyCode(),
gameSettings.rightKey.getKeyCode(),
gameSettings.sprintKey.getKeyCode(),
gameSettings.sneakKey.getKeyCode(),
gameSettings.jumpKey.getKeyCode()
};

for (int i = 0; i < keys.length; i++)
if (keyCode == keys[i])
timeQueue.add(ButtonMS.of(ButtonMS.Button.values()[i], Keyboard.getEventNanoseconds(), pressed));


API.Events.onKeyInput(InputConstants.convert(keyCode), key, pressed);

if (pressed) {
checkKeyBinding(keyCode);
}
}

public static void onMouseEvent(int button, boolean buttonstate, int x, int y, int dx, int dy, int dwheel, long nanoseconds) {
API.Events.onMouseInput(
Mouse.Button.fromInt(button),
button == -1 ? Mouse.State.NONE : (buttonstate ? Mouse.State.DOWN : Mouse.State.UP),
x, y, dx, dy,
dwheel, nanoseconds
);

if (buttonstate)
checkKeyBinding(button - 100);
}

private static void checkKeyBinding(int keyCode) {
if (Minecraft.getInstance().screen != null) return;

for (Map.Entry<String, KeyBinding> keyBindingEntry : MPKMod.keyBindingMap.entrySet()) {
KeyBinding keyBinding = keyBindingEntry.getValue();
String keyBindingId = keyBindingEntry.getKey();

if (keyBinding.getKeyCode() == keyCode) {
API.Events.onKeybind(keyBindingId);
return;
}
}
}

public static void onTickStart(Minecraft mc) {
if (mc.isPaused() || mc.world == null) return;
API.Events.onTickStart();
}

public static void onTickEnd(Minecraft mc) {
if (mc.isPaused() || mc.world == null) return;
Entity cameraEntity = mc.getCamera();

if (cameraEntity != null) {
Box cameraEntityBB = cameraEntity.getShape();
Player mpkPlayer = new Player()
.setPos(new Vector3D(cameraEntity.x, cameraEntity.y, cameraEntity.z))
.setLastPos(new Vector3D(cameraEntity.lastX, cameraEntity.lastY, cameraEntity.lastZ))
.setMotion(new Vector3D(cameraEntity.velocityX, cameraEntity.velocityY, cameraEntity.velocityZ))
.setRotation(cameraEntity.yaw, cameraEntity.pitch)
.setOnGround(cameraEntity.onGround)
.setSprinting(cameraEntity.isSprinting())
.setBoundingBox(new BoundingBox3D(
new Vector3D(cameraEntityBB.minX, cameraEntityBB.minY, cameraEntityBB.minZ),
new Vector3D(cameraEntityBB.maxX, cameraEntityBB.maxY, cameraEntityBB.maxZ)
))
.constructKeyInput()
.setKeyMSList(timeQueue.copy());

if (cameraEntity instanceof PlayerEntity) {
mpkPlayer.setFlying(((PlayerEntity) cameraEntity).abilities.flying);
}

mpkPlayer.buildAndSave();

timeQueue.clear();
}
API.Events.onTickEnd();
}

public static void onServerConnect(ClientConnectionEvents.PlayReadyContext ctx) {
API.Events.onServerConnect(ctx.isServerLocal());
}

public static void onServerDisconnect(ClientConnectionEvents.DisconnectContext ctx) {
API.Events.onServerDisconnect();
}
}
Loading
Loading