Compare commits

..

2 Commits

Author SHA1 Message Date
81722152da Improve BER
All checks were successful
EnergonRelics/pipeline/head This commit looks good
2020-07-31 13:13:55 -04:00
17df481428 Add New Textures 2020-07-30 23:20:57 -04:00
21 changed files with 265 additions and 17 deletions

View File

@ -8,6 +8,7 @@ import net.minecraft.block.BlockState;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.render.RenderLayer;
import net.minecraft.client.render.RenderPhase;
import net.minecraft.client.render.VertexConsumer;
import net.minecraft.client.render.VertexConsumerProvider;
import net.minecraft.client.render.VertexFormats;
@ -16,6 +17,7 @@ import net.minecraft.client.render.block.entity.BlockEntityRenderer;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.item.ItemStack;
import net.minecraft.util.Hand;
import net.minecraft.util.Identifier;
import net.minecraft.util.math.Direction;
import net.minecraft.util.math.Matrix4f;
@ -26,11 +28,12 @@ public class HighlightBlockEntityRenderer extends BlockEntityRenderer<BlockEntit
super(dispatcher);
}
private static RenderLayer getLayer() {
return RenderLayer.of("energonrelics_highlight", VertexFormats.POSITION_COLOR, 7, 256, false, true, RenderLayer.MultiPhaseParameters.builder().transparency(RenderPhaseAccessor.getTRANSLUCENT_TRANSPARENCY()).layering(RenderPhaseAccessor.getVIEW_OFFSET_Z_LAYERING()).build(false));
private static RenderLayer getLayer(Identifier texture) {
return RenderLayer.of("energonrelics_highlight", VertexFormats.POSITION_COLOR, 7, 256, false, true, RenderLayer.MultiPhaseParameters.builder().transparency(RenderPhaseAccessor.getTRANSLUCENT_TRANSPARENCY()).layering(RenderPhaseAccessor.getVIEW_OFFSET_Z_LAYERING()).texture(new RenderPhase.Texture(texture, false, false)).fog(RenderPhaseAccessor.getNO_FOG()).target(RenderPhaseAccessor.getITEM_TARGET()).build(false));
}
private static final RenderLayer LAYER = getLayer();
private static final RenderLayer SELECTED_LAYER = getLayer(new Identifier(EnergonRelics.NAMESPACE, "textures/entity/selected_energy_block.png"));
private static final RenderLayer UNSELECTED_LAYER = getLayer(new Identifier(EnergonRelics.NAMESPACE, "textures/entity/unselected_energy_block.png"));
@Override
public void render(BlockEntity entity, float tickDelta, MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, int overlay) {
@ -43,22 +46,22 @@ public class HighlightBlockEntityRenderer extends BlockEntityRenderer<BlockEntit
boolean contains = ((EnergyReceiverBlockEntity) entity).contains(EnergonRelics.NETWORK_CHIP_ITEM.getID(stack));
Matrix4f matrix4f = matrices.peek().getModel();
if (!contains) {
renderLayer(entity, matrix4f, vertexConsumers.getBuffer(LAYER), 1.0f, 0.0f);
renderLayer(entity, matrix4f, vertexConsumers.getBuffer(UNSELECTED_LAYER));
} else {
renderLayer(entity, matrix4f, vertexConsumers.getBuffer(LAYER), 0.0f, 1.0f);
renderLayer(entity, matrix4f, vertexConsumers.getBuffer(SELECTED_LAYER));
}
}
}
matrices.pop();
}
private void renderLayer(BlockEntity entity, Matrix4f matrix4f, VertexConsumer vertexConsumer, float r, float b) {
renderSide(entity, matrix4f, vertexConsumer, 0f, 1f, 0f, 1f, 1f, 1f, 1f, 1f, r, b, Direction.SOUTH);
renderSide(entity, matrix4f, vertexConsumer, 0f, 1f, 1f, 0f, 0f, 0f, 0f, 0f, r, b, Direction.NORTH);
renderSide(entity, matrix4f, vertexConsumer, 1f, 1f, 1f, 0f, 0f, 1f, 1f, 0f, r, b, Direction.EAST);
renderSide(entity, matrix4f, vertexConsumer, 0f, 0f, 0f, 1f, 0f, 1f, 1f, 0f, r, b, Direction.WEST);
renderSide(entity, matrix4f, vertexConsumer, 0f, 1f, 0f, 0f, 0f, 0f, 1f, 1f, r, b, Direction.DOWN);
renderSide(entity, matrix4f, vertexConsumer, 0f, 1f, 1.0f, 1.0f, 1f, 1f, 0f, 0f, r, b, Direction.UP);
private void renderLayer(BlockEntity entity, Matrix4f matrix4f, VertexConsumer vertexConsumer) {
renderSide(entity, matrix4f, vertexConsumer, 0f, 1f, 0f, 1f, 1f, 1f, 1f, 1f, Direction.SOUTH);
renderSide(entity, matrix4f, vertexConsumer, 0f, 1f, 1f, 0f, 0f, 0f, 0f, 0f, Direction.NORTH);
renderSide(entity, matrix4f, vertexConsumer, 1f, 1f, 1f, 0f, 0f, 1f, 1f, 0f, Direction.EAST);
renderSide(entity, matrix4f, vertexConsumer, 0f, 0f, 0f, 1f, 0f, 1f, 1f, 0f, Direction.WEST);
renderSide(entity, matrix4f, vertexConsumer, 0f, 1f, 0f, 0f, 0f, 0f, 1f, 1f, Direction.DOWN);
renderSide(entity, matrix4f, vertexConsumer, 0f, 1f, 1.0f, 1.0f, 1f, 1f, 0f, 0f, Direction.UP);
}
private boolean shouldDrawSide(BlockEntity entity, Direction side) {
@ -66,12 +69,12 @@ public class HighlightBlockEntityRenderer extends BlockEntityRenderer<BlockEntit
return Block.shouldDrawSide(state, Objects.requireNonNull(entity.getWorld()), entity.getPos(), side);
}
private void renderSide(BlockEntity entity, Matrix4f matrix4f, VertexConsumer vertexConsumer, float f, float g, float h, float i, float j, float k, float l, float m, float n, float p, Direction side) {
private void renderSide(BlockEntity entity, Matrix4f matrix4f, VertexConsumer vertexConsumer, float f, float g, float h, float i, float j, float k, float l, float m, Direction side) {
if (shouldDrawSide(entity, side)) {
vertexConsumer.vertex(matrix4f, f, h, j).color(n, (float) 0.0, p, 0.2f).next();
vertexConsumer.vertex(matrix4f, g, h, k).color(n, (float) 0.0, p, 0.2f).next();
vertexConsumer.vertex(matrix4f, g, i, l).color(n, (float) 0.0, p, 0.2f).next();
vertexConsumer.vertex(matrix4f, f, i, m).color(n, (float) 0.0, p, 0.2f).next();
vertexConsumer.vertex(matrix4f, f, h, j).color(1f, 1f, 1f, 1f).next();
vertexConsumer.vertex(matrix4f, g, h, k).color(1f, 1f, 1f, 1f).next();
vertexConsumer.vertex(matrix4f, g, i, l).color(1f, 1f, 1f, 1f).next();
vertexConsumer.vertex(matrix4f, f, i, m).color(1f, 1f, 1f, 1f).next();
}
}
}

View File

@ -15,4 +15,14 @@ public interface RenderPhaseAccessor {
static RenderPhase.Layering getVIEW_OFFSET_Z_LAYERING() {
throw new UnsupportedOperationException();
}
@Accessor
static RenderPhase.Fog getNO_FOG() {
throw new UnsupportedOperationException();
}
@Accessor
static RenderPhase.Target getITEM_TARGET() {
throw new UnsupportedOperationException();
}
}

View File

@ -0,0 +1,99 @@
{
"parent": "minecraft:block/block",
"textures": {
"0": "energonrelics:block/gold_block",
"1": "energonrelics:block/lightning_rod_base",
"particle": "energonrelics:block/gold_block"
},
"elements": [
{
"from": [5, 14, 5],
"to": [11, 16, 11],
"rotation": {"angle": 0, "axis": "y", "origin": [8, 23, 8]},
"faces": {
"north": {"uv": [5, 0, 11, 2], "texture": "#1"},
"east": {"uv": [5, 0, 11, 2], "texture": "#1"},
"south": {"uv": [5, 0, 11, 2], "texture": "#1"},
"west": {"uv": [5, 0, 11, 2], "texture": "#1"},
"up": {"uv": [0, 0, 6, 6], "texture": "#1"},
"down": {"uv": [5, 5, 11, 11], "texture": "#1"}
}
},
{
"from": [0, 0, 0],
"to": [16, 4, 16],
"faces": {
"north": {"uv": [0, 7, 16, 11], "texture": "#1"},
"east": {"uv": [0, 7, 16, 11], "texture": "#1"},
"south": {"uv": [0, 7, 16, 11], "texture": "#1"},
"west": {"uv": [0, 7, 16, 11], "texture": "#1"},
"up": {"uv": [0, 0, 16, 16], "texture": "#1"},
"down": {"uv": [0, 0, 16, 16], "texture": "#1"}
}
},
{
"from": [0, 6, 0],
"to": [16, 10, 16],
"rotation": {"angle": 0, "axis": "y", "origin": [8, 14, 8]},
"faces": {
"north": {"uv": [0, 3, 16, 7], "texture": "#1"},
"east": {"uv": [0, 3, 16, 7], "texture": "#1"},
"south": {"uv": [0, 3, 16, 7], "texture": "#1"},
"west": {"uv": [0, 3, 16, 7], "texture": "#1"},
"up": {"uv": [0, 0, 16, 16], "texture": "#1"},
"down": {"uv": [0, 0, 16, 16], "texture": "#1"}
}
},
{
"from": [2, 10, 2],
"to": [14, 12, 14],
"rotation": {"angle": 0, "axis": "y", "origin": [8, 18, 8]},
"faces": {
"north": {"uv": [2, 2, 14, 4], "rotation": 180, "texture": "#1"},
"east": {"uv": [4, 3, 16, 5], "texture": "#1"},
"south": {"uv": [2, 2, 14, 4], "rotation": 180, "texture": "#1"},
"west": {"uv": [4, 3, 16, 5], "texture": "#1"},
"up": {"uv": [2, 2, 14, 14], "texture": "#1"},
"down": {"uv": [0, 0, 12, 12], "texture": "#missing"}
}
},
{
"from": [6, 12, 6],
"to": [10, 14, 10],
"rotation": {"angle": 0, "axis": "y", "origin": [9, 20, 9]},
"faces": {
"north": {"uv": [5, 4, 9, 6], "texture": "#0"},
"east": {"uv": [1, 7, 5, 9], "texture": "#0"},
"south": {"uv": [4, 9, 8, 11], "texture": "#0"},
"west": {"uv": [2, 2, 6, 4], "texture": "#0"},
"up": {"uv": [2, 2, 6, 4], "texture": "#0"},
"down": {"uv": [2, 2, 6, 4], "texture": "#0"}
}
},
{
"from": [1, 4, 1],
"to": [15, 6, 15],
"rotation": {"angle": 0, "axis": "y", "origin": [9, 12, 9]},
"faces": {
"north": {"uv": [1, 3, 15, 5], "texture": "#0"},
"east": {"uv": [1, 3, 15, 5], "texture": "#0"},
"south": {"uv": [1, 3, 15, 5], "texture": "#0"},
"west": {"uv": [1, 3, 15, 5], "texture": "#0"},
"up": {"uv": [1, 4, 15, 6], "texture": "#0"},
"down": {"uv": [1, 4, 15, 6], "texture": "#0"}
}
}
],
"groups": [
{
"name": "blackstone body",
"origin": [8, 18, 8],
"children": [0, 1, 2, 3]
},
{
"name": "gold",
"origin": [9, 12, 9],
"children": [4, 5]
}
]
}

View File

@ -0,0 +1,22 @@
{
"credit": "Made by Azazelthedemonlord",
"textures": {
"0": "energonrelics:block/lightning_rod",
"particle": "energonrelics:block/gold_block"
},
"elements": [
{
"from": [7, 0, 7],
"to": [9, 16, 9],
"rotation": {"angle": 0, "axis": "y", "origin": [15, 8, 15]},
"faces": {
"north": {"uv": [0, 0, 2, 16], "texture": "#0"},
"east": {"uv": [2, 0, 4, 16], "texture": "#0"},
"south": {"uv": [0, 0, 2, 16], "texture": "#0"},
"west": {"uv": [2, 0, 4, 16], "texture": "#0"},
"up": {"uv": [4, 0, 6, 2], "texture": "#0"},
"down": {"uv": [4, 2, 6, 4], "texture": "#0"}
}
}
]
}

View File

@ -0,0 +1,114 @@
{
"parent": "minecraft:block/block",
"textures": {
"0": "energonrelics:block/lightning_rod",
"1": "energonrelics:block/lightning_rod_base",
"particle": "energonrelics:block/gold_block"
},
"elements": [
{
"from": [7, 0, 7],
"to": [9, 14, 9],
"rotation": {"angle": 0, "axis": "y", "origin": [15, 8, 15]},
"faces": {
"north": {"uv": [0, 0, 2, 14], "texture": "#0"},
"east": {"uv": [2, 1, 4, 15], "texture": "#0"},
"south": {"uv": [0, 0, 2, 14], "texture": "#0"},
"west": {"uv": [2, 1, 4, 15], "texture": "#0"},
"up": {"uv": [4, 0, 6, 2], "texture": "#0"},
"down": {"uv": [4, 2, 6, 4], "texture": "#0"}
}
},
{
"from": [6, 10, 6],
"to": [10, 13, 10],
"rotation": {"angle": 0, "axis": "y", "origin": [14, 20, 17]},
"faces": {
"north": {"uv": [8, 9, 12, 12], "texture": "#1"},
"east": {"uv": [10, 7, 14, 10], "texture": "#1"},
"south": {"uv": [4, 4, 8, 7], "texture": "#1"},
"west": {"uv": [5, 3, 9, 6], "rotation": 180, "texture": "#1"},
"up": {"uv": [2, 2, 6, 6], "texture": "#1"},
"down": {"uv": [9, 4, 13, 8], "texture": "#1"}
}
},
{
"from": [7, 11, 5],
"to": [9, 12, 11],
"rotation": {"angle": 0, "axis": "y", "origin": [15, 19, 20]},
"faces": {
"north": {"uv": [0, 0, 2, 1], "texture": "#missing"},
"east": {"uv": [1, 7, 2, 13], "rotation": 270, "texture": "#0"},
"south": {"uv": [0, 0, 2, 1], "texture": "#missing"},
"west": {"uv": [1, 7, 2, 13], "rotation": 270, "texture": "#0"},
"up": {"uv": [1, 2, 3, 8], "texture": "#0"},
"down": {"uv": [1, 8, 3, 14], "texture": "#0"}
}
},
{
"from": [11, 9, 7],
"to": [12, 15, 9],
"rotation": {"angle": 0, "axis": "y", "origin": [19, 18, 20]},
"faces": {
"north": {"uv": [0, 1, 1, 7], "texture": "#0"},
"east": {"uv": [1, 1, 3, 7], "texture": "#0"},
"south": {"uv": [1, 3, 2, 9], "texture": "#0"},
"west": {"uv": [1, 1, 3, 7], "texture": "#0"},
"up": {"uv": [1, 1, 2, 3], "texture": "#0"},
"down": {"uv": [1, 1, 2, 3], "texture": "#0"}
}
},
{
"from": [4, 9, 7],
"to": [5, 15, 9],
"rotation": {"angle": 0, "axis": "y", "origin": [12, 18, 20]},
"faces": {
"north": {"uv": [0, 9, 1, 15], "texture": "#0"},
"east": {"uv": [1, 6, 3, 12], "texture": "#0"},
"south": {"uv": [2, 7, 3, 13], "texture": "#0"},
"west": {"uv": [1, 6, 3, 12], "texture": "#0"},
"up": {"uv": [1, 6, 2, 8], "texture": "#0"},
"down": {"uv": [2, 6, 3, 8], "texture": "#0"}
}
},
{
"from": [7, 9, 4],
"to": [9, 15, 5],
"rotation": {"angle": 0, "axis": "y", "origin": [15, 18, 16]},
"faces": {
"north": {"uv": [2, 4, 4, 10], "texture": "#0"},
"east": {"uv": [3, 4, 4, 10], "texture": "#0"},
"south": {"uv": [2, 4, 4, 10], "texture": "#0"},
"west": {"uv": [2, 4, 3, 10], "texture": "#0"},
"up": {"uv": [2, 4, 4, 5], "texture": "#0"},
"down": {"uv": [0, 6, 2, 7], "texture": "#0"}
}
},
{
"from": [7, 9, 11],
"to": [9, 15, 12],
"rotation": {"angle": 0, "axis": "y", "origin": [15, 18, 23]},
"faces": {
"north": {"uv": [1, 4, 3, 10], "texture": "#0"},
"east": {"uv": [2, 6, 3, 12], "texture": "#0"},
"south": {"uv": [1, 4, 3, 10], "texture": "#0"},
"west": {"uv": [2, 7, 3, 13], "texture": "#0"},
"up": {"uv": [1, 4, 3, 5], "texture": "#0"},
"down": {"uv": [1, 4, 3, 5], "texture": "#0"}
}
},
{
"from": [5, 11, 7],
"to": [11, 12, 9],
"rotation": {"angle": 0, "axis": "y", "origin": [15, 19, 20]},
"faces": {
"north": {"uv": [1, 6, 2, 12], "rotation": 90, "texture": "#0"},
"east": {"uv": [2, 5, 4, 11], "rotation": 90, "texture": "#0"},
"south": {"uv": [3, 5, 4, 11], "rotation": 90, "texture": "#0"},
"west": {"uv": [2, 5, 4, 11], "rotation": 90, "texture": "#0"},
"up": {"uv": [2, 5, 4, 11], "rotation": 90, "texture": "#0"},
"down": {"uv": [1, 5, 3, 11], "rotation": 90, "texture": "#0"}
}
}
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 499 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 552 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 416 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 586 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 569 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 565 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 544 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 264 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 483 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 526 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 518 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 543 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 529 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 490 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 490 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB