Skip to content

Commit

Permalink
fix: fixed the second layer of skin overlapping with ice and fires ar…
Browse files Browse the repository at this point in the history
…mors
  • Loading branch information
TheBv committed Jan 3, 2024
1 parent 19dee47 commit f20bfc8
Showing 1 changed file with 42 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,22 @@
import com.github.alexthe666.iceandfire.entity.props.SirenProperties;
import com.github.alexthe666.iceandfire.entity.util.ICustomMoveController;
import com.github.alexthe666.iceandfire.enums.EnumParticles;
import com.github.alexthe666.iceandfire.item.IafArmorMaterial;
import com.github.alexthe666.iceandfire.message.MessageDragonControl;
import com.github.alexthe666.iceandfire.pathfinding.raycoms.WorldEventContext;
import net.minecraft.client.CameraType;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.screens.TitleScreen;
import net.minecraft.client.model.HumanoidModel;
import net.minecraft.client.model.PlayerModel;
import net.minecraft.client.renderer.GameRenderer;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.EquipmentSlot;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.ArmorItem;
import net.minecraft.world.item.ItemStack;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.client.event.RenderLevelStageEvent;
Expand All @@ -38,6 +44,7 @@
import net.minecraftforge.fml.common.Mod;
import org.jetbrains.annotations.NotNull;

import java.util.List;
import java.util.Random;

@OnlyIn(Dist.CLIENT)
Expand Down Expand Up @@ -69,7 +76,7 @@ public void onCameraSetup(ViewportEvent.ComputeCameraAngles event) {
int currentView = IceAndFire.PROXY.getDragon3rdPersonView();
float scale = ((EntityDragonBase) player.getVehicle()).getRenderSize() / 3;
if (Minecraft.getInstance().options.getCameraType() == CameraType.THIRD_PERSON_BACK ||
Minecraft.getInstance().options.getCameraType() == CameraType.THIRD_PERSON_FRONT) {
Minecraft.getInstance().options.getCameraType() == CameraType.THIRD_PERSON_FRONT) {
if (currentView == 1) {
event.getCamera().move(-event.getCamera().getMaxZoom(scale * 1.2F), 0F, 0);
} else if (currentView == 2) {
Expand Down Expand Up @@ -163,6 +170,39 @@ public void onPreRenderLiving(RenderLivingEvent.Pre event) {
if (shouldCancelRender(event.getEntity())) {
event.setCanceled(true);
}
for (EquipmentSlot slot : List.of(EquipmentSlot.HEAD, EquipmentSlot.CHEST, EquipmentSlot.LEGS, EquipmentSlot.FEET)) {
ItemStack stack = event.getEntity().getItemBySlot(slot);
if (stack.getItem() instanceof ArmorItem armorStack && armorStack.getMaterial() instanceof IafArmorMaterial) {
switch (slot) {
case HEAD -> {
if (event.getRenderer().getModel() instanceof HumanoidModel<?> humanoidModel) {
humanoidModel.hat.visible = false;
}
}
case CHEST -> {
if (event.getRenderer().getModel() instanceof PlayerModel<?> playerModel) {
playerModel.jacket.visible = false;
playerModel.leftSleeve.visible = false;
playerModel.rightSleeve.visible = false;
}
}
case LEGS -> {
if (event.getRenderer().getModel() instanceof PlayerModel<?> playerModel) {
playerModel.leftPants.visible = false;
playerModel.rightPants.visible = false;
}
}
case FEET -> {
if (event.getRenderer().getModel() instanceof PlayerModel<?> playerModel) {
playerModel.leftLeg.visible = false;
playerModel.rightLeg.visible = false;
}
}
}

}
}

}

@SubscribeEvent
Expand All @@ -189,6 +229,7 @@ public void onGuiOpened(ScreenEvent.Opening event) {

// TODO: add this to client side config
public final boolean AUTO_ADAPT_3RD_PERSON = true;

@SubscribeEvent
public void onEntityMount(EntityMountEvent event) {

Expand Down

0 comments on commit f20bfc8

Please sign in to comment.