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
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -336,8 +336,17 @@ All changes are toggleable via config files.
* **Bewitchment**
* **Witches' Oven Fix:** Fixes Witches' Oven consuming container fuel items
* **Bibliocraft**
* **Allow Any Black Dye for Printing Press:** Allow the Printing Press to properly work with any itemstack with the dyeBlack oredict, instead of only processing with Ink Sacs
* **Disable Version Check:** Fixes client-side memory leak by disabling version check
* **Fix Armor Stand Binding:** Fix BiblioCraft's custom Armor Stand not respecting the Curse of Binding
* **Fix Armor Stand Slots:** Fix BiblioCraft's custom Armor Stand using the incorrect slots for items or not recognizing the items as valid
* **Fix Fancy Sign Rotation:** Fix Fancy Signs rendering items and blocks in different ways between the GUI and in-world
* **Fix IItemHandler Method Not Existing:** Fix IItemHandler#getStackInSlot method not existing due to being obfuscated by IInventory, preventing countless errors
* **Fix Item Transfer:** Make BiblioCraft actually use simulate properly when inserting and extracting items, fixing many item transfer methods
* **Fix ItemStack Copying:** Fixes removing an ItemStack not copying all data correctly, particularly for backpacks
* **Fix Left Handed Rendering:** Fixes the Antique Atlas and Clipboard rendering incorrect when the Main Hand is set to Left
* **Fix Using Incorrect Hand:** Fix the Clipboard and the Stockroom Catalogue behaving incorrectly when used in the offhand
* **Multiplayer Sound Fix:** Register all sounds, fixing bugs when attempting to play them on servers
* **Binnie's Mods**
* **Gather Windfall:** Allows Forestry farms to pick up ExtraTrees fruit
* **Biomes O' Plenty**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import mod.acgaming.universaltweaks.core.UTMixinLoader;
import mod.acgaming.universaltweaks.mods.arcanearchives.UTArcaneArchivesEvents;
import mod.acgaming.universaltweaks.mods.astralsorcery.UTClearOnChange;
import mod.acgaming.universaltweaks.mods.bibliocraft.sound.UTBiblioCraftSoundRegister;
import mod.acgaming.universaltweaks.mods.bloodmagic.UTBloodMagicEvents;
import mod.acgaming.universaltweaks.mods.botania.UTBotaniaFancySkybox;
import mod.acgaming.universaltweaks.mods.collective.UTCollectiveEvents;
Expand Down Expand Up @@ -136,6 +137,7 @@ public void preInit(FMLPreInitializationEvent event)
if (UTConfigGeneral.MASTER_SWITCHES.utMasterSwitchModIntegration)
{
if (UTMixinLoader.regularTConLoaded() && UTConfigMods.TINKERS_CONSTRUCT.utTConOreDictCacheToggle) UTOreDictCache.preInit();
if (Loader.isModLoaded("bibliocraft") && UTConfigMods.BIBLIOCRAFT.utRegisterSoundToggle) MinecraftForge.EVENT_BUS.register(new UTBiblioCraftSoundRegister());
}

if (UTConfigGeneral.MASTER_SWITCHES.utMasterSwitchTweaks)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.gameevent.TickEvent;

import mod.acgaming.universaltweaks.mods.vanilla.mixin.UTEntityLivingBaseAccessor;

// MC-849
// https://bugs.mojang.com/browse/MC-849
// Courtesy of Marcono1234, makamys
Expand All @@ -17,7 +19,7 @@ public static void utDoubleConsumption(TickEvent.PlayerTickEvent event)
ItemStack currentItem = event.player.inventory.getCurrentItem();
if (event.player.getActiveItemStack() != currentItem && ItemStack.areItemStacksEqual(currentItem, event.player.getActiveItemStack()))
{
event.player.activeItemStack = currentItem;
((UTEntityLivingBaseAccessor) event.player).setActiveItemStack(currentItem);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import mod.acgaming.universaltweaks.UniversalTweaks;
import mod.acgaming.universaltweaks.config.UTConfigGeneral;
import mod.acgaming.universaltweaks.mods.vanilla.mixin.UTEntityAccessor;

public class UTPortalLocationLink
{
Expand All @@ -17,7 +18,7 @@ public class UTPortalLocationLink
public static void utDimensionChangeEventPortalLocation(EntityTravelToDimensionEvent event)
{
if (UTConfigGeneral.DEBUG.utDebugToggle) UniversalTweaks.LOGGER.debug("UTPortalLocationLink ::: Entity travel to dimension event");
if (event.getEntity().inPortal && event.getEntity().getEntityWorld().provider.getDimension() == 0)
if (((UTEntityAccessor) event.getEntity()).isInPortal() && event.getEntity().getEntityWorld().provider.getDimension() == 0)
{
writePortalNBT(event.getEntity());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -453,15 +453,64 @@ public static class BewitchmentCategory

public static class BiblioCraftCategory
{
@Config.RequiresMcRestart
@Config.Name("Allow Any Black Dye for Printing Press")
@Config.Comment("Allow the Printing Press to properly work with any itemstack with the dyeBlack oredict, instead of only processing with Ink Sacs")
public boolean utPrintingPressAnyBlackDyeToggle = true;

@Config.RequiresMcRestart
@Config.Name("Disable Version Check")
@Config.Comment("Fixes client-side memory leak by disabling version check")
public boolean utDisableVersionCheckToggle = true;

@Config.RequiresMcRestart
@Config.Name("Fix Armor Stand Slots")
@Config.Comment("Fix BiblioCraft's custom Armor Stand using the incorrect slots for items or not recognizing the items as valid")
public boolean utArmorStandSlotFixToggle = true;

@Config.RequiresMcRestart
@Config.Name("Fix Armor Stand Binding")
@Config.Comment("Fix BiblioCraft's custom Armor Stand not respecting the Curse of Binding")
public boolean utArmorStandBindingCurseToggle = true;

@Config.RequiresMcRestart
@Config.Name("Fix Fancy Sign Rotation")
@Config.Comment("Fix Fancy Signs rendering items and blocks in different ways between the GUI and in-world")
public boolean utFancySignRotationToggle = true;

@Config.RequiresMcRestart
@Config.Name("Fix Left Handed Rendering")
@Config.Comment("Fixes the Antique Atlas and Clipboard rendering incorrect when the Main Hand is set to Left")
public boolean utSwapDisplayHandWhenLeftHanded = true;

@Config.RequiresMcRestart
@Config.Name("Fix Using Incorrect Hand")
@Config.Comment("Fix the Clipboard and the Stockroom Catalogue behaving incorrectly when used in the offhand")
public boolean utFixHandConsumption = true;

@Config.RequiresMcRestart
@Config.Name("Fix IItemHandler Method Not Existing")
@Config.Comment
({
"Fix IItemHandler#getStackInSlot method not existing due to being obfuscated by IInventory, preventing countless errors",
"This occurs because BiblioCraft's Tile Entities implement both IInventory and IItemHandler, and getStackInSlot is an obfuscated method in IInventory but not IItemHandler",
})
public boolean utEnsureIItemHandlerMethodToggle = true;

@Config.RequiresMcRestart
@Config.Name("Fix Item Transfer")
@Config.Comment("Make BiblioCraft actually use simulate properly when inserting and extracting items, fixing many item transfer methods")
public boolean utFixItemTransferToggle = true;

@Config.RequiresMcRestart
@Config.Name("Fix ItemStack Copying")
@Config.Comment("Fixes removing an ItemStack not copying all data correctly, particularly for backpacks")
public boolean utCopyItemStackCorrectlyToggle = true;

@Config.RequiresMcRestart
@Config.Name("Multiplayer Sound Fix")
@Config.Comment("Register all sounds, fixing bugs when attempting to play them on servers")
public boolean utRegisterSoundToggle = true;
}

public static class BiomesOPlentyCategory
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,11 @@ public class UTLoadingPlugin implements IFMLLoadingPlugin, IEarlyMixinLoader
private static final Map<String, BooleanSupplier> commonMixinConfigs = ImmutableMap.copyOf(new HashMap<String, BooleanSupplier>()
{
{
if (UTConfigGeneral.MASTER_SWITCHES.utMasterSwitchModIntegration)
{
put("mixins.vanilla.mod.accessors.json", () -> true);
}

if (UTConfigGeneral.MASTER_SWITCHES.utMasterSwitchBugfixes)
{
put("mixins.bugfixes.blocks.comparatortiming.json", () -> UTConfigBugfixes.BLOCKS.utComparatorTimingToggle);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ public class UTMixinLoader implements ILateMixinLoader
if (UTConfigGeneral.MASTER_SWITCHES.utMasterSwitchModIntegration)
{
put("mixins.mods.actuallyadditions.itemparticle.json", () -> loaded("actuallyadditions") && UTConfigMods.ACTUALLY_ADDITIONS.utItemLaserParticlesGraphics > -1);
put("mixins.mods.bibliocraft.lefthand.json", () -> loaded("bibliocraft") && UTConfigMods.BIBLIOCRAFT.utSwapDisplayHandWhenLeftHanded);
put("mixins.mods.bibliocraft.sign.json", () -> loaded("bibliocraft") && UTConfigMods.BIBLIOCRAFT.utFancySignRotationToggle);
put("mixins.mods.bibliocraft.version.json", () -> loaded("bibliocraft") && UTConfigMods.BIBLIOCRAFT.utDisableVersionCheckToggle);
put("mixins.mods.cbmultipart.client.json", () -> loaded("forgemultipartcbe") && UTConfigMods.CB_MULTIPART.utMemoryLeakFixToggle);
put("mixins.mods.compactmachines.memory.json", () -> loaded("compactmachines3") && UTConfigMods.COMPACT_MACHINES.utMemoryLeakFixToggle);
Expand Down Expand Up @@ -70,7 +72,13 @@ public class UTMixinLoader implements ILateMixinLoader
put("mixins.mods.astralsorcery.tool.json", () -> loaded("astralsorcery") && UTConfigMods.ASTRAL_SORCERY.utEmptyPropertiesZero);
put("mixins.mods.backpack.json", () -> loaded("backpack") && UTConfigMods.BACKPACKS.utBPNoOffhandInteractionToggle);
put("mixins.mods.bewitchment.json", () -> loaded("bewitchment") && UTConfigMods.BEWITCHMENT.utWitchesOvenFixToggle);
put("mixins.mods.bibliocraft.armor.json", () -> loaded("bibliocraft") && UTConfigMods.BIBLIOCRAFT.utArmorStandSlotFixToggle);
put("mixins.mods.bibliocraft.armorbinding.json", () -> loaded("bibliocraft") && UTConfigMods.BIBLIOCRAFT.utArmorStandBindingCurseToggle);
put("mixins.mods.bibliocraft.hand.json", () -> loaded("bibliocraft") && UTConfigMods.BIBLIOCRAFT.utFixHandConsumption);
put("mixins.mods.bibliocraft.handler.json", () -> loaded("bibliocraft") && UTConfigMods.BIBLIOCRAFT.utEnsureIItemHandlerMethodToggle);
put("mixins.mods.bibliocraft.itemstack.json", () -> loaded("bibliocraft") && UTConfigMods.BIBLIOCRAFT.utCopyItemStackCorrectlyToggle);
put("mixins.mods.bibliocraft.printpress.json", () -> loaded("bibliocraft") && UTConfigMods.BIBLIOCRAFT.utPrintingPressAnyBlackDyeToggle);
put("mixins.mods.bibliocraft.transfer.json", () -> loaded("bibliocraft") && UTConfigMods.BIBLIOCRAFT.utFixItemTransferToggle);
put("mixins.mods.biomesoplenty.json", () -> loaded("biomesoplenty"));
put("mixins.mods.biomesoplenty.sealevel.json", () -> loaded("biomesoplenty") && UTConfigTweaks.WORLD.utSeaLevel != 63);
put("mixins.mods.bloodmagic.boundtool.json", () -> loaded("bloodmagic") && UTConfigMods.BLOOD_MAGIC.utBoundToolTweakToggle);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
package mod.acgaming.universaltweaks.mods.bibliocraft.armor.mixin;

import net.minecraft.entity.EntityLiving;
import net.minecraft.inventory.EntityEquipmentSlot;
import net.minecraft.item.ItemArmor;
import net.minecraft.item.ItemStack;
import net.minecraft.util.NonNullList;

import com.llamalad7.mixinextras.expression.Definition;
import com.llamalad7.mixinextras.expression.Expression;
import com.llamalad7.mixinextras.injector.ModifyExpressionValue;
import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;
import com.llamalad7.mixinextras.sugar.Local;
import jds.bibliocraft.containers.ContainerArmor;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Slice;

// Courtesy of WaitingIdly
@Mixin(value = ContainerArmor.class, remap = false)
public abstract class UTContainerArmorMixin
{
/**
* @author WaitingIdly
* @reason Slots are ordered 0/1/2/3 as HEAD/CHEST/LEGS/FEET, BiblioCraft inverts that order in this location.
* This fixes inserting into the armor stand slots.
*/
@WrapOperation(method = "transferStackInSlot", at = @At(value = "INVOKE", target = "Ljds/bibliocraft/containers/ContainerArmor;mergeItemStack(Lnet/minecraft/item/ItemStack;IIZ)Z"), slice = @Slice(from = @At(value = "FIELD", target = "Lnet/minecraft/inventory/EntityEquipmentSlot;FEET:Lnet/minecraft/inventory/EntityEquipmentSlot;"), to = @At(value = "CONSTANT", args = "classValue=net/minecraft/item/ItemSkull")))
private boolean utEnsureArmorStandOrder(ContainerArmor instance, ItemStack stack, int startIndex, int endIndex, boolean reverseDirection, Operation<Boolean> original)
{
int start = startIndex <= 3 ? 3 - startIndex : startIndex;
return original.call(instance, stack, start, start + 1, reverseDirection);
}

/**
* @author WaitingIdly
* @reason Slots are ordered 0/1/2/3 as HEAD/CHEST/LEGS/FEET for Vanilla, BiblioCraft has the incorrect order.
* This fixes shift-clicking from the player armor slots.
*/
@WrapOperation(method = "transferStackInSlot", at = @At(value = "INVOKE", target = "Lnet/minecraft/util/NonNullList;get(I)Ljava/lang/Object;"), slice = @Slice(from = @At(value = "FIELD", target = "Lnet/minecraft/inventory/EntityEquipmentSlot;FEET:Lnet/minecraft/inventory/EntityEquipmentSlot;"), to = @At(value = "CONSTANT", args = "classValue=net/minecraft/item/ItemSkull")))
private Object utEnsureArmorSlotOrder(NonNullList<Object> instance, int index, Operation<Object> original)
{
return original.call(instance, 3 - index);
}

/**
* @author WaitingIdly
* @reason Skip the ItemArmor check. Requires {@link #utSkipItemArmorCast} and {@link #utAccessRealEquipmentSlot}
*/
@Definition(id = "ItemArmor", type = ItemArmor.class)
@Expression("? instanceof ItemArmor")
@ModifyExpressionValue(method = "transferStackInSlot", at = @At("MIXINEXTRAS:EXPRESSION"))
private boolean utSkipItemArmorCheck(boolean original)
{
return true;
}

/**
* @author WaitingIdly
* @reason Skip the ItemArmor cast. Requires {@link #utSkipItemArmorCheck} and {@link #utAccessRealEquipmentSlot}
*/
@Definition(id = "ItemArmor", type = ItemArmor.class)
@Expression("(ItemArmor) ?")
@WrapOperation(method = "transferStackInSlot", at = @At("MIXINEXTRAS:EXPRESSION"))
private ItemArmor utSkipItemArmorCast(Object object, Operation<ItemArmor> original)
{
return null;
}

/**
* @author WaitingIdly
* @reason Returns the real EntityEquipmentSlot for the item, using the forge method.
* Requires {@link #utSkipItemArmorCast} and {@link #utSkipItemArmorCheck}.
* Fixes slots not respecting the armor type of the stack and only allowing {@link ItemArmor}.
*/
@WrapOperation(method = "transferStackInSlot", at = @At(value = "FIELD", target = "Lnet/minecraft/item/ItemArmor;armorType:Lnet/minecraft/inventory/EntityEquipmentSlot;"))
private EntityEquipmentSlot utAccessRealEquipmentSlot(ItemArmor instance, Operation<EntityEquipmentSlot> original, @Local(ordinal = 0) ItemStack stack)
{
return EntityLiving.getSlotForItemStack(stack);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package mod.acgaming.universaltweaks.mods.bibliocraft.armor.mixin;

import net.minecraft.entity.EntityLiving;
import net.minecraft.inventory.EntityEquipmentSlot;
import net.minecraft.item.ItemStack;

import jds.bibliocraft.slots.SlotArmorBoots;
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;

// Courtesy of WaitingIdly
@Mixin(value = SlotArmorBoots.class, remap = false)
public abstract class UTSlotArmorBootsMixin
{
/**
* @author WaitingIdly
* @reason Make BiblioCraft use the forge method to determine
* if the itemstack is valid for the desired armor slot.
*/
@Inject(method = "isItemValid", at = @At("HEAD"), cancellable = true)
private void utEnsureValidity(ItemStack stack, CallbackInfoReturnable<Boolean> cir)
{
cir.setReturnValue(EntityEquipmentSlot.FEET == EntityLiving.getSlotForItemStack(stack));
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package mod.acgaming.universaltweaks.mods.bibliocraft.armor.mixin;

import net.minecraft.entity.EntityLiving;
import net.minecraft.inventory.EntityEquipmentSlot;
import net.minecraft.item.ItemStack;

import jds.bibliocraft.slots.SlotArmorCuirass;
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;

// Courtesy of WaitingIdly
@Mixin(value = SlotArmorCuirass.class, remap = false)
public abstract class UTSlotArmorCuirassMixin
{
/**
* @author WaitingIdly
* @reason Make BiblioCraft use the forge method to determine
* if the itemstack is valid for the desired armor slot.
*/
@Inject(method = "isItemValid", at = @At("HEAD"), cancellable = true)
private void utEnsureValidity(ItemStack stack, CallbackInfoReturnable<Boolean> cir)
{
cir.setReturnValue(EntityEquipmentSlot.CHEST == EntityLiving.getSlotForItemStack(stack));
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package mod.acgaming.universaltweaks.mods.bibliocraft.armor.mixin;

import net.minecraft.entity.EntityLiving;
import net.minecraft.inventory.EntityEquipmentSlot;
import net.minecraft.item.ItemStack;

import jds.bibliocraft.slots.SlotArmorGreaves;
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;

// Courtesy of WaitingIdly
@Mixin(value = SlotArmorGreaves.class, remap = false)
public abstract class UTSlotArmorGreavesMixin
{
/**
* @author WaitingIdly
* @reason Make BiblioCraft use the forge method to determine
* if the itemstack is valid for the desired armor slot.
*/
@Inject(method = "isItemValid", at = @At("HEAD"), cancellable = true)
private void utEnsureValidity(ItemStack stack, CallbackInfoReturnable<Boolean> cir)
{
cir.setReturnValue(EntityEquipmentSlot.LEGS == EntityLiving.getSlotForItemStack(stack));
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package mod.acgaming.universaltweaks.mods.bibliocraft.armor.mixin;

import net.minecraft.entity.EntityLiving;
import net.minecraft.inventory.EntityEquipmentSlot;
import net.minecraft.item.ItemStack;

import jds.bibliocraft.slots.SlotArmorHelm;
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;

// Courtesy of WaitingIdly
@Mixin(value = SlotArmorHelm.class, remap = false)
public abstract class UTSlotArmorHelmMixin
{
/**
* @author WaitingIdly
* @reason Make BiblioCraft use the forge method to determine
* if the itemstack is valid for the desired armor slot.
*/
@Inject(method = "isItemValid", at = @At("HEAD"), cancellable = true)
private void utEnsureValidity(ItemStack stack, CallbackInfoReturnable<Boolean> cir)
{
cir.setReturnValue(EntityEquipmentSlot.HEAD == EntityLiving.getSlotForItemStack(stack));
}
}
Loading