Search in sources :

Example 1 with MekaSuitArmor

use of mekanism.client.render.armor.MekaSuitArmor in project Mekanism by mekanism.

the class RenderTickHandler method renderArm.

@SubscribeEvent
public void renderArm(RenderArmEvent event) {
    AbstractClientPlayerEntity player = event.getPlayer();
    ItemStack chestStack = player.getItemBySlot(EquipmentSlotType.CHEST);
    if (chestStack.getItem() instanceof ItemMekaSuitArmor) {
        MekaSuitArmor armor = (MekaSuitArmor) ((ItemMekaSuitArmor) chestStack.getItem()).getGearModel();
        armor.setAllVisible(true);
        // Note: We just want it to act as empty even if there is a map as it looks a lot better
        boolean rightHand = event.getArm() == HandSide.RIGHT;
        if (rightHand) {
            armor.rightArmPose = ArmPose.EMPTY;
        } else {
            armor.leftArmPose = ArmPose.EMPTY;
        }
        armor.attackTime = 0.0F;
        armor.crouching = false;
        armor.swimAmount = 0.0F;
        armor.setupAnim(player, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F);
        armor.renderArm(event.getPoseStack(), event.getMultiBufferSource(), event.getPackedLight(), OverlayTexture.NO_OVERLAY, chestStack.hasFoil(), player, rightHand);
        event.setCanceled(true);
    }
}
Also used : ItemMekaSuitArmor(mekanism.common.item.gear.ItemMekaSuitArmor) AbstractClientPlayerEntity(net.minecraft.client.entity.player.AbstractClientPlayerEntity) ItemMekaSuitArmor(mekanism.common.item.gear.ItemMekaSuitArmor) MekaSuitArmor(mekanism.client.render.armor.MekaSuitArmor) ItemStack(net.minecraft.item.ItemStack) SubscribeEvent(net.minecraftforge.eventbus.api.SubscribeEvent)

Aggregations

MekaSuitArmor (mekanism.client.render.armor.MekaSuitArmor)1 ItemMekaSuitArmor (mekanism.common.item.gear.ItemMekaSuitArmor)1 AbstractClientPlayerEntity (net.minecraft.client.entity.player.AbstractClientPlayerEntity)1 ItemStack (net.minecraft.item.ItemStack)1 SubscribeEvent (net.minecraftforge.eventbus.api.SubscribeEvent)1