diff --git a/build.gradle b/build.gradle index 2fc5362b4..44288edb4 100644 --- a/build.gradle +++ b/build.gradle @@ -33,8 +33,8 @@ sourceCompatibility = targetCompatibility = compileJava.sourceCompatibility = co minecraft { mappings channel: 'snapshot', version: '20200920-mixed-1.16.3' accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg') - - runs { + + runs { client { workingDirectory project.file('run') // property 'mixin.env.disableRefMap', 'true' diff --git a/src/main/java/com/simibubi/create/AllBlocks.java b/src/main/java/com/simibubi/create/AllBlocks.java index 62fec60ab..c1a9c1f7f 100644 --- a/src/main/java/com/simibubi/create/AllBlocks.java +++ b/src/main/java/com/simibubi/create/AllBlocks.java @@ -1338,6 +1338,17 @@ public class AllBlocks { .build() .register(); + static { + REGISTRATE.startSection(AllSections.CURIOSITIES); + } + + public static final BlockEntry CHROMATIC_PROJECTOR = + REGISTRATE.block("chromatic_projector", Block::new) + .initialProperties(() -> Blocks.IRON_BLOCK) + .item() + .build() + .register(); + // Load this class public static void register() {} diff --git a/src/main/java/com/simibubi/create/AllTileEntities.java b/src/main/java/com/simibubi/create/AllTileEntities.java index be2086c82..767531933 100644 --- a/src/main/java/com/simibubi/create/AllTileEntities.java +++ b/src/main/java/com/simibubi/create/AllTileEntities.java @@ -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 TESTFX = + Create.registrate() + .tileEntity("chromatic_projector", ChromaticProjectorTileEntity::new) + .validBlocks(AllBlocks.CHROMATIC_PROJECTOR) + .register(); + public static void register() {} } diff --git a/src/main/java/com/simibubi/create/content/curiosities/ChromaticProjectorBlock.java b/src/main/java/com/simibubi/create/content/curiosities/ChromaticProjectorBlock.java new file mode 100644 index 000000000..729cdf60f --- /dev/null +++ b/src/main/java/com/simibubi/create/content/curiosities/ChromaticProjectorBlock.java @@ -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(); + } +} diff --git a/src/main/java/com/simibubi/create/content/curiosities/ChromaticProjectorTileEntity.java b/src/main/java/com/simibubi/create/content/curiosities/ChromaticProjectorTileEntity.java new file mode 100644 index 000000000..8fe2e4644 --- /dev/null +++ b/src/main/java/com/simibubi/create/content/curiosities/ChromaticProjectorTileEntity.java @@ -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); + } +} diff --git a/src/main/java/com/simibubi/create/foundation/render/backend/effects/EffectsHandler.java b/src/main/java/com/simibubi/create/foundation/render/backend/effects/EffectsHandler.java new file mode 100644 index 000000000..509e5fb5b --- /dev/null +++ b/src/main/java/com/simibubi/create/foundation/render/backend/effects/EffectsHandler.java @@ -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); + } + } + + +} diff --git a/src/main/resources/assets/create/flywheel/shaders/chromatic.frag b/src/main/resources/assets/create/flywheel/shaders/chromatic.frag new file mode 100644 index 000000000..7a1546907 --- /dev/null +++ b/src/main/resources/assets/create/flywheel/shaders/chromatic.frag @@ -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); +}