Fix portal colors

Changes to be ommitted:
	modified:   src/main/java/org/dimdev/dimdoors/block/ModBlocks.java
	modified:   src/main/java/org/dimdev/dimdoors/client/EntranceRiftBlockEntityRenderer.java
	modified:   src/main/java/org/dimdev/dimdoors/client/MyRenderLayer.java
This commit is contained in:
SD 2020-09-26 22:36:57 +05:30
parent d1cdf9349d
commit b2a6bf46f7
No known key found for this signature in database
GPG key ID: E36B57EE08544BC5
3 changed files with 13 additions and 12 deletions

View file

@ -21,7 +21,7 @@ public final class ModBlocks {
public static final Block QUARTZ_DIMENSIONAL_DOOR = register("dimdoors:quartz_dimensional_door", new DimensionalDoorBlock(FabricBlockSettings.of(Material.STONE, MaterialColor.QUARTZ).nonOpaque()));
public static final Block OAK_DIMENSIONAL_TRAPDOOR = register("dimdoors:wood_dimensional_trapdoor", new DimensionalTrapdoorBlock(FabricBlockSettings.of(Material.WOOD, MaterialColor.WOOD).nonOpaque()));
public static final Block DIMENSIONAL_PORTAL = register("dimdoors:dimensional_portal", new DimensionalPortalBlock(FabricBlockSettings.of(Material.AIR).collidable(false).nonOpaque().dropsNothing()));
public static final Block DIMENSIONAL_PORTAL = register("dimdoors:dimensional_portal", new DimensionalPortalBlock(FabricBlockSettings.of(Material.AIR).collidable(false).nonOpaque().dropsNothing().lightLevel(10)));
public static final Block DETACHED_RIFT = register("dimdoors:detached_rift", new DetachedRiftBlock(FabricBlockSettings.of(Material.AIR).nonOpaque()));
public static final Block WHITE_FABRIC = registerFabric("dimdoors:white_fabric", DyeColor.WHITE);

View file

@ -19,6 +19,7 @@ import net.minecraft.client.render.block.entity.BlockEntityRenderer;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.client.util.math.Vector3f;
import net.minecraft.util.math.Direction;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.Matrix4f;
import net.fabricmc.api.EnvType;
@ -64,14 +65,14 @@ public class EntranceRiftBlockEntityRenderer extends BlockEntityRenderer<Entranc
private void renderVertices(EntranceRiftBlockEntity entrance, MatrixStack matrices, VertexConsumerProvider vertexConsumers, Direction orientation, Vector3f vec, List<RenderLayer> layers) {
vec.scale((float) (orientation == Direction.NORTH || orientation == Direction.WEST || orientation == Direction.UP ? 0.01 : 0.01 - 1));
double d = entrance.getPos().getSquaredDistance(this.dispatcher.camera.getPos(), true);
int k = this.getOffset(d);
float g = 0.75F;
double squaredDistance = entrance.getPos().getSquaredDistance(this.dispatcher.camera.getPos(), true);
int offset = this.getOffset(squaredDistance);
float u = 0.75F;
Matrix4f matrix4f = matrices.peek().getModel();
this.drawAllVertices(entrance, g, 0.15F, matrix4f, vertexConsumers.getBuffer(layers.get(0)), orientation);
this.drawAllVertices(entrance, u, 0.15F, matrix4f, vertexConsumers.getBuffer(layers.get(0)), orientation);
for(int l = 1; l < k; ++l) {
this.drawAllVertices(entrance, g, 2.0F / (float)(18 - l), matrix4f, vertexConsumers.getBuffer(layers.get(l)), orientation);
for(int i = 1; i < offset; ++i) {
this.drawAllVertices(entrance, u, 2.0F / (float)(18 - i), matrix4f, vertexConsumers.getBuffer(layers.get(i)), orientation);
}
}
@ -96,9 +97,9 @@ public class EntranceRiftBlockEntityRenderer extends BlockEntityRenderer<Entranc
}
private void drawAllVertices(EntranceRiftBlockEntity blockEntity, float u, float v, Matrix4f matrix4f, VertexConsumer vertexConsumer, Direction dir) {
float r = (RANDOM.nextFloat() * 0.5F + 0.1F) * v;
float g = (RANDOM.nextFloat() * 0.5F + 0.4F) * v;
float b = (RANDOM.nextFloat() * 0.5F + 0.5F) * v;
float r = MathHelper.clamp((RANDOM.nextFloat() * 0.3F + 0.1F) * v, 0, 1);
float g = MathHelper.clamp((RANDOM.nextFloat() * 0.4F + 0.1F) * v, 0, 1);
float b = MathHelper.clamp((RANDOM.nextFloat() * 0.5F + 0.6F) * v, 0, 1);
this.drawVertices(blockEntity, matrix4f, vertexConsumer, 0.0F, 1.0F, 0.0F, 1.0F, 1.0F, 1.0F, 1.0F, 1.0F, r, g, b, Direction.SOUTH);
this.drawVertices(blockEntity, matrix4f, vertexConsumer, 0.0F, 1.0F, 1.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, r, g, b, Direction.NORTH);
this.drawVertices(blockEntity, matrix4f, vertexConsumer, 1.0F, 1.0F, 1.0F, 0.0F, 0.0F, 1.0F, 1.0F, 0.0F, r, g, b, Direction.EAST);

View file

@ -86,10 +86,10 @@ public class MyRenderLayer extends RenderLayer {
RenderPhase.Texture texture;
if (layer <= 1) {
transparency = TRANSLUCENT_TRANSPARENCY;
texture = new RenderPhase.Texture(WARP_PATH, false, false);
texture = new RenderPhase.Texture(EndPortalBlockEntityRenderer.PORTAL_TEXTURE, false, false);
} else {
transparency = ADDITIVE_TRANSPARENCY;
texture = new RenderPhase.Texture(EndPortalBlockEntityRenderer.PORTAL_TEXTURE, false, false);
texture = new RenderPhase.Texture(WARP_PATH, false, false);
}
return of("dimensional_portal", VertexFormats.POSITION_COLOR, 7, 256, false, true, RenderLayer.MultiPhaseParameters.builder().transparency(transparency).texture(texture).texturing(new RenderPhase.PortalTexturing(layer)).fog(BLACK_FOG).build(false));