Search in sources :

Example 1 with EndermanEntity

use of net.minecraft.entity.mob.EndermanEntity in project Entity_Texture_Features by Traben-0.

the class MIX_EyesFeatureRenderer method getAlteredEyesTexture.

private Identifier getAlteredEyesTexture(LivingEntity entity) {
    String path = "";
    if (entity instanceof EndermanEntity) {
        path = "textures/entity/enderman/enderman_eyes.png";
    } else if (entity instanceof SpiderEntity) {
        path = "textures/entity/spider_eyes.png";
    } else if (entity instanceof PhantomEntity) {
        path = "textures/entity/phantom_eyes.png";
    }
    Identifier vanilla = new Identifier(path);
    UUID id = entity.getUuid();
    try {
        if (!Texture_OptifineOrTrueRandom.containsKey(path)) {
            ETF_processNewRandomTextureCandidate(path);
        }
        if (Texture_OptifineOrTrueRandom.containsKey(path)) {
            // if needs to check if change required
            if (UUID_entityAwaitingDataClearing2.containsKey(id)) {
                if (UUID_randomTextureSuffix2.containsKey(id)) {
                    if (!hasUpdatableRandomCases2.containsKey(id)) {
                        hasUpdatableRandomCases2.put(id, true);
                    }
                    if (hasUpdatableRandomCases2.get(id)) {
                        // UUID_entityAwaitingDataClearing.put(id, UUID_entityAwaitingDataClearing.get(id)+1);
                        if (UUID_entityAwaitingDataClearing2.get(id) + 100 < System.currentTimeMillis()) {
                            if (Texture_OptifineOrTrueRandom.get(path)) {
                                // if (UUID_randomTextureSuffix.containsKey(id)) {
                                int hold = UUID_randomTextureSuffix2.get(id);
                                ETF_resetSingleData(id);
                                ETF_testCases(path, id, entity, true, UUID_randomTextureSuffix2, hasUpdatableRandomCases2);
                                // if didnt change keep the same
                                if (!UUID_randomTextureSuffix2.containsKey(id)) {
                                    UUID_randomTextureSuffix2.put(id, hold);
                                }
                            // }
                            }
                            // else here would do something for true random but no need really - may optimise this
                            UUID_entityAwaitingDataClearing2.remove(id);
                        }
                    } else {
                        UUID_entityAwaitingDataClearing2.remove(id);
                    }
                }
            }
            if (Texture_OptifineOrTrueRandom.get(path)) {
                // if it doesn't have a random already assign one
                if (!UUID_randomTextureSuffix2.containsKey(id)) {
                    ETF_testCases(path, id, entity, false, UUID_randomTextureSuffix2, hasUpdatableRandomCases2);
                    // if all failed set to vanilla
                    if (!UUID_randomTextureSuffix2.containsKey(id)) {
                        UUID_randomTextureSuffix2.put(id, 0);
                    }
                    UUID_entityAlreadyCalculated.add(id);
                }
                // System.out.println("suffix was ="+UUID_randomTextureSuffix.get(id));
                if (UUID_randomTextureSuffix2.get(id) == 0) {
                    if (!TEXTURE_HasOptifineDefaultReplacement.containsKey(vanilla.toString())) {
                        TEXTURE_HasOptifineDefaultReplacement.put(vanilla.toString(), ETF_isExistingFile(ETF_returnOptifineOrVanillaIdentifier(path)));
                    }
                    if (TEXTURE_HasOptifineDefaultReplacement.get(vanilla.toString())) {
                        return ETF_returnBlinkIdOrGiven(entity, ETF_returnOptifineOrVanillaIdentifier(path).toString(), id);
                    } else {
                        return ETF_returnBlinkIdOrGiven(entity, vanilla.toString(), id);
                    }
                } else {
                    return ETF_returnBlinkIdOrGiven(entity, ETF_returnOptifineOrVanillaIdentifier(path, UUID_randomTextureSuffix2.get(id)).toString(), id);
                }
            } else {
                // true random assign
                hasUpdatableRandomCases2.put(id, false);
                if (Texture_TotalTrueRandom.get(path) > 0) {
                    if (!UUID_randomTextureSuffix2.containsKey(id)) {
                        int randomReliable = Math.abs(id.hashCode());
                        randomReliable %= Texture_TotalTrueRandom.get(path);
                        randomReliable++;
                        if (randomReliable == 1 && ignoreOnePNG.get(path)) {
                            randomReliable = 0;
                        }
                        UUID_randomTextureSuffix2.put(id, randomReliable);
                        UUID_entityAlreadyCalculated.add(id);
                    }
                    if (UUID_randomTextureSuffix2.get(id) == 0) {
                        return ETF_returnBlinkIdOrGiven(entity, vanilla.toString(), id);
                    } else {
                        return ETF_returnBlinkIdOrGiven(entity, ETF_returnOptifineOrVanillaPath(path, UUID_randomTextureSuffix2.get(id), ""), id);
                    }
                } else {
                    return ETF_returnBlinkIdOrGiven(entity, vanilla.toString(), id);
                }
            }
        } else {
            ETF_modMessage("not random", false);
            return ETF_returnBlinkIdOrGiven(entity, vanilla.toString(), id);
        }
    } catch (Exception e) {
        ETF_modMessage(e.toString(), false);
        return ETF_returnBlinkIdOrGiven(entity, vanilla.toString(), id);
    }
}
Also used : PhantomEntity(net.minecraft.entity.mob.PhantomEntity) Identifier(net.minecraft.util.Identifier) EndermanEntity(net.minecraft.entity.mob.EndermanEntity) SpiderEntity(net.minecraft.entity.mob.SpiderEntity) UUID(java.util.UUID)

Aggregations

UUID (java.util.UUID)1 EndermanEntity (net.minecraft.entity.mob.EndermanEntity)1 PhantomEntity (net.minecraft.entity.mob.PhantomEntity)1 SpiderEntity (net.minecraft.entity.mob.SpiderEntity)1 Identifier (net.minecraft.util.Identifier)1