Skip to content

Commit

Permalink
PRs follow-up
Browse files Browse the repository at this point in the history
  • Loading branch information
ACGaming committed Feb 8, 2025
1 parent 9365ab7 commit 70dbe22
Show file tree
Hide file tree
Showing 12 changed files with 142 additions and 100 deletions.
31 changes: 17 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,9 @@ All changes are toggleable via config files.
* **Cave Generation:** Sets custom values for the vanilla cave generation
* **Charged Creeper Spawning:** Sets the chance for creepers to spawn charged
* **Chat:**
* **Chat Lines:** Sets the maximum number of chat lines to display
* **Compact Messages:** Removes duplicate messages and instead put a number behind the message how often it was repeated
* **Keep Sent Messages:** Don't clear sent message history on leaving the world
* **Chat Lines:** Sets the maximum number of chat lines to display
* **Compact Messages:** Removes duplicate messages and instead put a number behind the message how often it was repeated
* **Keep Sent Messages:** Don't clear sent message history on leaving the world
* **Check Animated Models:** Improves model load times by checking if an animated model exists before trying to load it
* **Chicken Shedding:** Allows chickens to have a chance to shed feathers (similarly to laying eggs)
* **Chunk Gen Limit:** Limits maximum chunk generation per tick for improved server performance
Expand Down Expand Up @@ -275,9 +275,9 @@ All changes are toggleable via config files.
* **XP Bottle Amount:** Sets the amount of experience spawned by bottles o' enchanting
* **XP Level Cap:** Sets the maximum experience level players can reach
* **Void Teleport:**
* Options allow toggling the setting globally, controlling to what Y-level the entity is teleported, if blindness is applied, maximum number of consecutive times, and how much and in what way fall damage is taken
* **Configure Entities:** Configures what entities can be teleported, and if the player is teleported
* **Configure Dimensions:** Configures what dimensions the effect can take place in
* Options allow toggling the setting globally, controlling to what Y-level the entity is teleported, if blindness is applied, maximum number of consecutive times, and how much and in what way fall damage is taken
* **Configure Entities:** Configures what entities can be teleported, and if the player is teleported
* **Configure Dimensions:** Configures what dimensions the effect can take place in

![](https://i.imgur.com/1EmHZlb.png)

Expand All @@ -291,10 +291,10 @@ All changes are toggleable via config files.
* **Laser Upgrade Voiding:** Fixes Laser Upgrades voiding instead of applying if there is only one item in the stack
* **Item Laser Particles Graphics:** Sets what level of Graphic Setting is required to disable the Item Particles generated by Item Lasers transferring items
* **Astral Sorcery**
* **Missing Player Log Level:** Downgrades the message when completing a recipe without an initializing player from a warning to a debug
* **Sooty Marble Rendering:** Fixes Sooty Marble Pillar blocking the proper rendering of adjacent fluids due to inverted logic
* **Clear Particle Effects:** Fixes a bug where particle effects would continue to render after changing dimensions
* **Fix Division By Zero Crystal Tool:** Fixes a bug where merging Crystal Tool Properties could result in a division by zero
* **Missing Player Log Level:** Downgrades the message when completing a recipe without an initializing player from a warning to a debug
* **Sooty Marble Rendering:** Fixes Sooty Marble Pillar blocking the proper rendering of adjacent fluids due to inverted logic
* **Clear Particle Effects:** Fixes a bug where particle effects would continue to render after changing dimensions
* **Fix Division By Zero Crystal Tool:** Fixes a bug where merging Crystal Tool Properties could result in a division by zero
* **Advent of Ascension**
* **Improved Player Tick:** Improves AoA player ticking by only sending inventory changes when necessary
* **Arcane Archives**
Expand Down Expand Up @@ -330,6 +330,8 @@ All changes are toggleable via config files.
* **Allowed Spawns Improvement:** Improves server performance by properly controlling spawn checks (effectiveness depends on CM's config)
* **Invisible Wall Render Fix:** Fixes some compact machine walls being invisible if [Nothirium](https://www.curseforge.com/minecraft/mc-mods/nothirium) 0.2.x (and up) or [Vintagium](https://github.com/Asek3/sodium-1.12) is installed
* **Memory Leak Fix:** Fixes client-side memory leak associated with miniaturization recipes
* **Corpse**
* **Opening GUIs Off-thread Fix:** Fixes opening up GUIs on a non-client thread
* **Effortless Building**
* **Block Transmutation Fix:** Fixes Effortless Building ignoring Metadata when checking for items in inventory
* **Electroblob's Wizardry**
Expand Down Expand Up @@ -362,7 +364,7 @@ All changes are toggleable via config files.
* **Forestry**
* **Arborist Villager Trades:** Adds custom emerald to germling trades to the arborist villager
* **HWYLA**
* **Keybindings Fix:** Fixes crashes in all menus when changing HWYLA keybindings to unsupported values
* **Keybindings Fix:** Fixes crashes in all menus when changing HWYLA keybindings to unsupported values
* **In Control!**
* **Spawn Rule Stats Fix:** Fixes onJoin spawn rules repeatedly modifying mob attack/health/speed
* **IndustrialCraft 2**
Expand Down Expand Up @@ -404,11 +406,11 @@ All changes are toggleable via config files.
* **Quark**
* **Duplication Fixes:** Fixes various duplication exploits
* **Random Things**
* **Anvil Crafting Fix:** Fixes a bug where crafting the output of an Anvil recipe would modify the recipe, preventing crafts until restart
* **Anvil Crafting Fix:** Fixes a bug where crafting the output of an Anvil recipe would modify the recipe, preventing crafts until restart
* **Railcraft**
* **No Beta Warning:** Disables the beta message warning on world join
* **No Beta Warning:** Disables the beta message warning on world join
* **Requious Frakto**
* **Particle Fixes:** Fixes server world being leaked to various particles
* **Particle Fixes:** Fixes server world being leaked to various particles
* **RFTools Dimension**
* **Properly Unregister Dimensions:** Fixes a bug where joining a world or server with any RFTools Dimension registered would disallow entering another world without that dimension until restarting.
* **Roost**
Expand All @@ -423,6 +425,7 @@ All changes are toggleable via config files.
* **SteamWorld**
* **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
* **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 @@ -967,6 +967,11 @@ public static class SteamWorldCategory

public static class StorageDrawersCategory
{
@Config.RequiresMcRestart
@Config.Name("Item Voiding Fix")
@Config.Comment("Prevents voiding of items when near capacity limits")
public boolean utSDItemVoidingFixToggle = false;

@Config.RequiresMcRestart
@Config.Name("Render Range")
@Config.Comment
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ public class UTMixinLoader implements ILateMixinLoader
put("mixins.mods.simpledifficulty.json", () -> loaded("simpledifficulty"));
put("mixins.mods.spiceoflife.dupes.json", () -> loaded("spiceoflife") && UTConfigMods.SPICE_OF_LIFE.utDuplicationFixesToggle);
put("mixins.mods.steamworld.json", () -> loaded("steamworld") && UTConfigMods.STEAMWORLD.utSkyOfOldFixToggle);
put("mixins.mods.storagedrawers.json", () -> loaded("storagedrawers") && UTConfigMods.STORAGE_DRAWERS.utSDItemVoidingFixToggle);
put("mixins.mods.tconstruct.json", () -> loaded("tconstruct"));
put("mixins.mods.tconstruct.oredictcache.json", () -> loaded("tconstruct") && UTConfigMods.TINKERS_CONSTRUCT.utTConOreDictCacheToggle);
put("mixins.mods.tconstruct.toolcustomization.json", () -> loaded("tconstruct") && UTConfigMods.TINKERS_CONSTRUCT.utTConToolCustomizationToggle);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
package mod.acgaming.universaltweaks.mods.corpse.mixin;

import com.llamalad7.mixinextras.injector.wrapmethod.WrapMethod;
import com.llamalad7.mixinextras.injector.wrapoperation.Operation;

import de.maxhenkel.corpse.net.MessageOpenHistory;

import net.minecraft.client.Minecraft;
import net.minecraftforge.fml.common.network.simpleimpl.IMessage;
import net.minecraftforge.fml.common.network.simpleimpl.MessageContext;

import com.llamalad7.mixinextras.injector.wrapmethod.WrapMethod;
import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
import de.maxhenkel.corpse.net.MessageOpenHistory;
import org.spongepowered.asm.mixin.Mixin;

@Mixin(value = MessageOpenHistory.class, remap = false)
Expand All @@ -20,5 +18,4 @@ private IMessage wrapOnMessage(MessageOpenHistory message, MessageContext ctx, O
Minecraft.getMinecraft().addScheduledTask(() -> original.call(message, ctx));
return null;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,11 @@ public interface IAuxData
Object UT$getData(String key);

@NotNull
default Int2IntMap getOrCreateData() {
default Int2IntMap getOrCreateData()
{
Int2IntMap v = (Int2IntMap) UT$getData(KEY);
if (v == null) {
if (v == null)
{
v = new Int2IntArrayMap();
UT$setData(KEY, v);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
package mod.acgaming.universaltweaks.mods.storagedrawers.mixin;

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.Iterator;
import java.util.Set;
import java.util.function.Predicate;

import net.minecraft.item.ItemStack;

import com.jaquadro.minecraft.storagedrawers.api.storage.IDrawer;
import com.jaquadro.minecraft.storagedrawers.api.storage.IDrawerGroup;
import com.jaquadro.minecraft.storagedrawers.block.tile.TileEntityController;
Expand All @@ -8,9 +16,6 @@
import com.llamalad7.mixinextras.sugar.ref.LocalIntRef;
import mod.acgaming.universaltweaks.mods.storagedrawers.api.IAuxData;
import mod.acgaming.universaltweaks.mods.storagedrawers.api.SlotGroupAccessor;

import net.minecraft.item.ItemStack;

import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
Expand All @@ -19,47 +24,25 @@
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.Iterator;
import java.util.Set;
import java.util.function.Predicate;

@Mixin(value = TileEntityController.class, remap = false)
public class UTDrawerControllerMixin {
public class UTDrawerControllerMixin
{

@Mixin(targets = "com.jaquadro.minecraft.storagedrawers.block.tile.TileEntityController$ItemRepository",
remap = false)
public static abstract class RepositoryMixin extends DrawerItemRepository {
public static abstract class RepositoryMixin extends DrawerItemRepository
{

@Shadow
@Final
TileEntityController this$0;

@Shadow
protected abstract boolean hasAccess(IDrawerGroup group, IDrawer drawer);

public RepositoryMixin(IDrawerGroup group) {
super(group);
}

// should probably use unreflect for this
@Unique
Method UT$getGroupForSlotRecord = null;

@Unique
private IDrawerGroup UT$getDrawerGroup(TileEntityController controller, SlotGroupAccessor o) {
try {
if (UT$getGroupForSlotRecord == null) {
UT$getGroupForSlotRecord = TileEntityController.class
.getDeclaredMethod("getGroupForSlotRecord", o.UT$getType());
UT$getGroupForSlotRecord.setAccessible(true);
}

return (IDrawerGroup) UT$getGroupForSlotRecord.invoke(controller, o);
} catch (NoSuchMethodException | InvocationTargetException | IllegalAccessException e) {
throw new RuntimeException(e);
}
public RepositoryMixin(IDrawerGroup group)
{
super(group);
}

@Inject(method = "insertItem",
Expand All @@ -70,38 +53,70 @@ public void readData(ItemStack stack, boolean simulate, Predicate<ItemStack> pre
CallbackInfoReturnable<ItemStack> cir,
@Local Iterator<SlotGroupAccessor> iterator,
@Local LocalIntRef amount,
@Local Set<Integer> checkedSlots) {
while (iterator.hasNext()) {
@Local Set<Integer> checkedSlots)
{
while (iterator.hasNext())
{
SlotGroupAccessor record = iterator.next();
IDrawerGroup candidateGroup = UT$getDrawerGroup(this$0, record);
if (candidateGroup != null) {
if (candidateGroup != null)
{
IDrawer drawerx = candidateGroup.getDrawer(record.UT$getSlot());
if (!drawerx.isEmpty() && this.testPredicateInsert(drawerx, stack, predicate) &&
this.hasAccess(candidateGroup, drawerx)) {
if (simulate) {
this.hasAccess(candidateGroup, drawerx))
{
if (simulate)
{
int inserted = ((IAuxData) drawerx).getOrCreateData().get(record.UT$getSlot());
if (inserted + drawerx.getStoredItemCount() == drawerx.getMaxCapacity()) {
if (inserted + drawerx.getStoredItemCount() == drawerx.getMaxCapacity())
{
continue;
}
}
amount.set(simulate ?
Math.max(amount.get() - drawerx.getAcceptingRemainingCapacity(), 0) :
drawerx.adjustStoredItemCount(amount.get()));
if (amount.get() == 0) {
if (amount.get() == 0)
{
cir.setReturnValue(ItemStack.EMPTY);
}

if (simulate) {
if (simulate)
{
checkedSlots.add(record.UT$getIndex());
}
}
}
}
}

@Shadow
protected abstract boolean hasAccess(IDrawerGroup group, IDrawer drawer);

@Unique
private IDrawerGroup UT$getDrawerGroup(TileEntityController controller, SlotGroupAccessor o)
{
try
{
if (UT$getGroupForSlotRecord == null)
{
UT$getGroupForSlotRecord = TileEntityController.class
.getDeclaredMethod("getGroupForSlotRecord", o.UT$getType());
UT$getGroupForSlotRecord.setAccessible(true);
}

return (IDrawerGroup) UT$getGroupForSlotRecord.invoke(controller, o);
}
catch (NoSuchMethodException | InvocationTargetException | IllegalAccessException e)
{
throw new RuntimeException(e);
}
}
}

@Mixin(targets = "com.jaquadro.minecraft.storagedrawers.block.tile.TileEntityController$SlotRecord", remap = false)
private static abstract class SlotRecordMixin implements SlotGroupAccessor {
private static abstract class SlotRecordMixin implements SlotGroupAccessor
{

@Shadow
public int slot;
Expand All @@ -110,17 +125,20 @@ private static abstract class SlotRecordMixin implements SlotGroupAccessor {
public int index;

@Override
public int UT$getSlot() {
public int UT$getSlot()
{
return slot;
}

@Override
public int UT$getIndex() {
public int UT$getIndex()
{
return index;
}

@Override
public Class<?> UT$getType() {
public Class<?> UT$getType()
{
return getClass();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
import org.spongepowered.asm.mixin.Shadow;

@Mixin(value = StandardDrawerGroup.class, remap = false)
public abstract class UTDrawerGroupMixin {
public abstract class UTDrawerGroupMixin
{

@Mixin(value = StandardDrawerGroup.DrawerData.class, remap = false)
public abstract static class DrawerDataMixin implements IAuxData
Expand All @@ -21,12 +22,14 @@ public abstract static class DrawerDataMixin implements IAuxData
public abstract Object getExtendedData(String key);

@Override
public void UT$setData(String key, Object value) {
public void UT$setData(String key, Object value)
{
setExtendedData(key, value);
}

@Override
public @Nullable Object UT$getData(String key) {
public @Nullable Object UT$getData(String key)
{
return getExtendedData(key);
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,31 +1,33 @@
package mod.acgaming.universaltweaks.mods.storagedrawers.mixin;

import mod.acgaming.universaltweaks.mods.storagedrawers.api.IAuxData;

import net.minecraft.item.ItemStack;

import com.jaquadro.minecraft.storagedrawers.api.storage.IDrawer;
import com.jaquadro.minecraft.storagedrawers.capabilities.DrawerItemHandler;
import com.llamalad7.mixinextras.sugar.Local;
import mod.acgaming.universaltweaks.mods.storagedrawers.api.IAuxData;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;

@Mixin(value = DrawerItemHandler.class, remap = false)
public abstract class UTDrawerHandlerMixin {
public abstract class UTDrawerHandlerMixin
{

@Inject(method = "insertItemInternal",
at = @At(value = "INVOKE_ASSIGN",
target = "Lcom/jaquadro/minecraft/storagedrawers/api/storage/IDrawerGroup;getDrawer(I)Lcom/jaquadro/minecraft/storagedrawers/api/storage/IDrawer;"))
public void setData(int slot, ItemStack stack, boolean simulate,
CallbackInfoReturnable<ItemStack> cir,
@Local IDrawer drawer) {
@Local IDrawer drawer)
{
int inserted = drawer.isEmpty() ?
drawer.getAcceptingMaxCapacity(stack) :
drawer.getAcceptingRemainingCapacity();

if (drawer instanceof IAuxData) {
if (drawer instanceof IAuxData)
{
((IAuxData) drawer).getOrCreateData().put(slot, inserted);
}
}
Expand Down
Loading

0 comments on commit 70dbe22

Please sign in to comment.