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
68 changes: 35 additions & 33 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
plugins {
// loom plugin
id "fabric-loom" version "${loom_version}"
// legacy looming (loom plugin improvements)
id "legacy-looming" version "${loom_version}"
id "com.palantir.git-version" version "4.2.0"
id "com.diffplug.spotless" version "8.1.0"
id "fabric-loom" version "${loom_version}"
id "ploceus" version "${loom_version}"
id "com.palantir.git-version" version "4.2.0"
id "com.diffplug.spotless" version "8.1.0"
}


// set basic properties
def hash = ""
if(project.release=="false") {
Expand All @@ -34,34 +32,38 @@ loom {

// dependency repositories
repositories {
mavenCentral()
maven { url = "https://maven.minecrafttas.com/main" }
//maven { url = "https://maven.minecrafttas.com/snapshots" }
maven { url = "https://raw.githubusercontent.com/BleachDev/cursed-mappings/main/" }
maven { url = "https://jitpack.io" }
maven { url = "https://repo.spongepowered.org/maven" }
mavenCentral()
maven { url = "https://maven.minecrafttas.com/main" }
maven { url = "https://maven.legacyfabric.net/" }
//maven { url = "https://maven.minecrafttas.com/snapshots" }
maven { url = "https://jitpack.io" }
maven { url = "https://repo.spongepowered.org/maven" }
}

// dependency configurations
configurations {
// embed dependency included in build
implementation.extendsFrom(embed)
// embed dependency included in build
implementation.extendsFrom(embed)
}

ploceus {
setIntermediaryGeneration(2)
}

// dependencies
dependencies {
// tasmod dependencies
embed "com.dselent:bigarraylist:1.6"
embed "com.github.KaptainWutax:SeedUtils:b6a383113c"
// tasmod dependencies
embed "com.dselent:bigarraylist:1.6"
embed "com.github.KaptainWutax:SeedUtils:b6a383113c"

// loom dependencies
minecraft "com.mojang:minecraft:${project.minecraft_version}"
mappings "net.legacyfabric:yarn:${project.minecraft_version}+build.mcp"
minecraft "com.mojang:minecraft:${project.minecraft_version}"
mappings ploceus.mcpMappings(project.mcp_channel, project.mcp_mcversion, project.mcp_build)
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"

// testing dependencies
testImplementation "org.junit.jupiter:junit-jupiter:5.14.1"
testRuntimeOnly "org.junit.platform:junit-platform-launcher"
testImplementation "org.junit.jupiter:junit-jupiter:5.14.1"
testRuntimeOnly "org.junit.platform:junit-platform-launcher"
}


Expand All @@ -71,12 +73,12 @@ compileJava {

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

// configure jar file
Expand All @@ -85,14 +87,14 @@ jar {
// pack embedded stuff
from {
configurations.embed.collect { it.isDirectory() ? it : zipTree(it) }
} {
exclude "LICENSE.txt", "META-INF/MANIFSET.MF", "META-INF/maven/**", "META-INF/*.RSA", "META-INF/*.SF"
} {
exclude "LICENSE.txt", "META-INF/MANIFSET.MF", "META-INF/maven/**", "META-INF/*.RSA", "META-INF/*.SF"
}
}

// configure testing
tasks.named("test", Test) {
useJUnitPlatform()
useJUnitPlatform()

testLogging {
events "passed", "skipped", "failed"
Expand All @@ -103,8 +105,8 @@ spotless {
encoding "UTF-8"
lineEndings "UNIX"
java {
importOrderFile("formatter/TASmodImportorder.txt")
eclipse().configFile("formatter/TASmodFormatter.xml")
importOrderFile("formatter/TASmodImportorder.txt")
eclipse().configFile("formatter/TASmodFormatter.xml")
}
enforceCheck false
}
5 changes: 4 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@ org.gradle.jvmargs=-Xmx3G
# Fabric properties
minecraft_version=1.12.2
loader_version=0.18.4
loom_version=1.14-SNAPSHOT
loom_version=1.15-SNAPSHOT
mcp_channel=stable
mcp_build=39
mcp_mcversion=1.12

# Mod properties
mod_name=Tool-Assisted Speedrun Mod
Expand Down
3 changes: 2 additions & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ pluginManagement {
repositories {
maven { url = "https://maven.minecrafttas.com/main" }
maven { url = "https://maven.fabricmc.net/" }
maven { url = "https://repo.legacyfabric.net/repository/legacyfabric/" }
maven { url = "https://maven.ornithemc.net/releases" }
maven { url = "https://maven.ornithemc.net/snapshots" }
mavenCentral()
gradlePluginPortal()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@
@Mixin(NetHandlerPlayClient.class)
public class MixinNetHandlerPlayClient {
@Shadow
private Minecraft gameController;
private Minecraft client;

@Inject(method = "handleJoinGame", at = @At(value = "RETURN"))
public void clientJoinServerEvent(CallbackInfo ci) throws ConnectException {
EventListenerRegistry.fireEvent(EventPlayerJoinedClientSide.class, gameController.player);
EventListenerRegistry.fireEvent(EventPlayerJoinedClientSide.class, client.player);
}

@Inject(method = "handlePlayerListItem", at = @At(value = "HEAD"))
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/com/minecrafttas/tasmod/TASmodClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,9 @@ public class TASmodClient implements ClientModInitializer, EventClientInit, Even

public static TickSyncClient ticksyncClient;

public final static Path tasfiledirectory = Minecraft.getMinecraft().mcDataDir.toPath().resolve("saves").resolve("tasfiles");
public final static Path tasfiledirectory = Minecraft.getMinecraft().gameDir.toPath().resolve("saves").resolve("tasfiles");

public final static Path savestatedirectory = Minecraft.getMinecraft().mcDataDir.toPath().resolve("saves").resolve("savestates");
public final static Path savestatedirectory = Minecraft.getMinecraft().gameDir.toPath().resolve("saves").resolve("savestates");

public static InfoHud hud;

Expand Down Expand Up @@ -353,7 +353,7 @@ private void registerConfigValues() {
}

private void loadConfig(Minecraft mc) {
Path configDir = mc.mcDataDir.toPath().resolve("config");
Path configDir = mc.gameDir.toPath().resolve("config");
if (!Files.exists(configDir)) {
try {
Files.createDirectory(configDir);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public List<String> getTabCompletions(MinecraftServer server, ICommandSender sen

public List<String> getFilenames() {
List<String> tab = new ArrayList<String>();
File folder = new File(Minecraft.getMinecraft().mcDataDir, "saves" + File.separator + "tasfiles");
File folder = new File(Minecraft.getMinecraft().gameDir, "saves" + File.separator + "tasfiles");
File[] listOfFiles = folder.listFiles(new FileFilter() {
@Override
public boolean accept(File pathname) {
Expand Down
13 changes: 6 additions & 7 deletions src/main/java/com/minecrafttas/tasmod/gui/InfoHud.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
import com.minecrafttas.tasmod.playback.filecommands.builtin.DesyncMonitorFileCommandExtension;
import com.minecrafttas.tasmod.virtual.VirtualInput;
import com.minecrafttas.tasmod.virtual.VirtualInterpolationHandler.MouseInterpolation;
import com.mojang.realmsclient.gui.ChatFormatting;

import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiScreen;
Expand Down Expand Up @@ -199,7 +198,7 @@ private void saveConfig() {
return;
}
try {
File tasmodDir = new File(Minecraft.getMinecraft().mcDataDir, "tasmod");
File tasmodDir = new File(Minecraft.getMinecraft().gameDir, "tasmod");
tasmodDir.mkdir();
File configFile = new File(tasmodDir, "infogui2.cfg");
if (!configFile.exists())
Expand Down Expand Up @@ -228,7 +227,7 @@ public boolean checkInit() {
try {
configuration = new Properties();
if (!resetLayout) {
File tasmodDir = new File(Minecraft.getMinecraft().mcDataDir, "tasmod");
File tasmodDir = new File(Minecraft.getMinecraft().gameDir, "tasmod");
tasmodDir.mkdir();
File configFile = new File(tasmodDir, "infogui2.cfg");
if (!configFile.exists())
Expand Down Expand Up @@ -368,17 +367,17 @@ public boolean checkInit() {
return "State";
} else {
TASstate state = TASmodClient.controller.getState();
ChatFormatting format = ChatFormatting.WHITE;
TextFormatting format = TextFormatting.WHITE;
String out = "";
if (state == TASstate.PLAYBACK) {
out = "Playback";
format = ChatFormatting.GREEN;
format = TextFormatting.GREEN;
} else if (state == TASstate.RECORDING) {
out = "Recording";
format = ChatFormatting.RED;
format = TextFormatting.RED;
} else if (state == TASstate.PAUSED) {
out = "Paused";
format = ChatFormatting.YELLOW;
format = TextFormatting.YELLOW;
} else if (state == TASstate.NONE) {
out = "";
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import java.util.Queue;
import java.util.concurrent.FutureTask;

import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
Expand Down Expand Up @@ -52,9 +53,11 @@ public long redirectMathMax(long oneLong, long i) {
@Shadow
private long currentTime;

@Final
@Shadow
private Queue<FutureTask<?>> futureTaskQueue;

@Final
@Shadow
private NetworkSystem networkSystem;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.minecrafttas.tasmod.mixin.playbackhooks;

import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
Expand Down Expand Up @@ -37,6 +38,7 @@
@Mixin(EntityRenderer.class)
public class MixinEntityRenderer implements SubtickDuck {

@Final
@Shadow
private Minecraft mc;
@Shadow
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,21 +20,21 @@
public class MixinChunkProviderClient implements ChunkProviderDuck {
@Shadow
@Final
private Long2ObjectMap<Chunk> chunkMapping;
private Long2ObjectMap<Chunk> loadedChunks;

/**
* <p>Unloads chunk data on the client.
* <p>This step is necessary as not doing this, will create phantom blocks on the client, with strange behaviour.
*/
@Override
public void unloadAllChunks() {
ObjectIterator<?> objectiterator = this.chunkMapping.values().iterator();
ObjectIterator<?> objectiterator = this.loadedChunks.values().iterator();

while (objectiterator.hasNext()) {
Chunk chunk = (Chunk) objectiterator.next();
chunk.onUnload();
}
chunkMapping.clear();
loadedChunks.clear();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public abstract class MixinChunkProviderServer implements ChunkProviderDuck {
*/
@Shadow
@Final
private Long2ObjectMap<Chunk> id2ChunkMap;
private Long2ObjectMap<Chunk> loadedChunks;

/**
* <p>Saves and unloads chunk data.
Expand All @@ -34,15 +34,15 @@ public abstract class MixinChunkProviderServer implements ChunkProviderDuck {
*/
@Override
public void unloadAllChunks() {
ObjectIterator<?> objectiterator = this.id2ChunkMap.values().iterator();
ObjectIterator<?> objectiterator = this.loadedChunks.values().iterator();

while (objectiterator.hasNext()) {
Chunk chunk = (Chunk) objectiterator.next();
this.saveChunkData(chunk);
this.saveChunkExtraData(chunk);
chunk.onUnload();
}
id2ChunkMap.clear();
loadedChunks.clear();
}

@Shadow
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
import com.minecrafttas.tasmod.util.Ducks.ChunkProviderDuck;
import com.minecrafttas.tasmod.util.Ducks.WorldClientDuck;
import com.minecrafttas.tasmod.util.LoggerMarkers;
import com.mojang.realmsclient.gui.ChatFormatting;

import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
Expand All @@ -37,6 +36,7 @@
import net.minecraft.client.multiplayer.ChunkProviderClient;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.text.TextComponentString;
import net.minecraft.util.text.TextFormatting;
import net.minecraft.world.chunk.Chunk;

/**
Expand Down Expand Up @@ -93,7 +93,7 @@ public void onClientLoadstateComplete() {
LOGGER.trace(LoggerMarkers.Savestate, "Add player {} to loaded entity list", player.getName());
int i = MathHelper.floor(player.posX / 16.0D);
int j = MathHelper.floor(player.posZ / 16.0D);
Chunk chunk = Minecraft.getMinecraft().world.getChunkFromChunkCoords(i, j);
Chunk chunk = Minecraft.getMinecraft().world.getChunk(i, j);
for (int k = 0; k < chunk.getEntityLists().length; k++) {
if (chunk.getEntityLists()[k].contains(player)) {
return;
Expand Down Expand Up @@ -181,8 +181,8 @@ public static void loadstate(String nameOfSavestate) throws Exception {
savestateContainerList = PlaybackSerialiser.loadFromFile(targetfile, state != TASstate.PLAYBACK);
} else {
controller.setTASStateClient(TASstate.NONE, false);
Minecraft.getMinecraft().player.sendMessage(new TextComponentString(ChatFormatting.YELLOW + "Inputs could not be loaded for this savestate,"));
Minecraft.getMinecraft().player.sendMessage(new TextComponentString(ChatFormatting.YELLOW + "since the file doesn't exist. Stopping!"));
Minecraft.getMinecraft().player.sendMessage(new TextComponentString(TextFormatting.YELLOW + "Inputs could not be loaded for this savestate,"));
Minecraft.getMinecraft().player.sendMessage(new TextComponentString(TextFormatting.YELLOW + "since the file doesn't exist. Stopping!"));
LOGGER.warn(LoggerMarkers.Savestate, "Inputs could not be loaded for this savestate, since the file doesn't exist.");
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public void addPlayerToServerChunk(EntityPlayerMP player) {
int i = MathHelper.floor(player.posX / 16.0D);
int j = MathHelper.floor(player.posZ / 16.0D);
WorldServer world = player.getServerWorld();
Chunk chunk = world.getChunkFromChunkCoords(i, j);
Chunk chunk = world.getChunk(i, j);
for (int k = 0; k < chunk.getEntityLists().length; k++) {
if (chunk.getEntityLists()[k].contains(player)) {
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ private String getShieldName(String uuid) {

@Deprecated
private Map<String, String> downloadNames() {
File feil = new File(Minecraft.getMinecraft().mcDataDir + File.separator + "playerstt.txt");
File feil = new File(Minecraft.getMinecraft().gameDir + File.separator + "playerstt.txt");
URL url;
Map<String, String> uuids = Maps.<String, String>newHashMap();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ public void onClientPacket(PacketID id, ByteBuffer buf, String username) throws

private List<String> getFilenames() {
List<String> tab = new ArrayList<String>();
File folder = new File(Minecraft.getMinecraft().mcDataDir, "saves" + File.separator + "tasfiles");
File folder = new File(Minecraft.getMinecraft().gameDir, "saves" + File.separator + "tasfiles");

File[] listOfFiles = folder.listFiles(new FileFilter() {
@Override
Expand Down
6 changes: 5 additions & 1 deletion src/main/resources/tasmod.accesswidener
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,8 @@ accessible field net/minecraft/world/World worldInfo Lnet/minecraft/world/storag

accessible method net/minecraft/world/storage/SaveHandler setSessionLock ()V

accessible field net/minecraft/client/settings/KeyBinding CATEGORY_ORDER Ljava/util/Map;
accessible field net/minecraft/client/settings/KeyBinding CATEGORY_ORDER Ljava/util/Map;

accessible method net/minecraft/server/MinecraftServer saveAllWorlds (Z)V
accessible method net/minecraft/server/MinecraftServer convertMapIfNeeded (Ljava/lang/String;)V
accessible method net/minecraft/server/MinecraftServer setResourcePackFromWorld (Ljava/lang/String;Lnet/minecraft/world/storage/ISaveHandler;)V
Loading