Search in sources :

Example 1 with LayerArmorBase

use of net.minecraft.client.renderer.entity.layers.LayerArmorBase in project Galacticraft by micdoodle8.

the class RenderPlayerGC method addGCLayers.

private void addGCLayers() {
    Field f1 = null;
    Field f2 = null;
    Field f3 = null;
    try {
        f1 = LayerArmorBase.class.getDeclaredField(GCCoreUtil.isDeobfuscated() ? "renderer" : "field_177190_a");
        f1.setAccessible(true);
    } catch (Exception ignore) {
    }
    // The following code removes the vanilla skull and item layer renderers and replaces them with the Galacticraft ones
    int itemLayerIndex = -1;
    int skullLayerIndex = -1;
    for (int i = 0; i < this.layerRenderers.size(); i++) {
        LayerRenderer layer = this.layerRenderers.get(i);
        if (layer instanceof LayerHeldItem) {
            itemLayerIndex = i;
        }
        if (layer instanceof LayerArmorBase) {
            if (f1 != null) {
                try {
                    f1.set(layer, this);
                } catch (Exception ignore) {
                }
            }
        } else if (layer instanceof LayerCustomHead) {
            skullLayerIndex = i;
        }
    }
    if (skullLayerIndex >= 0) {
        this.setLayer(skullLayerIndex, new LayerCustomHead(this.getMainModel().bipedHead));
    }
    if (itemLayerIndex >= 0 && !ConfigManagerCore.disableVehicleCameraChanges) {
        this.setLayer(itemLayerIndex, new LayerHeldItemGC(this));
    }
    this.addLayer(new LayerOxygenTanks(this));
    this.addLayer(new LayerOxygenGear(this));
    this.addLayer(new LayerOxygenMask(this));
    this.addLayer(new LayerOxygenParachute(this));
    this.addLayer(new LayerFrequencyModule(this));
    if (GalacticraftCore.isPlanetsLoaded) {
        this.addLayer(new LayerThermalPadding(this));
        RenderPlayerGC.thermalPaddingTexture0 = new ResourceLocation("galacticraftplanets", "textures/misc/thermal_padding_0.png");
        RenderPlayerGC.thermalPaddingTexture1 = new ResourceLocation("galacticraftplanets", "textures/misc/thermal_padding_1.png");
        RenderPlayerGC.thermalPaddingTexture1_T2 = new ResourceLocation("galacticraftplanets", "textures/misc/thermal_padding_t2_1.png");
        RenderPlayerGC.heatShieldTexture = new ResourceLocation("galacticraftplanets", "textures/misc/shield.png");
        this.addLayer(new LayerShield(this));
    }
}
Also used : LayerHeldItem(net.minecraft.client.renderer.entity.layers.LayerHeldItem) LayerRenderer(net.minecraft.client.renderer.entity.layers.LayerRenderer) LayerCustomHead(net.minecraft.client.renderer.entity.layers.LayerCustomHead) Field(java.lang.reflect.Field) ResourceLocation(net.minecraft.util.ResourceLocation) LayerArmorBase(net.minecraft.client.renderer.entity.layers.LayerArmorBase)

Aggregations

Field (java.lang.reflect.Field)1 LayerArmorBase (net.minecraft.client.renderer.entity.layers.LayerArmorBase)1 LayerCustomHead (net.minecraft.client.renderer.entity.layers.LayerCustomHead)1 LayerHeldItem (net.minecraft.client.renderer.entity.layers.LayerHeldItem)1 LayerRenderer (net.minecraft.client.renderer.entity.layers.LayerRenderer)1 ResourceLocation (net.minecraft.util.ResourceLocation)1