diff --git a/README.md b/README.md index aa82d674..992ad04e 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ ![Available for MC 1.12.2](https://img.shields.io/badge/Available%20for-MC%201.12.2-3498db.svg?labelColor=34495e&style=for-the-badge) ![License LGPL-3.0](https://img.shields.io/github/license/ACGaming/UniversalTweaks?labelColor=34495e&color=3498db&style=for-the-badge) [![Stars](https://img.shields.io/github/stars/ACGaming/UniversalTweaks?labelColor=34495e&color=3498db&style=for-the-badge)](https://github.com/ACGaming/UniversalTweaks/stargazers) -[![Superseded Mods](https://img.shields.io/badge/Superseded%20Mods-97-3498db.svg?labelColor=34495e&style=for-the-badge)](https://www.curseforge.com/minecraft/mc-mods/universal-tweaks/relations/dependencies?page=1&type=Incompatible) +[![Superseded Mods](https://img.shields.io/badge/Superseded%20Mods-100+-3498db.svg?labelColor=34495e&style=for-the-badge)](https://www.curseforge.com/minecraft/mc-mods/universal-tweaks/relations/dependencies?page=1&type=Incompatible) # UNIVERSAL TWEAKS diff --git a/src/main/java/mod/acgaming/universaltweaks/bugfixes/entities/arrow/mixin/UTEntityTippedArrowMixin.java b/src/main/java/mod/acgaming/universaltweaks/bugfixes/entities/arrow/mixin/UTEntityTippedArrowMixin.java index 553327cd..612a7535 100644 --- a/src/main/java/mod/acgaming/universaltweaks/bugfixes/entities/arrow/mixin/UTEntityTippedArrowMixin.java +++ b/src/main/java/mod/acgaming/universaltweaks/bugfixes/entities/arrow/mixin/UTEntityTippedArrowMixin.java @@ -1,12 +1,12 @@ package mod.acgaming.universaltweaks.bugfixes.entities.arrow.mixin; +import java.util.Set; + import net.minecraft.entity.projectile.EntityTippedArrow; import net.minecraft.init.PotionTypes; import net.minecraft.potion.PotionEffect; import net.minecraft.potion.PotionType; -import java.util.Set; - import mod.acgaming.universaltweaks.config.UTConfigBugfixes; import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Mixin; @@ -21,7 +21,7 @@ public abstract class UTEntityTippedArrowMixin { @Shadow - private PotionType potion; + private PotionType potion; @Shadow @Final private Set customPotionEffects; diff --git a/src/main/java/mod/acgaming/universaltweaks/bugfixes/entities/desync/IPrevMotion.java b/src/main/java/mod/acgaming/universaltweaks/bugfixes/entities/desync/IPrevMotion.java index e895eb1e..4279447d 100644 --- a/src/main/java/mod/acgaming/universaltweaks/bugfixes/entities/desync/IPrevMotion.java +++ b/src/main/java/mod/acgaming/universaltweaks/bugfixes/entities/desync/IPrevMotion.java @@ -17,6 +17,7 @@ public interface IPrevMotion /** * Checks if this entity has ever called super.onUpdate(). This should adequately determine if it should be ignored by the desync fix. + * * @return true if the implementing class calls super.onUpdate() */ boolean hasSuperUpdate(); diff --git a/src/main/java/mod/acgaming/universaltweaks/bugfixes/misc/crafteditemstatistics/mixin/UTSlotCraftingMixin.java b/src/main/java/mod/acgaming/universaltweaks/bugfixes/misc/crafteditemstatistics/mixin/UTSlotCraftingMixin.java index dc4b4af6..9b835da2 100644 --- a/src/main/java/mod/acgaming/universaltweaks/bugfixes/misc/crafteditemstatistics/mixin/UTSlotCraftingMixin.java +++ b/src/main/java/mod/acgaming/universaltweaks/bugfixes/misc/crafteditemstatistics/mixin/UTSlotCraftingMixin.java @@ -4,6 +4,7 @@ import net.minecraft.inventory.Slot; import net.minecraft.inventory.SlotCrafting; import net.minecraft.item.ItemStack; + import mod.acgaming.universaltweaks.config.UTConfigBugfixes; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; diff --git a/src/main/java/mod/acgaming/universaltweaks/config/UTConfigBugfixes.java b/src/main/java/mod/acgaming/universaltweaks/config/UTConfigBugfixes.java index b11873c9..9a890925 100644 --- a/src/main/java/mod/acgaming/universaltweaks/config/UTConfigBugfixes.java +++ b/src/main/java/mod/acgaming/universaltweaks/config/UTConfigBugfixes.java @@ -256,7 +256,7 @@ public static class EntitiesCategory @Config.Name("Skeleton Aim") @Config.Comment("Fixes skeletons not looking at their targets when strafing") public boolean utSkeletonAimToggle = true; - + @Config.RequiresMcRestart @Config.Name("Untipped Arrow Particles") @Config.Comment("Fixes untipped arrows emitting blue tipped arrow particles upon reloading a world") @@ -308,7 +308,7 @@ public static class MiscCategory @Config.Name("Blast Protection Knockback") @Config.Comment("Fixes the blast protection enchantment not reducing knockback from explosions except at very high levels") public boolean utBlastProtectionKnockbackToggle = false; - + @Config.RequiresMcRestart @Config.Name("Crafted Item Statistics") @Config.Comment("Fixes crafted item statistics not increasing correctly when items are crafted with shift-click or drop methods") @@ -337,7 +337,7 @@ public static class MiscCategory @Config.Name("Potion Amplifier Visibility") @Config.Comment("Fixes potion effects not displaying their level above 'IV'") public boolean utPotionAmplifierVisibilityToggle = true; - + @Config.RequiresMcRestart @Config.Name("Spectator Menu") @Config.Comment("Fixes the spectator menu not showing player skins") diff --git a/src/main/java/mod/acgaming/universaltweaks/config/UTConfigTweaks.java b/src/main/java/mod/acgaming/universaltweaks/config/UTConfigTweaks.java index b582b1ad..d97a297f 100644 --- a/src/main/java/mod/acgaming/universaltweaks/config/UTConfigTweaks.java +++ b/src/main/java/mod/acgaming/universaltweaks/config/UTConfigTweaks.java @@ -1198,7 +1198,7 @@ public static class MiscCategory @Config.RequiresMcRestart @Config.Name("Compact Messages") @Config.Comment("Removes duplicate messages and instead put a number behind the message how often it was repeated") - public boolean utCompactMessagesToggle = true; + public boolean utCompactMessagesToggle = false; @Config.RequiresMcRestart @Config.Name("Linear XP Amount") diff --git a/src/main/java/mod/acgaming/universaltweaks/core/UTLoadingPlugin.java b/src/main/java/mod/acgaming/universaltweaks/core/UTLoadingPlugin.java index 7d3df0ab..2cf12b2a 100644 --- a/src/main/java/mod/acgaming/universaltweaks/core/UTLoadingPlugin.java +++ b/src/main/java/mod/acgaming/universaltweaks/core/UTLoadingPlugin.java @@ -258,8 +258,7 @@ public boolean shouldMixinConfigQueue(String mixinConfig) if (isDev) { // Causes crashes in dev env only - if (mixinConfig.equals("mixins.tweaks.misc.armorcurve.json")) return false; - return true; + return !mixinConfig.equals("mixins.tweaks.misc.armorcurve.json"); } if (isClient) { diff --git a/src/main/java/mod/acgaming/universaltweaks/mods/cbmultipart/mixin/UTControlKeyValueMixin.java b/src/main/java/mod/acgaming/universaltweaks/mods/cbmultipart/mixin/UTControlKeyValueMixin.java index 2d1fcc4f..6c1ebfa7 100644 --- a/src/main/java/mod/acgaming/universaltweaks/mods/cbmultipart/mixin/UTControlKeyValueMixin.java +++ b/src/main/java/mod/acgaming/universaltweaks/mods/cbmultipart/mixin/UTControlKeyValueMixin.java @@ -6,17 +6,14 @@ import codechicken.multipart.ControlKeyModifer; import codechicken.multipart.ControlKeyModifer$; -import org.spongepowered.asm.mixin.Final; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Mutable; -import org.spongepowered.asm.mixin.Shadow; -import org.spongepowered.asm.mixin.Unique; +import org.spongepowered.asm.mixin.*; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.ModifyArg; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; // Courtesy of jchung01 + /** * Note: To my knowledge, {@link ControlKeyModifer#isControlDown(EntityPlayer)} is never called in any mod, so this mixin isn't very useful. */ diff --git a/src/main/java/mod/acgaming/universaltweaks/mods/compactmachines/mixin/UTCubeToolsMixin.java b/src/main/java/mod/acgaming/universaltweaks/mods/compactmachines/mixin/UTCubeToolsMixin.java index 078c6a64..5b818097 100644 --- a/src/main/java/mod/acgaming/universaltweaks/mods/compactmachines/mixin/UTCubeToolsMixin.java +++ b/src/main/java/mod/acgaming/universaltweaks/mods/compactmachines/mixin/UTCubeToolsMixin.java @@ -17,23 +17,27 @@ // Courtesy of jchung01 @Mixin(value = CubeTools.class, remap = false) -public class UTCubeToolsMixin { +public class UTCubeToolsMixin +{ /** * Using a block's complete (x,y,z) position, determine the size of compact machine it belongs to. * * @param section the section of world, possibly a sub-chunk or chunk - * @param pos the block pos, including its y dimension + * @param pos the block pos, including its y dimension * @return the corresponding compact machine's interior size + 1 */ @Unique - private static int universalTweaks$getCubeSizeWithYContext(IBlockAccess section, MutableBlockPos pos) { + private static int universalTweaks$getCubeSizeWithYContext(IBlockAccess section, MutableBlockPos pos) + { pos.setPos(pos.getX() * 1024, pos.getY(), pos.getZ()); - for (int i = EnumMachineSize.values().length - 1; i >= 0; i--) { + for (int i = EnumMachineSize.values().length - 1; i >= 0; i--) + { EnumMachineSize size = EnumMachineSize.values()[i]; // (x + dimension, y, z) pos.move(EnumFacing.EAST, size.getDimension()); - if (section.getBlockState(pos).getBlock() == Blockss.wall) { + if (section.getBlockState(pos).getBlock() == Blockss.wall) + { return size.getDimension(); } // Reset to (x, y, z) @@ -52,17 +56,21 @@ public class UTCubeToolsMixin { * to get block state info for the bottom sub-chunk of the machine, not the upper sub-chunk. This causes invisible walls for that upper sub-chunk. * * @param instance the EnumMachineSize instance - * @param world the section of world, possibly a sub-chunk or chunk - * @param pos the block pos + * @param world the section of world, possibly a sub-chunk or chunk + * @param pos the block pos * @return the corresponding compact machine's interior size + 1 */ @Redirect(method = "shouldSideBeRendered", at = @At(value = "INVOKE", target = "Lorg/dave/compactmachines3/reference/EnumMachineSize;getDimension()I")) - private static int utReassignSize(EnumMachineSize instance, IBlockAccess world, BlockPos pos) { + private static int utReassignSize(EnumMachineSize instance, IBlockAccess world, BlockPos pos) + { if (!UTConfigMods.COMPACT_MACHINES.utCMRenderFixToggle) return instance.getDimension(); PooledMutableBlockPos mPos = PooledMutableBlockPos.retain(pos); - try { + try + { return universalTweaks$getCubeSizeWithYContext(world, mPos.setPos(pos.getX() / 1024, pos.getY(), 0)); - } finally { + } + finally + { // Have to manually release in 1.12 mPos.release(); } diff --git a/src/main/java/mod/acgaming/universaltweaks/mods/effortlessbuilding/mixin/UTInventoryHelperMixin.java b/src/main/java/mod/acgaming/universaltweaks/mods/effortlessbuilding/mixin/UTInventoryHelperMixin.java index 2b6380f0..de47440c 100644 --- a/src/main/java/mod/acgaming/universaltweaks/mods/effortlessbuilding/mixin/UTInventoryHelperMixin.java +++ b/src/main/java/mod/acgaming/universaltweaks/mods/effortlessbuilding/mixin/UTInventoryHelperMixin.java @@ -1,10 +1,10 @@ package mod.acgaming.universaltweaks.mods.effortlessbuilding.mixin; - -import mod.acgaming.universaltweaks.config.UTConfigMods; import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; + +import mod.acgaming.universaltweaks.config.UTConfigMods; import nl.requios.effortlessbuilding.helper.InventoryHelper; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; @@ -12,10 +12,12 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; @Mixin(InventoryHelper.class) -public class UTInventoryHelperMixin { +public class UTInventoryHelperMixin +{ @Inject(method = "findItemStackInInventory", at = @At("HEAD"), cancellable = true, remap = false) - private static void utFindItemStackInInventory(EntityPlayer player, Block block, CallbackInfoReturnable cir) { + private static void utFindItemStackInInventory(EntityPlayer player, Block block, CallbackInfoReturnable cir) + { if (UTConfigMods.EFFORTLESS_BUILDING.utEFTransmutationFixToggle) cir.setReturnValue(ItemStack.EMPTY); } } \ No newline at end of file diff --git a/src/main/java/mod/acgaming/universaltweaks/mods/effortlessbuilding/mixin/UTSurvivalHelperMixin.java b/src/main/java/mod/acgaming/universaltweaks/mods/effortlessbuilding/mixin/UTSurvivalHelperMixin.java index 7678c0cb..1a2f2793 100644 --- a/src/main/java/mod/acgaming/universaltweaks/mods/effortlessbuilding/mixin/UTSurvivalHelperMixin.java +++ b/src/main/java/mod/acgaming/universaltweaks/mods/effortlessbuilding/mixin/UTSurvivalHelperMixin.java @@ -1,6 +1,5 @@ package mod.acgaming.universaltweaks.mods.effortlessbuilding.mixin; -import mod.acgaming.universaltweaks.config.UTConfigMods; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; @@ -9,6 +8,8 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Vec3d; import net.minecraft.world.World; + +import mod.acgaming.universaltweaks.config.UTConfigMods; import nl.requios.effortlessbuilding.helper.SurvivalHelper; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; @@ -16,16 +17,20 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; @Mixin(SurvivalHelper.class) -public class UTSurvivalHelperMixin { +public class UTSurvivalHelperMixin +{ @Inject(method = "placeBlock", at = @At("HEAD"), remap = false, cancellable = true) - private static void utPlaceBlock(World world, EntityPlayer player, BlockPos pos, IBlockState blockState, ItemStack origstack, EnumFacing facing, Vec3d hitVec, boolean skipPlaceCheck, boolean skipCollisionCheck, boolean playSound, CallbackInfoReturnable cir) { + private static void utPlaceBlock(World world, EntityPlayer player, BlockPos pos, IBlockState blockState, ItemStack origstack, EnumFacing facing, Vec3d hitVec, boolean skipPlaceCheck, boolean skipCollisionCheck, boolean playSound, CallbackInfoReturnable cir) + { if (!UTConfigMods.EFFORTLESS_BUILDING.utEFTransmutationFixToggle) return; int meta = blockState.getBlock().damageDropped(blockState); origstack = ItemStack.EMPTY; - for (int i = 0; i < player.inventory.mainInventory.size(); i++) { + for (int i = 0; i < player.inventory.mainInventory.size(); i++) + { ItemStack stack = player.inventory.mainInventory.get(i); - if (stack.getItem().equals(Item.getItemFromBlock(blockState.getBlock())) && stack.getMetadata() == meta) { + if (stack.getItem().equals(Item.getItemFromBlock(blockState.getBlock())) && stack.getMetadata() == meta) + { origstack = stack; break; } diff --git a/src/main/java/mod/acgaming/universaltweaks/mods/effortlessbuilding/mixin/UTUndoRedoMixin.java b/src/main/java/mod/acgaming/universaltweaks/mods/effortlessbuilding/mixin/UTUndoRedoMixin.java index 64df879f..87728e66 100644 --- a/src/main/java/mod/acgaming/universaltweaks/mods/effortlessbuilding/mixin/UTUndoRedoMixin.java +++ b/src/main/java/mod/acgaming/universaltweaks/mods/effortlessbuilding/mixin/UTUndoRedoMixin.java @@ -1,10 +1,11 @@ package mod.acgaming.universaltweaks.mods.effortlessbuilding.mixin; -import mod.acgaming.universaltweaks.config.UTConfigMods; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; + +import mod.acgaming.universaltweaks.config.UTConfigMods; import nl.requios.effortlessbuilding.buildmodifier.UndoRedo; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; @@ -12,16 +13,20 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; @Mixin(UndoRedo.class) -public class UTUndoRedoMixin { +public class UTUndoRedoMixin +{ - @Inject(method = "findItemStackInInventory", at = @At("HEAD"), cancellable = true, remap = false) - private static void utFindItemStackInInventory(EntityPlayer player, IBlockState blockState, CallbackInfoReturnable cir) { + @Inject(method = "findItemStackInInventory", at = @At("HEAD"), cancellable = true, remap = false) + private static void utFindItemStackInInventory(EntityPlayer player, IBlockState blockState, CallbackInfoReturnable cir) + { if (!UTConfigMods.EFFORTLESS_BUILDING.utEFTransmutationFixToggle) return; int meta = blockState.getBlock().damageDropped(blockState); ItemStack stack = ItemStack.EMPTY; - for (int i = 0; i < player.inventory.mainInventory.size(); i++) { + for (int i = 0; i < player.inventory.mainInventory.size(); i++) + { ItemStack stack1 = player.inventory.mainInventory.get(i); - if (stack1.getItem().equals(Item.getItemFromBlock(blockState.getBlock())) && stack1.getMetadata() == meta) { + if (stack1.getItem().equals(Item.getItemFromBlock(blockState.getBlock())) && stack1.getMetadata() == meta) + { stack = stack1; break; } diff --git a/src/main/java/mod/acgaming/universaltweaks/mods/thaumicwonders/mixin/UTItemVoidFortressArmorMixin.java b/src/main/java/mod/acgaming/universaltweaks/mods/thaumicwonders/mixin/UTItemVoidFortressArmorMixin.java index d0a91451..212b4a1f 100644 --- a/src/main/java/mod/acgaming/universaltweaks/mods/thaumicwonders/mixin/UTItemVoidFortressArmorMixin.java +++ b/src/main/java/mod/acgaming/universaltweaks/mods/thaumicwonders/mixin/UTItemVoidFortressArmorMixin.java @@ -1,7 +1,5 @@ package mod.acgaming.universaltweaks.mods.thaumicwonders.mixin; -import net.minecraft.client.model.ModelBiped; - import com.verdantartifice.thaumicwonders.client.renderers.models.gear.ModelVoidFortressArmor; import com.verdantartifice.thaumicwonders.common.items.armor.ItemVoidFortressArmor; import org.spongepowered.asm.mixin.Mixin; diff --git a/src/main/java/mod/acgaming/universaltweaks/tweaks/items/parry/UTParry.java b/src/main/java/mod/acgaming/universaltweaks/tweaks/items/parry/UTParry.java index e599aedf..56fe1b44 100644 --- a/src/main/java/mod/acgaming/universaltweaks/tweaks/items/parry/UTParry.java +++ b/src/main/java/mod/acgaming/universaltweaks/tweaks/items/parry/UTParry.java @@ -37,9 +37,9 @@ @Mod.EventBusSubscriber(modid = UniversalTweaks.MODID) public class UTParry { + private static final List projectileList = new ArrayList<>(); private static Enchantment enchantment; private static EnumEnchantmentType enchantmentTypeShield; - private static final List projectileList = new ArrayList<>(); public static void initProjectileList() { diff --git a/src/main/java/mod/acgaming/universaltweaks/tweaks/misc/advancements/mixin/UTAdvancementManagerMixin.java b/src/main/java/mod/acgaming/universaltweaks/tweaks/misc/advancements/mixin/UTAdvancementManagerMixin.java index 18aeb3dd..8921c75b 100644 --- a/src/main/java/mod/acgaming/universaltweaks/tweaks/misc/advancements/mixin/UTAdvancementManagerMixin.java +++ b/src/main/java/mod/acgaming/universaltweaks/tweaks/misc/advancements/mixin/UTAdvancementManagerMixin.java @@ -1,7 +1,8 @@ package mod.acgaming.universaltweaks.tweaks.misc.advancements.mixin; -import mod.acgaming.universaltweaks.config.UTConfigTweaks; import net.minecraft.advancements.AdvancementManager; + +import mod.acgaming.universaltweaks.config.UTConfigTweaks; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; diff --git a/src/main/java/mod/acgaming/universaltweaks/tweaks/misc/chat/mixin/UTCompactMessageMixin.java b/src/main/java/mod/acgaming/universaltweaks/tweaks/misc/chat/mixin/UTCompactMessageMixin.java index 3eca7999..69d3fe37 100644 --- a/src/main/java/mod/acgaming/universaltweaks/tweaks/misc/chat/mixin/UTCompactMessageMixin.java +++ b/src/main/java/mod/acgaming/universaltweaks/tweaks/misc/chat/mixin/UTCompactMessageMixin.java @@ -1,6 +1,9 @@ package mod.acgaming.universaltweaks.tweaks.misc.chat.mixin; -import mod.acgaming.universaltweaks.config.UTConfigTweaks; +import java.util.ArrayList; +import java.util.List; +import java.util.regex.Pattern; + import net.minecraft.client.Minecraft; import net.minecraft.client.gui.ChatLine; import net.minecraft.client.gui.GuiNewChat; @@ -10,6 +13,8 @@ import net.minecraft.util.text.Style; import net.minecraft.util.text.TextComponentString; import net.minecraft.util.text.TextFormatting; + +import mod.acgaming.universaltweaks.config.UTConfigTweaks; import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; @@ -18,15 +23,12 @@ import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -import java.util.ArrayList; -import java.util.List; -import java.util.regex.Pattern; - @Mixin(GuiNewChat.class) -public abstract class UTCompactMessageMixin { +public abstract class UTCompactMessageMixin +{ @Unique - private Pattern universalTweaks$matchPattern = Pattern.compile("(?:§7)?+\\s+\\(+\\d+\\)"); + private final Pattern universalTweaks$matchPattern = Pattern.compile("(?:§7)?+\\s+\\(+\\d+\\)"); @Shadow @Final @@ -36,25 +38,35 @@ public abstract class UTCompactMessageMixin { @Final private List chatLines = new ArrayList<>(); - @Shadow @Final private Minecraft mc; + @Shadow + @Final + private Minecraft mc; - @Shadow public abstract float getChatScale(); + @Shadow + public abstract float getChatScale(); - @Shadow public abstract int getChatWidth(); + @Shadow + public abstract int getChatWidth(); @Inject(method = "setChatLine", at = @At("HEAD")) - public void utCompactMessage(ITextComponent chatComponent, int chatLineId, int updateCounter, boolean displayOnly, CallbackInfo ci) { + public void utCompactMessage(ITextComponent chatComponent, int chatLineId, int updateCounter, boolean displayOnly, CallbackInfo ci) + { if (!UTConfigTweaks.MISC.utCompactMessagesToggle) return; int count = 1; - int chatSize = MathHelper.floor((float)this.getChatWidth() / this.getChatScale()); + int chatSize = MathHelper.floor((float) this.getChatWidth() / this.getChatScale()); List splittedText = GuiUtilRenderComponents.splitText(chatComponent, chatSize, this.mc.fontRenderer, false, false); - ITextComponent textComponent = splittedText.get(splittedText.size()-1); - for (int i = 0; i < drawnChatLines.size(); i++) { + ITextComponent textComponent = splittedText.get(splittedText.size() - 1); + for (int i = 0; i < drawnChatLines.size(); i++) + { ChatLine chatLine = drawnChatLines.get(i); - if (universalTweaks$isMessageEqual(chatLine.getChatComponent().createCopy(), textComponent.createCopy())) { - if (!chatLine.getChatComponent().getSiblings().isEmpty()) { - for (ITextComponent sibling : chatLine.getChatComponent().getSiblings()) { - if (universalTweaks$matchPattern.matcher(sibling.getUnformattedComponentText()).matches()) { + if (universalTweaks$isMessageEqual(chatLine.getChatComponent().createCopy(), textComponent.createCopy())) + { + if (!chatLine.getChatComponent().getSiblings().isEmpty()) + { + for (ITextComponent sibling : chatLine.getChatComponent().getSiblings()) + { + if (universalTweaks$matchPattern.matcher(sibling.getUnformattedComponentText()).matches()) + { count += Integer.parseInt(sibling.getUnformattedComponentText().replaceAll("(?:§7)?\\D?", "")); break; } @@ -69,19 +81,27 @@ public void utCompactMessage(ITextComponent chatComponent, int chatLineId, int u } @Unique - private boolean universalTweaks$isMessageEqual(ITextComponent msg1, ITextComponent msg2) { + private boolean universalTweaks$isMessageEqual(ITextComponent msg1, ITextComponent msg2) + { boolean isEqual = false; - if (msg1.equals(msg2) || msg1.getUnformattedText().equals(msg2.getUnformattedText())) { + if (msg1.equals(msg2) || msg1.getUnformattedText().equals(msg2.getUnformattedText())) + { isEqual = true; - } else { - if (!msg1.getSiblings().isEmpty()) { - for (int i = 0; i < msg1.getSiblings().size(); i++) { + } + else + { + if (!msg1.getSiblings().isEmpty()) + { + for (int i = 0; i < msg1.getSiblings().size(); i++) + { ITextComponent sibling = msg1.getSiblings().get(i); - if (universalTweaks$matchPattern.matcher(sibling.getUnformattedComponentText()).matches()) { + if (universalTweaks$matchPattern.matcher(sibling.getUnformattedComponentText()).matches()) + { msg1.getSiblings().remove(sibling); } } - if (msg1.equals(msg2) || msg1.getUnformattedText().equals(msg2.getUnformattedText())) { + if (msg1.equals(msg2) || msg1.getUnformattedText().equals(msg2.getUnformattedText())) + { isEqual = true; } } diff --git a/src/main/java/mod/acgaming/universaltweaks/tweaks/misc/lightning/damage/UTLightningItemDestruction.java b/src/main/java/mod/acgaming/universaltweaks/tweaks/misc/lightning/damage/UTLightningItemDestruction.java index 59878f7d..c1e0dda0 100644 --- a/src/main/java/mod/acgaming/universaltweaks/tweaks/misc/lightning/damage/UTLightningItemDestruction.java +++ b/src/main/java/mod/acgaming/universaltweaks/tweaks/misc/lightning/damage/UTLightningItemDestruction.java @@ -6,8 +6,8 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import mod.acgaming.universaltweaks.UniversalTweaks; -import mod.acgaming.universaltweaks.config.UTConfigTweaks; import mod.acgaming.universaltweaks.config.UTConfigGeneral; +import mod.acgaming.universaltweaks.config.UTConfigTweaks; @Mod.EventBusSubscriber(modid = UniversalTweaks.MODID) public class UTLightningItemDestruction @@ -17,8 +17,8 @@ public static void onLightningStrike(EntityStruckByLightningEvent event) { if (event.getEntity() instanceof EntityItem && UTConfigTweaks.MISC.LIGHTNING.utLightningItemDestructionToggle) { - if (UTConfigGeneral.DEBUG.utDebugToggle) UniversalTweaks.LOGGER.debug("UTLightningItemDestruction ::: Lightning strike event"); - event.setCanceled(true); + if (UTConfigGeneral.DEBUG.utDebugToggle) UniversalTweaks.LOGGER.debug("UTLightningItemDestruction ::: Lightning strike event"); + event.setCanceled(true); } } } \ No newline at end of file diff --git a/src/main/java/mod/acgaming/universaltweaks/tweaks/misc/loadsound/UTLoadSound.java b/src/main/java/mod/acgaming/universaltweaks/tweaks/misc/loadsound/UTLoadSound.java index aef2438b..b887eba5 100644 --- a/src/main/java/mod/acgaming/universaltweaks/tweaks/misc/loadsound/UTLoadSound.java +++ b/src/main/java/mod/acgaming/universaltweaks/tweaks/misc/loadsound/UTLoadSound.java @@ -26,13 +26,13 @@ @Mod.EventBusSubscriber(modid = UniversalTweaks.MODID, value = Side.CLIENT) public class UTLoadSound { - private static boolean playedMenu = false; - private static boolean playedWorld = false; private static final Random random = new Random(); private static final List soundListMC = new ArrayList<>(); private static final List soundListWorld = new ArrayList<>(); private static final List pitchListMC = new ArrayList<>(); private static final List pitchListWorld = new ArrayList<>(); + private static boolean playedMenu = false; + private static boolean playedWorld = false; public static void initLists() { diff --git a/src/main/java/mod/acgaming/universaltweaks/tweaks/performance/advancementcheck/mixin/UTAdvancementManagerMixin.java b/src/main/java/mod/acgaming/universaltweaks/tweaks/performance/advancementcheck/mixin/UTAdvancementManagerMixin.java index 74021c20..7f2f747a 100644 --- a/src/main/java/mod/acgaming/universaltweaks/tweaks/performance/advancementcheck/mixin/UTAdvancementManagerMixin.java +++ b/src/main/java/mod/acgaming/universaltweaks/tweaks/performance/advancementcheck/mixin/UTAdvancementManagerMixin.java @@ -1,20 +1,20 @@ package mod.acgaming.universaltweaks.tweaks.performance.advancementcheck.mixin; -import mod.acgaming.universaltweaks.config.UTConfigTweaks; -import net.minecraft.advancements.AdvancementManager; import org.apache.logging.log4j.Logger; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.injection.At; +import net.minecraft.advancements.AdvancementManager; import com.llamalad7.mixinextras.injector.WrapWithCondition; +import mod.acgaming.universaltweaks.config.UTConfigTweaks; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; // Courtesy of fonnymunkey @Mixin(AdvancementManager.class) public abstract class UTAdvancementManagerMixin { @WrapWithCondition( - method = "loadCustomAdvancements", - at = @At(value = "INVOKE", target = "Lorg/apache/logging/log4j/Logger;error(Ljava/lang/String;)V", + method = "loadCustomAdvancements", + at = @At(value = "INVOKE", target = "Lorg/apache/logging/log4j/Logger;error(Ljava/lang/String;)V", remap = false) ) public boolean utLoadCustomAdvancements0(Logger instance, String s) @@ -23,8 +23,8 @@ public boolean utLoadCustomAdvancements0(Logger instance, String s) } @WrapWithCondition( - method = "loadCustomAdvancements", - at = @At(value = "INVOKE", target = "Lorg/apache/logging/log4j/Logger;error(Ljava/lang/String;Ljava/lang/Throwable;)V", + method = "loadCustomAdvancements", + at = @At(value = "INVOKE", target = "Lorg/apache/logging/log4j/Logger;error(Ljava/lang/String;Ljava/lang/Throwable;)V", remap = false) ) public boolean utLoadCustomAdvancements1(Logger instance, String s, Throwable throwable) @@ -33,8 +33,8 @@ public boolean utLoadCustomAdvancements1(Logger instance, String s, Throwable th } @WrapWithCondition( - method = "loadBuiltInAdvancements", - at = @At(value = "INVOKE", target = "Lorg/apache/logging/log4j/Logger;error(Ljava/lang/String;)V", + method = "loadBuiltInAdvancements", + at = @At(value = "INVOKE", target = "Lorg/apache/logging/log4j/Logger;error(Ljava/lang/String;)V", remap = false) ) public boolean utLoadBuiltInAdvanacements0(Logger instance, String s) @@ -43,8 +43,8 @@ public boolean utLoadBuiltInAdvanacements0(Logger instance, String s) } @WrapWithCondition( - method = "loadBuiltInAdvancements", - at = @At(value = "INVOKE", target = "Lorg/apache/logging/log4j/Logger;error(Ljava/lang/String;Ljava/lang/Throwable;)V", + method = "loadBuiltInAdvancements", + at = @At(value = "INVOKE", target = "Lorg/apache/logging/log4j/Logger;error(Ljava/lang/String;Ljava/lang/Throwable;)V", remap = false) ) public boolean utLoadBuiltInAdvanacements1(Logger instance, String s, Throwable throwable) diff --git a/src/main/java/mod/acgaming/universaltweaks/tweaks/performance/advancementcheck/mixin/UTForgeHooksMixin.java b/src/main/java/mod/acgaming/universaltweaks/tweaks/performance/advancementcheck/mixin/UTForgeHooksMixin.java index 999bd2c1..6ac40ac1 100644 --- a/src/main/java/mod/acgaming/universaltweaks/tweaks/performance/advancementcheck/mixin/UTForgeHooksMixin.java +++ b/src/main/java/mod/acgaming/universaltweaks/tweaks/performance/advancementcheck/mixin/UTForgeHooksMixin.java @@ -1,21 +1,21 @@ package mod.acgaming.universaltweaks.tweaks.performance.advancementcheck.mixin; -import mod.acgaming.universaltweaks.config.UTConfigTweaks; -import net.minecraftforge.common.ForgeHooks; import org.apache.logging.log4j.Logger; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.injection.At; +import net.minecraftforge.common.ForgeHooks; import com.llamalad7.mixinextras.injector.WrapWithCondition; +import mod.acgaming.universaltweaks.config.UTConfigTweaks; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; // Courtesy of fonnymunkey @Mixin(ForgeHooks.class) public abstract class UTForgeHooksMixin { @WrapWithCondition( - method = "lambda$loadAdvancements$0", - at = @At(value = "INVOKE", target = "Lorg/apache/logging/log4j/Logger;error(Ljava/lang/String;Ljava/lang/Throwable;)V"), - remap = false + method = "lambda$loadAdvancements$0", + at = @At(value = "INVOKE", target = "Lorg/apache/logging/log4j/Logger;error(Ljava/lang/String;Ljava/lang/Throwable;)V"), + remap = false ) private static boolean utLoadAdvancements(Logger instance, String s, Throwable throwable) { diff --git a/src/main/java/mod/acgaming/universaltweaks/tweaks/performance/texturemapcheck/mixin/UTTextureMapCheckMixin.java b/src/main/java/mod/acgaming/universaltweaks/tweaks/performance/texturemapcheck/mixin/UTTextureMapCheckMixin.java index 680b298e..a5d2250d 100644 --- a/src/main/java/mod/acgaming/universaltweaks/tweaks/performance/texturemapcheck/mixin/UTTextureMapCheckMixin.java +++ b/src/main/java/mod/acgaming/universaltweaks/tweaks/performance/texturemapcheck/mixin/UTTextureMapCheckMixin.java @@ -1,21 +1,20 @@ package mod.acgaming.universaltweaks.tweaks.performance.texturemapcheck.mixin; -import mod.acgaming.universaltweaks.config.UTConfigTweaks; -import net.minecraft.client.renderer.texture.TextureMap; import org.apache.logging.log4j.Logger; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Redirect; +import net.minecraft.client.renderer.texture.TextureMap; import com.llamalad7.mixinextras.injector.WrapWithCondition; +import mod.acgaming.universaltweaks.config.UTConfigTweaks; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; // Courtesy of Elephant_1214 @Mixin(value = TextureMap.class, priority = 500) public class UTTextureMapCheckMixin { @WrapWithCondition( - method = "*", at = @At(value = "INVOKE", target = "Lorg/apache/logging/log4j/Logger;error(Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)V", remap = false), - require = 0 + method = "*", at = @At(value = "INVOKE", target = "Lorg/apache/logging/log4j/Logger;error(Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)V", remap = false), + require = 0 ) private boolean utCheckTexMap(Logger instance, String message, Object p0, Object p1) { diff --git a/src/main/resources/mixins.tweaks.misc.chat.compactmessage.json b/src/main/resources/mixins.tweaks.misc.chat.compactmessage.json index 9d33e37f..cfb7af94 100644 --- a/src/main/resources/mixins.tweaks.misc.chat.compactmessage.json +++ b/src/main/resources/mixins.tweaks.misc.chat.compactmessage.json @@ -1,9 +1,9 @@ { -"package": "mod.acgaming.universaltweaks.tweaks.misc.chat.mixin", -"refmap": "universaltweaks.refmap.json", -"minVersion": "0.8", -"compatibilityLevel": "JAVA_8", -"client": [ - "UTCompactMessageMixin" -] + "package": "mod.acgaming.universaltweaks.tweaks.misc.chat.mixin", + "refmap": "universaltweaks.refmap.json", + "minVersion": "0.8", + "compatibilityLevel": "JAVA_8", + "client": [ + "UTCompactMessageMixin" + ] } \ No newline at end of file