Skip to content
This repository was archived by the owner on Jun 17, 2025. It is now read-only.

Commit e78c48b

Browse files
committed
- workaround for Vault Hunters problem where a stack NBT will sometimes be set to null sometimes to empty CompoundNBT. Witch was breaking auto refill.
- fixed quick locked slot key not saving the locked slots - fixed default sort to sort by the order of the search tab of the creative menu. **This will change the default sort.** - workaround for MacOS OpenGL strangeness that caused locked slots, swipe move/throw and tooltips mostly not work on forge builds. - workaround for [scouts](https://www.curseforge.com/minecraft/mc-mods/scout) differences with vanilla. scout slots will now be ignored.
1 parent 9736366 commit e78c48b

File tree

101 files changed

+2485
-90
lines changed

Some content is hidden

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

101 files changed

+2485
-90
lines changed

build.gradle.kts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import org.anti_ad.mc.ipnext.buildsrc.loom_version
2323
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
2424
import java.io.ByteArrayOutputStream
2525

26-
val versionObj = Version("1", "9", "1",
26+
val versionObj = Version("1", "9", "2",
2727
preRelease = (System.getenv("IPNEXT_RELEASE") == null))
2828

2929

@@ -88,7 +88,7 @@ allprojects {
8888
group = "org.anti-ad.mc"
8989
ext.set("mod_artefact_version", versionObj.toCleanString())
9090
ext.set("mod_artefact_is_release", versionObj.isRelease())
91-
ext.set("libIPN_version", "2.0.1")
91+
ext.set("libIPN_version", "2.0.2")
9292

9393
tasks.withType<JavaCompile>().configureEach {
9494
options.isFork = true

buildSrc/src/main/kotlin/org/anti_ad/mc/ipnext/buildsrc/DependencyConfig.kt

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import org.gradle.api.artifacts.Configuration
2424
import org.gradle.api.artifacts.Dependency
2525
import org.gradle.kotlin.dsl.*
2626
import org.gradle.kotlin.dsl.dependencies
27+
import java.util.concurrent.*
2728

2829
//var shadedApi: Configuration? = null
2930

@@ -121,11 +122,18 @@ fun Project.fabricCommonDependency(minecraft_version: Any,
121122
}
122123

123124
libIPN_version?.let {
124-
"modApi"("org.anti_ad.mc:libIPN-$libIPN_version")
125+
"modApi"("org.anti_ad.mc:libIPN-$libIPN_version") {
126+
this.isChanging = true
127+
}
125128
}
126129

127130
"modRuntimeOnly"("net.fabricmc:fabric-language-kotlin:1.8.2+kotlin.1.7.10")
128131
}
132+
configurations.all {
133+
resolutionStrategy {
134+
cacheChangingModulesFor(0, TimeUnit.SECONDS)
135+
}
136+
}
129137
}
130138

131139
private fun ___fgdeobf(id: Any): Dependency {

changelog.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@
33
### 1.9.2
44

55
- workaround for Vault Hunters problem where a stack NBT will sometimes be set to null sometimes to empty CompoundNBT. Witch was breaking auto refill.
6+
- fixed quick locked slot key not saving the locked slots
7+
- fixed default sort to sort by the order of the search tab of the creative menu. **This will change the default sort.**
8+
- workaround for MacOS OpenGL strangeness that caused locked slots, swipe move/throw and tooltips mostly not work on forge builds.
9+
- workaround for [scouts](https://www.curseforge.com/minecraft/mc-mods/scout) differences with vanilla. scout slots will now be ignored.
610

711
#### Supported Minecraft versions
812
- **1.16.x**

optimize-jar.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ convert() {
1717

1818
find . -type f | sort | zip -q -X -9 -@ "$OUT" > /dev/null
1919

20-
advzip -3 -z "$OUT" > /dev/null
20+
advzip -4 -z -i 10 "$OUT" > /dev/null
2121

2222
# shellcheck disable=SC2164
2323
popd > /dev/null

platforms/fabric-1.16/build.gradle.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,7 @@ plugins.withId("idea") {
134134
loom {
135135
runConfigs["client"].programArgs.addAll(listOf<String>("--width=1280", "--height=720", "--username=DEV"))
136136
mixin.defaultRefmapName.set("inventoryprofilesnext-refmap.json")
137+
accessWidenerPath.set(file("src/main/resources/ipnext.accesswidener"))
137138
}
138139

139140
tasks.named<AntlrTask>("generateGrammarSource").configure {
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
package org.anti_ad.mc.common.vanilla.accessors.entity
2+
3+
import org.anti_ad.mc.common.vanilla.alias.entity.Entity
4+
5+
val Entity.`(uuid)`
6+
get() = uuid
7+
8+
val Entity.`(uuidString)`: String
9+
get() = uuidAsString
10+
11+
val Entity.`(pos)`
12+
get() = pos
13+
14+
val Entity.`(blockPos)`
15+
get() = blockPos
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
package org.anti_ad.mc.common.vanilla.accessors.entity
2+
3+
4+
import org.anti_ad.mc.common.vanilla.alias.ClickableWidget
5+
import org.anti_ad.mc.common.vanilla.alias.MerchantScreen
6+
import org.anti_ad.mc.common.vanilla.alias.NbtElement
7+
import org.anti_ad.mc.common.vanilla.alias.StringNbtReader
8+
import org.anti_ad.mc.common.vanilla.alias.entity.VillagerEntity
9+
import org.anti_ad.mc.common.vanilla.alias.village.TradeOffer
10+
import org.anti_ad.mc.common.vanilla.alias.village.VillagerProfession
11+
12+
val VillagerEntity.`(profession)`
13+
inline get() = this.villagerData.profession
14+
15+
val VillagerProfession.`(professionId)`
16+
inline get() = this.toString()
17+
18+
val VillagerEntity.`(villagerData)`
19+
inline get() = this.villagerData
20+
21+
val MerchantScreen.`(recipes)`
22+
get() = this.screenHandler.recipes
23+
24+
val MerchantScreen.`(indexStartOffset)`
25+
get() = indexStartOffset
26+
27+
val MerchantScreen.`(offers)`
28+
get() = offers
29+
30+
val ClickableWidget.`(isHovered)`
31+
get() = isHovered
32+
33+
val TradeOffer.`(originalFirstBuyItem)`
34+
get() = originalFirstBuyItem
35+
36+
val TradeOffer.`(secondBuyItem)`
37+
get() = secondBuyItem
38+
39+
val TradeOffer.`(sellItem)`
40+
get() = sellItem
41+
42+
val VillagerProfession.`(id)`
43+
get() = toString()
44+
45+
fun StringNbtReader_parse(s: String): NbtElement? {
46+
return StringNbtReader.parse(s)
47+
}

platforms/fabric-1.16/src/main/java/org/anti_ad/mc/ipnext/item/ItemTypeExtensions.kt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,11 @@ inline val FoodComponent.`(saturationModifier)`
159159

160160
inline val ItemType.rawId: Int
161161
get() = Registry.ITEM.`(getRawId)`(item)
162+
163+
inline val ItemType.searchTabIndex: Int
164+
get() = rawId
165+
166+
162167
inline val ItemType.damage: Int
163168
get() = vanillaStack.damage
164169
inline val ItemType.enchantmentsScore: Double
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
/*
2+
* Inventory Profiles Next
3+
*
4+
* Copyright (c) 2023 Plamen K. Kosseff <p.kosseff@gmail.com>
5+
*
6+
* This program is free software: you can redistribute it and/or modify
7+
* it under the terms of the GNU Affero General Public License as published by
8+
* the Free Software Foundation, either version 3 of the License, or
9+
* (at your option) any later version.
10+
*
11+
* This program is distributed in the hope that it will be useful,
12+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14+
* GNU Affero General Public License for more details.
15+
*
16+
* You should have received a copy of the GNU Affero General Public License
17+
* along with this program. If not, see <https://www.gnu.org/licenses/>.
18+
*/
19+
20+
package org.anti_ad.mc.ipnext.mixin;
21+
22+
import net.minecraft.client.gui.screen.ingame.MerchantScreen;
23+
import net.minecraft.client.util.math.MatrixStack;
24+
import net.minecraft.item.ItemStack;
25+
import net.minecraft.village.TradeOffer;
26+
import net.minecraft.village.TradeOfferList;
27+
import org.anti_ad.mc.ipnext.Log;
28+
import org.anti_ad.mc.ipnext.event.villagers.VillagerTradeManager;
29+
import org.spongepowered.asm.mixin.Final;
30+
import org.spongepowered.asm.mixin.Mixin;
31+
import org.spongepowered.asm.mixin.Shadow;
32+
import org.spongepowered.asm.mixin.injection.At;
33+
import org.spongepowered.asm.mixin.injection.Inject;
34+
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
35+
import org.spongepowered.asm.mixin.injection.callback.LocalCapture;
36+
37+
import java.util.Iterator;
38+
39+
@Mixin(MerchantScreen.class)
40+
public class MixinMerchantScreen {
41+
42+
@Final
43+
@Shadow
44+
public MerchantScreen.WidgetButtonPage[] offers;
45+
46+
@SuppressWarnings({"DataFlowIssue", "rawtypes"})
47+
@Inject(method = "render",
48+
at = @At(value = "FIELD", target = "Lnet/minecraft/client/render/item/ItemRenderer;zOffset:F", ordinal = 0),
49+
locals = LocalCapture.CAPTURE_FAILHARD)
50+
void render(MatrixStack matrices, int mouseX, int mouseY, float delta, CallbackInfo ci, TradeOfferList tradeOfferList, int i, int j, int k, int l, int m, Iterator var11, TradeOffer tradeOffer, ItemStack itemStack, ItemStack itemStack2, ItemStack itemStack3, ItemStack itemStack4) {
51+
MerchantScreen self = (MerchantScreen)((Object)this);
52+
VillagerTradeManager.INSTANCE.drawingButton(self, matrices, mouseX, mouseY, tradeOffer, i, j, k, l, m);
53+
}
54+
55+
56+
}
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
/*
2+
* Inventory Profiles Next
3+
*
4+
* Copyright (c) 2023 Plamen K. Kosseff <p.kosseff@gmail.com>
5+
*
6+
* This program is free software: you can redistribute it and/or modify
7+
* it under the terms of the GNU Affero General Public License as published by
8+
* the Free Software Foundation, either version 3 of the License, or
9+
* (at your option) any later version.
10+
*
11+
* This program is distributed in the hope that it will be useful,
12+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14+
* GNU Affero General Public License for more details.
15+
*
16+
* You should have received a copy of the GNU Affero General Public License
17+
* along with this program. If not, see <https://www.gnu.org/licenses/>.
18+
*/
19+
20+
package org.anti_ad.mc.ipnext.mixin;
21+
22+
import net.minecraft.entity.Entity;
23+
import net.minecraft.entity.passive.MerchantEntity;
24+
import net.minecraft.entity.passive.VillagerEntity;
25+
import net.minecraft.network.packet.c2s.play.PlayerInteractEntityC2SPacket;
26+
import net.minecraft.util.Hand;
27+
import net.minecraft.util.math.Vec3d;
28+
import org.anti_ad.mc.ipnext.event.villagers.VillagerTradeManager;
29+
import org.spongepowered.asm.mixin.Mixin;
30+
import org.spongepowered.asm.mixin.injection.At;
31+
import org.spongepowered.asm.mixin.injection.Inject;
32+
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
33+
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
34+
35+
@Mixin(PlayerInteractEntityC2SPacket.class)
36+
public class MixinPlayerInteractEntityC2SPacket {
37+
38+
@Inject(method = "Lnet/minecraft/network/packet/c2s/play/PlayerInteractEntityC2SPacket;<init>(Lnet/minecraft/entity/Entity;Lnet/minecraft/util/Hand;Lnet/minecraft/util/math/Vec3d;Z)V",
39+
at = @At("TAIL"))
40+
private void interactAt(Entity entity, Hand hand, Vec3d hitPos, boolean playerSneaking, CallbackInfo ci) {
41+
if (entity instanceof MerchantEntity) {
42+
VillagerTradeManager.INSTANCE.setCurrentVillager((MerchantEntity) entity);
43+
}
44+
}
45+
}

platforms/fabric-1.16/src/main/java/org/anti_ad/mc/ipnext/mixin/MixinScreen.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,4 +47,16 @@ public void init(MinecraftClient minecraftClient, int i, int j, CallbackInfo ci)
4747
return Unit.INSTANCE;
4848
});
4949
}
50+
51+
@Inject(at = @At("RETURN"), method = "removed()V")
52+
public void removed(CallbackInfo ci) {
53+
Screen self = (Screen) (Object) this;
54+
ScreenEventHandler.INSTANCE.onScreenRemoved(self);
55+
}
56+
57+
@Inject(at = @At("RETURN"), method = "onClose()V")
58+
public void close(CallbackInfo ci) {
59+
Screen self = (Screen) (Object) this;
60+
ScreenEventHandler.INSTANCE.onScreenRemoved(self);
61+
}
5062
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
accessWidener v1 named
2+
3+
accessible class net/minecraft/client/gui/screen/ingame/MerchantScreen$WidgetButtonPage
4+
accessible field net/minecraft/client/gui/screen/ingame/MerchantScreen offers [Lnet/minecraft/client/gui/screen/ingame/MerchantScreen$WidgetButtonPage;
5+
accessible field net/minecraft/client/gui/screen/ingame/MerchantScreen indexStartOffset I

platforms/fabric-1.16/src/main/resources/mixins.ipnext.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@
2424
"MixinClientPlayerInteractionManager",
2525
"IMixinBucketItem",
2626
"IMixinFluid",
27-
"IMixinEntityBucketItem"
27+
"IMixinEntityBucketItem",
28+
"MixinMerchantScreen",
29+
"MixinPlayerInteractEntityC2SPacket"
2830
],
2931
"injectors": {
3032
"defaultRequire": 1

platforms/fabric-1.18.2/build.gradle.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@ loom {
135135
runConfigs["client"].ideConfigGenerated(true)
136136
runConfigs["client"].programArgs.addAll(listOf<String>("--width=1280", "--height=720", "--username=DEV"))
137137
mixin.defaultRefmapName.set("inventoryprofilesnext-refmap.json")
138+
accessWidenerPath.set(file("src/main/resources/ipnext.accesswidener"))
138139
}
139140

140141
tasks.named<AntlrTask>("generateGrammarSource").configure {
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
package org.anti_ad.mc.common.vanilla.accessors.entity
2+
3+
import org.anti_ad.mc.common.vanilla.alias.entity.Entity
4+
5+
val Entity.`(uuid)`
6+
get() = uuid
7+
8+
val Entity.`(uuidString)`: String
9+
get() = uuidAsString
10+
11+
val Entity.`(pos)`
12+
get() = pos
13+
14+
val Entity.`(blockPos)`
15+
get() = blockPos
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
package org.anti_ad.mc.common.vanilla.accessors.entity
2+
3+
4+
import org.anti_ad.mc.common.vanilla.alias.ClickableWidget
5+
import org.anti_ad.mc.common.vanilla.alias.MerchantScreen
6+
import org.anti_ad.mc.common.vanilla.alias.NbtElement
7+
import org.anti_ad.mc.common.vanilla.alias.StringNbtReader
8+
import org.anti_ad.mc.common.vanilla.alias.entity.VillagerEntity
9+
import org.anti_ad.mc.common.vanilla.alias.village.TradeOffer
10+
import org.anti_ad.mc.common.vanilla.alias.village.VillagerProfession
11+
12+
val VillagerEntity.`(profession)`
13+
inline get() = this.villagerData.profession
14+
15+
val VillagerProfession.`(professionId)`
16+
inline get() = this.id
17+
18+
val VillagerEntity.`(villagerData)`
19+
inline get() = this.villagerData
20+
21+
val MerchantScreen.`(recipes)`
22+
get() = this.screenHandler.recipes
23+
24+
val MerchantScreen.`(indexStartOffset)`
25+
get() = indexStartOffset
26+
27+
val MerchantScreen.`(offers)`
28+
get() = offers
29+
30+
val ClickableWidget.`(isHovered)`
31+
get() = isHovered
32+
33+
val TradeOffer.`(originalFirstBuyItem)`
34+
get() = originalFirstBuyItem
35+
36+
val TradeOffer.`(secondBuyItem)`
37+
get() = secondBuyItem
38+
39+
val TradeOffer.`(sellItem)`
40+
get() = sellItem
41+
42+
val VillagerProfession.`(id)`
43+
get() = id
44+
45+
fun StringNbtReader_parse(s: String): NbtElement? {
46+
return StringNbtReader.parse(s)
47+
}

platforms/fabric-1.18.2/src/main/java/org/anti_ad/mc/ipnext/item/ItemTypeExtensions.kt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,10 @@ inline val FoodComponent.`(saturationModifier)`
162162

163163
inline val ItemType.rawId: Int
164164
get() = Registry.ITEM.`(getRawId)`(item)
165+
166+
inline val ItemType.searchTabIndex: Int
167+
get() = rawId
168+
165169
inline val ItemType.damage: Int
166170
get() = vanillaStack.damage
167171
inline val ItemType.enchantmentsScore: Double

0 commit comments

Comments
 (0)