Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
50e2fb3
[Gui] Readded keystrokes to InfoGui
ScribbleTAS Jul 13, 2024
90860ea
[PlaybackSerialiser] Fixed the first tick being incorrect
ScribbleTAS Jul 13, 2024
f9277cc
[Savestates] Readded request code
ScribbleTAS Jul 13, 2024
03aa6ca
[Savestates] Fixed client motion not working
ScribbleTAS Jul 13, 2024
a24e501
[FileCommands] Added more precision to desyncMonitor
ScribbleTAS Jul 14, 2024
2bee234
[PlaybackSerialiser] Reenabled camera angle storing on full ticks
ScribbleTAS Jul 17, 2024
9aeae79
[PlaybackSerialiser] Fix some filecommands not being loaded after sav…
ScribbleTAS Jul 20, 2024
f297b3f
[PlaybackSerialiser] Switched pitch and yaw
ScribbleTAS Jul 24, 2024
c5faf56
[PlaybackSerialiser] Improved error handling
ScribbleTAS Jul 24, 2024
b54196a
[VirtualInput] Fixed player being able to turn during playback
ScribbleTAS Jul 26, 2024
cc86838
[Gui] Added more info to InfoHud
ScribbleTAS Jul 26, 2024
c8649a1
[Gui] Added camera rotation to InfoHud
ScribbleTAS Jul 27, 2024
030e215
[Savestates] Trying to fix crashes and errors
ScribbleTAS Jul 27, 2024
1af74d5
[Savestates] Fixed camera not being correctly applied after loadstate
ScribbleTAS Jul 27, 2024
d2e219d
[Savestates] Reintroduced savestates at the end of the tick
ScribbleTAS Jul 27, 2024
319b82d
[Savestates] Fixed chunks being not loaded after loading a savestate
ScribbleTAS Jul 28, 2024
f0f58d8
[PlaybackSerialiser] Fixed the ability to add a wrong flavorname as t…
ScribbleTAS Jul 28, 2024
c9ae630
[Savestates] Fixed loadstate during recording not loading metadata
ScribbleTAS Jul 28, 2024
74a00e4
[Savestates] Removed weird lag after loadstate during tr0
ScribbleTAS Jul 28, 2024
765459b
Removed "savestates are broken" warnings from the chat
ScribbleTAS Jul 28, 2024
ee49c66
[Savestates] Clearing tickListEntries on loadstate
ScribbleTAS Aug 1, 2024
bd9c27c
[Savestates] Refactored classes
ScribbleTAS Aug 13, 2024
6ccc968
[MCTCommon] Added AbstractDataFile
ScribbleTAS Aug 20, 2024
34a6970
[Savestate] Switched to paths instead of files
ScribbleTAS Aug 21, 2024
b6d43be
[Savestates] Add proper storage of tickListEntries
ScribbleTAS Dec 4, 2024
781dc25
Update gradle workflow version
ScribbleTAS Dec 4, 2024
a20ce2b
Add release.yml
ScribbleTAS Dec 5, 2024
8478c59
[Savestates] Add warning when tickListEntries file is missing
ScribbleTAS Dec 6, 2024
c0291c8
[Savestates] Fix player chunk map having duplicate entries
ScribbleTAS Dec 7, 2024
ec9faf3
[Savestates] Fix loading across dimensions failing on first try
ScribbleTAS Dec 7, 2024
daaabd6
[Savestates] Fix portal not generating when changing dimensions
ScribbleTAS Dec 7, 2024
d50e2b5
[Savestates] Fix potion effect showing after loading across dimensions
ScribbleTAS Dec 7, 2024
0c0131d
[Savestates] Add scoreboard storing
ScribbleTAS Dec 7, 2024
2b58b1e
[Savestates] Use vanilla world loading
ScribbleTAS Dec 8, 2024
f5bae49
[Savestates] Fix/add savestate events on the client
ScribbleTAS Dec 8, 2024
d9ab780
[Savestates] Fix error handling further crashing the game
ScribbleTAS Dec 8, 2024
1ce07c9
[Savestates] Trying things
ScribbleTAS Dec 8, 2024
5dc9725
[Savestates] Fix player not being updated
ScribbleTAS Dec 10, 2024
0803451
[Savestates] Fix entities being duplicated after loadstate
ScribbleTAS Dec 11, 2024
bc5418c
[Savestates] Fix issues after loading across dimensions
ScribbleTAS Dec 11, 2024
460a04d
[MCTCommon] Add save to json to data file
ScribbleTAS Dec 12, 2024
7d6fe51
[Savestates] Start rewriting player motion
ScribbleTAS Dec 12, 2024
8001f4b
[Savestates] Finish implementing player motion
ScribbleTAS Dec 13, 2024
528331e
Fix documentation of SAVESTATE_CLEAR_SCOREBOARD in TASmodPackets
ScribbleTAS Dec 13, 2024
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
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
with:
gradle-version: 8.6
gradle-version: 8.10.2
- name: Build TASmod with Gradle
run: gradle build
- name: Upload Test Report
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/buildandupload.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
with:
gradle-version: 8.6
gradle-version: 8.10.2
- name: Build TASmod with Gradle
run: gradle build
- name: Upload artifact
Expand Down
31 changes: 31 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Create Release
on:
release:
types: [published]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Java
uses: actions/setup-java@v4
with:
java-version: '22'
distribution: 'temurin'
architecture: x64
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
with:
gradle-version: 8.10.2
- name: Setup workspace
run: gradle build -Prelease=true
- name: Upload assets
uses: softprops/action-gh-release@v2
with:
files: 'build/libs/!(-@(dev|sources|javadoc|all)).jar'
- name: Publish 1.12.2
uses: Kir-Antipov/[email protected]
with:
files: 'build/libs/*-1.12.2-*!(*-@(dev|sources|javadoc|all)).jar'
modrinth-token: ${{ secrets.MODRINTH_TOKEN }}
curseforge-token: ${{ secrets.CURSEFORGE_TOKEN }}
20 changes: 12 additions & 8 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,28 @@ plugins {
id 'fabric-loom' version "${loom_version}"
// legacy looming (loom plugin improvements)
id 'legacy-looming' version "${loom_version}"
id 'com.palantir.git-version' version '3.1.0'
}


// set basic properties
version = project.version
def hash = ""
if(project.release=="false") {
hash = "-SNAPSHOT_"+versionDetails().gitHash.substring(0,7)
}
version = project.version+hash
group = project.group

// compile for java 8
sourceCompatibility = targetCompatibility = JavaVersion.VERSION_1_8
java {
// compile for java 8
sourceCompatibility = targetCompatibility = 8
}

loom {
// set access widener
accessWidenerPath = file('src/main/resources/tasmod.accesswidener')
// add log4jconfig
log4jConfigs.from(file('src/main/resources/log4j.xml'))

}

// dependency repositories
Expand Down Expand Up @@ -52,8 +58,6 @@ dependencies {
testImplementation 'org.junit.jupiter:junit-jupiter:5.10.0'
}



// task for downloading KillTheRng
//task downloadKTRNG(type: Copy) {
//group 'tasmod'
Expand All @@ -62,15 +66,15 @@ dependencies {
//into 'run/mods/'
//}

compileJava{
compileJava {
options.release = 8
}

// process fabric mod json
processResources {
inputs.property "version", project.version
inputs.property "mcversion", project.minecraft_version

filesMatching("fabric.mod.json") {
expand 'mod_url': project.mod_url, 'name': project.mod_name, 'mod_version': project.version, 'mod_description': project.mod_description, 'mod_sources': project.mod_sources, 'mod_email': project.mod_email
}
Expand Down
7 changes: 4 additions & 3 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ org.gradle.jvmargs=-Xmx3G

# Fabric properties
minecraft_version=1.12.2
loader_version=0.15.9
loom_version=1.6-SNAPSHOT
loader_version=0.16.9
loom_version=1.8-SNAPSHOT

# Mod properties
mod_name=Tool-Assisted Speedrun Mod
Expand All @@ -16,4 +16,5 @@ [email protected]
# TASmod properties
group=com.minecrafttas
artifact=TASmod-1.12.2
version=Beta1.0-SNAPSHOT
version=Beta1.0
release=false
123 changes: 23 additions & 100 deletions src/main/java/com/minecrafttas/mctcommon/Configuration.java
Original file line number Diff line number Diff line change
@@ -1,116 +1,45 @@
package com.minecrafttas.mctcommon;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.InvalidPropertiesFormatException;
import java.util.LinkedHashMap;
import java.util.List;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.Properties;

import com.minecrafttas.mctcommon.Configuration.ConfigOptions;
import com.minecrafttas.mctcommon.registry.AbstractRegistry;
import com.minecrafttas.mctcommon.registry.Registerable;
import com.minecrafttas.mctcommon.ConfigurationRegistry.ConfigOptions;
import com.minecrafttas.mctcommon.file.AbstractDataFile;

/**
* A <i>very</i> simple configuration class
*
* @author Scribble
*/

public class Configuration extends AbstractRegistry<ConfigOptions> {
public class Configuration extends AbstractDataFile {

private File file;
private ConfigurationRegistry registry;

private Properties properties;

private String comment;

public Configuration(String comment, File configFile) {
super("Configuration", new LinkedHashMap<>());

file = configFile;
this.comment = comment;
public Configuration(String comment, Path configFile, ConfigurationRegistry registry) {
super(configFile, "config", comment);
this.registry = registry;
}

protected final List<ConfigOptions> configRegistry = new ArrayList<>();

@Override
public void register(ConfigOptions registryObject) {
if(registryObject == null) {
return;
}

if(configRegistry.contains(registryObject)) {
return;
}

configRegistry.add(registryObject);
}

@Override
public void unregister(ConfigOptions registryObject) {
if (registryObject == null) {
return;
}

if (!configRegistry.contains(registryObject)) {
return;
}

configRegistry.remove(registryObject);
}

public void load() {
if (file.exists()) {
properties = loadInner();
public void loadFromXML() {
if (Files.exists(file)) {
loadFromXML(file);
}
if (properties == null || !file.exists()) {
if (properties == null || !Files.exists(file)) {
properties = generateDefault();
save();
}
}

private Properties loadInner() {
FileInputStream fis;
Properties newProp = new Properties();
try {
fis = new FileInputStream(file);
newProp.loadFromXML(fis);
fis.close();
} catch (InvalidPropertiesFormatException e) {
MCTCommon.LOGGER.error("The config file could not be read", e);
return null;
} catch (FileNotFoundException e) {
MCTCommon.LOGGER.warn("No config file found: {}", file);
return null;
} catch (IOException e) {
MCTCommon.LOGGER.error("An error occured while reading the config", e);
return null;
}
return newProp;
}

public void save() {
save(file);
}

public void save(File file) {
try {
FileOutputStream fos = new FileOutputStream(file);
properties.storeToXML(fos, comment, "UTF-8");
fos.close();
} catch (IOException e) {
e.printStackTrace();
saveToXML();
}
}

/**
* Generates the default property list from the values provided in {@link #registry}
* @return The default property list
*/
public Properties generateDefault() {
Properties newProperties = new Properties();
configRegistry.forEach((configOption)->{
registry.getConfigRegistry().forEach((configOption) -> {
newProperties.put(configOption.getConfigKey(), configOption.getDefaultValue());
});
return newProperties;
Expand All @@ -121,6 +50,7 @@ public String get(ConfigOptions configOption) {
}

public int getInt(ConfigOptions configOption) {
// TODO Add config exception or something... NumberFormatExceptions all around...
return Integer.parseInt(get(configOption));
}

Expand All @@ -133,11 +63,11 @@ public boolean has(ConfigOptions configOption) {
}

public void set(ConfigOptions configOption, String value) {
if(properties == null) {
if (properties == null) {
throw new NullPointerException("Config needs to be loaded first, before trying to set a value");
}
properties.setProperty(configOption.getConfigKey(), value);
save();
saveToXML();
}

public void set(ConfigOptions configOption, int value) {
Expand All @@ -156,13 +86,6 @@ public void reset(ConfigOptions configOption) {

public void delete(ConfigOptions configOption) {
properties.remove(configOption);
save();
}

public interface ConfigOptions extends Registerable {

public String getDefaultValue();

public String getConfigKey();
saveToXML();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
package com.minecrafttas.mctcommon;

import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;

import com.minecrafttas.mctcommon.ConfigurationRegistry.ConfigOptions;
import com.minecrafttas.mctcommon.registry.AbstractRegistry;
import com.minecrafttas.mctcommon.registry.Registerable;

public class ConfigurationRegistry extends AbstractRegistry<ConfigOptions> {

protected final List<ConfigOptions> configRegistry = new ArrayList<>();

public ConfigurationRegistry() {
super("Configuration", new LinkedHashMap<>());
}

@Override
public void register(ConfigOptions registryObject) {
if (registryObject == null) {
return;
}

if (configRegistry.contains(registryObject)) {
return;
}

configRegistry.add(registryObject);
}

@Override
public void unregister(ConfigOptions registryObject) {
if (registryObject == null) {
return;
}

if (!configRegistry.contains(registryObject)) {
return;
}

configRegistry.remove(registryObject);
}

public List<ConfigOptions> getConfigRegistry() {
return configRegistry;
}

/**
* <p>Interface for registering your own options in the TASmod config
*
* @see com.minecrafttas.tasmod.registries.TASmodConfig TASmodConfig
* @author Scribble
*/
public interface ConfigOptions extends Registerable {
/**
* @return The config key name that is stored in the file
*/
public String getConfigKey();

/**
* @return The default value that is used if the config key doesn't exist yet
*/
public String getDefaultValue();
}
}
8 changes: 4 additions & 4 deletions src/main/java/com/minecrafttas/mctcommon/MCTCommon.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@

public class MCTCommon {
public static final Logger LOGGER = LogManager.getLogger("MCTCommon");

public static final Marker Event = MarkerManager.getMarker("Event");

public static final Marker Server = MarkerManager.getMarker("Server");

public static final Marker Client = MarkerManager.getMarker("Client");

public static final Marker Timeout = MarkerManager.getMarker("Timeout");

}
Loading
Loading