Skip to content

Commit

Permalink
Merge pull request #372 from IcarussOne/main
Browse files Browse the repository at this point in the history
6th Batch of Tweaks
  • Loading branch information
ACGaming authored Feb 7, 2024
2 parents 4babc39 + fa75acd commit 503870d
Show file tree
Hide file tree
Showing 9 changed files with 116 additions and 2 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ All changes are toggleable via config files.
* **Chunk Saving:** Fixes loading of outdated chunks to prevent duplications, deletions and data corruption
* **Comparator Timing:** Fixes inconsistent delays of comparators to prevent redstone timing issues
* **Concurrent Entity AI Tasks:** Replaces linked entity AI task sets with concurrent sets to avoid mod exception concerning entity AI
* **Crafted Item Statistics:** Fixes crafted item statistics not increasing correctly when items are crafted with shift-click or drop methods
* **Death Time:** Fixes corrupted entities exceeding the allowed death time
* **Depth Mask:** Fixes entity and particle rendering issues by enabling depth buffer writing
* **Destroy Entity Packets:** Fixes lag caused by dead entities by sending additional packets when the player is not alive
Expand Down Expand Up @@ -68,6 +69,7 @@ All changes are toggleable via config files.
* **Shear Mooshroom Dupe:** Fixes a duplication exploit connected to shearing mooshrooms
* **Skeleton Aim:** Fixes skeletons not looking at their targets when strafing
* **Sleep Resets Weather:** Fixes sleeping always resetting rain and thunder times
* **Spectator Menu:** Fixes the spectator menu not showing player skins
* **Tile Entity Map:** Replaces the chunk position data table to prevent tile entity related issues
* **Villager Mantle:** Returns missing hoods to villager mantles
* **Witch Huts:** Fixes witch hut structure data not accounting for the height it is generated at
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

// MC-88959
// https://bugs.mojang.com/browse/MC-88959
// Courtesy of mrgrim
// Courtesy of Nessiesson
@Mixin(BlockPistonBase.class)
public abstract class UTPistonBaseBlockMixin
{
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
package mod.acgaming.universaltweaks.bugfixes.misc.crafteditemstatistics.mixin;

import net.minecraft.inventory.IInventory;
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;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;

// MC-65198, MC-161869
// https://bugs.mojang.com/browse/MC-65198
// https://bugs.mojang.com/browse/MC-161869
// Courtesy of mrgrim
@Mixin(SlotCrafting.class)
public abstract class UTSlotCraftingMixin extends Slot
{
@Shadow
private int amountCrafted;

public UTSlotCraftingMixin(IInventory inventoryIn, int index, int xPosition, int yPosition)
{
super(inventoryIn, index, xPosition, yPosition);
}

@Inject(method = "decrStackSize", at = @At("HEAD"), cancellable = true)
private void utFixCraftingStats(int amount, CallbackInfoReturnable<ItemStack> cir)
{
if (UTConfigBugfixes.MISC.utCraftedItemStatisticsToggle)
{
ItemStack ret = super.decrStackSize(amount);
this.amountCrafted += ret.getCount();

cir.setReturnValue(ret);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
package mod.acgaming.universaltweaks.bugfixes.misc.spectator.mixin;

import com.mojang.authlib.GameProfile;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.spectator.PlayerMenuObject;
import net.minecraft.client.network.NetworkPlayerInfo;
import net.minecraft.client.renderer.texture.TextureManager;
import net.minecraft.util.ResourceLocation;
import mod.acgaming.universaltweaks.config.UTConfigBugfixes;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;

// MC-125157
// https://bugs.mojang.com/browse/MC-125157
// Courtesy of mrgrim
@Mixin(PlayerMenuObject.class)
public abstract class UTPlayerMenuObjectMixin
{
@Shadow
@Final
private GameProfile profile;

@Redirect(method = "renderIcon", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/texture/TextureManager;bindTexture(Lnet/minecraft/util/ResourceLocation;)V"))
private void utRedirectBindTexture(TextureManager textureManager, ResourceLocation resource)
{
if (UTConfigBugfixes.MISC.utSpectatorMenuToggle)
{
final Minecraft mc = Minecraft.getMinecraft();
final NetworkPlayerInfo npi = mc.player.connection.getPlayerInfo(this.profile.getName());
if (npi != null)
{
mc.getTextureManager().bindTexture(npi.getLocationSkin());
}
} else
{
textureManager.bindTexture(resource);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,11 @@ 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")
public boolean utCraftedItemStatisticsToggle = true;

@Config.RequiresMcRestart
@Config.Name("Depth Mask")
Expand All @@ -327,6 +332,11 @@ 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")
public boolean utSpectatorMenuToggle = true;

@Config.RequiresMcRestart
@Config.Name("Packet Size")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1032,7 +1032,7 @@ public static class ItemEntitiesCategory

@Config.Name("[17] Slowed Movement")
@Config.Comment("Slows how often item entities update their position to improve performance")
public boolean utIEUpdateToggle = true;
public boolean utIEUpdateToggle = false;
}

public static class MendingCategory
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ public List<String> getMixinConfigs()
configs.add("mixins.bugfixes.misc.modelgap.json");
configs.add("mixins.bugfixes.misc.potionamplifier.json");
configs.add("mixins.bugfixes.misc.smoothlighting.json");
configs.add("mixins.bugfixes.misc.spectatormenu.json");
configs.add("mixins.bugfixes.misc.startup.json");
configs.add("mixins.bugfixes.world.frustumculling.json");
configs.add("mixins.tweaks.entities.autojump.json");
Expand Down Expand Up @@ -178,6 +179,7 @@ public List<String> getMixinConfigs()
configs.add("mixins.bugfixes.entities.skeletonaim.json");
configs.add("mixins.bugfixes.entities.suffocation.json");
configs.add("mixins.bugfixes.entities.tracker.json");
configs.add("mixins.bugfixes.misc.crafteditemstatistics.json");
configs.add("mixins.bugfixes.misc.enchantment.json");
configs.add("mixins.bugfixes.misc.packetsize.json");
configs.add("mixins.bugfixes.misc.particlespawning.json");
Expand Down Expand Up @@ -281,6 +283,8 @@ public boolean shouldMixinConfigQueue(String mixinConfig)
return UTConfigBugfixes.MISC.utPotionAmplifierVisibilityToggle;
case "mixins.bugfixes.misc.smoothlighting.json":
return UTConfigBugfixes.MISC.utAccurateSmoothLighting;
case "mixins.bugfixes.misc.spectatormenu.json":
return UTConfigBugfixes.MISC.utSpectatorMenuToggle;
case "mixins.bugfixes.misc.startup.json":
return UTConfigTweaks.PERFORMANCE.utFasterBackgroundStartupToggle;
case "mixins.bugfixes.world.frustumculling.json":
Expand Down Expand Up @@ -353,6 +357,8 @@ public boolean shouldMixinConfigQueue(String mixinConfig)
return UTConfigBugfixes.BLOCKS.utPistonRetractionToggle;
case "mixins.bugfixes.blocks.bed.json":
return UTConfigBugfixes.BLOCKS.utSleepResetsWeatherToggle;
case "mixins.bugfixes.misc.crafteditemstatistics.json":
return UTConfigBugfixes.MISC.utCraftedItemStatisticsToggle;
case "mixins.bugfixes.misc.enchantment.json":
return UTConfigBugfixes.MISC.utBlastProtectionKnockbackToggle;
case "mixins.bugfixes.misc.packetsize.json":
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"package": "mod.acgaming.universaltweaks.bugfixes.misc.crafteditemstatistics.mixin",
"refmap": "universaltweaks.refmap.json",
"minVersion": "0.8",
"compatibilityLevel": "JAVA_8",
"mixins": ["UTSlotCraftingMixin"]
}
7 changes: 7 additions & 0 deletions src/main/resources/mixins.bugfixes.misc.spectatormenu.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"package": "mod.acgaming.universaltweaks.bugfixes.misc.spectatormenu.mixin",
"refmap": "universaltweaks.refmap.json",
"minVersion": "0.8",
"compatibilityLevel": "JAVA_8",
"client": ["UTPlayerMenuObjectMixin"]
}

0 comments on commit 503870d

Please sign in to comment.