Подписывайтесь на наш Telegram и не пропускайте важные новости! Перейти

Визуальная часть WaveyCapes EXP 3.1

Пожалуйста, авторизуйтесь для просмотра ссылки.

На эту тему темы уже были, но они были не полными как по мне. Скажу сразу, да это с Excellent! Просто есть люди которые не могут это спастить, да

Для начала качаем
Пожалуйста, авторизуйтесь для просмотра ссылки.
и кидаем в удобную директорию. Вот так выглядит у меня:

Далее переходим в основной ваш клас и вставляем это:
Expensive.java:
Expand Collapse Copy
import eblan.svin.utils.waveycapes.WaveyCapesBase;

[USER=270918]@Getter[/USER]
@FieldDefaults(level = AccessLevel.PRIVATE)
public class Expensive {
    //код до...
    private WaveyCapesBase waveyCapes;

    private void initWaveyCapes() {
        this.waveyCapes = new WaveyCapesBase();
        this.waveyCapes.init();
    }

    private void clientLoad() {
        //код до...
        try {
            initWaveyCapes();
        } catch (Exception e) {
            e.printStackTrace();
        }
        //код после...
    }

    //код после...

}

после этого net.minecraft.client.entity.player.AbstractClientPlayerEntity заменяем полностью на:
AbstractClientPlayerEntity:
Expand Collapse Copy
package net.minecraft.client.entity.player;

import com.google.common.hash.Hashing;
import com.mojang.authlib.GameProfile;
import eblan.svin.command.friends.FriendStorage;
import lombok.Getter;
import lombok.Setter;
import net.minecraft.client.Minecraft;
import net.minecraft.client.network.play.NetworkPlayerInfo;
import net.minecraft.client.renderer.texture.DownloadingTexture;
import net.minecraft.client.renderer.texture.Texture;
import net.minecraft.client.renderer.texture.TextureManager;
import net.minecraft.client.resources.DefaultPlayerSkin;
import net.minecraft.client.world.ClientWorld;
import net.minecraft.entity.ai.attributes.Attributes;
import net.minecraft.entity.passive.ShoulderRidingEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.BowItem;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.StringUtils;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.vector.Vector3d;
import net.minecraft.world.GameType;
import net.optifine.Config;
import net.optifine.player.CapeUtils;
import net.optifine.player.PlayerConfigurations;
import net.optifine.reflect.Reflector;
import eblan.svin.events.PlayerLookEvent;
import eblan.svin.utils.waveycapes.interfaces.CapeHolder;
import eblan.svin.utils.waveycapes.sim.StickSimulation;
import net.minecraft.util.math.vector.Vector2f;

import javax.annotation.Nullable;

public abstract class AbstractClientPlayerEntity extends PlayerEntity implements CapeHolder {
    private final StickSimulation stickSimulation;
    private final ResourceLocation CAPE_LOCATION = new ResourceLocation("expensive/images/cape.png");
    private NetworkPlayerInfo playerInfo;
    public float rotateElytraX;
    public float rotateElytraY;
    public float rotateElytraZ;
    public final ClientWorld worldClient;
    [USER=270918]@Getter[/USER]
    [USER=1132491]@setter[/USER]
    private ResourceLocation locationOfCape = null;
    [USER=270918]@Getter[/USER]
    [USER=1132491]@setter[/USER]
    private long reloadCapeTimeMs = 0L;
    [USER=270918]@Getter[/USER]
    [USER=1132491]@setter[/USER]
    private boolean elytraOfCape = false;
    [USER=270918]@Getter[/USER]
    private String nameClear = null;
    public ShoulderRidingEntity entityShoulderLeft;
    public ShoulderRidingEntity entityShoulderRight;
    public float capeRotateX;
    public float capeRotateY;
    public float capeRotateZ;
    private static final ResourceLocation TEXTURE_ELYTRA = new ResourceLocation("textures/entity/elytra.png");

    public AbstractClientPlayerEntity(ClientWorld world, GameProfile profile) {
        super(world, world.func_239140_u_(), world.func_243489_v(), profile);
        this.worldClient = world;
        this.nameClear = profile.getName();

        if (this.nameClear != null && !this.nameClear.isEmpty()) {
            this.nameClear = StringUtils.stripControlCodes(this.nameClear);
        }

        CapeUtils.downloadCape(this);
        PlayerConfigurations.getPlayerConfiguration(this);
        this.stickSimulation = new StickSimulation();
    }

    /**
     * Returns true if the player is in spectator mode.
     */
    public boolean isSpectator() {
        if (Minecraft.getInstance().getConnection() == null) return false;
        NetworkPlayerInfo networkplayerinfo = Minecraft.getInstance().getConnection().getPlayerInfo(this.getGameProfile().getId());
        return networkplayerinfo != null && networkplayerinfo.getGameType() == GameType.SPECTATOR;
    }

    public boolean isCreative() {
        if (Minecraft.getInstance().getConnection() == null) return false;
        NetworkPlayerInfo networkplayerinfo = Minecraft.getInstance().getConnection().getPlayerInfo(this.getGameProfile().getId());
        return networkplayerinfo != null && networkplayerinfo.getGameType() == GameType.CREATIVE;
    }

    /**
     * Checks if this instance of AbstractClientPlayer has any associated player data.
     */
    public boolean hasPlayerInfo() {
        return this.getPlayerInfo() != null;
    }

    [USER=1265501]@nullable[/USER]
    protected NetworkPlayerInfo getPlayerInfo() {
        if (this.playerInfo == null) {
            this.playerInfo = Minecraft.getInstance().getConnection().getPlayerInfo(this.getUniqueID());
        }

        return this.playerInfo;
    }

    /**
     * Returns true if the player has an associated skin.
     */
    public boolean hasSkin() {
        NetworkPlayerInfo networkplayerinfo = this.getPlayerInfo();
        return networkplayerinfo != null && networkplayerinfo.hasLocationSkin();
    }

    /**
     * Returns the ResourceLocation associated with the player's skin
     */
    public ResourceLocation getLocationSkin() {
        NetworkPlayerInfo networkplayerinfo = this.getPlayerInfo();
        return networkplayerinfo == null ? DefaultPlayerSkin.getDefaultSkin(this.getUniqueID()) : networkplayerinfo.getLocationSkin();
    }


    [USER=1265501]@nullable[/USER]
    public ResourceLocation getLocationCape() {
        if (this.hasCustomCape()) {
//            System.out.println("Дабавляю");
            return CAPE_LOCATION;
        }
        if (!Config.isShowCapes()) {
            return null;
        } else {
            if (this.reloadCapeTimeMs != 0L && System.currentTimeMillis() > this.reloadCapeTimeMs) {
                CapeUtils.reloadCape(this);
                this.reloadCapeTimeMs = 0L;
            }

            if (this.locationOfCape != null) {
                return this.locationOfCape;
            } else {
                NetworkPlayerInfo networkplayerinfo = this.getPlayerInfo();
                return networkplayerinfo == null ? null : networkplayerinfo.getLocationCape();
            }
        }
    }

    [USER=1367676]@override[/USER]
    protected void updateCape() {
        if (this.hasCustomCape()) {
//            System.out.println("Абанавляю");
            this.simulate(this);
        }
        super.updateCape();
    }

    public boolean hasCustomCape() {
        return this instanceof ClientPlayerEntity || FriendStorage.isFriend(nameClear);
    }

    public boolean isPlayerInfoSet() {
        return this.getPlayerInfo() != null;
    }

    [USER=1265501]@nullable[/USER]

    /**
     * Gets the special Elytra texture for the player.
     */
    public ResourceLocation getLocationElytra() {
        NetworkPlayerInfo networkplayerinfo = this.getPlayerInfo();
        return networkplayerinfo == null ? null : networkplayerinfo.getLocationElytra();
    }

    public static DownloadingTexture getDownloadImageSkin(ResourceLocation resourceLocationIn, String username) {
        TextureManager texturemanager = Minecraft.getInstance().getTextureManager();
        Texture texture = texturemanager.getTexture(resourceLocationIn);

        if (texture == null) {
            texture = new DownloadingTexture(null, String.format("http://skins.minecraft.net/MinecraftSkins/%s.png", StringUtils.stripControlCodes(username)), DefaultPlayerSkin.getDefaultSkin(getOfflineUUID(username)), true, null);
            texturemanager.loadTexture(resourceLocationIn, texture);
        }

        return (DownloadingTexture) texture;
    }

    /**
     * Returns true if the username has an associated skin.
     */
    public static ResourceLocation getLocationSkin(String username) {
        return new ResourceLocation("skins/" + Hashing.sha1().hashUnencodedChars(StringUtils.stripControlCodes(username)));
    }

    public String getSkinType() {
        NetworkPlayerInfo networkplayerinfo = this.getPlayerInfo();
        return networkplayerinfo == null ? DefaultPlayerSkin.getSkinType(this.getUniqueID()) : networkplayerinfo.getSkinType();
    }

    public float getFovModifier() {
        float f = 1.0F;

        if (this.abilities.isFlying) {
            f *= 1.1F;
        }

        f = (float) ((double) f * ((this.getAttributeValue(Attributes.MOVEMENT_SPEED) / (double) this.abilities.getWalkSpeed() + 1.0D) / 2.0D));

        if (this.abilities.getWalkSpeed() == 0.0F || Float.isNaN(f) || Float.isInfinite(f)) {
            f = 1.0F;
        }

        if (this.isHandActive() && this.getActiveItemStack().getItem() instanceof BowItem) {
            int i = this.getItemInUseMaxCount();
            float f1 = (float) i / 20.0F;

            if (f1 > 1.0F) {
                f1 = 1.0F;
            } else {
                f1 = f1 * f1;
            }

            f *= 1.0F - f1 * 0.15F;
        }

        return Reflector.ForgeHooksClient_getOffsetFOV.exists() ? Reflector.callFloat(Reflector.ForgeHooksClient_getOffsetFOV, this, f) : MathHelper.lerp(Minecraft.getInstance().gameSettings.fovScaleEffect, 1.0F, f);
    }

    public boolean hasElytraCape() {
        if (this.hasCustomCape()) {
            return false;
        }
        ResourceLocation resourcelocation = this.getLocationCape();

        if (resourcelocation == null) {
            return false;
        } else {
            return resourcelocation != this.locationOfCape || this.elytraOfCape;
        }
    }

    public Vector3d getLook(float partialTicks) {
        float yaw = this.rotationYaw;
//        System.out.println("Абзор миняю");
        float pitch = this.rotationPitch;

        PlayerLookEvent playerLookEvent = new PlayerLookEvent(new Vector2f(yaw, pitch));

        yaw = playerLookEvent.getRotation().x;
        pitch = playerLookEvent.getRotation().y;

        return this.getVectorForRotation(pitch, yaw);
    }

    [USER=1367676]@override[/USER]
    public StickSimulation getSimulation() {
        return this.stickSimulation;
    }

    public String getNameClear() {
        return this.nameClear;
    }
}

потом в net.minecraft.client.renderer.entity.PlayerRenderer заменяем public PlayerRenderer(EntityRendererManager renderManager, boolean useSmallArms) на:
PlayerRenderer:
Expand Collapse Copy
public PlayerRenderer(EntityRendererManager renderManager, boolean useSmallArms)
{
    super(renderManager, new PlayerModel<>(0.0F, useSmallArms), 0.5F);
    this.addLayer(new BipedArmorLayer<>(this, new BipedModel(0.5F), new BipedModel(1.0F)));
    this.addLayer(new HeldItemLayer<>(this));
    this.addLayer(new ArrowLayer<>(this));
    this.addLayer(new Deadmau5HeadLayer(this));
    this.addLayer(new CustomCapeRenderLayer(this));
    this.addLayer(new HeadLayer<>(this));
    this.addLayer(new ElytraLayer<>(this));
    this.addLayer(new ParrotVariantLayer<>(this));
    this.addLayer(new SpinAttackEffectLayer<>(this));
    this.addLayer(new BeeStingerLayer<>(this));
}

И последнее, создаем PlayerLookEvent в eblan.svin.events (или expensive.events) и туда:
PlayerLookEvent.java:
Expand Collapse Copy
package eblan.svin.events;

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.Setter;
import net.minecraft.util.math.vector.Vector2f;

[USER=270918]@Getter[/USER]
[USER=1132491]@setter[/USER]
[USER=1484803]@AllArgsConstructor[/USER]
public final class PlayerLookEvent {
    private Vector2f rotation;

    public Vector2f getRotation() {
        return rotation;
    }
}

Надеюсь тем кому надо я помог :)
хелп, когда иду плащ не развивается иногда развивается на половину но дёргается
 
Назад
Сверху Снизу