pick 97420a31d The big reformat of 2020

This commit is contained in:
yueh
2020-06-16 21:41:28 +02:00
parent 5304b3febe
commit 5225ea426b
2252 changed files with 95466 additions and 118582 deletions
@@ -1,10 +1,10 @@
package appeng.client.render.tesr;
import appeng.block.storage.DriveSlotState;
import appeng.client.render.FacingToRotation;
import appeng.tile.storage.TileDrive;
import java.util.EnumMap;
import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.vertex.IVertexBuilder;
import net.minecraft.client.renderer.*;
import net.minecraft.client.renderer.tileentity.TileEntityRenderer;
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
@@ -13,7 +13,9 @@ import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.fml.common.ObfuscationReflectionHelper;
import java.util.EnumMap;
import appeng.block.storage.DriveSlotState;
import appeng.client.render.FacingToRotation;
import appeng.tile.storage.TileDrive;
/**
* Renders the drive cell status indicators.
@@ -34,52 +36,37 @@ public class DriveLedTileEntityRenderer extends TileEntityRenderer<TileDrive> {
STATE_COLORS.put(DriveSlotState.FULL, new Vector3f(1, 0, 0));
}
private static final float L = 14/16.f; // left (x-axis)
private static final float R = 13/16.f; // right (x-axis)
private static final float T = 14/16.f; // top (x-axis)
private static final float B = 12.999f/16.f; // bottom (x-axis)
private static final float FR = 0.4f/16.f; // front (z-axis)
private static final float BA = 1/16.f; // back (z-axis)
private static final float L = 14 / 16.f; // left (x-axis)
private static final float R = 13 / 16.f; // right (x-axis)
private static final float T = 14 / 16.f; // top (x-axis)
private static final float B = 12.999f / 16.f; // bottom (x-axis)
private static final float FR = 0.4f / 16.f; // front (z-axis)
private static final float BA = 1 / 16.f; // back (z-axis)
// Vertex data for the LED cuboid (has no back)
// Directions are when looking from the front onto the LED
private static final float[] LED_QUADS = {
// Front Face
R, T, FR,
L, T, FR,
L, B, FR,
R, B, FR,
R, T, FR, L, T, FR, L, B, FR, R, B, FR,
// Left Face
L, T, FR,
L, T, BA,
L, B, BA,
L, B, FR,
L, T, FR, L, T, BA, L, B, BA, L, B, FR,
// Right Face
R, T, BA,
R, T, FR,
R, B, FR,
R, B, BA,
R, T, BA, R, T, FR, R, B, FR, R, B, BA,
// Top Face
R, T, BA,
L, T, BA,
L, T, FR,
R, T, FR,
R, T, BA, L, T, BA, L, T, FR, R, T, FR,
// Bottom Face
R, B, FR,
L, B, FR,
L, B, BA,
R, B, BA,
};
R, B, FR, L, B, FR, L, B, BA, R, B, BA, };
private static final RenderType STATE = RenderType.makeType("ae_drive_leds", DefaultVertexFormats.POSITION_COLOR, 7, 32565, false, true, RenderType.State.getBuilder()
.build(false));
private static final RenderType STATE = RenderType.makeType("ae_drive_leds", DefaultVertexFormats.POSITION_COLOR, 7,
32565, false, true, RenderType.State.getBuilder().build(false));
public DriveLedTileEntityRenderer(TileEntityRendererDispatcher rendererDispatcherIn) {
super(rendererDispatcherIn);
}
@Override
public void render(TileDrive drive, float partialTicks, MatrixStack ms, IRenderTypeBuffer buffers, int combinedLightIn, int combinedOverlayIn) {
public void render(TileDrive drive, float partialTicks, MatrixStack ms, IRenderTypeBuffer buffers,
int combinedLightIn, int combinedOverlayIn) {
if (drive.getCellCount() != 10) {
throw new IllegalStateException("Expected drive to have 10 slots");
@@ -90,10 +77,10 @@ public class DriveLedTileEntityRenderer extends TileEntityRenderer<TileDrive> {
FacingToRotation.get(drive.getForward(), drive.getUp()).push(ms);
ms.translate(-0.5, -0.5, -0.5);
RenderState.TransparencyState TRANSLUCENT_TRANSPARENCY = ObfuscationReflectionHelper.getPrivateValue(RenderState.class, null, "field_228515_g_");
RenderType rt =RenderType.makeType("ae_drive_leds", DefaultVertexFormats.POSITION_COLOR, 7, 32565, false, true, RenderType.State.getBuilder()
.transparency(TRANSLUCENT_TRANSPARENCY)
.build(false));
RenderState.TransparencyState TRANSLUCENT_TRANSPARENCY = ObfuscationReflectionHelper
.getPrivateValue(RenderState.class, null, "field_228515_g_");
RenderType rt = RenderType.makeType("ae_drive_leds", DefaultVertexFormats.POSITION_COLOR, 7, 32565, false, true,
RenderType.State.getBuilder().transparency(TRANSLUCENT_TRANSPARENCY).build(false));
IVertexBuilder buffer = buffers.getBuffer(STATE);
for (int row = 0; row < 5; row++) {
@@ -106,7 +93,8 @@ public class DriveLedTileEntityRenderer extends TileEntityRenderer<TileDrive> {
ms.push();
// Position this drive model copy at the correct slot. The transform is based on the
// Position this drive model copy at the correct slot. The transform is based on
// the
// cell-model being in slot 0,0 at the top left of the drive.
float xOffset = -col * 7 / 16.0f;
float yOffset = -row * 3 / 16.0f;
@@ -114,9 +102,10 @@ public class DriveLedTileEntityRenderer extends TileEntityRenderer<TileDrive> {
for (int i = 0; i < LED_QUADS.length; i += 3) {
float x = LED_QUADS[i];
float y = LED_QUADS[i+1];
float z = LED_QUADS[i+2];
buffer.pos(ms.getLast().getMatrix(), x, y, z).color(color.getX(), color.getY(), color.getZ(), 1.f).endVertex();
float y = LED_QUADS[i + 1];
float z = LED_QUADS[i + 2];
buffer.pos(ms.getLast().getMatrix(), x, y, z).color(color.getX(), color.getY(), color.getZ(), 1.f)
.endVertex();
}
ms.pop();