Skip to content

Commit

Permalink
Fabric loader 0.13 fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
BleachDev committed Mar 13, 2022
1 parent 29fd879 commit 17ad79d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
9 changes: 4 additions & 5 deletions src/main/java/org/bleachhack/gui/UpdateScreen.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import net.fabricmc.loader.api.FabricLoader;
import net.fabricmc.loader.impl.ModContainerImpl;
import net.minecraft.client.gui.screen.Screen;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.item.ItemStack;
Expand Down Expand Up @@ -43,7 +42,7 @@ public class UpdateScreen extends WindowScreen {

private WindowScrollbarWidget scrollbar;
private Set<WindowWidget> changelogWidgets = new HashSet<>();

private String updateResult = "";

public UpdateScreen(Screen parent, JsonObject updateJson) {
Expand Down Expand Up @@ -103,8 +102,8 @@ public void init() {

getWindow(0).addWidget(
new WindowButtonWidget(3, h - 21, w / 2 - 2, h - 3, "Website", () ->
Util.getOperatingSystem().open(URI.create("https://bleachhack.org/"))
));
Util.getOperatingSystem().open(URI.create("https://bleachhack.org/"))
));

getWindow(0).addWidget(
new WindowButtonWidget(w / 2 + 2, h - 21, w - 3, h - 3, "Update", () -> {
Expand All @@ -119,7 +118,7 @@ public void init() {
return;
}

File modpath = new File(((ModContainerImpl) FabricLoader.getInstance().getModContainer("bleachhack").get()).getOriginPath().toUri());
File modpath = new File(FabricLoader.getInstance().getModContainer("bleachhack").get().getOrigin().getPaths().get(0).toUri());

if (!modpath.isFile()) {
updateResult = "Invalid mod path!";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public Resource getResource(Identifier id) throws IOException {
return new ResourceImpl(id.getNamespace(), id, parseURL(id.getPath()), null);

// Scuffed resource loader
Path path = FabricLoader.getInstance().getModContainer(id.getNamespace()).get().getPath("assets/" + id.getNamespace() + "/" + id.getPath());
Path path = FabricLoader.getInstance().getModContainer(id.getNamespace()).get().findPath("assets/" + id.getNamespace() + "/" + id.getPath()).get();
return new ResourceImpl(id.getNamespace(), id, Files.newInputStream(path), null);
}

Expand Down

0 comments on commit 17ad79d

Please sign in to comment.