XHG78999 发表于 2022-8-1 16:04:28

方块熊孩子MTR 发表于 2022-8-1 15:57
众所周知数字分正和负,所以我建议你把-114514也加上

行,这个怎么样
package com.xhg78999.mtrfac.render;

import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.blaze3d.vertex.VertexConsumer;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.resources.ResourceLocation;

import java.util.*;

// Render!Vertex!Textures!Aaaaaaaaaaaaaaaaaaaaa I crashed! :(

public class LineRender{
    private final PoseStack pose;
    private final MultiBufferSource source;
    private static final Map<String, RenderType> CACHE_A = new HashMap<>();
    private static final Map<ResourceLocation, RenderType> CACHE_B = new HashMap<>();


    public void renderLine(float x1, float y1, float z1, float x2, float y2, float z2){
      if(x1 == x2 && y1 == y2 && z1 == z2){
            return;
      }
      if((x1 == 114514 && z1 == 114514) || (x1 == -114514 && z1 == -114514)){
            System.out.printIn("Looks like you put it in a henhenaaaaaaa pos. Oh, Homo is everywhere! :)");
      }
      pose.pushPose();
                final int newLight = convertLight(6);
                final VertexConsumer vertexs = source.getBuffer(getRenderLayer("mtrfac:textures/custom_render/lines.png", newLight, false));
                final float lineHeightSmall = (y2 - y1);
                this.draw(pose, source, x1, y1 + lineHeightSmall * i, z1, x2, y1 + lineHeightSmall * (i + 1), z2, facing, 0xFF000000, newLight);
                pose.popPose();
    }

    private RenderType getLayers(String texture, int light) {
                return light == MAX_LIGHT_GLOWING ? this.getLightTexture(new ResourceLocation(texture)) : this.getTexture(new ResourceLocation(texture));
        }

    private RenderType getLightTexture(ResourceLocation texture) {
                return this.cache(texture.toString() + false, () -> beaconBeam(texture, false), CACHE_A);
        }

    private RenderType getTexture(ResourceLocation texture) {
                return this.cache(texture, () -> entityCutout(texture), CACHE_B);
        }

    private static <T> RenderType cache(T identifier, Supplier<RenderType> supplier, Map<T, RenderType> cache) {
                if (cache.containsKey(identifier)) {
                        return cache.get(identifier);
                } else {
                        final RenderType renderLayer = supplier.get();
                        cache.put(identifier, renderLayer);
                        return renderLayer;
                }
        }
}

qingqing 发表于 2022-8-1 17:13:27

让我看看

qingqing 发表于 2022-8-1 17:13:48

qingqing 发表于 2022-8-1 17:13
让我看看

没看懂

轩轩JYX 发表于 2022-8-1 19:10:20

心态崩了,看不懂:(:(:(

XHG78999 发表于 2022-8-1 19:19:24

轩轩JYX 发表于 2022-8-1 19:10
心态崩了,看不懂

没事,不学java看不懂的
你看看置顶的楼罢

Max温焰 发表于 2022-8-1 20:15:03

woc大佬

XHG78999 发表于 2022-8-2 10:19:51

Max温焰 发表于 2022-8-1 20:15
woc大佬

接触网模型都做好了,代码也写好了,™神奇Gradle编译了16个小时一直卡在root project,我的[数据删除]又坏掉了,心态™崩了啊,册那

XHG78999 发表于 2022-8-2 10:21:15

森哥_DKZ4 发表于 2022-8-1 13:35
homo特有的回复才能看后半段(悲)

铁迷都是homo(暴论
然而罗生都是homo,铁圈真的homo无处不在(悲

哄哄 发表于 2022-8-2 10:35:47

让我康康(喜)

-DKZ4- 发表于 2022-8-2 11:05:21

XHG78999 发表于 2022-8-2 10:21
铁迷都是homo(暴论
然而罗生都是homo,铁圈真的homo无处不在(悲

干脆改名叫HOMOBBS罢(悲)
页: 1 [2] 3 4 5 6 7 8 9 10 11
查看完整版本: homo特有的渲染(确信