diff --git a/README.md b/README.md index 8c7dba33..f35d93a0 100644 --- a/README.md +++ b/README.md @@ -315,6 +315,8 @@ All changes are toggleable via config files. * **Duplication Fixes:** Fixes various duplication exploits * **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 +* **Aether Legacy** + * **Capture Accessory Drops:** When dropping equipped Accessories, add the drops to the event instead of dropping them directly, allowing compatibility with various grave mods * **Agricraft** * **Ender IO Integration Fix:** Fixes crash when Ender IO's Farming Station attempts to harvest Agricraft crops * **Astral Sorcery** @@ -547,5 +549,9 @@ All changes are toggleable via config files. * **Tool Customization:** Sets the attack damage cutoff at which diminishing returns start for any Tinkers' tool and sets the rate at which a tool's attack damage incrementally decays depending on its damage cutoff * **Tiny Progressions** * **Duplication Fixes:** Fixes various duplication exploits +* **TombManyGraves2** + * **Add Compat Aether Legacy Accessories:** If **Aether Legacy: Capture Accessory Drops** is enabled, allow TombManyGraves2 to have compat with Aether Legacy Accessories + * **Change Timestamp:** Change the timestamp used from 'MM_dd_YYYY_HH_mm_ss' to an ISO 8601 based format of 'YYYY-MM-dd'T'HH:mm:ss' + * **Proper World Size Check:** Fix TombManyGraves not spawning the grave due to incorrectly checking world height * **Woot** * **Cleanup Simulated Kills:** Remove any leftover entities spawned on simulated mob's death diff --git a/dependencies.gradle b/dependencies.gradle index 600d4f69..26afd13e 100644 --- a/dependencies.gradle +++ b/dependencies.gradle @@ -56,6 +56,7 @@ final def mod_dependencies = [ 'curse.maven:abyssalcraft-53686:3425234' : [debug_abyssalcraft], 'curse.maven:actuallyaditions-228404:2844115' : [debug_actually_additions], 'curse.maven:advent-of-ascension-311054:3054253' : [debug_advent_of_ascension], + 'curse.maven:aether-255308:6316434' : [debug_aether_legacy], 'curse.maven:agricraft-225635:3317747' : [debug_agricraft], 'curse.maven:applecore-224472:2969118' : [debug_the_spice_of_life], 'curse.maven:arcanearchives-311357:3057332' : [debug_arcane_archives], @@ -89,7 +90,6 @@ final def mod_dependencies = [ 'curse.maven:cyclops-core-232758:3159497' : [debug_evilcraft], 'curse.maven:dankkstorage-335673:2787318' : [debug_dankstorage], 'curse.maven:effortlessbuilding-302113:2847346' : [debug_effortless_building], - 'curse.maven:official-divinerpg-363543:3081433' : [debug_divinerpg], 'curse.maven:electroblobs-wizardry-265642:5354477' : [debug_electroblobs_wizardry], 'curse.maven:elementary-staffs-346007:2995593' : [debug_elementary_staffs], 'curse.maven:elenaidodge2-442962:3343308' : [debug_elenai_dodge_2], @@ -127,6 +127,7 @@ final def mod_dependencies = [ 'curse.maven:netherchest-268888:2655413' : [debug_netherchest], 'curse.maven:netherrocks-226140:2628297' : [debug_netherrocks], 'curse.maven:nuclearcraft-226254:3784145' : [debug_nuclearcraft], + 'curse.maven:official-divinerpg-363543:3081433' : [debug_divinerpg], 'curse.maven:openblocks-228816:2699056' : [debug_openblocks], 'curse.maven:openmodslib-228815:2699055' : [debug_openblocks], 'curse.maven:patchouli-306770:3162874' : [debug_bewitchment, debug_roots], @@ -156,9 +157,9 @@ final def mod_dependencies = [ 'curse.maven:tech-reborn-233564:2966851' : [debug_tech_reborn], 'curse.maven:teslacorelib-254602:2891841' : [debug_industrial_foregoing], 'curse.maven:test_dummy-225738:2503041' : [debug_test_dummy], + 'curse.maven:thaumcraft-223628:2629023' : [debug_thaumcraft], 'curse.maven:the-betweenlands-243363:4479688' : [debug_the_betweenlands], 'curse.maven:the-erebus-220698:3211974' : [debug_erebus], - 'curse.maven:thaumcraft-223628:2629023' : [debug_thaumcraft], 'curse.maven:thefarlanders-336432:2805139' : [debug_the_farlanders], 'curse.maven:thermal-expansion-69163:2926431' : [debug_thermal_expansion], 'curse.maven:thermalfoundation-222880:2926428' : [debug_thermal_expansion], @@ -166,6 +167,7 @@ final def mod_dependencies = [ 'curse.maven:tinkers_construct-74072:2902483' : [debug_tinkers_construct, debug_moartinkers], 'curse.maven:tinkerscomplement-272671:2843439' : [debug_tinkers_construct], 'curse.maven:tinyprogressions-250850:2721018' : [debug_tiny_progressions], + 'curse.maven:tomb-many-graves-2-262823:2619249' : [debug_tomb_many_graves], 'curse.maven:woot-244049:2712670' : [debug_woot], 'maven.modrinth:industrial-foregoing:1.12.13-237' : [debug_industrial_foregoing], 'net.darkhax.bookshelf:Bookshelf-1.12.2:2.3.590' : [debug_stages, debug_bookshelf], diff --git a/gradle.properties b/gradle.properties index e8f100f9..89441413 100644 --- a/gradle.properties +++ b/gradle.properties @@ -9,6 +9,7 @@ debug_abyssalcraft = false debug_actually_additions = false debug_advent_of_ascension = false +debug_aether_legacy = false debug_agricraft = false debug_arcane_archives = false debug_astral_sorcery = false @@ -92,6 +93,7 @@ debug_the_spice_of_life = false debug_thermal_expansion = false debug_tinkers_construct = false debug_tiny_progressions = false +debug_tomb_many_graves = false debug_woot = false # Gradle Settings diff --git a/src/main/java/mod/acgaming/universaltweaks/config/UTConfigMods.java b/src/main/java/mod/acgaming/universaltweaks/config/UTConfigMods.java index 09c75700..8e47c5f5 100644 --- a/src/main/java/mod/acgaming/universaltweaks/config/UTConfigMods.java +++ b/src/main/java/mod/acgaming/universaltweaks/config/UTConfigMods.java @@ -23,6 +23,10 @@ public class UTConfigMods @Config.Name("Actually Additions") public static final ActuallyAdditionsCategory ACTUALLY_ADDITIONS = new ActuallyAdditionsCategory(); + @Config.LangKey("cfg.universaltweaks.modintegration.aether_legacy") + @Config.Name("Aether Legacy") + public static final AetherLegacyCategory AETHER_LEGACY = new AetherLegacyCategory(); + @Config.LangKey("cfg.universaltweaks.modintegration.agricraft") @Config.Name("Agricraft") public static final AgricraftCategory AGRICRAFT = new AgricraftCategory(); @@ -335,6 +339,10 @@ public class UTConfigMods @Config.Name("Tiny Progressions") public static final TinyProgressionsCategory TINY_PROGRESSIONS = new TinyProgressionsCategory(); + @Config.LangKey("cfg.universaltweaks.modintegration.tombmanygraves") + @Config.Name("TombManyGraves2") + public static final TombManyGravesCategory TOMBMANYGRAVES = new TombManyGravesCategory(); + @Config.LangKey("cfg.universaltweaks.modintegration.woot") @Config.Name("Woot") public static final WootCategory WOOT = new WootCategory(); @@ -371,6 +379,14 @@ public static class ActuallyAdditionsCategory public int utItemLaserParticlesGraphics = -1; } + public static class AetherLegacyCategory + { + @Config.RequiresMcRestart + @Config.Name("Capture Accessory Drops") + @Config.Comment("When dropping equipped Accessories, add the drops to the event instead of dropping them directly, allowing compatibility with various grave mods") + public boolean utCaptureAccessoryDrops = true; + } + public static class AgricraftCategory { @Config.RequiresMcRestart @@ -1526,6 +1542,30 @@ public static class TinyProgressionsCategory public boolean utDuplicationFixesToggle = true; } + public static class TombManyGravesCategory + { + @SuppressWarnings("unused") + @Config.RequiresMcRestart + @Config.Name("Aether Legacy Accessory Compat") + @Config.Comment + ({ + "Universal Tweaks always adds AetherLegacyInventory compat to TombManyGraves2,", + "but this functionality will only work properly if Aether Legacy: Capture Accessory Drops is enabled.", + "This cannot be disabled, and this config only exists to notify that this functionality exists." + }) + public String utUnusedAccessoryCompatEnabled = "ALWAYS_ENABLED"; + + @Config.RequiresMcRestart + @Config.Name("Change Timestamp") + @Config.Comment("Change the timestamp used from 'MM_dd_YYYY_HH_mm_ss' to an ISO 8601 based format of 'yyyy-MM-dd'T'HH:mm:ss'") + public boolean utISOTimestamp = false; + + @Config.RequiresMcRestart + @Config.Name("Proper World Size Check") + @Config.Comment("Fix TombManyGraves not spawning the grave due to incorrectly checking world height") + public boolean utProperWorldSizeCheck = true; + } + public static class WootCategory { @Config.RequiresMcRestart diff --git a/src/main/java/mod/acgaming/universaltweaks/core/UTMixinLoader.java b/src/main/java/mod/acgaming/universaltweaks/core/UTMixinLoader.java index 80ff325a..3b40cf08 100644 --- a/src/main/java/mod/acgaming/universaltweaks/core/UTMixinLoader.java +++ b/src/main/java/mod/acgaming/universaltweaks/core/UTMixinLoader.java @@ -67,6 +67,7 @@ public class UTMixinLoader implements ILateMixinLoader put("mixins/mods/mixins.abyssalcraft.json", c -> c.isModPresent("abyssalcraft")); put("mixins/mods/mixins.actuallyadditions.dupes.json", c -> c.isModPresent("actuallyadditions") && UTConfigMods.ACTUALLY_ADDITIONS.utDuplicationFixesToggle); put("mixins/mods/mixins.actuallyadditions.relayupgrade.json", c -> c.isModPresent("actuallyadditions") && UTConfigMods.ACTUALLY_ADDITIONS.utLaserUpgradeVoid); + put("mixins/mods/mixins.aetherlegacy.eventdrops.json", c -> c.isModPresent("aether_legacy") && UTConfigMods.AETHER_LEGACY.utCaptureAccessoryDrops); put("mixins/mods/mixins.agricraft.json", c -> c.isModPresent("agricraft") && UTConfigMods.AGRICRAFT.utEnderIOPluginFixToggle); put("mixins/mods/mixins.aoa3.json", c -> c.isModPresent("aoa3") && UTConfigMods.AOA.utImprovedPlayerTickToggle); put("mixins/mods/mixins.arcanearchives.dupes.json", c -> c.isModPresent("arcanearchives") && UTConfigMods.ARCANE_ARCHIVES.utDuplicationFixesToggle); @@ -181,6 +182,8 @@ public class UTMixinLoader implements ILateMixinLoader put("mixins/mods/mixins.thermalexpansion.dupes.json", c -> c.isModPresent("thermalexpansion") && UTConfigMods.THERMAL_EXPANSION.utDuplicationFixesToggle); put("mixins/mods/mixins.thermalexpansion.json", c -> c.isModPresent("thermalexpansion")); put("mixins/mods/mixins.tinyprogressions.dupes.json", c -> c.isModPresent("tp") && UTConfigMods.TINY_PROGRESSIONS.utDuplicationFixesToggle); + put("mixins/mods/mixins.tombmanygraves.timestamp.json", c -> c.isModPresent("tombmanygraves") && UTConfigMods.TOMBMANYGRAVES.utISOTimestamp); + put("mixins/mods/mixins.tombmanygraves.worldsize.json", c -> c.isModPresent("tombmanygraves") && UTConfigMods.TOMBMANYGRAVES.utProperWorldSizeCheck); put("mixins/mods/mixins.woot.json", c -> c.isModPresent("woot") && UTConfigMods.WOOT.utCleanupSimulatedKillsToggle); } if (UTConfigGeneral.MASTER_SWITCHES.utMasterSwitchTweaks) diff --git a/src/main/java/mod/acgaming/universaltweaks/mods/aetherlegacy/mixin/UTPlayerAetherEventsMixin.java b/src/main/java/mod/acgaming/universaltweaks/mods/aetherlegacy/mixin/UTPlayerAetherEventsMixin.java new file mode 100644 index 00000000..d502dbdb --- /dev/null +++ b/src/main/java/mod/acgaming/universaltweaks/mods/aetherlegacy/mixin/UTPlayerAetherEventsMixin.java @@ -0,0 +1,26 @@ +package mod.acgaming.universaltweaks.mods.aetherlegacy.mixin; + +import com.gildedgames.the_aether.player.PlayerAether; +import com.gildedgames.the_aether.player.PlayerAetherEvents; +import com.llamalad7.mixinextras.injector.wrapoperation.Operation; +import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; + +// Courtesy of WaitingIdly +@Mixin(value = PlayerAetherEvents.class, remap = false) +public abstract class UTPlayerAetherEventsMixin +{ + /** + * @author WaitingIdly + * @reason Make sure the capture drops flag is enabled when dropping accessories, + * as this is required for some interactions, such as with grave mods. + */ + @WrapOperation(method = "onPlayerDrops", at = @At(value = "INVOKE", target = "Lcom/gildedgames/the_aether/player/PlayerAether;dropAccessories()V")) + private void utCaptureAccessoryDrops(PlayerAether instance, Operation original) + { + instance.thePlayer.captureDrops = true; + original.call(instance); + instance.thePlayer.captureDrops = false; + } +} diff --git a/src/main/java/mod/acgaming/universaltweaks/mods/tombmanygraves/AetherLegacyInventory.java b/src/main/java/mod/acgaming/universaltweaks/mods/tombmanygraves/AetherLegacyInventory.java new file mode 100644 index 00000000..5be49093 --- /dev/null +++ b/src/main/java/mod/acgaming/universaltweaks/mods/tombmanygraves/AetherLegacyInventory.java @@ -0,0 +1,65 @@ +package mod.acgaming.universaltweaks.mods.tombmanygraves; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; + +import com.gildedgames.the_aether.api.AetherAPI; +import com.gildedgames.the_aether.api.player.util.IAccessoryInventory; +import com.m4thg33k.tombmanygraves.api.GraveInventoryHelper; +import com.m4thg33k.tombmanygraves.api.GraveRegistry; +import com.m4thg33k.tombmanygraves.api.IGraveInventory; +import com.m4thg33k.tombmanygraves.api.TempInventory; + +/** + * Same code as their source code at + * AetherLegacyInventory.java + * except using valid methods + removing the println calls + actually part of a jar. + */ +@SuppressWarnings("unused") // GraveRegistry is registered via reflection +@GraveRegistry(id = "aether_legacy", name = "Aether", reqMod = "aether_legacy", overridable = true) +public class AetherLegacyInventory implements IGraveInventory +{ + @Override + public boolean pregrabLogic(EntityPlayer player) + { + return true; + } + + @Override + public TempInventory getItems(EntityPlayer player) + { + return GraveInventoryHelper.storeInventory(AetherAPI.getInstance().get(player).getAccessoryInventory()); + } + + @Override + public void insertInventory(EntityPlayer player, TempInventory graveItems, boolean shouldForce) + { + IAccessoryInventory inventory = AetherAPI.getInstance().get(player).getAccessoryInventory(); + for (int i = 0; i < graveItems.getSizeInventory(); i++) + { + ItemStack graveItem = graveItems.getStackInSlot(i); + + if (!graveItem.isEmpty()) + { + ItemStack playerItem = inventory.getStackInSlot(i).copy(); + + if (playerItem.isEmpty()) + { + // No problem, just put the grave item in! + inventory.setInventorySlotContents(i, graveItem); + } + else if (shouldForce) + { + // Slot is blocked, but we're forcing it + inventory.setInventorySlotContents(i, graveItem); + GraveInventoryHelper.dropItem(player, playerItem); + } + else + { + // Slot is blocked, but not forcing + GraveInventoryHelper.dropItem(player, graveItem); + } + } + } + } +} \ No newline at end of file diff --git a/src/main/java/mod/acgaming/universaltweaks/mods/tombmanygraves/mixin/UTCommonEventsMixin.java b/src/main/java/mod/acgaming/universaltweaks/mods/tombmanygraves/mixin/UTCommonEventsMixin.java new file mode 100644 index 00000000..8f49d26c --- /dev/null +++ b/src/main/java/mod/acgaming/universaltweaks/mods/tombmanygraves/mixin/UTCommonEventsMixin.java @@ -0,0 +1,53 @@ +package mod.acgaming.universaltweaks.mods.tombmanygraves.mixin; + +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.World; + +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 com.m4thg33k.tombmanygraves.events.CommonEvents; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; + +// Courtesy of WaitingIdly +@Mixin(value = CommonEvents.class, remap = false) +public abstract class UTCommonEventsMixin +{ + /** + * @author WaitingIdly + * @reason Replace the check for the world height that uses {@code 0 <= y < }{@link World#getActualHeight()} + * with {@link World#isOutsideBuildHeight}, as the former can be incorrect + * if {@link World#getActualHeight()} doesn't reflect the true height of the world, + * or if Cubic Chunks or another similar mod that expands world height is enabled. + *

+ * Note that {@code x < y} also matches {@code x >= y}, + * and so if this applied to both checks it would internally be + * {@code !utCheckWorldSize() && utCheckWorldSize()}, + * which would make it always false. + */ + @Definition(id = "pos", local = @Local(type = BlockPos.class, argsOnly = true)) + @Definition(id = "getY", method = "Lnet/minecraft/util/math/BlockPos;getY()I") + @Expression("pos.getY() < ?") + @ModifyExpressionValue(method = "isValidLocation", at = @At(value = "MIXINEXTRAS:EXPRESSION", ordinal = 0)) + private boolean utCheckWorldSize(boolean original, @Local(argsOnly = true) World world, @Local(argsOnly = true) BlockPos pos) + { + return world.isOutsideBuildHeight(pos); + } + + /** + * @author WaitingIdly + * @reason Skip the actual height check, since the logic is already handled in {@link #utCheckWorldSize}. + */ + @Definition(id = "getActualHeight", method = "Lnet/minecraft/world/World;getActualHeight()I") + @Definition(id = "world", local = @Local(type = World.class, argsOnly = true)) + @Expression("? < world.getActualHeight()") + @WrapOperation(method = "isValidLocation", at = @At("MIXINEXTRAS:EXPRESSION")) + private boolean utSkipActualHeightCheck(int left, int right, Operation original) + { + return true; + } +} diff --git a/src/main/java/mod/acgaming/universaltweaks/mods/tombmanygraves/mixin/UTInventoryHolderMixin.java b/src/main/java/mod/acgaming/universaltweaks/mods/tombmanygraves/mixin/UTInventoryHolderMixin.java new file mode 100644 index 00000000..572132c3 --- /dev/null +++ b/src/main/java/mod/acgaming/universaltweaks/mods/tombmanygraves/mixin/UTInventoryHolderMixin.java @@ -0,0 +1,22 @@ +package mod.acgaming.universaltweaks.mods.tombmanygraves.mixin; + +import com.m4thg33k.tombmanygraves.invman.InventoryHolder; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.Constant; +import org.spongepowered.asm.mixin.injection.ModifyConstant; + +// Courtesy of WaitingIdly +@Mixin(value = InventoryHolder.class, remap = false) +public abstract class UTInventoryHolderMixin +{ + /** + * @author WaitingIdly + * @reason Change the timestamp to use an ISO 8601-based format, + * ignoring milliseconds and time zone. + */ + @ModifyConstant(method = "grabPlayerData(Lnet/minecraft/entity/player/EntityPlayer;)V", constant = @Constant(stringValue = "MM_dd_YYYY_HH_mm_ss")) + private String utChangeTimestamp(String constant) + { + return "yyyy-MM-dd'T'HH:mm:ss"; + } +} diff --git a/src/main/resources/assets/universaltweaks/lang/en_us.lang b/src/main/resources/assets/universaltweaks/lang/en_us.lang index c7403e8f..de5c61f9 100644 --- a/src/main/resources/assets/universaltweaks/lang/en_us.lang +++ b/src/main/resources/assets/universaltweaks/lang/en_us.lang @@ -53,6 +53,7 @@ cfg.universaltweaks.bugfixes.entities.entitylists=Entity Lists cfg.universaltweaks.modintegration.abyssalcraft=AbyssalCraft cfg.universaltweaks.modintegration.actuallyadditions=Actually Additions +cfg.universaltweaks.modintegration.aether_legacy=Aether Legacy cfg.universaltweaks.modintegration.agricraft=Agricraft cfg.universaltweaks.modintegration.aoa=Advent of Ascension cfg.universaltweaks.modintegration.arcanearchives=Arcane Archives @@ -130,6 +131,7 @@ cfg.universaltweaks.modintegration.te=Thermal Expansion cfg.universaltweaks.modintegration.test_dummy=MmmMmmMmmMmm cfg.universaltweaks.modintegration.thefarlanders=The Farlanders cfg.universaltweaks.modintegration.tinyprogressions=Tiny Progressions +cfg.universaltweaks.modintegration.tombmanygraves=TombManyGraves2 cfg.universaltweaks.modintegration.tr=Tech Reborn cfg.universaltweaks.modintegration.woot=Woot cfg.universaltweaks.modintegration=Mod Integration diff --git a/src/main/resources/mixins/mods/mixins.aetherlegacy.eventdrops.json b/src/main/resources/mixins/mods/mixins.aetherlegacy.eventdrops.json new file mode 100644 index 00000000..d1a8e3f0 --- /dev/null +++ b/src/main/resources/mixins/mods/mixins.aetherlegacy.eventdrops.json @@ -0,0 +1,7 @@ +{ + "package": "mod.acgaming.universaltweaks.mods.aetherlegacy.mixin", + "refmap": "universaltweaks.refmap.json", + "minVersion": "0.8", + "compatibilityLevel": "JAVA_8", + "mixins": ["UTPlayerAetherEventsMixin"] +} \ No newline at end of file diff --git a/src/main/resources/mixins/mods/mixins.tombmanygraves.timestamp.json b/src/main/resources/mixins/mods/mixins.tombmanygraves.timestamp.json new file mode 100644 index 00000000..a3b0dd6b --- /dev/null +++ b/src/main/resources/mixins/mods/mixins.tombmanygraves.timestamp.json @@ -0,0 +1,7 @@ +{ + "package": "mod.acgaming.universaltweaks.mods.tombmanygraves.mixin", + "refmap": "universaltweaks.refmap.json", + "minVersion": "0.8", + "compatibilityLevel": "JAVA_8", + "mixins": ["UTInventoryHolderMixin"] +} \ No newline at end of file diff --git a/src/main/resources/mixins/mods/mixins.tombmanygraves.worldsize.json b/src/main/resources/mixins/mods/mixins.tombmanygraves.worldsize.json new file mode 100644 index 00000000..69ffb9ae --- /dev/null +++ b/src/main/resources/mixins/mods/mixins.tombmanygraves.worldsize.json @@ -0,0 +1,10 @@ +{ + "package": "mod.acgaming.universaltweaks.mods.tombmanygraves.mixin", + "refmap": "universaltweaks.refmap.json", + "minVersion": "0.8", + "compatibilityLevel": "JAVA_8", + "mixinextras": { + "minVersion": "0.5.0" + }, + "mixins": ["UTCommonEventsMixin"] +} \ No newline at end of file