diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 665146b..79d4c8f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -21,22 +21,21 @@ jobs: runs-on: ${{ matrix.os }} steps: - name: checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: validate gradle wrapper - uses: gradle/wrapper-validation-action@v1 + uses: gradle/wrapper-validation-action@v2 - name: setup jdk ${{ matrix.java }} - uses: actions/setup-java@v3 + uses: actions/setup-java@v4 with: java-version: ${{ matrix.java }} distribution: 'microsoft' - name: make gradle wrapper executable - if: ${{ runner.os != 'Windows' }} run: chmod +x ./gradlew - name: build run: ./gradlew build - name: capture build artifacts if: ${{ runner.os == 'Linux' && matrix.java == '17' }} # Only upload artifacts built from latest java on one OS - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: Artifacts path: build/libs/ diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 09f72d1..23a7b7a 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -14,7 +14,7 @@ jobs: contents: write steps: - name: Download artifacts - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: name: Artifacts path: ./ diff --git a/.gitignore b/.gitignore index c476faf..111a1d3 100644 --- a/.gitignore +++ b/.gitignore @@ -22,6 +22,7 @@ classes/ .vscode/ bin/ .classpath +.factorypath .project # macos diff --git a/build.gradle b/build.gradle index 01a1928..49dd8b5 100644 --- a/build.gradle +++ b/build.gradle @@ -39,6 +39,8 @@ processResources { filesMatching("fabric.mod.json") { expand "version": project.version } + + exclude "**/*.xcf" } tasks.withType(JavaCompile).configureEach { diff --git a/changelog.md b/changelog.md index 65ac5ae..ca1587c 100644 --- a/changelog.md +++ b/changelog.md @@ -20,10 +20,24 @@ Initial release - _Regression: Restocks cause a crash if Deplete Reroll is disabled._ # v2 -## 2.0.0 +## 2.0 - Made some methods and types available through an API. - Added an entrypoint to define villager trades from outside mods -## 2.1.0 +## 2.1 +### 2.1.0 - Reimplemented Trade-Rebalance support in a backward-compatible way -## 2.1.1 +### 2.1.1 - Fixed a crash that would occur upon restock if Depleted Reroll is disabled. +### 2.1.2 (Branched of v2.2) +- Custom serialization is no longer callable from the render thread. +## 2.2 +### 2.2.0 +- Updated for MC 1.20.5 +- For caching, a map's `item_name` takes priority over the `custom_name` if both are present. +- Placeholder trades are no longer empty. (Cosmetic change only.) +- Added custom logic for upgrading caches from before 1.20.5 +### 2.2.1 +- Updated for MC 1.21 +### 2.2.2 +- Custom serialization is no longer callable from the render thread. +This boost performances when using Fresh Animations diff --git a/gradle.properties b/gradle.properties index 48d7067..9e8ea23 100644 --- a/gradle.properties +++ b/gradle.properties @@ -12,6 +12,6 @@ loader_version=0.15.3 fabric_version=0.91.2+1.20.2 # Mod Properties -mod_version=2.1.1 +mod_version=2.1.2 maven_group=tk.estecka.shiftingwares archives_base_name=shifting-wares diff --git a/port.md b/port.md new file mode 100644 index 0000000..6e45099 --- /dev/null +++ b/port.md @@ -0,0 +1,20 @@ +# Minecraft Code Breaking Changes +### 1.19.4 +Current master + +### 1.20.2 +#### Worked Around: +- Need to handle the experimental trade rebalance: build for 1.20.2 and check that the feature's identifier exists before executing related code. + +### 1.20.5 +#### No Workaround: +- `ItemStack::hasCustomName` and `FilledMapItem::getMapId` were replaced with DataComponents. +- Exploration maps now use an `item_name` instead of a `custom_name`. Map caches from older versions are not automatically upgraded by minecraft. +- `TradeOffer` now takes the price as a `TradeItem` instead of an `ItemStack`. The second price is also an `Optional` +#### Possible Workaround: +- `ItemStack::writeToNbt` and `readFromNbt` were removed or changed: Use `ItemStack::CODEC` instead. +- Trade offers no longer support selling or buying air: Use some placeholder items instead. + +### 1.21.0 +#### No Workaround +- `getRandom()` was moved from `LivingEntity` to its parent class `Entity`. No code change required, but needs recompilation. diff --git a/src/main/java/tk/estecka/shiftingwares/mixin/VillagerEntityMixin.java b/src/main/java/tk/estecka/shiftingwares/mixin/VillagerEntityMixin.java index bd3eda7..21cf363 100644 --- a/src/main/java/tk/estecka/shiftingwares/mixin/VillagerEntityMixin.java +++ b/src/main/java/tk/estecka/shiftingwares/mixin/VillagerEntityMixin.java @@ -91,14 +91,18 @@ private boolean RestockDepletedOnly(TradeOffer offer, Operation hasBeen @Inject ( method="writeCustomDataToNbt", at=@At("TAIL")) void WriteCachedMapsToNbt(NbtCompound nbt, CallbackInfo info){ - this.tradeCache.FillCacheFromTrades(villager.getOffers()); - this.tradeCache.WriteMapCacheToNbt(nbt); + if (!villager.getWorld().isClient()){ + this.tradeCache.FillCacheFromTrades(villager.getOffers()); + this.tradeCache.WriteMapCacheToNbt(nbt); + } } @Inject ( method="readCustomDataFromNbt", at=@At("TAIL")) void ReadCachedMapsFromNbt(NbtCompound nbt, CallbackInfo info){ - this.tradeCache.ReadMapCacheFromNbt(nbt); - this.tradeCache.FillCacheFromTrades(villager.getOffers()); + if (!villager.getWorld().isClient()){ + this.tradeCache.ReadMapCacheFromNbt(nbt); + this.tradeCache.FillCacheFromTrades(villager.getOffers()); + } } }