Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -593,6 +593,7 @@ Available in flavors [**Cleanroom**](https://www.curseforge.com/minecraft/modpac
* **Sky of Old Dimension Fix:** Fixes a Stack Overflow crash when entering the Sky of Old Dimension
* **Storage Drawers**
* **Item Voiding Fix:** Prevents voiding of items when near capacity limits
* **Remove Position from Drops:** Removes position data from drawers that keep their contents when broken, allowing them to stack with each other
* **Render Range:** Approximate range in blocks at which drawers render contained items
* **Tardis**
* **Memory Leak Fix:** Fixes a client-side memory leak associated with EntityPlayer
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1530,6 +1530,11 @@ public static class StorageDrawersCategory
@Config.Comment("Prevents voiding of items when near capacity limits")
public boolean utSDItemVoidingFixToggle = false;

@Config.RequiresMcRestart
@Config.Name("Remove Position from Drops")
@Config.Comment("Removes position data from drawers that keep their contents when broken")
public boolean utSDRemoveDropCoordinatesToggle = true;

@Config.RequiresMcRestart
@Config.Name("Render Range")
@Config.Comment
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@ public class UTMixinLoader implements ILateMixinLoader
put("mixins/mods/mixins.simpledifficulty.raincollector.json", c -> c.isModPresent("simpledifficulty") && UTConfigMods.SIMPLE_DIFFICULTY.utRainCollectorCanteenToggle);
put("mixins/mods/mixins.spiceoflife.dupes.json", c -> c.isModPresent("spiceoflife") && UTConfigMods.SPICE_OF_LIFE.utDuplicationFixesToggle);
put("mixins/mods/mixins.steamworld.json", c -> c.isModPresent("steamworld") && UTConfigMods.STEAMWORLD.utSkyOfOldFixToggle);
put("mixins/mods/mixins.storagedrawers.dropposition.json", c -> c.isModPresent("storagedrawers") && UTConfigMods.STORAGE_DRAWERS.utSDRemoveDropCoordinatesToggle);
put("mixins/mods/mixins.storagedrawers.json", c -> c.isModPresent("storagedrawers") && UTConfigMods.STORAGE_DRAWERS.utSDItemVoidingFixToggle);
put("mixins/mods/mixins.tconstruct.json", c -> regularTConLoaded());
put("mixins/mods/mixins.tconstruct.oredictcache.json", c -> regularTConLoaded() && UTConfigMods.TINKERS_CONSTRUCT.utTConOreDictCacheToggle);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package mod.acgaming.universaltweaks.mods.storagedrawers.mixin;

import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.common.util.Constants;

import com.jaquadro.minecraft.storagedrawers.block.BlockDrawers;
import com.llamalad7.mixinextras.injector.ModifyExpressionValue;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;

// Remove the position data from the dropped item so that it stacks with others
@Mixin(value = BlockDrawers.class, remap = false)
public abstract class UTDrawersDropMixin
{

@ModifyExpressionValue(
method = "getDrops",
at = @At(
value = "INVOKE",
target = "Lcom/jaquadro/minecraft/storagedrawers/block/BlockDrawers;getMainDrop(Lnet/minecraft/world/IBlockAccess;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/block/state/IBlockState;)Lnet/minecraft/item/ItemStack;"
)
)
private ItemStack utRemoveDropPosition(ItemStack original)
{
if (!original.hasTagCompound()) return original;

NBTTagCompound data = original.getTagCompound();
if (!data.hasKey("tile", Constants.NBT.TAG_COMPOUND)) return original;

NBTTagCompound tileData = data.getCompoundTag("tile");
tileData.removeTag("x");
tileData.removeTag("y");
tileData.removeTag("z");

return original;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"package": "mod.acgaming.universaltweaks.mods.storagedrawers.mixin",
"refmap": "universaltweaks.refmap.json",
"minVersion": "0.8",
"compatibilityLevel": "JAVA_8",
"mixins": ["UTDrawersDropMixin"]
}
Loading