-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #372 from IcarussOne/main
6th Batch of Tweaks
- Loading branch information
Showing
9 changed files
with
116 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
...gaming/universaltweaks/bugfixes/misc/crafteditemstatistics/mixin/UTSlotCraftingMixin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
} | ||
} |
42 changes: 42 additions & 0 deletions
42
...d/acgaming/universaltweaks/bugfixes/misc/spectatormenu/mixin/UTPlayerMenuObjectMixin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
src/main/resources/mixins.bugfixes.misc.crafteditemstatistics.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"] | ||
} |