Skip to content

Commit

Permalink
Formatting, cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
ACGaming committed Feb 26, 2024
1 parent 215b195 commit 4d2970b
Show file tree
Hide file tree
Showing 22 changed files with 143 additions and 107 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -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

Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -21,7 +21,7 @@
public abstract class UTEntityTippedArrowMixin
{
@Shadow
private PotionType potion;
private PotionType potion;
@Shadow
@Final
private Set<PotionEffect> customPotionEffects;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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")
Expand Down Expand Up @@ -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")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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();
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,21 +1,23 @@
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;
import org.spongepowered.asm.mixin.injection.Inject;
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<ItemStack> cir) {
private static void utFindItemStackInInventory(EntityPlayer player, Block block, CallbackInfoReturnable<ItemStack> cir)
{
if (UTConfigMods.EFFORTLESS_BUILDING.utEFTransmutationFixToggle) cir.setReturnValue(ItemStack.EMPTY);
}
}
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -9,23 +8,29 @@
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;
import org.spongepowered.asm.mixin.injection.Inject;
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<Boolean> 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<Boolean> 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;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,27 +1,32 @@
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;
import org.spongepowered.asm.mixin.injection.Inject;
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<ItemStack> cir) {
@Inject(method = "findItemStackInInventory", at = @At("HEAD"), cancellable = true, remap = false)
private static void utFindItemStackInInventory(EntityPlayer player, IBlockState blockState, CallbackInfoReturnable<ItemStack> 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;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@
@Mod.EventBusSubscriber(modid = UniversalTweaks.MODID)
public class UTParry
{
private static final List<EntityEntry> projectileList = new ArrayList<>();
private static Enchantment enchantment;
private static EnumEnchantmentType enchantmentTypeShield;
private static final List<EntityEntry> projectileList = new ArrayList<>();

public static void initProjectileList()
{
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
Loading

0 comments on commit 4d2970b

Please sign in to comment.