mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-11-21 23:13:28 +01:00
commit
74addcb6e0
3 changed files with 40 additions and 52 deletions
|
@ -25,6 +25,7 @@ public class RenderTypes extends RenderType {
|
||||||
.setOutputState(MAIN_TARGET)
|
.setOutputState(MAIN_TARGET)
|
||||||
.setLightmapState(RenderStateShard.LIGHTMAP)
|
.setLightmapState(RenderStateShard.LIGHTMAP)
|
||||||
.setCullState(RenderStateShard.NO_CULL)
|
.setCullState(RenderStateShard.NO_CULL)
|
||||||
.setShaderState(RenderStateShard.POSITION_COLOR_TEX_LIGHTMAP_SHADER)
|
.setShaderState(RenderStateShard.POSITION_COLOR_SHADER)
|
||||||
.createCompositeState(true));
|
.createCompositeState(true));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,7 +38,7 @@ public class ParticleBeam extends Particle {
|
||||||
RenderSystem.disableCull();
|
RenderSystem.disableCull();
|
||||||
RenderSystem.enableBlend();
|
RenderSystem.enableBlend();
|
||||||
RenderSystem.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE);
|
RenderSystem.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE);
|
||||||
return tesselator.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.PARTICLE);
|
return tesselator.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION_COLOR);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -100,7 +100,7 @@ public class ParticleBeam extends Particle {
|
||||||
|
|
||||||
public static ParticleOptions createData(double endX, double endY, double endZ, int color, float alpha,
|
public static ParticleOptions createData(double endX, double endY, double endZ, int color, float alpha,
|
||||||
int maxAge, double rotationTime, float size) {
|
int maxAge, double rotationTime, float size) {
|
||||||
return new BeamParticleData(endX, endY, endZ, color, maxAge, rotationTime, size);
|
return new BeamParticleData(endX, endY, endZ, FastColor.ARGB32.color((int)(alpha * 255F), color), maxAge, rotationTime, size);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,7 +26,6 @@ import net.minecraft.client.renderer.LightTexture;
|
||||||
import net.minecraft.client.renderer.MultiBufferSource;
|
import net.minecraft.client.renderer.MultiBufferSource;
|
||||||
import net.minecraft.client.renderer.entity.ItemRenderer;
|
import net.minecraft.client.renderer.entity.ItemRenderer;
|
||||||
import net.minecraft.client.renderer.texture.TextureAtlas;
|
import net.minecraft.client.renderer.texture.TextureAtlas;
|
||||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
|
||||||
import net.minecraft.client.renderer.texture.TextureManager;
|
import net.minecraft.client.renderer.texture.TextureManager;
|
||||||
import net.minecraft.client.resources.model.BakedModel;
|
import net.minecraft.client.resources.model.BakedModel;
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
|
@ -234,9 +233,9 @@ public final class AssetUtil {
|
||||||
int g = (color >> 8) & 0xFF;
|
int g = (color >> 8) & 0xFF;
|
||||||
int b = color & 0xFF;
|
int b = color & 0xFF;
|
||||||
int a = (int) (alpha * 255);*/
|
int a = (int) (alpha * 255);*/
|
||||||
int r = (int)(((color >> 16) & 0xFF) * alpha);
|
int r = (int)(((color >> 16) & 0xFF) * alpha * 0.4F);
|
||||||
int g = (int)(((color >> 8) & 0xFF) * alpha);
|
int g = (int)(((color >> 8) & 0xFF) * alpha * 0.4F);
|
||||||
int b = (int)((color & 0xFF) * alpha);
|
int b = (int)((color & 0xFF) * alpha * 0.4F);
|
||||||
int a = 255;
|
int a = 255;
|
||||||
|
|
||||||
int lightmap = LightTexture.pack(MAX_LIGHT_X, MAX_LIGHT_Y);
|
int lightmap = LightTexture.pack(MAX_LIGHT_X, MAX_LIGHT_Y);
|
||||||
|
@ -254,35 +253,29 @@ public final class AssetUtil {
|
||||||
|
|
||||||
Matrix4f matrix = matrixStack.last().pose();
|
Matrix4f matrix = matrixStack.last().pose();
|
||||||
|
|
||||||
TextureAtlasSprite sprite = Minecraft.getInstance().getTextureAtlas(TextureAtlas.LOCATION_BLOCKS).apply(FORGE_WHITE);
|
|
||||||
float minU = sprite.getU0();
|
|
||||||
float maxU = sprite.getU1();
|
|
||||||
float minV = sprite.getV0();
|
|
||||||
float maxV = sprite.getV1();
|
|
||||||
|
|
||||||
//Draw laser tube faces
|
//Draw laser tube faces
|
||||||
for (int i = 1; i < 4; i++) {
|
for (int i = 1; i < 4; i++) {
|
||||||
float width = beamWidth * (i / 4.0f);
|
float width = beamWidth * (i / 4.0f);
|
||||||
//top
|
//top
|
||||||
builder.addVertex(matrix, -width, width, 0.0f).setColor(r, g, b, a).setUv(minU, maxV).setLight(lightmap);
|
builder.addVertex(matrix, -width, width, 0.0f).setColor(r, g, b, a).setLight(lightmap);
|
||||||
builder.addVertex(matrix, width, width, 0.0f).setColor(r, g, b, a).setUv(maxU, maxV).setLight(lightmap);
|
builder.addVertex(matrix, width, width, 0.0f).setColor(r, g, b, a).setLight(lightmap);
|
||||||
builder.addVertex(matrix, width, width, -length).setColor(r, g, b, a).setUv(maxU, minV).setLight(lightmap);
|
builder.addVertex(matrix, width, width, -length).setColor(r, g, b, a).setLight(lightmap);
|
||||||
builder.addVertex(matrix, -width, width, -length).setColor(r, g, b, a).setUv(minU, minV).setLight(lightmap);
|
builder.addVertex(matrix, -width, width, -length).setColor(r, g, b, a).setLight(lightmap);
|
||||||
//bottom
|
//bottom
|
||||||
builder.addVertex(matrix, -width, -width, 0.0f).setColor(r, g, b, a).setUv(minU, maxV).setLight(lightmap);
|
builder.addVertex(matrix, -width, -width, 0.0f).setColor(r, g, b, a).setLight(lightmap);
|
||||||
builder.addVertex(matrix, -width, -width, -length).setColor(r, g, b, a).setUv(minU, minV).setLight(lightmap);
|
builder.addVertex(matrix, -width, -width, -length).setColor(r, g, b, a).setLight(lightmap);
|
||||||
builder.addVertex(matrix, width, -width, -length).setColor(r, g, b, a).setUv(maxU, minV).setLight(lightmap);
|
builder.addVertex(matrix, width, -width, -length).setColor(r, g, b, a).setLight(lightmap);
|
||||||
builder.addVertex(matrix, width, -width, 0.0f).setColor(r, g, b, a).setUv(maxU, maxV).setLight(lightmap);
|
builder.addVertex(matrix, width, -width, 0.0f).setColor(r, g, b, a).setLight(lightmap);
|
||||||
//left
|
//left
|
||||||
builder.addVertex(matrix, -width, width, 0.0f).setColor(r, g, b, a).setUv(maxU, maxV).setLight(lightmap);
|
builder.addVertex(matrix, -width, width, 0.0f).setColor(r, g, b, a).setLight(lightmap);
|
||||||
builder.addVertex(matrix, -width, -width, 0.0f).setColor(r, g, b, a).setUv(maxU, maxV).setLight(lightmap);
|
builder.addVertex(matrix, -width, -width, 0.0f).setColor(r, g, b, a).setLight(lightmap);
|
||||||
builder.addVertex(matrix, -width, -width, -length).setColor(r, g, b, a).setUv(minU, minV).setLight(lightmap);
|
builder.addVertex(matrix, -width, -width, -length).setColor(r, g, b, a).setLight(lightmap);
|
||||||
builder.addVertex(matrix, -width, width, -length).setColor(r, g, b, a).setUv(minU, minV).setLight(lightmap);
|
builder.addVertex(matrix, -width, width, -length).setColor(r, g, b, a).setLight(lightmap);
|
||||||
//right
|
//right
|
||||||
builder.addVertex(matrix, width, width, 0.0f).setColor(r, g, b, a).setUv(maxU, maxV).setLight(lightmap);
|
builder.addVertex(matrix, width, width, 0.0f).setColor(r, g, b, a).setLight(lightmap);
|
||||||
builder.addVertex(matrix, width, -width, 0.0f).setColor(r, g, b, a).setUv(maxU, maxV).setLight(lightmap);
|
builder.addVertex(matrix, width, -width, 0.0f).setColor(r, g, b, a).setLight(lightmap);
|
||||||
builder.addVertex(matrix, width, -width, -length).setColor(r, g, b, a).setUv(minU, minV).setLight(lightmap);
|
builder.addVertex(matrix, width, -width, -length).setColor(r, g, b, a).setLight(lightmap);
|
||||||
builder.addVertex(matrix, width, width, -length).setColor(r, g, b, a).setUv(minU, minV).setLight(lightmap);
|
builder.addVertex(matrix, width, width, -length).setColor(r, g, b, a).setLight(lightmap);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -334,37 +327,31 @@ public final class AssetUtil {
|
||||||
|
|
||||||
Matrix4f matrix = matrixStack.last().pose();
|
Matrix4f matrix = matrixStack.last().pose();
|
||||||
|
|
||||||
RenderSystem.setShader(GameRenderer::getPositionColorLightmapShader);
|
RenderSystem.setShader(GameRenderer::getPositionColorShader);
|
||||||
|
|
||||||
TextureAtlasSprite sprite = Minecraft.getInstance().getTextureAtlas(TextureAtlas.LOCATION_BLOCKS).apply(FORGE_WHITE);
|
|
||||||
float minU = sprite.getU0();
|
|
||||||
float maxU = sprite.getU1();
|
|
||||||
float minV = sprite.getV0();
|
|
||||||
float maxV = sprite.getV1();
|
|
||||||
|
|
||||||
//Draw laser tube faces
|
//Draw laser tube faces
|
||||||
for (int i = 1; i < 4; i++) {
|
for (int i = 1; i < 4; i++) {
|
||||||
float width = beamWidth * (i / 4.0f);
|
float width = beamWidth * (i / 4.0f);
|
||||||
//top
|
//top
|
||||||
builder.addVertex(matrix, -width, width, 0.0f).setColor(r, g, b, a).setUv(minU, maxV).setLight(lightmap);
|
builder.addVertex(matrix, -width, width, 0.0f).setColor(r, g, b, a);
|
||||||
builder.addVertex(matrix, width, width, 0.0f).setColor(r, g, b, a).setUv(maxU, maxV).setLight(lightmap);
|
builder.addVertex(matrix, width, width, 0.0f).setColor(r, g, b, a);
|
||||||
builder.addVertex(matrix, width, width, -length).setColor(r, g, b, a).setUv(maxU, minV).setLight(lightmap);
|
builder.addVertex(matrix, width, width, -length).setColor(r, g, b, a);
|
||||||
builder.addVertex(matrix, -width, width, -length).setColor(r, g, b, a).setUv(minU, minV).setLight(lightmap);
|
builder.addVertex(matrix, -width, width, -length).setColor(r, g, b, a);
|
||||||
//bottom
|
//bottom
|
||||||
builder.addVertex(matrix, -width, -width, 0.0f).setColor(r, g, b, a).setUv(minU, maxV).setLight(lightmap);
|
builder.addVertex(matrix, -width, -width, 0.0f).setColor(r, g, b, a);
|
||||||
builder.addVertex(matrix, -width, -width, -length).setColor(r, g, b, a).setUv(minU, minV).setLight(lightmap);
|
builder.addVertex(matrix, -width, -width, -length).setColor(r, g, b, a);
|
||||||
builder.addVertex(matrix, width, -width, -length).setColor(r, g, b, a).setUv(maxU, minV).setLight(lightmap);
|
builder.addVertex(matrix, width, -width, -length).setColor(r, g, b, a);
|
||||||
builder.addVertex(matrix, width, -width, 0.0f).setColor(r, g, b, a).setUv(maxU, maxV).setLight(lightmap);
|
builder.addVertex(matrix, width, -width, 0.0f).setColor(r, g, b, a);
|
||||||
//left
|
//left
|
||||||
builder.addVertex(matrix, -width, width, 0.0f).setColor(r, g, b, a).setUv(maxU, maxV).setLight(lightmap);
|
builder.addVertex(matrix, -width, width, 0.0f).setColor(r, g, b, a);
|
||||||
builder.addVertex(matrix, -width, -width, 0.0f).setColor(r, g, b, a).setUv(maxU, maxV).setLight(lightmap);
|
builder.addVertex(matrix, -width, -width, 0.0f).setColor(r, g, b, a);
|
||||||
builder.addVertex(matrix, -width, -width, -length).setColor(r, g, b, a).setUv(minU, minV).setLight(lightmap);
|
builder.addVertex(matrix, -width, -width, -length).setColor(r, g, b, a);
|
||||||
builder.addVertex(matrix, -width, width, -length).setColor(r, g, b, a).setUv(minU, minV).setLight(lightmap);
|
builder.addVertex(matrix, -width, width, -length).setColor(r, g, b, a);
|
||||||
//right
|
//right
|
||||||
builder.addVertex(matrix, width, width, 0.0f).setColor(r, g, b, a).setUv(maxU, maxV).setLight(lightmap);
|
builder.addVertex(matrix, width, width, 0.0f).setColor(r, g, b, a);
|
||||||
builder.addVertex(matrix, width, -width, 0.0f).setColor(r, g, b, a).setUv(maxU, maxV).setLight(lightmap);
|
builder.addVertex(matrix, width, -width, 0.0f).setColor(r, g, b, a);
|
||||||
builder.addVertex(matrix, width, -width, -length).setColor(r, g, b, a).setUv(minU, minV).setLight(lightmap);
|
builder.addVertex(matrix, width, -width, -length).setColor(r, g, b, a);
|
||||||
builder.addVertex(matrix, width, width, -length).setColor(r, g, b, a).setUv(minU, minV).setLight(lightmap);
|
builder.addVertex(matrix, width, width, -length).setColor(r, g, b, a);
|
||||||
|
|
||||||
}
|
}
|
||||||
matrixStack.popPose();
|
matrixStack.popPose();
|
||||||
|
|
Loading…
Reference in a new issue