Skip to content

Commit 70ca860

Browse files
committed
Port to 1.21.5 (#87)
1 parent 382d33f commit 70ca860

424 files changed

Lines changed: 8810 additions & 5600 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ loom {
107107
gametestClient {
108108
inherit client
109109
name "GameTest Client"
110-
vmArg "-Dfabric-api.gametest.structures.output-dir=${file("src/gametest/resources/data/itematic/gametest/structure")}"
110+
vmArg "-Ditematic.gametest.structure-output-directory=${file("src/gametest/resources/data")}"
111111

112112
runDir "run"
113113
source sourceSets.gametest

gradle.properties

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ org.gradle.jvmargs=-Xmx1G
33

44
# Fabric Properties
55
# check these on https://fabricmc.net/develop
6-
minecraft_version=1.21.4
7-
yarn_mappings=1.21.4+build.8
6+
minecraft_version=1.21.5
7+
yarn_mappings=1.21.5+build.1
88
loader_version=0.18.4
99

1010
# Mod Properties
@@ -13,4 +13,4 @@ org.gradle.jvmargs=-Xmx1G
1313
archives_base_name = itematic
1414

1515
# Dependencies
16-
fabric_version=0.119.4+1.21.4
16+
fabric_version=0.128.2+1.21.5

gradle/wrapper/gradle-wrapper.jar

5.26 KB
Binary file not shown.

gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-9.2.0-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-9.4.0-bin.zip
44
networkTimeout=10000
55
validateDistributionUrl=true
66
zipStoreBase=GRADLE_USER_HOME

gradlew

Lines changed: 5 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

gradlew.bat

Lines changed: 1 addition & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/client/java/net/errorcraft/itematic/access/client/gui/screen/GameModeSelectionScreenGameModeSelectionAccess.java

Lines changed: 0 additions & 11 deletions
This file was deleted.
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
package net.errorcraft.itematic.access.client.gui.screen;
2+
3+
import net.minecraft.item.Item;
4+
import net.minecraft.item.ItemStack;
5+
import net.minecraft.registry.Registry;
6+
import net.minecraft.registry.RegistryKey;
7+
8+
public interface GameModeSwitcherScreenAccess {
9+
interface GameModeSelectionAccess {
10+
default ItemStack itematic$icon(Registry<Item> registry) {
11+
return ItemStack.EMPTY;
12+
}
13+
default void itematic$setIcon(RegistryKey<Item> item) {}
14+
}
15+
}

src/client/java/net/errorcraft/itematic/mixin/client/gui/screen/GameModeSelectionScreenExtender.java renamed to src/client/java/net/errorcraft/itematic/mixin/client/gui/screen/GameModeSwitcherScreenExtender.java

Lines changed: 27 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
package net.errorcraft.itematic.mixin.client.gui.screen;
22

33

4-
import net.errorcraft.itematic.access.client.gui.screen.GameModeSelectionScreenGameModeSelectionAccess;
4+
import net.errorcraft.itematic.access.client.gui.screen.GameModeSwitcherScreenAccess;
55
import net.errorcraft.itematic.item.ItemKeys;
66
import net.minecraft.client.MinecraftClient;
77
import net.minecraft.client.gui.DrawContext;
8-
import net.minecraft.client.gui.screen.GameModeSelectionScreen;
8+
import net.minecraft.client.gui.screen.GameModeSwitcherScreen;
99
import net.minecraft.item.Item;
1010
import net.minecraft.item.ItemConvertible;
1111
import net.minecraft.item.ItemStack;
@@ -20,52 +20,53 @@
2020
import org.spongepowered.asm.mixin.injection.At;
2121
import org.spongepowered.asm.mixin.injection.Redirect;
2222

23-
public class GameModeSelectionScreenExtender {
24-
@Mixin(GameModeSelectionScreen.ButtonWidget.class)
23+
public class GameModeSwitcherScreenExtender {
24+
@Mixin(GameModeSwitcherScreen.ButtonWidget.class)
2525
public static class ButtonWidgetExtender {
2626
@Redirect(
2727
method = "renderWidget",
2828
at = @At(
2929
value = "INVOKE",
30-
target = "Lnet/minecraft/client/gui/screen/GameModeSelectionScreen$GameModeSelection;renderIcon(Lnet/minecraft/client/gui/DrawContext;II)V"
30+
target = "Lnet/minecraft/client/gui/screen/GameModeSwitcherScreen$GameModeSelection;renderIcon(Lnet/minecraft/client/gui/DrawContext;II)V"
3131
)
3232
)
33-
private void renderIconUseRegistryEntry(GameModeSelectionScreen.GameModeSelection instance, DrawContext context, int x, int y) {
33+
private void renderIconUseRegistryEntry(GameModeSwitcherScreen.GameModeSelection instance, DrawContext context, int x, int y) {
3434
World world = MinecraftClient.getInstance().world;
3535
if (world == null) {
3636
return;
3737
}
38+
3839
ItemStack stack = instance.itematic$icon(world.getRegistryManager().getOrThrow(RegistryKeys.ITEM));
3940
context.drawItem(stack, x, y);
4041
}
4142
}
4243

43-
@Mixin(GameModeSelectionScreen.GameModeSelection.class)
44-
public static class GameModeSelectionExtender implements GameModeSelectionScreenGameModeSelectionAccess {
45-
@Final
44+
@Mixin(GameModeSwitcherScreen.GameModeSelection.class)
45+
public static class GameModeSelectionExtender implements GameModeSwitcherScreenAccess.GameModeSelectionAccess {
4646
@Shadow
47-
public static GameModeSelectionScreen.GameModeSelection CREATIVE;
48-
4947
@Final
50-
@Shadow
51-
public static GameModeSelectionScreen.GameModeSelection SURVIVAL;
48+
public static GameModeSwitcherScreen.GameModeSelection CREATIVE;
5249

53-
@Final
5450
@Shadow
55-
public static GameModeSelectionScreen.GameModeSelection ADVENTURE;
51+
@Final
52+
public static GameModeSwitcherScreen.GameModeSelection SURVIVAL;
5653

54+
@Shadow
5755
@Final
56+
public static GameModeSwitcherScreen.GameModeSelection ADVENTURE;
57+
5858
@Shadow
59-
public static GameModeSelectionScreen.GameModeSelection SPECTATOR;
59+
@Final
60+
public static GameModeSwitcherScreen.GameModeSelection SPECTATOR;
6061

6162
@Unique
6263
private RegistryKey<Item> icon;
6364

6465
static {
65-
((GameModeSelectionExtender)(Object) CREATIVE).icon = ItemKeys.GRASS_BLOCK;
66-
((GameModeSelectionExtender)(Object) SURVIVAL).icon = ItemKeys.IRON_SWORD;
67-
((GameModeSelectionExtender)(Object) ADVENTURE).icon = ItemKeys.MAP;
68-
((GameModeSelectionExtender)(Object) SPECTATOR).icon = ItemKeys.ENDER_EYE;
66+
CREATIVE.itematic$setIcon(ItemKeys.GRASS_BLOCK);
67+
SURVIVAL.itematic$setIcon(ItemKeys.IRON_SWORD);
68+
ADVENTURE.itematic$setIcon(ItemKeys.MAP);
69+
SPECTATOR.itematic$setIcon(ItemKeys.ENDER_EYE);
6970
}
7071

7172
@Redirect(
@@ -84,9 +85,15 @@ private static ItemStack newItemStackReturnEmptyStack(ItemConvertible item) {
8485
if (this.icon == null) {
8586
return ItemStack.EMPTY;
8687
}
88+
8789
return registry.getOptional(this.icon)
8890
.map(ItemStack::new)
8991
.orElse(ItemStack.EMPTY);
9092
}
93+
94+
@Override
95+
public void itematic$setIcon(RegistryKey<Item> icon) {
96+
this.icon = icon;
97+
}
9198
}
9299
}

src/client/java/net/errorcraft/itematic/mixin/client/gui/screen/ingame/SmithingScreenExtender.java

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import com.llamalad7.mixinextras.sugar.Share;
77
import com.llamalad7.mixinextras.sugar.ref.LocalRef;
88
import net.errorcraft.itematic.item.component.ItemComponentTypes;
9-
import net.errorcraft.itematic.item.component.components.SmithingTemplateItemComponent;
9+
import net.errorcraft.itematic.item.component.components.SmithingTemplateProviderItemComponent;
1010
import net.errorcraft.itematic.item.smithing.template.SmithingTemplate;
1111
import net.minecraft.client.gui.screen.ingame.ForgingScreen;
1212
import net.minecraft.client.gui.screen.ingame.SmithingScreen;
@@ -16,7 +16,6 @@
1616
import net.minecraft.item.Item;
1717
import net.minecraft.item.ItemStack;
1818
import net.minecraft.item.SmithingTemplateItem;
19-
import net.minecraft.registry.entry.RegistryEntry;
2019
import net.minecraft.screen.SmithingScreenHandler;
2120
import net.minecraft.text.Text;
2221
import net.minecraft.util.Identifier;
@@ -44,9 +43,8 @@ public SmithingScreenExtender(SmithingScreenHandler handler, PlayerInventory pla
4443
private void storeSmithingTemplate(CallbackInfo info, @Share("smithingTemplate") LocalRef<Optional<SmithingTemplate>> smithingTemplate) {
4544
smithingTemplate.set(this.handler.getSlot(0)
4645
.getStack()
47-
.itematic$getBehavior(ItemComponentTypes.SMITHING_TEMPLATE)
48-
.map(SmithingTemplateItemComponent::template)
49-
.map(RegistryEntry::value)
46+
.itematic$getBehavior(ItemComponentTypes.SMITHING_TEMPLATE_PROVIDER)
47+
.map(SmithingTemplateProviderItemComponent::template)
5048
);
5149
}
5250

@@ -97,9 +95,8 @@ private Object checkPresenceEquipmentBehavior(ItemStack instance, ComponentType<
9795
)
9896
)
9997
private boolean instanceOfSmithingTemplateItemUseItemComponentCheck(Object reference, Class<SmithingTemplateItem> clazz, @Local(ordinal = 0) ItemStack itemStack, @Share("smithingTemplate") LocalRef<SmithingTemplate> smithingTemplate) {
100-
Optional<SmithingTemplate> optionalSmithingTemplate = itemStack.itematic$getBehavior(ItemComponentTypes.SMITHING_TEMPLATE)
101-
.map(SmithingTemplateItemComponent::template)
102-
.map(RegistryEntry::value);
98+
Optional<SmithingTemplate> optionalSmithingTemplate = itemStack.itematic$getBehavior(ItemComponentTypes.SMITHING_TEMPLATE_PROVIDER)
99+
.map(SmithingTemplateProviderItemComponent::template);
103100
optionalSmithingTemplate.ifPresent(smithingTemplate::set);
104101
return optionalSmithingTemplate.isPresent();
105102
}

0 commit comments

Comments
 (0)