Skip to content

Commit

Permalink
fix geckolib invisibility handling
Browse files Browse the repository at this point in the history
  • Loading branch information
iron431 committed Sep 3, 2024
1 parent 9dceade commit 31a1f5f
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
1 change: 1 addition & 0 deletions LATEST_CHANGES.MD
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
- Fixed Scrolls without spell container component crashing the client
- Fixed Armor Cape Layer not tracking to entity's during various animations
- Fixed Affinity Rings being able to roll disabled spells
- Fixed geckolib mob invisibility handling

### API
-
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import software.bernie.geckolib.renderer.GeoEntityRenderer;
import software.bernie.geckolib.renderer.layer.BlockAndItemGeoLayer;
import software.bernie.geckolib.renderer.layer.ItemArmorGeoLayer;
import software.bernie.geckolib.util.ClientUtil;
import software.bernie.geckolib.util.RenderUtil;

import javax.annotation.Nonnull;
Expand Down Expand Up @@ -194,6 +195,9 @@ protected void adjustHandItemRendering(PoseStack poseStack, ItemStack stack, T a

@Override
public void render(T entity, float entityYaw, float partialTick, PoseStack poseStack, MultiBufferSource bufferSource, int packedLight) {
if (entity.isInvisible() && entity.isInvisibleTo(ClientUtil.getClientPlayer())) {
return;
}
super.render(entity, entityYaw, partialTick, poseStack, bufferSource, packedLight);
poseStack.pushPose();
float f = Mth.rotLerp(partialTick, entity.yBodyRotO, entity.yBodyRot);
Expand All @@ -204,7 +208,8 @@ public void render(T entity, float entityYaw, float partialTick, PoseStack poseS
}
model.getBone("torso").ifPresent(bone -> {
RenderUtil.prepMatrixForBone(poseStack, bone);
});poseStack.scale(-1.0F, -1.0F, 1.0F);
});
poseStack.scale(-1.0F, -1.0F, 1.0F);
poseStack.translate(0.0F, -1.501F, 0.0F);
this.hardCodedCapeLayer.render(poseStack, bufferSource, packedLight, entity, 0, 0, partialTick, 0, 0, 0);
poseStack.popPose();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
import net.minecraft.world.item.Items;
import net.minecraft.world.item.alchemy.Potions;
import org.jetbrains.annotations.Nullable;
import software.bernie.geckolib.util.Color;

import static io.redspace.ironsspellbooks.render.EnergySwirlLayer.CHARGE_TEXTURE;
import static io.redspace.ironsspellbooks.render.EnergySwirlLayer.EVASION_TEXTURE;
Expand Down Expand Up @@ -51,11 +50,6 @@ public void render(AbstractSpellCastingMob entity, float entityYaw, float partia

}

@Override
public Color getRenderColor(AbstractSpellCastingMob animatable, float partialTick, int packedLight) {
return animatable.isInvisible() ? Color.ofRGBA(1f, 1f, 1f, .3f) : super.getRenderColor(animatable, partialTick, packedLight);
}

@Override
public RenderType getRenderType(AbstractSpellCastingMob animatable, ResourceLocation texture, @Nullable MultiBufferSource bufferSource, float partialTick) {
return animatable.isInvisible() ? RenderType.entityTranslucent(texture) : super.getRenderType(animatable, texture, bufferSource, partialTick);
Expand Down

0 comments on commit 31a1f5f

Please sign in to comment.