-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b95a9f4
commit 5911aad
Showing
22 changed files
with
70 additions
and
103 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
10 changes: 0 additions & 10 deletions
10
common/src/main/java/me/cael/capes/mixins/AccessorPlayerListEntry.java
This file was deleted.
Oops, something went wrong.
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
23 changes: 0 additions & 23 deletions
23
common/src/main/java/me/cael/capes/mixins/MixinElytraFeatureRenderer.java
This file was deleted.
Oops, something went wrong.
30 changes: 20 additions & 10 deletions
30
common/src/main/java/me/cael/capes/mixins/MixinPlayerListEntry.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 |
---|---|---|
@@ -1,36 +1,46 @@ | ||
package me.cael.capes.mixins; | ||
|
||
import com.mojang.authlib.GameProfile; | ||
import me.cael.capes.CapeConfig; | ||
import me.cael.capes.Capes; | ||
import me.cael.capes.handler.PlayerHandler; | ||
import net.minecraft.client.network.PlayerListEntry; | ||
import net.minecraft.client.util.SkinTextures; | ||
import net.minecraft.util.Identifier; | ||
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.Inject; | ||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; | ||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; | ||
|
||
import java.util.function.Supplier; | ||
|
||
@Mixin(PlayerListEntry.class) | ||
public class MixinPlayerListEntry { | ||
@Shadow @Final private GameProfile profile; | ||
@Shadow private boolean texturesLoaded; | ||
|
||
@Inject(method = "loadTextures", at = @At("HEAD")) | ||
private void loadTextures(CallbackInfo ci) { | ||
if (!texturesLoaded) { | ||
PlayerHandler.Companion.onLoadTexture(profile); | ||
} | ||
@Inject(method = "texturesSupplier", at = @At("HEAD")) | ||
private static void loadTextures(GameProfile profile, CallbackInfoReturnable<Supplier<SkinTextures>> cir) { | ||
PlayerHandler.Companion.onLoadTexture(profile); | ||
} | ||
|
||
@Inject(method = "getCapeTexture", at = @At("TAIL"), cancellable = true) | ||
private void getCapeTexture(CallbackInfoReturnable<Identifier> cir) { | ||
@Inject(method = "getSkinTextures", at = @At("TAIL"), cancellable = true) | ||
private void getCapeTexture(CallbackInfoReturnable<SkinTextures> cir) { | ||
PlayerHandler handler = PlayerHandler.Companion.fromProfile(profile); | ||
if (handler.getHasCape()) { | ||
cir.setReturnValue(handler.getCape()); | ||
CapeConfig config = Capes.INSTANCE.getCONFIG(); | ||
SkinTextures oldTextures = cir.getReturnValue(); | ||
Identifier capeTexture = handler.getCape(); | ||
Identifier elytraTexture = handler.getHasElytraTexture() && config.getEnableElytraTexture() ? capeTexture : new Identifier("textures/entity/elytra.png"); | ||
SkinTextures newTextures = new SkinTextures( | ||
oldTextures.texture(), oldTextures.textureUrl(), | ||
capeTexture, elytraTexture, | ||
oldTextures.model(), oldTextures.secure()); | ||
cir.setReturnValue(newTextures); | ||
} | ||
} | ||
|
||
|
||
|
||
} |
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
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
Binary file not shown.
Binary file added
BIN
+260 Bytes
common/src/main/resources/assets/capes/textures/gui/sprites/icon/cape_options.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
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
2 changes: 1 addition & 1 deletion
2
...e/cael/capes/forge/ForgedCapesPlugin.java → ...capes/forge/mixins/ForgedCapesPlugin.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
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
Oops, something went wrong.