Skip to content

Commit

Permalink
Fix running on Forge 47.3.26+ (#191)
Browse files Browse the repository at this point in the history
Update Forge and mark TradeOffersTypeAwareBuyForOneEmeraldFactoryMixin injectors as not required, for Forge 47.3.26+ (#191)

Signed-off-by: unilock <[email protected]>
  • Loading branch information
unilock authored Feb 7, 2025
1 parent 68f98fa commit 4bd998f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,15 @@ public abstract class TradeOffersTypeAwareBuyForOneEmeraldFactoryMixin {
* We want to prevent this default logic so modded villager types will work.
* So we return an empty stream so an exception is never thrown.
*/
@Redirect(method = "<init>", at = @At(value = "INVOKE", target = "Lnet/minecraft/registry/DefaultedRegistry;stream()Ljava/util/stream/Stream;"))
@Redirect(method = "<init>", at = @At(value = "INVOKE", target = "Lnet/minecraft/registry/DefaultedRegistry;stream()Ljava/util/stream/Stream;"), require = 0)
private <T> Stream<T> disableVanillaCheck(DefaultedRegistry<VillagerType> instance) {
return Stream.empty();
}

/**
* To prevent "item" -> "air" trades, if the result of a type aware trade is air, make sure no offer is created.
*/
@Inject(method = "create", at = @At(value = "NEW", target = "net/minecraft/village/TradeOffer"), locals = LocalCapture.CAPTURE_FAILEXCEPTION, cancellable = true)
@Inject(method = "create", at = @At(value = "NEW", target = "net/minecraft/village/TradeOffer"), locals = LocalCapture.CAPTURE_FAILEXCEPTION, cancellable = true, require = 0)
private void failOnNullItem(Entity entity, Random random, CallbackInfoReturnable<TradeOffer> cir, ItemStack buyingItem) {
if (buyingItem.isEmpty()) { // Will return true for an "empty" item stack that had null passed in the ctor
cir.setReturnValue(null); // Return null to prevent creation of empty trades
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ fabric-client-tags-api-v1-version=1.1.2

# FFAPI Properties
loom.platform=forge
forge_version=1.20.1-47.2.6
forge_version=1.20.1-47.3.27
pack_format=15
forgified_version=1.11.10
forge_fabric_loader_version=2.6.0+0.15.0+1.20.1

0 comments on commit 4bd998f

Please sign in to comment.