Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main'
Browse files Browse the repository at this point in the history
  • Loading branch information
Thepigcat76 committed Jul 20, 2024
2 parents 6304db2 + 027d853 commit f749c89
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ mod_name=Modular Angel Ring

mod_license=All Rights Reserved

mod_version=1.0.6
mod_version=1.2.0

mod_group_id=com.leclowndu93150.modular_angelring

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
import com.leclowndu93150.modular_angelring.registry.ItemRegistry;
import net.minecraft.client.player.AbstractClientPlayer;
import top.theillusivec4.curios.api.CuriosApi;
import top.theillusivec4.curios.api.SlotResult;

import java.util.Optional;

public class AngelRingCheck {
public static boolean isBaseEquipped(AbstractClientPlayer playerEntity) {
Expand All @@ -12,4 +15,12 @@ public static boolean isBaseEquipped(AbstractClientPlayer playerEntity) {
public static boolean isEquipped(AbstractClientPlayer playerEntity) {
return isBaseEquipped(playerEntity);
}

public static boolean isVisible(AbstractClientPlayer playerEntity) {
if (isEquipped(playerEntity)) {
Optional<SlotResult> slotResult = CuriosApi.getCuriosInventory(playerEntity).flatMap(handler -> handler.findFirstCurio(ItemRegistry.ANGEL_RING.get()));
return slotResult.get().slotContext().visible();
}
return false;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import org.joml.Quaternionf;

import static com.leclowndu93150.modular_angelring.render.AngelRingCheck.isEquipped;
import static com.leclowndu93150.modular_angelring.render.AngelRingCheck.isVisible;

public class AngelRingRenderer extends RenderLayer<AbstractClientPlayer, PlayerModel<AbstractClientPlayer>> {
public static final double FLAP_FREQUENCY = 0.5; // flaps per second
Expand All @@ -31,7 +32,7 @@ public AngelRingRenderer(RenderLayerParent<AbstractClientPlayer, PlayerModel<Abs
@Override
public void render(@NotNull PoseStack matrixStack, @NotNull MultiBufferSource buffer, int packedLight, @NotNull AbstractClientPlayer player, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch) {
assert Minecraft.getInstance().player != null;
if (!player.isInvisible() && isEquipped(player)) {
if (!player.isInvisible() && isEquipped(player) && isVisible(player)) {
matrixStack.pushPose();
getParentModel().body.translateAndRotate(matrixStack);

Expand Down

0 comments on commit f749c89

Please sign in to comment.