Skip to content

Commit f342a19

Browse files
committed
Finish 1.20.1 port
1 parent 9f659a3 commit f342a19

14 files changed

Lines changed: 27 additions & 18 deletions

File tree

.github/workflows/build.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@ jobs:
2727
- name: Validate Gradle Wrapper
2828
uses: gradle/wrapper-validation-action@v1
2929

30-
- name: Setup JDK 21
30+
- name: Setup JDK 17
3131
uses: actions/setup-java@v1
3232
with:
33-
java-version: 21
33+
java-version: 17
3434

3535
- name: Build
3636
run: ./gradlew clean neoforge:build fabric:build

build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
plugins {
22
id "architectury-plugin" version "3.4-SNAPSHOT"
3-
id "dev.architectury.loom" version "1.13-SNAPSHOT" apply false
3+
id "dev.architectury.loom" version "1.10-SNAPSHOT" apply false
44
id "me.shedaniel.unified-publishing" version "0.1.+" apply false
55
id "com.github.breadmoirai.github-release" version "2.4.1"
66
}
@@ -105,7 +105,7 @@ allprojects {
105105

106106
tasks.withType(JavaCompile) {
107107
options.encoding = "UTF-8"
108-
options.release = 21
108+
options.release = 17
109109
}
110110

111111
tasks.create("prepareWorkspace") {}

common/src/client/java/io/github/jamalam360/utility_belt/client/mixin/MinecraftMixin.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public class MinecraftMixin {
4040
ordinal = 2
4141
)
4242
)
43-
private boolean utilitybelt$useHotbarKeysInBelt(boolean pressed, @Local(name = "i") int i) {
43+
private boolean utilitybelt$useHotbarKeysInBelt(boolean pressed, @Local int i) {
4444
StateManager stateManager = StateManager.getStateManager(true);
4545
if (stateManager.isInBelt(this.player) && pressed) {
4646
switch (UtilityBeltClient.CLIENT_CONFIG.get().hotbarKeyBehaviour) {

common/src/main/java/io/github/jamalam360/utility_belt/mixin/LivingEntityMixin.java

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
11
package io.github.jamalam360.utility_belt.mixin;
22

3+
import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
4+
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;
35
import io.github.jamalam360.utility_belt.util.Duck;
46
import io.github.jamalam360.utility_belt.util.UtilityBeltInventory;
57
import io.github.jamalam360.utility_belt.state.StateManager;
68
import net.minecraft.server.level.ServerPlayer;
79
import net.minecraft.world.InteractionHand;
10+
import net.minecraft.world.entity.EquipmentSlot;
811
import net.minecraft.world.entity.LivingEntity;
12+
import net.minecraft.world.entity.player.Player;
913
import net.minecraft.world.item.ItemStack;
1014
import org.spongepowered.asm.mixin.Mixin;
1115
import org.spongepowered.asm.mixin.Shadow;
@@ -25,18 +29,23 @@ public abstract class LivingEntityMixin implements Duck.LivingEntity {
2529
}
2630

2731
@SuppressWarnings("ConstantValue")
28-
@Inject(
32+
@WrapOperation(
2933
method = "setItemInHand",
30-
at = @At("HEAD")
34+
at = @At(
35+
value = "INVOKE",
36+
target = "Lnet/minecraft/world/entity/LivingEntity;setItemSlot(Lnet/minecraft/world/entity/EquipmentSlot;Lnet/minecraft/world/item/ItemStack;)V"
37+
)
3138
)
32-
private void utilitybelt$setItemInHand(InteractionHand hand, ItemStack stack, CallbackInfo ci) {
33-
if (hand == InteractionHand.MAIN_HAND && (Object) this instanceof ServerPlayer player) {
39+
private void utilitybelt$setItemInHand(LivingEntity instance, EquipmentSlot equipmentSlot, ItemStack itemStack, Operation<Void> original) {
40+
if ((Object) this instanceof Player player) {
3441
StateManager stateManager = StateManager.getStateManager(player);
3542
if (stateManager.isInBelt(player)) {
3643
UtilityBeltInventory.Mutable inv = stateManager.getMutableInventory(player);
37-
inv.setItem(stateManager.getSelectedBeltSlot(player), stack);
44+
inv.setItem(stateManager.getSelectedBeltSlot(player), itemStack);
3845
stateManager.setInventory(player, inv);
3946
}
47+
} else {
48+
original.call(instance, equipmentSlot, itemStack);
4049
}
4150
}
4251
}

common/src/main/java/io/github/jamalam360/utility_belt/mixin/SmithingMenuMixin.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public SmithingMenuMixin(MenuType<?> type, int containerId, Inventory playerInve
3636
)
3737
private List<SmithingRecipe> utilitybelt$capBeltSize(List<SmithingRecipe> original) {
3838
if (!original.isEmpty()) {
39-
SmithingRecipe recipe = original.getFirst();
39+
SmithingRecipe recipe = original.get(0);
4040

4141
if (recipe.getId().equals(UPGRADE_RECIPE_LOCATION)) {
4242
ItemStack inputStack = this.getSlot(1).getItem();
@@ -63,8 +63,8 @@ public SmithingMenuMixin(MenuType<?> type, int containerId, Inventory playerInve
6363
ordinal = 1
6464
)
6565
)
66-
private void utilitybelt$upgradeBeltSlots(ResultContainer instance, int slot, ItemStack resultStack, Operation<Void> original, @Local(name = "list") List<SmithingRecipe> list) {
67-
SmithingRecipe recipe = list.getFirst();
66+
private void utilitybelt$upgradeBeltSlots(ResultContainer instance, int slot, ItemStack resultStack, Operation<Void> original, @Local List<SmithingRecipe> list) {
67+
SmithingRecipe recipe = list.get(0);
6868
if (recipe.getId().equals(UPGRADE_RECIPE_LOCATION)) {
6969
ItemStack inputStack = this.getSlot(1).getItem();
7070

common/src/main/java/io/github/jamalam360/utility_belt/util/UtilityBeltInventory.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,8 +118,8 @@ public boolean isEmpty() {
118118

119119
@Override
120120
public boolean equals(Object obj) {
121-
if (obj instanceof Mutable(List<ItemStack> items1)) {
122-
return listMatches(this.items, items1);
121+
if (obj instanceof Mutable other) {
122+
return listMatches(this.items, other.items);
123123
}
124124

125125
return false;
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

0 commit comments

Comments
 (0)