Skip to content

Commit

Permalink
Update to 1.20.4
Browse files Browse the repository at this point in the history
  • Loading branch information
Patbox committed Dec 19, 2023
1 parent 4c7e205 commit 4c3df9a
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 17 deletions.
10 changes: 5 additions & 5 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@ org.gradle.jvmargs=-Xmx1G

# Fabric Properties
# check these on https://fabricmc.net/versions.html
minecraft_version=1.20.2-rc2
yarn_mappings=1.20.2-rc2+build.2
loader_version=0.14.22
minecraft_version=1.20.4
yarn_mappings=1.20.4+build.1
loader_version=0.15.1

#Fabric api
fabric_version=0.89.0+1.20.2
fabric_version=0.91.1+1.20.4


# Mod Properties
mod_version = 1.3.0+1.20.2
mod_version = 1.5.0+1.20.4
maven_group = eu.pb4
archives_base_name = sgui

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package eu.pb4.sgui.api.elements;

import com.mojang.authlib.GameProfile;
import com.mojang.authlib.minecraft.MinecraftProfileTextures;
import eu.pb4.sgui.api.GuiHelpers;
import net.minecraft.enchantment.Enchantment;
import net.minecraft.enchantment.Enchantments;
Expand Down Expand Up @@ -266,7 +267,7 @@ public AnimatedGuiElementBuilder setSkullOwner(String value) {
*/
public AnimatedGuiElementBuilder setSkullOwner(GameProfile profile, @Nullable MinecraftServer server) {
if (profile.getId() != null && server != null) {
if (server.getSessionService().getTextures(profile, false).isEmpty()) {
if (server.getSessionService().getTextures(profile) == MinecraftProfileTextures.EMPTY) {
var tmp = server.getSessionService().fetchProfile(profile.getId(), false);
if (tmp != null) {
profile = tmp.profile();
Expand Down Expand Up @@ -355,7 +356,7 @@ public ItemStack asStack() {
NbtList loreItems = new NbtList();
for (Text l : this.lore) {
l = l.copy().styled(GuiHelpers.STYLE_CLEARER);
loreItems.add(NbtString.of(Text.Serializer.toJson(l)));
loreItems.add(NbtString.of(Text.Serialization.toJsonString(l)));
}
display.put("Lore", loreItems);
}
Expand Down
12 changes: 6 additions & 6 deletions src/main/java/eu/pb4/sgui/api/elements/BookElementBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public BookElementBuilder addPage(Text... lines) {
for (Text line : lines) {
text.append(line).append("\n");
}
this.getOrCreatePages().add(NbtString.of(Text.Serializer.toJson(text)));
this.getOrCreatePages().add(NbtString.of(Text.Serialization.toJsonString(text)));
return this;
}

Expand All @@ -70,7 +70,7 @@ public BookElementBuilder setPage(int index, Text... lines) {
for (Text line : lines) {
text.append(line).append("\n");
}
this.getOrCreatePages().set(index, NbtString.of(Text.Serializer.toJson(text)));
this.getOrCreatePages().set(index, NbtString.of(Text.Serialization.toJsonString(text)));
return this;
}

Expand Down Expand Up @@ -161,7 +161,7 @@ public ItemStack asStack() {
NbtList pages = this.getOrCreatePages();
for (int i = 0; i < pages.size(); i++) {
try {
pages.set(i, NbtString.of(Text.Serializer.fromLenientJson(pages.getString(i)).getString()));
pages.set(i, NbtString.of(Text.Serialization.fromLenientJson(pages.getString(i)).getString()));
} catch (Exception e) {
pages.set(i, NbtString.of("Invalid page data!"));
}
Expand Down Expand Up @@ -207,7 +207,7 @@ public static BookElementBuilder from(ItemStack book) {
if (book.getOrCreateNbt().contains("pages")) {
NbtList pages = book.getOrCreateNbt().getList("pages", NbtElement.STRING_TYPE);
for (NbtElement page : pages) {
builder.addPage(Text.Serializer.fromLenientJson(page.asString()));
builder.addPage(Text.Serialization.fromLenientJson(page.asString()));
}
}

Expand All @@ -230,7 +230,7 @@ public static Text getPageContents(ItemStack book, int index) {
if (book.getOrCreateNbt().contains("pages")) {
NbtList pages = book.getOrCreateNbt().getList("pages", NbtElement.STRING_TYPE);
if(index < pages.size()) {
return Text.Serializer.fromJson(pages.get(index).asString());
return Text.Serialization.fromJson(pages.get(index).asString());
}
}

Expand All @@ -247,7 +247,7 @@ public static Text getPageContents(ItemStack book, int index) {
public static Text getPageContents(BookElementBuilder book, int index) {
NbtList pages = book.getOrCreatePages();
if(index < pages.size()) {
return Text.Serializer.fromJson(pages.get(index).asString());
return Text.Serialization.fromJson(pages.get(index).asString());
}
return Text.literal("");
}
Expand Down
7 changes: 4 additions & 3 deletions src/main/java/eu/pb4/sgui/api/elements/GuiElementBuilder.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package eu.pb4.sgui.api.elements;

import com.mojang.authlib.GameProfile;
import com.mojang.authlib.minecraft.MinecraftProfileTextures;
import eu.pb4.sgui.api.GuiHelpers;
import net.minecraft.enchantment.Enchantment;
import net.minecraft.enchantment.Enchantments;
Expand Down Expand Up @@ -111,7 +112,7 @@ public static GuiElementBuilder from(ItemStack stack) {
}

public static List<Text> getLore(ItemStack stack) {
return stack.getOrCreateSubNbt("display").getList("Lore", NbtElement.STRING_TYPE).stream().map(tag -> Text.Serializer.fromJson(tag.asString())).collect(Collectors.toList());
return stack.getOrCreateSubNbt("display").getList("Lore", NbtElement.STRING_TYPE).stream().map(tag -> Text.Serialization.fromJson(tag.asString())).collect(Collectors.toList());
}

/**
Expand Down Expand Up @@ -273,7 +274,7 @@ public GuiElementBuilder unbreakable() {
*/
public GuiElementBuilder setSkullOwner(GameProfile profile, @Nullable MinecraftServer server) {
if (profile.getId() != null && server != null) {
if (server.getSessionService().getTextures(profile, false).isEmpty()) {
if (server.getSessionService().getTextures(profile) == MinecraftProfileTextures.EMPTY) {
var tmp = server.getSessionService().fetchProfile(profile.getId(), false);
if (tmp != null) {
profile = tmp.profile();
Expand Down Expand Up @@ -376,7 +377,7 @@ public ItemStack asStack() {
NbtList loreItems = new NbtList();
for (Text l : this.lore) {
l = l.copy().styled(GuiHelpers.STYLE_CLEARER);
loreItems.add(NbtString.of(Text.Serializer.toJson(l)));
loreItems.add(NbtString.of(Text.Serialization.toJsonString(l)));
}
display.put("Lore", loreItems);
}
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/eu/pb4/sgui/api/gui/SignGui.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import eu.pb4.sgui.virtual.FakeScreenHandler;
import eu.pb4.sgui.virtual.sign.VirtualSignBlockEntity;
import net.minecraft.block.AbstractSignBlock;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
Expand Down Expand Up @@ -104,7 +105,7 @@ public void setColor(DyeColor color) {
* @param type a block in the {@link BlockTags#SIGNS} tag
*/
public void setSignType(Block type) {
if (!type.getRegistryEntry().isIn(BlockTags.SIGNS)) {
if (!(type instanceof AbstractSignBlock)) {
throw new IllegalArgumentException("The type must be a sign");
}

Expand Down

0 comments on commit 4c3df9a

Please sign in to comment.