-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add button enabled/disabled, add level to nametags
- Loading branch information
1 parent
95c34db
commit d246af4
Showing
10 changed files
with
119 additions
and
164 deletions.
There are no files selected for viewing
33 changes: 33 additions & 0 deletions
33
src/client/java/com/bibireden/playerex/mixin/EntityRendererMixin.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,33 @@ | ||
package com.bibireden.playerex.mixin; | ||
|
||
import com.bibireden.data_attributes.api.DataAttributesAPI; | ||
import com.bibireden.playerex.PlayerEX; | ||
import com.bibireden.playerex.api.attribute.PlayerEXAttributes; | ||
import com.llamalad7.mixinextras.sugar.Local; | ||
import net.minecraft.client.render.entity.EntityRenderer; | ||
import net.minecraft.entity.Entity; | ||
import net.minecraft.entity.player.PlayerEntity; | ||
import net.minecraft.text.Text; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.Unique; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.ModifyArg; | ||
|
||
import java.util.Optional; | ||
|
||
@Mixin(EntityRenderer.class) | ||
abstract class EntityRendererMixin<T extends Entity> { | ||
@Unique | ||
private boolean playerex$shouldRenderLevel() { return PlayerEX.CONFIG.getShowLevelOnNameplates(); } | ||
|
||
@ModifyArg(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/entity/EntityRenderer;renderLabelIfPresent(Lnet/minecraft/entity/Entity;Lnet/minecraft/text/Text;Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumerProvider;I)V"), index = 1) | ||
private Text playerex$renderLabelIfPresent(Text text, @Local(argsOnly = true) Entity entity) { | ||
if (playerex$shouldRenderLevel() && entity instanceof PlayerEntity livingEntity) { | ||
Optional<Double> maybeLevel = DataAttributesAPI.getValue(PlayerEXAttributes.LEVEL, livingEntity); | ||
if (maybeLevel.isPresent()) { | ||
text = text.copy().append(" ").append(Text.translatable("playerex.ui.nameplate.level", maybeLevel.get().intValue()).styled((style) -> style.withColor(0xFFAA00))); | ||
} | ||
} | ||
return text; | ||
} | ||
} |
111 changes: 0 additions & 111 deletions
111
src/client/java/com/bibireden/playerex/mixin/LivingEntityRendererMixin.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
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
10 changes: 10 additions & 0 deletions
10
src/client/kotlin/com/bibireden/playerex/ui/util/Colors.kt
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,10 @@ | ||
package com.bibireden.playerex.ui.util | ||
|
||
object Colors { | ||
const val GRAY = 0x9C9C9C | ||
const val GOLD = 0xF0C25E | ||
const val SATURATED_BLUE = 0x6EBAE5 | ||
const val SANDY = 0xEDCD76 | ||
const val IMPISH_RED = 0xD63042 | ||
const val DARK_GREEN = 0x48D19B | ||
} |
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.