Skip to content
This repository has been archived by the owner on Sep 30, 2024. It is now read-only.

Commit

Permalink
Fix switching pages not working
Browse files Browse the repository at this point in the history
  • Loading branch information
Patbox committed Apr 2, 2022
1 parent 904c79f commit 1baf8f3
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 21 deletions.
34 changes: 17 additions & 17 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
plugins {
id 'fabric-loom' version '0.11-SNAPSHOT'
id 'maven-publish'
id "com.modrinth.minotaur" version "1.2.1"
id "com.modrinth.minotaur" version "2.+"
//id 'com.matthewprenger.cursegradle' version '1.4.0'
}
import com.modrinth.minotaur.TaskModrinthUpload
import com.modrinth.minotaur.request.VersionType

sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
Expand All @@ -30,9 +28,9 @@ dependencies {

modCompileOnly 'curse.maven:repurposed-structures-fabric-391366:3542863'

modImplementation include("eu.pb4:sgui:1.0.0+1.18.1")
modImplementation include("eu.pb4:sgui:1.0.1+1.18.2")
modImplementation include("eu.pb4:hologram-api:0.2.1+1.18-pre5")
modImplementation include("eu.pb4:polymer:0.2.0-beta.29+1.18.2")
modImplementation include("eu.pb4:polymer:0.2.0-beta.36+1.18.2")
modImplementation include("fr.catcore:server-translations-api:1.4.9+1.18.2-rc1")
}

Expand Down Expand Up @@ -98,18 +96,20 @@ publishing {
}
}*/

task publishModrinth (type: TaskModrinthUpload){
onlyIf {
System.getenv("MODRINTH")
if (System.getenv("MODRINTH")) {
modrinth {
token = System.getenv("MODRINTH")
projectId = 'gU9Ao8K2'
versionNumber = version
versionType = "release"
changelog = System.getenv("CHANGELOG")
// On fabric, use 'remapJar' instead of 'jar'
uploadFile = remapJar
gameVersions = [((String) project.minecraft_version)]
loaders = ["fabric"]
}

token = System.getenv("MODRINTH")
projectId = 'gU9Ao8K2'
versionNumber = version
versionType = VersionType.RELEASE
changelog = System.getenv("CHANGELOG")
// On fabric, use 'remapJar' instead of 'jar'
uploadFile = remapJar
addGameVersion((String) project.minecraft_version)
addLoader('fabric')
remapJar {
finalizedBy project.tasks.modrinth
}
}
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@ archives_base_name=wraith-waystones
# currently not on the main fabric site, check on the maven: https://maven.fabricmc.net/net/fabricmc/fabric-api/fabric-api
fabric_version=0.47.8+1.18.2

sub_version=0
sub_version=1

11 changes: 8 additions & 3 deletions src/main/java/wraith/waystones/gui/UniversalWaystoneGui.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import net.minecraft.text.Text;
import net.minecraft.text.TranslatableText;
import net.minecraft.util.Hand;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.registry.Registry;
import org.jetbrains.annotations.Nullable;
import wraith.waystones.Waystones;
Expand All @@ -27,6 +28,7 @@

import java.util.ArrayList;
import java.util.Comparator;
import java.util.Objects;
import java.util.function.Consumer;
import java.util.function.Predicate;

Expand Down Expand Up @@ -129,7 +131,7 @@ protected void updateDisplay() {
private void updateWaystones() {
this.sortedWaystones = new ArrayList<>();
if (((PlayerEntityMixinAccess) player).shouldViewDiscoveredWaystones()) {
this.sortedWaystones.addAll(((PlayerAccess) player).getHashesSorted());
this.sortedWaystones.addAll(((PlayerEntityMixinAccess) player).getDiscoveredWaystones());
}
if (((PlayerEntityMixinAccess) player).shouldViewGlobalWaystones()) {
for (String waystone : Waystones.WAYSTONE_STORAGE.getGlobals()) {
Expand All @@ -138,12 +140,15 @@ private void updateWaystones() {
}
}
}
this.sortedWaystones.sort(Comparator.comparing(a -> Waystones.WAYSTONE_STORAGE.getWaystoneData(a).getWaystoneName()));
this.sortedWaystones.sort(Comparator.comparing(a -> {
var data = Waystones.WAYSTONE_STORAGE.getWaystoneData(a);
return data != null ? data.getWaystoneName() : "";
}));
}

@Override
protected int getPageAmount() {
return this.sortedWaystones.size() / PAGE_SIZE;
return MathHelper.ceil(this.sortedWaystones.size() / (double) PAGE_SIZE);
}

@Override
Expand Down

0 comments on commit 1baf8f3

Please sign in to comment.