Open NOBTG opened 9 months ago
感谢提供,帮大忙了 😍
不客气! (其实我也在做1.20的无尽渲染qwq)
如果之后有新进展会通过这个板块说的,保证开源!
Check Avaritia Universal for 1.17.1, there is a cosmic render there
第二版本!优化更多更整齐! 懒得git[doge] https://drive.google.com/file/d/1DCOxCjhoDH3OiGXYsMhDVbsJs5Fi3XVT/view?usp=sharing
对了,也许之后我可以帮你搞Rainbow Eyes Renderer and Cosmic Armor Renderer,还有珍珠的圆形model
Entity这边我还挺可以的
假设以后你做好了Cosmic Renderer,我可以拿来用吗(在我的mod)?
随意啦
azzzz,谢谢哈!
比较粗暴的实现: `import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.blaze3d.vertex.VertexConsumer; import net.minecraft.client.Minecraft; import net.minecraft.client.model.HumanoidModel; import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.RenderType; import net.minecraft.client.renderer.entity.RenderLayerParent; import net.minecraft.client.renderer.entity.layers.RenderLayer; import net.minecraft.client.renderer.texture.OverlayTexture; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.entity.LivingEntity; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; import org.jetbrains.annotations.NotNull;
@OnlyIn(Dist.CLIENT)
public class ArmorInfinityLayer extends RenderLayer<LivingEntity, HumanoidModel
public ArmorInfinityLayer(RenderLayerParent<LivingEntity, HumanoidModel<LivingEntity>> pRenderer) {
super(pRenderer);
}
{
new Thread(() -> {
while (Minecraft.getInstance().isRunning()) {
ArmorInfinityLayer.tick += 1.6f;
ArmorInfinityLayer.tick = ArmorInfinityLayer.tick >= 720.0f ? 0.0F : ArmorInfinityLayer.tick;
synchronized (this) {
try {
this.wait(50);
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
}
}
}).start();
}
public void render(@NotNull PoseStack poseStack, @NotNull MultiBufferSource multiBufferSource, int i, @NotNull LivingEntity livingEntity, float v, float v1, float v2, float v3, float v4, float v5) {
VertexConsumer vertex2 = multiBufferSource.getBuffer(RenderType.entityCutout(eyeTex));
if (true) {
poseStack.pushPose();
getParentModel().hat.render(poseStack, vertex2, i, OverlayTexture.NO_OVERLAY, getCurrentRainbowColor()[0], getCurrentRainbowColor()[1], getCurrentRainbowColor()[2], 1.0F);
poseStack.popPose();
}
}
private static float[] getCurrentRainbowColor() {
float val = ArmorInfinityLayer.tick % 720.0f;
int color = HsvToRgb((val >= 360.0f ? 720.0f - val : val) / 100.0F, 0.8f, 0.8f);
return new float[]{color >> 16 & 255, color >> 8 & 255, color & 255};
}
} ` 还是建议放在Tick Update
Avaritia Render : ITextureAtlasSpriteLoader
And RegisterTextureAtlasSpriteLoadersEvent
And RegisterTextureAtlasSpriteLoadersEvent
已完成部分渲染
so cool
emm,稍微看了一下,简单来说,不好說 (除了你写的)。
因为CCLib需要很多功能,所以会添加很多Class,那很多方法是你用不到,也不需要的。
加载如此多的Class只会放慢游戏加载速度罢了,所以我替你大概整理了一下几个需要用的,(我只弄了Cosmic)。
这边处理的方法是把未使用的方法先删除一遍,然后删除未使用的Class,循环,直到无法再删(所有方法跟Class都有被调用),但是注意循环调用(TransformList那个),那个要判断完再删除。
加油!
我只有写无尽剑 :)
@NOBTG 末影珍珠爆炸渲染用的是obj,有些不能删的
还有,并不是渲染完全还原了,我不知道哪里出了问题,导致飞行时翅膀的渲染是一个块状平面!
@NOBTG 末影珍珠爆炸渲染用的是obj,有些不能删的
OK,那可以做完再刪,我去試試看啥翅膀的
看了,是cosmic的問題
去除前:
去除後:
可以看到,去除後是沒有的
有空我再修修看。。。
另外,這個東西的作用是0,因為沒有關聯 (雖然設置了,但fsh、json沒有寫進去)
實際上:
CCShaderInstance.create(...)->new CCShaderInstance(...)->ShaderInstance.super()->
讀ResourceLocation,打開json,
ResourceLocation resourcelocation = new ResourceLocation(shaderLocation.getNamespace(), "shaders/core/" + shaderLocation.getPath() + ".json");
Reader reader = p_173336_.openAsReader(resourcelocation);
JsonObject jsonobject = GsonHelper.parse(reader);
讀uniforms,
JsonArray jsonarray2 = GsonHelper.getAsJsonArray(jsonobject, "uniforms", (JsonArray)null);
int l;
if (jsonarray2 != null) {
l = 0;
for(Iterator var31 = jsonarray2.iterator(); var31.hasNext(); ++l) {
JsonElement jsonelement2 = (JsonElement)var31.next();
try {
this.parseUniformNode(jsonelement2);
} catch (Exception var18) {
ChainedJsonException chainedjsonexception3 = ChainedJsonException.forException(var18);
chainedjsonexception3.prependJsonKey("uniforms[" + l + "]");
throw chainedjsonexception3;
}
}
}
調用回CCShaderInstance.parseUniformNode(...)
,產生CCUniform
CCUniform uniform = CCUniform.makeUniform(name, type, count, this);
uniforms.add(uniform);
而json:
和fsh:
都沒寫,所以這只是嘗試?
Checks/检查
Description/描述
由于Avaritia 1.18.2暂时没有Source Code,我自己反编译与修改了一部分代码,使其优化,此版本还是需要CodeChickenLib awa,但是也许可以做参考,无尽弓与锭还有剑都有做。
Link : https://github.com/NOBTG/1.18.2-Avaritia-Cosmic_and_Halo-Renderer
你需要在Mod主类加上:
请注意! 此代码仅供惨考与学习之用,下载后请于24小时内删除,其衍生出的任何法律作者一率不承担。