use of net.minecraft.entity.mob.SpiderEntity 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);
}
}
use of net.minecraft.entity.mob.SpiderEntity in project RPG-Hud by KurodaAkira.
the class HudElementEntityInspectVanilla method drawEntityOnScreen.
public static void drawEntityOnScreen(int posX, int posY, LivingEntity entity) {
int scale = 1;
int s1 = (int) (18 / entity.getHeight());
int s3 = (int) (18 / entity.getScaleFactor());
int offset = 0;
if (s1 > s3) {
scale = s3;
} else
scale = s1;
if (entity instanceof SquidEntity) {
scale = 11;
offset = -13;
} else if (entity instanceof SpiderEntity) {
scale = 11;
offset = -5;
}
posY += offset;
float f = (float) Math.atan((180 / 40.0F));
float g = (float) Math.atan((0 / 40.0F));
MatrixStack ms = RenderSystem.getModelViewStack();
ms.push();
ms.translate(posX, posY, 1050.0F);
ms.scale(1.0F, 1.0F, -1.0F);
RenderSystem.applyModelViewMatrix();
MatrixStack matrixStack = new MatrixStack();
matrixStack.translate(0.0D, 0.0D, 1000.0D);
matrixStack.scale(scale, scale, scale);
Quaternion quaternion = Vec3f.POSITIVE_Z.getDegreesQuaternion(180.0F);
Quaternion quaternion2 = Vec3f.POSITIVE_X.getDegreesQuaternion(g * 20.0F);
quaternion.hamiltonProduct(quaternion2);
matrixStack.multiply(quaternion);
float h = entity.bodyYaw;
float i = entity.getYaw();
float j = entity.getPitch();
float k = entity.prevHeadYaw;
float l = entity.headYaw;
entity.bodyYaw = 180.0F + f * 20.0F;
entity.setYaw(180.0F + f * 40.0F);
entity.setPitch(-g * 20.0F);
entity.headYaw = entity.getYaw();
entity.prevHeadYaw = entity.getYaw();
DiffuseLighting.method_34742();
EntityRenderDispatcher entityRenderDispatcher = MinecraftClient.getInstance().getEntityRenderDispatcher();
quaternion2.conjugate();
entityRenderDispatcher.setRotation(quaternion2);
entityRenderDispatcher.setRenderShadows(false);
VertexConsumerProvider.Immediate immediate = MinecraftClient.getInstance().getBufferBuilders().getEntityVertexConsumers();
entityRenderDispatcher.render(entity, 0.0D, 0.0D, 0.0D, 0.0F, 1.0F, matrixStack, immediate, 15728880);
immediate.draw();
entityRenderDispatcher.setRenderShadows(true);
entity.bodyYaw = h;
entity.setYaw(i);
entity.setPitch(j);
entity.prevHeadYaw = k;
entity.headYaw = l;
ms.pop();
RenderSystem.applyModelViewMatrix();
DiffuseLighting.enableGuiDepthLighting();
}
Aggregations