Skip to content

Commit

Permalink
flush
Browse files Browse the repository at this point in the history
  • Loading branch information
Globox1997 committed Jan 11, 2024
1 parent d12e3e3 commit 83ee70c
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ protected PlayerListEntry getPlayerListEntry() {

@Override
public int getLevel() {
if (getPlayerListEntry() != null)
if (getPlayerListEntry() != null) {
return ((PlayerListAccess) getPlayerListEntry()).getLevel();

}
return 0;
}
}
10 changes: 6 additions & 4 deletions src/main/java/net/levelz/mixin/player/MinecraftClientMixin.java
Original file line number Diff line number Diff line change
Expand Up @@ -69,14 +69,16 @@ private boolean restrictHandUsage(boolean blockBreaking) {
if (item instanceof SwordItem) {
levelList = LevelLists.swordList;
} else if (item instanceof AxeItem) {
if (ConfigInit.CONFIG.bindAxeDamageToSwordRestriction && !blockBreaking)
if (ConfigInit.CONFIG.bindAxeDamageToSwordRestriction && !blockBreaking) {
levelList = LevelLists.swordList;
else
} else {
levelList = LevelLists.axeList;
} else if (item instanceof HoeItem)
}
} else if (item instanceof HoeItem) {
levelList = LevelLists.hoeList;
else if (item instanceof PickaxeItem || item instanceof ShovelItem)
} else if (item instanceof PickaxeItem || item instanceof ShovelItem) {
levelList = LevelLists.toolList;
}
if (levelList != null && ((ToolItem) item).getMaterial() != null) {
String material = ((ToolItem) item).getMaterial().toString().toLowerCase();
if (!PlayerStatsManager.playerLevelisHighEnough(player, levelList, material, true)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,11 @@ protected void renderLabelIfPresentMixin(AbstractClientPlayerEntity abstractClie

@ModifyArg(method = "renderLabelIfPresent", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/entity/LivingEntityRenderer;renderLabelIfPresent(Lnet/minecraft/entity/Entity;Lnet/minecraft/text/Text;Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumerProvider;I)V", ordinal = 1))
protected Text renderLabelIfPresentMixin(Text original) {
if (ConfigInit.CONFIG.showLevel)
if (ConfigInit.CONFIG.showLevel) {
return Team.decorateName(abstractClientPlayerEntity.getScoreboardTeam(),
Text.translatable("text.levelz.scoreboard", ((PlayerListAccess) abstractClientPlayerEntity).getLevel(), abstractClientPlayerEntity.getName()));
else
} else {
return original;
}
}
}

0 comments on commit 83ee70c

Please sign in to comment.