Reverted feature debug code and tweaked rendering

Changes to be committed:
	modified:   src/main/java/org/dimdev/dimdoors/client/DetachedRiftBlockEntityRenderer.java
	modified:   src/main/java/org/dimdev/dimdoors/client/EntranceRiftBlockEntityRenderer.java
	modified:   src/main/java/org/dimdev/dimdoors/client/MyRenderLayer.java
	modified:   src/main/java/org/dimdev/dimdoors/client/tesseract/Tesseract.java
	modified:   src/main/java/org/dimdev/dimdoors/command/SchematicCommand.java
	modified:   src/main/java/org/dimdev/dimdoors/world/feature/ModFeatures.java
This commit is contained in:
SD 2020-08-23 16:07:01 +05:30
parent 00a461d4e0
commit 872edcd516
No known key found for this signature in database
GPG key ID: E36B57EE08544BC5
6 changed files with 28 additions and 29 deletions

View file

@ -18,9 +18,9 @@ import net.fabricmc.api.Environment;
@Environment(EnvType.CLIENT) @Environment(EnvType.CLIENT)
public class DetachedRiftBlockEntityRenderer extends BlockEntityRenderer<DetachedRiftBlockEntity> { public class DetachedRiftBlockEntityRenderer extends BlockEntityRenderer<DetachedRiftBlockEntity> {
public static final Identifier tesseract_path = new Identifier("dimdoors:textures/other/tesseract.png"); public static final Identifier TESSERACT_PATH = new Identifier("dimdoors:textures/other/tesseract.png");
private static final Tesseract tesseract = new Tesseract(); private static final Tesseract TESSERACT = new Tesseract();
private static final RiftCurves.PolygonInfo CURVE = RiftCurves.CURVES.get(0); private static final RiftCurves.PolygonInfo CURVE = RiftCurves.CURVES.get(0);
public static long showRiftCoreUntil = 0; public static long showRiftCoreUntil = 0;
@ -42,11 +42,11 @@ public class DetachedRiftBlockEntityRenderer extends BlockEntityRenderer<Detache
renderCrack(vcs.getBuffer(MyRenderLayer.CRACK), matrices, rift); renderCrack(vcs.getBuffer(MyRenderLayer.CRACK), matrices, rift);
} }
private void renderCrack(VertexConsumer vc, MatrixStack matricees, DetachedRiftBlockEntity rift) { private void renderCrack(VertexConsumer vc, MatrixStack matrices, DetachedRiftBlockEntity rift) {
matricees.push(); matrices.push();
matricees.translate(0.5, 0.5, 0.5); matrices.translate(0.5, 0.5, 0.5);
RiftCrackRenderer.drawCrack(vc, 0, CURVE, ModConfig.GRAPHICS.riftSize * rift.size, 0xF1234568L * rift.getPos().hashCode()); RiftCrackRenderer.drawCrack(vc, 0, CURVE, ModConfig.GRAPHICS.riftSize * rift.size, 0xF1234568L * rift.getPos().hashCode());
matricees.pop(); matrices.pop();
} }
private void renderTesseract(VertexConsumer vc, DetachedRiftBlockEntity rift, MatrixStack matrices, float tickDelta) { private void renderTesseract(VertexConsumer vc, DetachedRiftBlockEntity rift, MatrixStack matrices, float tickDelta) {
@ -59,7 +59,7 @@ public class DetachedRiftBlockEntityRenderer extends BlockEntityRenderer<Detache
matrices.translate(0.5, 0.5, 0.5); matrices.translate(0.5, 0.5, 0.5);
matrices.scale(0.25f, 0.25f, 0.25f); matrices.scale(0.25f, 0.25f, 0.25f);
tesseract.draw(vc, color, radian); TESSERACT.draw(vc, color, radian);
matrices.pop(); matrices.pop();
} }

View file

@ -15,8 +15,11 @@ import net.minecraft.client.render.VertexConsumer;
import net.minecraft.client.render.VertexConsumerProvider; import net.minecraft.client.render.VertexConsumerProvider;
import net.minecraft.client.render.block.entity.BlockEntityRenderDispatcher; import net.minecraft.client.render.block.entity.BlockEntityRenderDispatcher;
import net.minecraft.client.render.block.entity.BlockEntityRenderer; import net.minecraft.client.render.block.entity.BlockEntityRenderer;
import net.minecraft.client.render.model.json.ModelTransformation;
import net.minecraft.client.util.math.MatrixStack; import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.client.util.math.Vector3f; import net.minecraft.client.util.math.Vector3f;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.util.Identifier; import net.minecraft.util.Identifier;
import net.minecraft.util.math.Direction; import net.minecraft.util.math.Direction;
import net.minecraft.util.math.Matrix4f; import net.minecraft.util.math.Matrix4f;
@ -38,24 +41,22 @@ public class EntranceRiftBlockEntityRenderer extends BlockEntityRenderer<Entranc
} }
@Override @Override
public void render(EntranceRiftBlockEntity entrance, float tickDelta, MatrixStack matrixStack, VertexConsumerProvider vertexConsumerProvider, int light, int overlay) { public void render(EntranceRiftBlockEntity entrance, float tickDelta, MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, int overlay) {
matrices.push();
MinecraftClient.getInstance().getItemRenderer().renderItem(new ItemStack(Items.DIRT), ModelTransformation.Mode.THIRD_PERSON_RIGHT_HAND, light, overlay, matrices, vertexConsumers);
if (MinecraftClient.getInstance().world == null if (MinecraftClient.getInstance().world == null
|| !MinecraftClient.getInstance().world.isChunkLoaded(entrance.getPos().getX() >> 4, entrance.getPos().getZ() >> 4)) { || !MinecraftClient.getInstance().world.isChunkLoaded(entrance.getPos().getX() >> 4, entrance.getPos().getZ() >> 4)) {
return; return;
} }
Direction orientation = entrance.getOrientation(); Direction orientation = entrance.getOrientation();
Vector3f vec = orientation.getOpposite().getUnitVector(); Vector3f vec = orientation.getOpposite().getUnitVector();
// New Rendering code
if (MinecraftClient.getInstance().world.getBlockState(entrance.getPos()).getBlock() instanceof DimensionalPortalBlock) { if (MinecraftClient.getInstance().world.getBlockState(entrance.getPos()).getBlock() instanceof DimensionalPortalBlock) {
vec.add(0 ,1 , 0); Vector3f ve2c = orientation.getOpposite().getUnitVector();
this.renderVertices(entrance, matrixStack, vertexConsumerProvider, orientation, vec); ve2c.add(0,1, 0);
this.renderVertices(entrance, matrices, vertexConsumers, orientation, ve2c);
} }
this.renderVertices(entrance, matrices, vertexConsumers, orientation, vec);
this.renderVertices(entrance, matrixStack, vertexConsumerProvider, orientation, vec);
/* ************************************************************************************************************************************* */
// Old Rendering code
// Vec3d offset = new Vec3d(vec); // Vec3d offset = new Vec3d(vec);
// DimensionalPortalRenderer.renderDimensionalPortal( // DimensionalPortalRenderer.renderDimensionalPortal(
// entrance.getPos().getX() + offset.x, // entrance.getPos().getX() + offset.x,
@ -67,20 +68,21 @@ public class EntranceRiftBlockEntityRenderer extends BlockEntityRenderer<Entranc
// 16, // 16,
// 16, // 16,
// entrance.getColors(16), // entrance.getColors(16),
// matrixStack, // matrices,
// vertexConsumerProvider.getBuffer(LAYERS.get(0))); // vertexConsumers.getBuffer(LAYERS.get(0)));
matrices.pop();
} }
private void renderVertices(EntranceRiftBlockEntity entrance, MatrixStack matrixStack, VertexConsumerProvider vertexConsumerProvider, Direction orientation, Vector3f vec) { private void renderVertices(EntranceRiftBlockEntity entrance, MatrixStack matrices, VertexConsumerProvider vertexConsumers, Direction orientation, Vector3f vec) {
vec.scale((float) (orientation == Direction.NORTH || orientation == Direction.WEST || orientation == Direction.UP ? 0.01 : 0.01 - 1)); 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); double d = entrance.getPos().getSquaredDistance(this.dispatcher.camera.getPos(), true);
int k = this.getOffset(d); int k = this.getOffset(d);
float g = 0.75F; float g = 0.75F;
Matrix4f matrix4f = matrixStack.peek().getModel(); Matrix4f matrix4f = matrices.peek().getModel();
this.drawAllVertices(entrance, g, 0.15F, matrix4f, vertexConsumerProvider.getBuffer(LAYERS.get(0)), orientation); this.drawAllVertices(entrance, g, 0.15F, matrix4f, vertexConsumers.getBuffer(LAYERS.get(1)), orientation);
for(int l = 1; l < k; ++l) { for(int l = 1; l < k; ++l) {
this.drawAllVertices(entrance, g, 2.0F / (float)(18 - l), matrix4f, vertexConsumerProvider.getBuffer(LAYERS.get(l)), orientation); this.drawAllVertices(entrance, g, 2.0F / (float)(18 - l), matrix4f, vertexConsumers.getBuffer(LAYERS.get(l)), orientation);
} }
} }

View file

@ -33,7 +33,7 @@ public class MyRenderLayer extends RenderLayer {
public static RenderLayer TESSERACT = RenderLayer.of("tesseract", VertexFormats.POSITION_COLOR_TEXTURE, GL11.GL_QUADS, 256, MultiPhaseParameters.builder() public static RenderLayer TESSERACT = RenderLayer.of("tesseract", VertexFormats.POSITION_COLOR_TEXTURE, GL11.GL_QUADS, 256, MultiPhaseParameters.builder()
.cull(DISABLE_CULLING) .cull(DISABLE_CULLING)
.lightmap(RenderPhase.DISABLE_LIGHTMAP) .lightmap(RenderPhase.DISABLE_LIGHTMAP)
.texture(new Texture(new Identifier("dimdoors:textures/other/tesseract.png"), false, false)) .texture(new Texture(DetachedRiftBlockEntityRenderer.TESSERACT_PATH, false, false))
.build(false)); .build(false));
public static RenderLayer getDimensionalPortal(int phase) { public static RenderLayer getDimensionalPortal(int phase) {

View file

@ -8,11 +8,9 @@ import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment; import net.fabricmc.api.Environment;
public class Tesseract { public class Tesseract {
private final Plane[] planes; private final Plane[] planes = new Plane[24];
public Tesseract() { public Tesseract() {
planes = new Plane[24];
planes[0] = new Plane( planes[0] = new Plane(
new Vector4f(-0.5f, -0.5f, -0.5f, -0.5f), new Vector4f(-0.5f, -0.5f, -0.5f, -0.5f),
new Vector4f(0.5f, -0.5f, -0.5f, -0.5f), new Vector4f(0.5f, -0.5f, -0.5f, -0.5f),

View file

@ -1,6 +1,5 @@
package org.dimdev.dimdoors.command; package org.dimdev.dimdoors.command;
import java.io.InputStream; import java.io.InputStream;
import com.mojang.brigadier.CommandDispatcher; import com.mojang.brigadier.CommandDispatcher;

View file

@ -29,9 +29,9 @@ public final class ModFeatures {
static { static {
SANDSTONE_PILLARS_FEATURE = GATEWAY_FEATURE.configure(new SchematicGatewayFeatureConfig(SchematicGateway.SCHEMATIC_ID_MAP.get(SANDSTONE_PILLARS_GATEWAY))) SANDSTONE_PILLARS_FEATURE = GATEWAY_FEATURE.configure(new SchematicGatewayFeatureConfig(SchematicGateway.SCHEMATIC_ID_MAP.get(SANDSTONE_PILLARS_GATEWAY)))
.decorate(ConfiguredFeatures.Decorators.SQUARE_TOP_SOLID_HEIGHTMAP .decorate(ConfiguredFeatures.Decorators.SQUARE_TOP_SOLID_HEIGHTMAP
.applyChance(ModConfig.WORLD.gatewayGenChance + 20)); .applyChance(ModConfig.WORLD.gatewayGenChance));
TWO_PILLARS_FEATURE = GATEWAY_FEATURE.configure(new SchematicGatewayFeatureConfig(SchematicGateway.SCHEMATIC_ID_MAP.get(TWO_PILLARS_GATEWAY))) TWO_PILLARS_FEATURE = GATEWAY_FEATURE.configure(new SchematicGatewayFeatureConfig(SchematicGateway.SCHEMATIC_ID_MAP.get(TWO_PILLARS_GATEWAY)))
.decorate(ConfiguredFeatures.Decorators.SQUARE_TOP_SOLID_HEIGHTMAP .decorate(ConfiguredFeatures.Decorators.SQUARE_TOP_SOLID_HEIGHTMAP
.applyChance(ModConfig.WORLD.gatewayGenChance + 20)); .applyChance(ModConfig.WORLD.gatewayGenChance));
} }
} }