Skip to content

Commit

Permalink
Update to 1.20.6
Browse files Browse the repository at this point in the history
  • Loading branch information
okx-code committed Aug 18, 2024
1 parent 0e1fb02 commit d4dd070
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 27 deletions.
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

plugins {
id("architectury-plugin") version "3.4-SNAPSHOT"
id("dev.architectury.loom") version "1.5-SNAPSHOT" apply false
id("dev.architectury.loom") version "1.7-SNAPSHOT" apply false
}

architectury {
Expand Down Expand Up @@ -50,7 +50,7 @@ allprojects {

tasks.withType(JavaCompile).configureEach {
options.encoding = "UTF-8"
options.release = 17
options.release = 21
}

java {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public class CompactedConfigScreen extends Screen {
display.put("Lore", lore);
tag.put("display", display);
item.put("tag", tag);
ITEM = ItemStack.of(item);
ITEM = ItemStack.parse(Minecraft.getInstance().level.registryAccess(), item).get();
}

private final AbstractCivModernMod mod;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import com.google.common.eventbus.Subscribe;
import net.minecraft.client.KeyMapping;
import net.minecraft.client.Minecraft;
import net.minecraft.core.component.DataComponents;
import net.minecraft.world.food.FoodProperties;
import net.minecraft.world.item.ItemStack;
import org.jetbrains.annotations.NotNull;
Expand Down Expand Up @@ -108,9 +109,9 @@ private void tick(
private boolean tryEat(ItemStack item) {
Minecraft mc = Minecraft.getInstance();

FoodProperties food = item.getItem().getFoodProperties();
if (food != null && food.getNutrition() > 0) {
if (mc.player.getFoodData().getFoodLevel() + food.getNutrition() <= 20) {
FoodProperties food = item.getItem().components().get(DataComponents.FOOD);
if (food != null && food.nutrition() > 0) {
if (mc.player.getFoodData().getFoodLevel() + food.nutrition() <= 20) {
return true;
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
package sh.okx.civmodern.common.mixins;

import net.minecraft.core.component.DataComponents;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.nbt.ListTag;
import net.minecraft.nbt.Tag;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.Style;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.component.ItemLore;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Unique;
import sh.okx.civmodern.common.features.ExtendedItemStack;
Expand All @@ -26,21 +28,12 @@ public boolean isMarkedAsCompacted() {

@Unique
private boolean civmodern$isCompacted() {
final CompoundTag itemTag = ((ItemStack) (Object) this).getTag();
if (itemTag == null) {
ItemLore lore = ((ItemStack) (Object) this).getComponents().get(DataComponents.LORE);
Component name = ((ItemStack) (Object) this).getComponents().get(DataComponents.ITEM_NAME);
if (lore == null || name == null) {
return false;
}
if (!(itemTag.get(ItemStack.TAG_DISPLAY) instanceof final CompoundTag displayTag)) {
return false;
}
if (!(displayTag.get(ItemStack.TAG_LORE) instanceof final ListTag loreTag)) {
return false;
}
if (loreTag.getElementType() != Tag.TAG_STRING) {
return false;
}
for (final Tag element : loreTag) {
final Component line = Component.Serializer.fromJson(element.getAsString());
for (Component line : lore.lines()) {
if (line == null) {
continue;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ private void renderEntity(GuiGraphics guiGraphics, Player player, Entity entity,
}
BakedModel bakedModel = Minecraft.getInstance().getItemRenderer().getModel(item, player.level(), player, 0);
guiGraphics.pose().scale(config.getIconSize(), config.getIconSize(), 1);
guiGraphics.pose().mulPoseMatrix(new Matrix4f().scaling(1.0f, -1.0f, 1.0f));
guiGraphics.pose().mulPose(new Matrix4f().scaling(1.0f, -1.0f, 1.0f));
guiGraphics.pose().scale(16.0f, 16.0f, 16.0f);

boolean notUseBlockLight = !bakedModel.usesBlockLight();
Expand Down
2 changes: 1 addition & 1 deletion fabric/src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@
"mixins": [
"civmodern.mixins.json"
]
}
}
12 changes: 6 additions & 6 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,21 @@ org.gradle.jvmargs=-Xmx3072M

archives_base_name=civmodern
maven_group=sh.okx.civmodern
mod_version=1.6.3
mod_version=1.6.4
mod_description=Civ Modern
copyright_licence=GPLv3
mod_home_url=https://github.com/okx-code/civmodern
mod_source_url=https://github.com/okx-code/civmodern
mod_issues_url=https://github.com/okx-code/civmodern/issues

minecraft_version=1.20.4
minecraft_version=1.20.6
architectury_version=11.1.13
# https://parchmentmc.org/docs/getting-started
parchment_version=2024.04.14
parchment_version=2024.06.16
enabled_platforms=fabric,forge

# https://fabricmc.net/versions.html
fabric_loader_version=0.15.7
fabric_api_version=0.96.4+1.20.4
fabric_loader_version=0.15.11
fabric_api_version=0.100.8+1.20.6

forge_version=1.20.4-49.0.31
forge_version=1.20.6-50.1.0

0 comments on commit d4dd070

Please sign in to comment.