- forge microblocks of neonite, antiblock and glotek are now emissive when using shaders

This commit is contained in:
iamblackornot committed 2023-11-06 16:12:00 +03:00
1 parent df216f68b4
commit 2150548111
4 files changed
+87 -6

No files matched your search

@@ -19,10 +19,13 @@ import com.cricketcraft.chisel.api.ChiselAPIProps;
import com.cricketcraft.chisel.api.FMPIMC;
import com.cricketcraft.chisel.api.rendering.TextureType;
import codechicken.microblock.MicroMaterialRegistry;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import team.chisel.block.BlockCarvableGlowie;
import team.chisel.client.render.FullBrightMicroMaterial;
import team.chisel.ctmlib.ISubmapManager;
public class CarvableHelper {
@@ -187,11 +190,21 @@ public class CarvableHelper {
Block block = info.getVariation()
.getBlock();
if (block.renderAsNormalBlock() || block.isOpaqueCube() || block.isNormalCube()) {
FMPIMC.registerFMP(
block,
info.getVariation()
.getBlockMeta());
if (block instanceof BlockCarvableGlowie) {
int meta = info.getVariation()
.getBlockMeta();
MicroMaterialRegistry.registerMaterial(
new FullBrightMicroMaterial(block, meta),
block.getUnlocalizedName() + ((meta > 0) ? ("_" + meta) : ""));
} else {
if (block.renderAsNormalBlock() || block.isOpaqueCube() || block.isNormalCube()) {
FMPIMC.registerFMP(
block,
info.getVariation()
.getBlockMeta());
}
}
if (forbidChiseling) return;
+1 -1
View File
@@ -181,7 +181,7 @@ public enum Features {
@Override
void addBlocks() {
BlockCarvable antiBlock = (BlockCarvable) new BlockCarvableAntiBlock()
BlockCarvable antiBlock = (BlockCarvable) new BlockCarvableGlowie(Material.rock)
.setCreativeTab(ChiselTabs.tabOtherChiselBlocks);
if (!Configurations.allowChiselCrossColors) {
@@ -0,0 +1,35 @@
package team.chisel.client.render;
import codechicken.lib.render.CCRenderState;
public class FullBrightLighting implements CCRenderState.IVertexOperation {
public static FullBrightLighting instance = new FullBrightLighting();
public int id;
public boolean load() {
if (!CCRenderState.computeLighting) {
return false;
}
CCRenderState.pipeline.addDependency(CCRenderState.colourAttrib);
CCRenderState.pipeline.addDependency(CCRenderState.lightCoordAttrib);
return true;
}
public void operate() {
CCRenderState.setBrightness(FULL_BRIGHT_BLOCK_BRIGHTNESS);
}
public int operationID() {
return id;
}
{
id = CCRenderState.registerOperation();
}
// magic number from 'RenderBlocksCTMFullbright'
// this is the brightness of the neonite, anti, glotek blocks
// so we use it for custom microblock lighting
private final static int FULL_BRIGHT_BLOCK_BRIGHTNESS = 0xF000F0;
}
@@ -0,0 +1,33 @@
package team.chisel.client.render;
import net.minecraft.block.Block;
import codechicken.lib.render.CCRenderState;
import codechicken.lib.render.ColourMultiplier;
import codechicken.lib.vec.Cuboid6;
import codechicken.lib.vec.Vector3;
import codechicken.microblock.BlockMicroMaterial;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class FullBrightMicroMaterial extends BlockMicroMaterial {
public FullBrightMicroMaterial(final Block block, final int meta) {
super(block, meta);
}
@SideOnly(Side.CLIENT)
public void renderMicroFace(final Vector3 pos, final int pass, final Cuboid6 bounds) {
CCRenderState.pipeline.builder()
.add((CCRenderState.IVertexOperation) pos.translation())
.add((CCRenderState.IVertexOperation) this.icont())
.add((CCRenderState.IVertexOperation) ColourMultiplier.instance(FULL_BRIGHT_COLOR_MULTIPLIER))
.add((CCRenderState.IVertexOperation) FullBrightLighting.instance)
.render();
}
// magic number from 'RenderBlocksCTMFullbright'
// this is what makes the neonite, anti, glotek blocks burn bright as my ass does
// so we use it for custom microblock render
private final static int FULL_BRIGHT_COLOR_MULTIPLIER = 0xFFFFFFFF;
}