Add basic blocks and TEs for the chromatic projector

This commit is contained in:
JozsefA 2021-04-09 16:16:25 -07:00
parent 536b8d2d5e
commit 08b2c498e6
7 changed files with 100 additions and 2 deletions

View file

@ -1338,6 +1338,17 @@ public class AllBlocks {
.build()
.register();
static {
REGISTRATE.startSection(AllSections.CURIOSITIES);
}
public static final BlockEntry<Block> CHROMATIC_PROJECTOR =
REGISTRATE.block("chromatic_projector", Block::new)
.initialProperties(() -> Blocks.IRON_BLOCK)
.item()
.build()
.register();
// Load this class
public static void register() {}

View file

@ -116,6 +116,7 @@ import com.simibubi.create.content.contraptions.relays.gearbox.GearboxInstance;
import com.simibubi.create.content.contraptions.relays.gearbox.GearboxRenderer;
import com.simibubi.create.content.contraptions.relays.gearbox.GearboxTileEntity;
import com.simibubi.create.content.contraptions.relays.gearbox.GearshiftTileEntity;
import com.simibubi.create.content.curiosities.ChromaticProjectorTileEntity;
import com.simibubi.create.content.logistics.block.belts.tunnel.BeltTunnelInstance;
import com.simibubi.create.content.logistics.block.belts.tunnel.BeltTunnelRenderer;
import com.simibubi.create.content.logistics.block.belts.tunnel.BeltTunnelTileEntity;
@ -654,5 +655,11 @@ public class AllTileEntities {
.renderer(() -> AdjustableRepeaterRenderer::new)
.register();
public static final TileEntityEntry<ChromaticProjectorTileEntity> TESTFX =
Create.registrate()
.tileEntity("chromatic_projector", ChromaticProjectorTileEntity::new)
.validBlocks(AllBlocks.CHROMATIC_PROJECTOR)
.register();
public static void register() {}
}

View file

@ -0,0 +1,27 @@
package com.simibubi.create.content.curiosities;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.IBlockReader;
import javax.annotation.Nullable;
import com.simibubi.create.AllTileEntities;
public class ChromaticProjectorBlock extends Block {
public ChromaticProjectorBlock(Properties p_i48440_1_) {
super(p_i48440_1_);
}
@Override
public boolean hasTileEntity(BlockState state) {
return true;
}
@Nullable
@Override
public TileEntity createTileEntity(BlockState state, IBlockReader world) {
return AllTileEntities.TESTFX.create();
}
}

View file

@ -0,0 +1,10 @@
package com.simibubi.create.content.curiosities;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.tileentity.TileEntityType;
public class ChromaticProjectorTileEntity extends TileEntity {
public ChromaticProjectorTileEntity(TileEntityType<?> te) {
super(te);
}
}

View file

@ -0,0 +1,30 @@
package com.simibubi.create.foundation.render.backend.effects;
import net.minecraft.client.MainWindow;
import net.minecraft.client.Minecraft;
import net.minecraft.client.shader.Framebuffer;
public class EffectsHandler {
final Minecraft mc;
private final Framebuffer framebuffer;
public EffectsHandler(Minecraft minecraft) {
this.mc = minecraft;
Framebuffer render = minecraft.getFramebuffer();
framebuffer = new Framebuffer(render.framebufferWidth, render.framebufferHeight, false, Minecraft.IS_RUNNING_ON_MAC);
}
public void prepFramebufferSize() {
MainWindow window = mc.getWindow();
if (framebuffer.framebufferWidth != window.getFramebufferWidth()
|| framebuffer.framebufferHeight != window.getFramebufferHeight()) {
framebuffer.func_216491_a(window.getFramebufferWidth(), window.getFramebufferHeight(),
Minecraft.IS_RUNNING_ON_MAC);
}
}
}

View file

@ -0,0 +1,13 @@
#version 120
layout (std140) struct Sphere {
vec4 positionRadius;
vec4 color;
} uSpheres;
uniform sampler2D uDepth;
uniform sampler2D uColor;
void main() {
gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);
}