[1.7.10] Mini-fix for arbitrary items not stacking

  • The FTB Forum is now read-only, and is here as an archive. To participate in our community discussions, please join our Discord! https://ftb.team/discord

williewillus

New Member
Jul 29, 2019
19
0
0
In Direwolf20's Episode 18 he mentioned the weird dirt that didn't stack properly. I had experienced this problem in 1.7 packs and have created a minimod that fixes the issue.

The issue is that certain item drops have an empty NBT tag added to them at some point. From what, I don't know. I'll leave that to the modpack and mod devs. (Edit: Research shows that the faulty mod is Thaumic Tinkerer, I don't know if the bug is fixed in dev versions) This is simply a quick drop-in fix for those who want it. All this mod does is listen for whenever an item spawns in the world, and if it has an *empty* NBT data tag, it erases it thus allowing it to stack with others. This should be completely safe because it only erases NBT root tags that are empty, so no data should ever be lost. It has been used in a production world with no problems.

No guarantees, as I obviously haven't tested against all edge cases. As always, take backups regularly!

Download: https://dl.dropboxusercontent.com/u/2080675/[1.7.10]StackerFix-universal-1.2.jar (Forge 1230 and up)
Source code (Yes it literally fits in a screenshot):
ecf7b438a70369f6d9603ed3b1876869.png
 
Last edited:

preceptor_teeth

New Member
Jul 29, 2019
34
0
0
Unfortunately, it does not for me. I place a block, like a torch or a conduit, and break it again, and it does not stack with the original.

I did have an issue where any items in my inventory (or in storage) that were created before I added this in kept the old behavior, but that gets fixed if you just throw them on the ground and pick them up again. Once I weeded out the few things that lingered, the problem is gone.
 

Reika

RotaryCraft Dev
FTB Mod Dev
Sep 3, 2013
5,079
5,331
550
Toronto, Canada
sites.google.com
I did have an issue where any items in my inventory (or in storage) that were created before I added this in kept the old behavior, but that gets fixed if you just throw them on the ground and pick them up again. Once I weeded out the few things that lingered, the problem is gone.
I had to make a much more aggressive fix:
Code:
  @SubscribeEvent(priority = EventPriority.HIGHEST)
   public void clearEmptyTags(EntityJoinWorldEvent evt) {
     Entity e = evt.entity;
     if (e instanceof EntityItem) {
       ItemStack is = ((EntityItem)e).getEntityItem();
       if (is.stackTagCompound != null && is.stackTagCompound.hasNoTags())
         is.stackTagCompound = null;
     }
   }

   @SubscribeEvent(priority = EventPriority.HIGHEST)
   public void clearEmptyTags(ItemPickupEvent evt) {
     ItemStack is = evt.pickedUp.getEntityItem();
     if (is.stackTagCompound != null && is.stackTagCompound.hasNoTags())
       is.stackTagCompound = null;
   }

   @SubscribeEvent(priority = EventPriority.HIGHEST)
   public void clearEmptyTags(ItemCraftedEvent evt) {
     ItemStack is = evt.crafting;
     if (is.stackTagCompound != null && is.stackTagCompound.hasNoTags())
       is.stackTagCompound = null;
   }

   @SubscribeEvent(priority = EventPriority.HIGHEST)
   public void clearEmptyTags(PlayerLoggedInEvent evt) {
     for (int i = 0; i < evt.player.inventory.getSizeInventory(); i++) {
       ItemStack is = evt.player.inventory.getStackInSlot(i);
       if (is != null && is.stackTagCompound != null && is.stackTagCompound.hasNoTags())
         is.stackTagCompound = null;
     }
   }

   @SubscribeEvent(priority = EventPriority.HIGHEST)
   public void clearEmptyTags(PlayerInteractEvent evt) {
     ItemStack is = evt.entityPlayer.getCurrentEquippedItem();
     if (is != null && is.stackTagCompound != null && is.stackTagCompound.hasNoTags())
       is.stackTagCompound = null;
   }
 

Mrdeadlocked

New Member
Jul 29, 2019
26
0
0
Anyone have a link to this mod? TooMuchLoot is doing the same thing and causing items not to stack.
 
R

Rixxi

Guest
Hey, I'm having the same issue with my custom mod pack. The link isn't working. Can I find this anywhere else?
 

Ozzymud2

New Member
Jul 29, 2019
17
0
0
Was helping someone on reddit with this. I am NOT a modder, but I got the mod from the screenshot in the 1st post to compile and installed it into Minecraft and it ran, showed up in the mods button. No clue if it's doing what it's supposed to, but hey, Minecraft didn't crash :p

Anyhoo, I uploaded it here: http://s000.tinyupload.com/index.php?file_id=01894389565988648790
As well as attaching it to this post, you will have to rename it from .jar.zip to .jar yourself.

Please, if you use it, test it in a test world 1st, do not blame me for wierdness.

Apparently Mariculture is the mod doing it as of this writing (not sure if he had the latest or what version in his custom pack)

Edit: I screwed up, didn't package it right, was still the deobf version :p
New link added in, and re-attached.
 

Attachments

  • [1.7.10] StackerFix-1.2.1.jar.zip
    2.2 KB · Views: 295
Last edited: