Skip to content

Commit

Permalink
Migrated to Minecraft v1.19.4
Browse files Browse the repository at this point in the history
  • Loading branch information
MehradN committed Mar 16, 2023
1 parent 213f15a commit bd7a03e
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 16 deletions.
5 changes: 3 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,11 @@ repositories {

dependencies {
minecraft "com.mojang:minecraft:${project.minecraft_version}"
mappings loom.layered() {
mappings loom.officialMojangMappings()
/*mappings loom.layered() {
officialMojangMappings()
parchment("org.parchmentmc.data:parchment-${project.minecraft_version}:${project.parchment_version}@zip")
}
}*/

implementation "com.github.LlamaLad7:MixinExtras:${project.mixin_extras_version}"
annotationProcessor "com.github.LlamaLad7:MixinExtras:${project.mixin_extras_version}"
Expand Down
12 changes: 6 additions & 6 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@ org.gradle.parallel=true

# Fabric Properties
# check these on https://fabricmc.net/develop
minecraft_version=1.19.3
parchment_version=2023.02.26
loader_version=0.14.14
minecraft_version=1.19.4
#parchment_version=2023.02.26
loader_version=0.14.17

# Mod Properties
mod_version=0.6.0
mod_version=0.7.0
maven_group=ir.mehradn
archives_base_name=rollback

# Dependencies
mixin_extras_version=0.1.1
fabric_version=0.74.0+1.19.3
midnightlib_version=1.1.0-fabric
fabric_version=0.76.0+1.19.4
midnightlib_version=1.2.1-fabric
17 changes: 16 additions & 1 deletion src/main/java/ir/mehradn/rollback/gui/RollbackScreen.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,17 @@
import ir.mehradn.rollback.util.mixin.WorldSelectionListCallbackAction;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.FileUtil;
import net.minecraft.Util;
import net.minecraft.client.gui.components.Button;
import net.minecraft.client.gui.components.CycleButton;
import net.minecraft.client.gui.screens.Screen;
import net.minecraft.network.chat.Component;
import net.minecraft.world.level.storage.LevelStorageSource;
import net.minecraft.world.level.storage.LevelSummary;

import java.io.IOException;
import java.nio.file.Path;
import java.util.function.Consumer;

@Environment(EnvType.CLIENT)
Expand Down Expand Up @@ -84,7 +88,18 @@ protected void init() {
));
addRenderableWidget(Button.builder(
Component.translatable("selectWorld.edit.backupFolder"),
(button) -> Util.getPlatform().openFile(this.minecraft.getLevelSource().getBackupPath().toFile())
(button) -> {
LevelStorageSource levelStorageSource = this.minecraft.getLevelSource();
Path path = levelStorageSource.getBackupPath();

try {
FileUtil.createDirectoriesSafe(path);
} catch (IOException e) {
throw new RuntimeException(e);
}

Util.getPlatform().openFile(path.toFile());
}
).bounds(this.width / 2 + 4, this.height - 52, 150, 20).build());

this.deleteButton = addRenderableWidget(Button.builder(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ private Button hideButton(Button btn) {
return btn;
}

@Inject(method = "init", at = @At(value = "INVOKE", ordinal = 0, target = "Lnet/minecraft/client/gui/screens/worldselection/SelectWorldScreen;updateButtonStatus(Z)V"))
@Inject(method = "init", at = @At(value = "INVOKE", ordinal = 0, target = "Lnet/minecraft/client/gui/screens/worldselection/SelectWorldScreen;updateButtonStatus(ZZ)V"))
private void addButton(CallbackInfo ci) {
if (RollbackConfig.replaceReCreateButton()) {
this.rollbackButton = addRenderableWidget(Button.builder(
Expand All @@ -51,7 +51,8 @@ private void addButton(CallbackInfo ci) {
}

@Inject(method = "updateButtonStatus", at = @At("RETURN"))
private void onUpdateButtonStatus(boolean active, CallbackInfo ci) {
this.rollbackButton.active = active;
private void onUpdateButtonStatus(boolean isPlayable, boolean isSelectable , CallbackInfo ci) {
if (RollbackConfig.replaceReCreateButton())
this.rollbackButton.active = isPlayable;
}
}
8 changes: 4 additions & 4 deletions src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@
"rollback.mixins.json"
],
"depends": {
"fabricloader": ">=0.14.14",
"minecraft": "~1.19.3",
"fabricloader": ">=0.14.17",
"minecraft": "~1.19.4",
"java": ">=17",
"fabric-api": ">=0.74.0+1.19.3",
"midnightlib": ">=1.1.0-fabric"
"fabric-api": ">=0.76.0+1.19.4",
"midnightlib": ">=1.2.1-fabric"
}
}

0 comments on commit bd7a03e

Please sign in to comment.