Registered BERs
BERs go brrr On branch 1.16 Changes to be committed: modified: src/main/java/org/dimdev/dimdoors/DimensionalDoorsClientInitializer.java modified: src/main/java/org/dimdev/dimdoors/DimensionalDoorsInitializer.java modified: src/main/java/org/dimdev/dimdoors/block/DimensionalPortalBlock.java modified: src/main/java/org/dimdev/dimdoors/client/DimensionalPortalRenderer.java modified: src/main/java/org/dimdev/dimdoors/client/EntranceRiftBlockEntityRenderer.java
This commit is contained in:
parent
4b6b2fad3c
commit
2a4ed3d8ca
5 changed files with 57 additions and 34 deletions
|
@ -7,6 +7,7 @@ import net.fabricmc.api.Environment;
|
|||
import net.fabricmc.fabric.api.blockrenderlayer.v1.BlockRenderLayerMap;
|
||||
import net.fabricmc.fabric.api.client.render.fluid.v1.FluidRenderHandler;
|
||||
import net.fabricmc.fabric.api.client.render.fluid.v1.FluidRenderHandlerRegistry;
|
||||
import net.fabricmc.fabric.api.client.rendereregistry.v1.BlockEntityRendererRegistry;
|
||||
import net.fabricmc.fabric.api.event.client.ClientSpriteRegistryCallback;
|
||||
import net.fabricmc.fabric.api.network.ClientSidePacketRegistry;
|
||||
import net.fabricmc.fabric.api.resource.ResourceManagerHelper;
|
||||
|
@ -26,7 +27,10 @@ import net.minecraft.util.math.Vec3i;
|
|||
import net.minecraft.util.registry.Registry;
|
||||
import net.minecraft.world.BlockRenderView;
|
||||
import org.dimdev.dimdoors.block.ModBlocks;
|
||||
import org.dimdev.dimdoors.block.entity.ModBlockEntityTypes;
|
||||
import org.dimdev.dimdoors.client.CustomSkyProvider;
|
||||
import org.dimdev.dimdoors.client.DetachedRiftBlockEntityRenderer;
|
||||
import org.dimdev.dimdoors.client.EntranceRiftBlockEntityRenderer;
|
||||
import org.dimdev.dimdoors.client.LimboSkyProvider;
|
||||
import org.dimdev.dimdoors.entity.ModEntityTypes;
|
||||
import org.dimdev.dimdoors.entity.MonolithEntity;
|
||||
|
@ -54,6 +58,9 @@ public class DimensionalDoorsClientInitializer implements ClientModInitializer {
|
|||
OpenWorlds.registerSkyRenderer(ModDimensions.LIMBO_TYPE, new LimboSkyProvider());
|
||||
|
||||
ClientSidePacketRegistry.INSTANCE.register(DimensionalDoorsInitializer.MONOLITH_PARTICLE_PACKET, MonolithEntity::spawnParticles);
|
||||
|
||||
BlockEntityRendererRegistry.INSTANCE.register(ModBlockEntityTypes.ENTRANCE_RIFT, EntranceRiftBlockEntityRenderer::new);
|
||||
BlockEntityRendererRegistry.INSTANCE.register(ModBlockEntityTypes.DETACHED_RIFT, DetachedRiftBlockEntityRenderer::new);
|
||||
}
|
||||
|
||||
private void putCutout(Block block) {
|
||||
|
|
|
@ -3,6 +3,7 @@ package org.dimdev.dimdoors;
|
|||
import net.fabricmc.api.ModInitializer;
|
||||
import net.fabricmc.fabric.api.command.v1.CommandRegistrationCallback;
|
||||
import org.dimdev.dimdoors.block.ModBlocks;
|
||||
import org.dimdev.dimdoors.block.entity.ModBlockEntityTypes;
|
||||
import org.dimdev.dimdoors.commands.CommandPocket;
|
||||
import org.dimdev.dimdoors.commands.CommandSaveSchem;
|
||||
import org.dimdev.dimdoors.commands.DimTeleportCommand;
|
||||
|
@ -29,6 +30,7 @@ public class DimensionalDoorsInitializer implements ModInitializer {
|
|||
ModEntityTypes.init();
|
||||
ModBiomes.init();
|
||||
ModFeatures.init();
|
||||
ModBlockEntityTypes.init();
|
||||
|
||||
this.registerCommands();
|
||||
|
||||
|
|
|
@ -1,9 +1,26 @@
|
|||
package org.dimdev.dimdoors.block;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import org.dimdev.dimdoors.block.entity.EntranceRiftBlockEntity;
|
||||
|
||||
public class DimensionalPortalBlock extends Block { // TODO
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.entity.BlockEntity;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.BlockView;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class DimensionalPortalBlock extends Block implements RiftProvider<EntranceRiftBlockEntity> {
|
||||
public DimensionalPortalBlock(Settings settings) {
|
||||
super(settings);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntranceRiftBlockEntity getRift(World world, BlockPos pos, BlockState state) {
|
||||
return (EntranceRiftBlockEntity) this.createBlockEntity(world);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockEntity createBlockEntity(BlockView world) {
|
||||
return new EntranceRiftBlockEntity();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,25 +3,24 @@ package org.dimdev.dimdoors.client;
|
|||
import com.mojang.blaze3d.platform.GlStateManager;
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.render.BufferBuilder;
|
||||
import net.minecraft.client.render.Tessellator;
|
||||
import net.minecraft.client.render.VertexConsumer;
|
||||
import net.minecraft.client.render.VertexFormats;
|
||||
import net.minecraft.client.render.*;
|
||||
import net.minecraft.client.util.GlAllocationUtils;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.Util;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.FloatBuffer;
|
||||
|
||||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
import static com.mojang.blaze3d.platform.GlStateManager.TexCoord.*;
|
||||
import static com.mojang.blaze3d.platform.GlStateManager.enableTexGen;
|
||||
|
||||
@Environment(EnvType.CLIENT)
|
||||
public final class DimensionalPortalRenderer { // TODO
|
||||
private static final FloatBuffer buffer = GlAllocationUtils.allocateFloatBuffer(16);
|
||||
private static final Identifier warpPath = new Identifier("dimdoors" + ":textures/other/warp.png");
|
||||
private static final FloatBuffer BUFFER = GlAllocationUtils.allocateFloatBuffer(16);
|
||||
private static final Identifier WARP_TEX = new Identifier("dimdoors", "textures/other/warp.png");
|
||||
|
||||
/**
|
||||
* Renders a dimensional portal, for use in various situations. Code is mostly based
|
||||
|
@ -37,7 +36,7 @@ public final class DimensionalPortalRenderer { // TODO
|
|||
* @param height The height of the wall.
|
||||
* @param colors An array containing the color to use on each pass. Its length determines the number of passes to do.
|
||||
*/
|
||||
public static void renderDimensionalPortal(VertexConsumer vc, double x, double y, double z, Direction orientation, double width, double height, float[][] colors) { // TODO: Make this work at any angle
|
||||
public static void renderDimensionalPortal(VertexConsumerProvider vc, double x, double y, double z, Direction orientation, double width, double height, float[][] colors) { // TODO: Make this work at any angle
|
||||
RenderSystem.disableLighting();
|
||||
RenderSystem.disableCull();
|
||||
|
||||
|
@ -48,7 +47,7 @@ public final class DimensionalPortalRenderer { // TODO
|
|||
float scale = 0.2625F;
|
||||
float colorMultiplier = 1.0F / (translationScale + .80F);
|
||||
|
||||
MinecraftClient.getInstance().getTextureManager().bindTexture(warpPath);
|
||||
MinecraftClient.getInstance().getTextureManager().bindTexture(WARP_TEX);
|
||||
RenderSystem.enableBlend();
|
||||
|
||||
if (pass == 0) {
|
||||
|
@ -189,9 +188,9 @@ public final class DimensionalPortalRenderer { // TODO
|
|||
}
|
||||
|
||||
private static FloatBuffer getBuffer(float f1, float f2, float f3, float f4) {
|
||||
buffer.clear();
|
||||
buffer.put(f1).put(f2).put(f3).put(f4);
|
||||
buffer.flip();
|
||||
return buffer;
|
||||
BUFFER.clear();
|
||||
BUFFER.put(f1).put(f2).put(f3).put(f4);
|
||||
BUFFER.flip();
|
||||
return BUFFER;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,17 +1,18 @@
|
|||
package org.dimdev.dimdoors.client;
|
||||
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
import org.dimdev.dimdoors.block.entity.EntranceRiftBlockEntity;
|
||||
|
||||
import net.minecraft.client.render.VertexConsumerProvider;
|
||||
import net.minecraft.client.render.block.entity.BlockEntityRenderDispatcher;
|
||||
import net.minecraft.client.render.block.entity.BlockEntityRenderer;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import net.minecraft.server.world.ServerWorld;
|
||||
import net.minecraft.client.util.math.Vector3f;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import org.dimdev.dimdoors.block.entity.EntranceRiftBlockEntity;
|
||||
|
||||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
|
||||
@Environment(EnvType.CLIENT)
|
||||
public class EntranceRiftBlockEntityRenderer extends BlockEntityRenderer<EntranceRiftBlockEntity> {
|
||||
|
@ -24,23 +25,20 @@ public class EntranceRiftBlockEntityRenderer extends BlockEntityRenderer<Entranc
|
|||
|
||||
@Override
|
||||
public void render(EntranceRiftBlockEntity entrance, float f, MatrixStack matrixStack, VertexConsumerProvider vertexConsumerProvider, int i, int j) {
|
||||
/*Direction orientation = entrance.getOrientation();
|
||||
Vec3d offset = new Vec3d(orientation.getOpposite().getUnitVector().scale(orientation == Direction.NORTH || orientation == Direction.WEST || orientation == Direction.UP ? entrance.pushIn : entrance.pushIn - 1));
|
||||
Direction orientation = entrance.getOrientation();
|
||||
Vector3f vec = orientation.getOpposite().getUnitVector();
|
||||
vec.scale((float) (orientation == Direction.NORTH || orientation == Direction.WEST || orientation == Direction.UP ? 0.01 : 0.01 - 1));
|
||||
Vec3d offset = new Vec3d(vec);
|
||||
DimensionalPortalRenderer.renderDimensionalPortal(
|
||||
x + offset.x,
|
||||
y + offset.y,
|
||||
z + offset.z,
|
||||
vertexConsumerProvider,
|
||||
entrance.getPos().getX() + offset.x,
|
||||
entrance.getPos().getY() + offset.y,
|
||||
entrance.getPos().getZ() + offset.z,
|
||||
//entrance.orientation.getHorizontalAngle(),
|
||||
//entrance.orientation.getDirectionVec().getY() * 90,
|
||||
orientation,
|
||||
extendLeft + entrance.extendRight,
|
||||
extendDown + entrance.extendUp,
|
||||
entrance.getColors(16));*/
|
||||
|
||||
/*if (entrance.lockStatus >= 1) {
|
||||
for (int i = 0; i < 1 + entrance.lockStatus; i++) {
|
||||
renderKeyHole(entrance, x, y, z, i);
|
||||
}
|
||||
}*/
|
||||
16,
|
||||
16,
|
||||
entrance.getColors(16));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue