Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
ScribbleTAS committed Aug 21, 2024
0 parents commit 75fef5c
Show file tree
Hide file tree
Showing 18 changed files with 1,490 additions and 0 deletions.
9 changes: 9 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#
# https://help.github.com/articles/dealing-with-line-endings/
#

# These are Windows script files and should use crlf
*.bat text eol=crlf

*.java diff=java
*.md diff=markdown
40 changes: 40 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# gradle

.gradle/
build/
out/
classes/

# eclipse

*.launch

# idea

.idea/
*.iml
*.ipr
*.iws

# vscode

.settings/
.vscode/
bin/
.classpath
.project

# macos

*.DS_Store

# fabric

run/

# java

hs_err_*.log
replay_*.log
*.hprof
*.jfr
674 changes: 674 additions & 0 deletions LICENSE

Large diffs are not rendered by default.

14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# LoTAS-Light
A very slimmed down version of [LoTAS](https://github.com/MinecraftTAS/LoTAS), in an attempt to make it easily upgradable to newer versions.

Needs Fabric API

## Features
- Tickratechanger
- Increase tickrate (Default key: <kbd>.</kbd>)
- Decrease tickrate (<kbd>,</kbd>)
- Freeze tickrate (<kbd>F8</kbd>)
- Advance tickrate (While tickrate is frozen) (<kbd>F9</kbd>)
- Savestates
- Saving (<kbd>J</kbd>)
- Loading (<kbd>K</kbd>)
62 changes: 62 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
plugins {
id 'fabric-loom' version '1.7-SNAPSHOT'
id 'maven-publish'
}

version = project.mod_version
group = project.maven_group

base {
archivesName = project.archives_base_name
}

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.
}

loom {

}

dependencies {
// To change the versions see the gradle.properties file
minecraft "com.mojang:minecraft:${project.minecraft_version}"
mappings loom.officialMojangMappings()
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"

// Fabric API. This is technically optional, but you probably want it anyway.
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"

}

processResources {
inputs.property "version", project.version

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

tasks.withType(JavaCompile).configureEach {
it.options.release = 21
}

java {
// 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.
withSourcesJar()

sourceCompatibility = JavaVersion.VERSION_21
targetCompatibility = JavaVersion.VERSION_21
}

jar {
from("LICENSE") {
rename { "${it}_${project.base.archivesName.get()}"}
}
}
17 changes: 17 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Done to increase the memory available to gradle.
org.gradle.jvmargs=-Xmx1G
org.gradle.parallel=true

# Fabric Properties
# check these on https://fabricmc.net/develop
minecraft_version=1.21.1
yarn_mappings=1.21+build.2
loader_version=0.15.11

# Mod Properties
mod_version=1.0.0
maven_group=com.mincecrafttas
archives_base_name=LoTAS-Light-1.21

# Dependencies
fabric_version=0.102.1+1.21.1
10 changes: 10 additions & 0 deletions settings.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
pluginManagement {
repositories {
maven {
name = 'Fabric'
url = 'https://maven.fabricmc.net/'
}
mavenCentral()
gradlePluginPortal()
}
}
10 changes: 10 additions & 0 deletions src/client/java/com/example/ExampleModClient.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package com.example;

import net.fabricmc.api.ClientModInitializer;

public class ExampleModClient implements ClientModInitializer {
@Override
public void onInitializeClient() {
// This entrypoint is suitable for setting up client-specific logic, such as rendering.
}
}
15 changes: 15 additions & 0 deletions src/client/java/com/example/mixin/client/ExampleClientMixin.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package com.example.mixin.client;

import net.minecraft.client.MinecraftClient;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;

@Mixin(MinecraftClient.class)
public class ExampleClientMixin {
@Inject(at = @At("HEAD"), method = "run")
private void init(CallbackInfo info) {
// This code is injected into the start of MinecraftClient.run()V
}
}
11 changes: 11 additions & 0 deletions src/client/resources/modid.client.mixins.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"required": true,
"package": "com.example.mixin.client",
"compatibilityLevel": "JAVA_21",
"client": [
"ExampleClientMixin"
],
"injectors": {
"defaultRequire": 1
}
}
17 changes: 17 additions & 0 deletions src/main/java/com/minecrafttas/lotas_light/LoTASLight.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package com.minecrafttas.lotas_light;

import com.minecrafttas.lotas_light.tickratechanger.TickrateChangerServer;

import net.fabricmc.api.ModInitializer;

public class LoTASLight implements ModInitializer {

public static TickrateChangerServer tickratechangerServer = new TickrateChangerServer();

@Override
public void onInitialize() {
// TODO Auto-generated method stub

}

}
55 changes: 55 additions & 0 deletions src/main/java/com/minecrafttas/lotas_light/LoTASLightClient.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
package com.minecrafttas.lotas_light;

import org.lwjgl.glfw.GLFW;

import com.minecrafttas.lotas_light.tickratechanger.TickrateChangerClient;
import com.mojang.blaze3d.platform.InputConstants;

import net.fabricmc.api.ClientModInitializer;
import net.fabricmc.fabric.api.client.keybinding.v1.KeyBindingHelper;
import net.minecraft.client.KeyMapping;

public class LoTASLightClient implements ClientModInitializer {

public static TickrateChangerClient tickratechangerClient = new TickrateChangerClient();

private KeyMapping increaseTickrate = new KeyMapping("key.lotaslight.increaseTickrate", InputConstants.Type.KEYSYM, GLFW.GLFW_KEY_PERIOD, "keycategory.lotaslight.lotaslight");
private KeyMapping decreaseTickrate = new KeyMapping("key.lotaslight.decreaseTickrate", InputConstants.Type.KEYSYM, GLFW.GLFW_KEY_COMMA, "keycategory.lotaslight.lotaslight");
private KeyMapping freezeTickrate = new KeyMapping("key.lotaslight.freezeTickrate", InputConstants.Type.KEYSYM, GLFW.GLFW_KEY_F8, "keycategory.lotaslight.lotaslight");
private KeyMapping advanceTickrate = new KeyMapping("key.lotaslight.advanceTickrate", InputConstants.Type.KEYSYM, GLFW.GLFW_KEY_F9, "keycategory.lotaslight.lotaslight");
private KeyMapping savestate = new KeyMapping("key.lotaslight.savestate", InputConstants.Type.KEYSYM, GLFW.GLFW_KEY_J, "keycategory.lotaslight.lotaslight");
private KeyMapping loadstate = new KeyMapping("key.lotaslight.loadstate", InputConstants.Type.KEYSYM, GLFW.GLFW_KEY_K, "keycategory.lotaslight.lotaslight");

@Override
public void onInitializeClient() {
registerKeybindings();
}

private void registerKeybindings() {
KeyBindingHelper.registerKeyBinding(increaseTickrate);
KeyBindingHelper.registerKeyBinding(decreaseTickrate);
KeyBindingHelper.registerKeyBinding(freezeTickrate);
KeyBindingHelper.registerKeyBinding(advanceTickrate);
KeyBindingHelper.registerKeyBinding(savestate);
KeyBindingHelper.registerKeyBinding(loadstate);

while (increaseTickrate.consumeClick()) {

}
while (decreaseTickrate.consumeClick()) {

}
while (freezeTickrate.consumeClick()) {

}
while (advanceTickrate.consumeClick()) {

}
while (savestate.consumeClick()) {

}
while (loadstate.consumeClick()) {

}
}
}
Loading

0 comments on commit 75fef5c

Please sign in to comment.