mirror of
https://github.com/FabricMC/fabric.git
synced 2025-02-16 19:59:56 -05:00
Fix crash in prod
This commit is contained in:
parent
c29459abaf
commit
95c147c6a1
1 changed files with 1 additions and 1 deletions
|
@ -47,7 +47,7 @@ public abstract class TypeAwareTradeMixin {
|
||||||
/**
|
/**
|
||||||
* To prevent "item" -> "air" trades, if the result of a type aware trade is air, make sure no offer is created.
|
* 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(Lnet/minecraft/entity/Entity;Ljava/util/Random;)Lnet/minecraft/village/TradeOffer;", at = @At(value = "NEW", target = "net/minecraft/village/TradeOffer"), locals = LocalCapture.CAPTURE_FAILEXCEPTION, cancellable = true)
|
||||||
private void failOnNullItem(Entity entity, Random random, CallbackInfoReturnable<TradeOffer> cir, ItemStack buyingItem) {
|
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
|
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
|
cir.setReturnValue(null); // Return null to prevent creation of empty trades
|
||||||
|
|
Loading…
Reference in a new issue