Skip to content

Commit

Permalink
fix crash when transferring items into chest cart
Browse files Browse the repository at this point in the history
  • Loading branch information
2No2Name committed Jul 20, 2023
1 parent c1d412d commit 9e10c41
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package mendedminecarts.mixin;

import mendedminecarts.MendedMinecartsMod;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.vehicle.StorageMinecartEntity;
import net.minecraft.entity.vehicle.VehicleInventory;
import net.minecraft.item.ItemStack;
Expand All @@ -18,7 +19,12 @@ public void setInventoryStack(int slot, ItemStack stack) {
stack.setCount(this.getMaxCountPerStack());
}
} else {
VehicleInventory.super.setInventoryStack(slot, stack);
//Copypaste from VehicleInventory
this.generateInventoryLoot(null);
this.getInventory().set(slot, stack);
if (!stack.isEmpty() && stack.getCount() > this.getMaxCountPerStack()) {
stack.setCount(this.getMaxCountPerStack());
}
}
}
}

0 comments on commit 9e10c41

Please sign in to comment.