mirror of
https://github.com/GTNewHorizons/Chisel.git
synced 2026-11-17 11:15:07 +00:00
Get rid of the ugly RenderBlocksCTMFullbright, some other refactors
This commit is contained in:
1 parent
3ae753ebc3
commit
2f6b455514
20 files changed
+215
-534
No files matched your search
@@ -2,12 +2,8 @@ package com.cricketcraft.chisel;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import com.cricketcraft.chisel.entity.EntityChiselSnowman;
|
||||
|
||||
import cpw.mods.fml.common.registry.EntityRegistry;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemCarrotOnAStick;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.common.config.Configuration;
|
||||
|
||||
@@ -21,6 +17,7 @@ import com.cricketcraft.chisel.compat.Compatibility;
|
||||
import com.cricketcraft.chisel.compat.IMCHandler;
|
||||
import com.cricketcraft.chisel.compat.fmp.FMPCompat;
|
||||
import com.cricketcraft.chisel.config.Configurations;
|
||||
import com.cricketcraft.chisel.entity.EntityChiselSnowman;
|
||||
import com.cricketcraft.chisel.init.ChiselBlocks;
|
||||
import com.cricketcraft.chisel.init.ChiselTabs;
|
||||
import com.cricketcraft.chisel.item.ItemCarvable;
|
||||
@@ -49,6 +46,7 @@ import cpw.mods.fml.common.event.FMLPostInitializationEvent;
|
||||
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import cpw.mods.fml.common.network.NetworkRegistry;
|
||||
import cpw.mods.fml.common.registry.EntityRegistry;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import cpw.mods.fml.common.registry.GameRegistry.Type;
|
||||
|
||||
@@ -64,8 +62,6 @@ public class Chisel {
|
||||
public static boolean multipartLoaded = false;
|
||||
public static int renderEldritchId;
|
||||
public static int renderCTMId;
|
||||
public static int renderCTMNoLightId;
|
||||
public static int renderCarpetId;
|
||||
public static int renderAutoChiselId;
|
||||
public static int renderGlowId;
|
||||
public static int renderLayeredId;
|
||||
|
||||
@@ -20,6 +20,7 @@ import com.cricketcraft.chisel.api.carving.ICarvingVariation;
|
||||
import com.cricketcraft.chisel.api.carving.IVariationInfo;
|
||||
import com.cricketcraft.chisel.block.*;
|
||||
import com.cricketcraft.chisel.carving.Carving;
|
||||
import com.cricketcraft.chisel.client.render.SubmapManagerAntiblock;
|
||||
import com.cricketcraft.chisel.client.render.SubmapManagerCarpetFloor;
|
||||
import com.cricketcraft.chisel.client.render.SubmapManagerFakeController;
|
||||
import com.cricketcraft.chisel.client.render.SubmapManagerSlab;
|
||||
@@ -46,7 +47,6 @@ import com.google.common.collect.Lists;
|
||||
import cpw.mods.fml.common.Loader;
|
||||
import cpw.mods.fml.common.registry.EntityRegistry;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
|
||||
import static com.cricketcraft.chisel.init.ChiselBlocks.*;
|
||||
import static com.cricketcraft.chisel.utils.General.sGNames;
|
||||
|
||||
@@ -137,7 +137,7 @@ public enum Features {
|
||||
}
|
||||
|
||||
for (int i = 0; i < 16; i++) {
|
||||
antiBlock.carverHelper.addVariation("tile.antiBlock." + ItemDye.field_150921_b[i] + ".desc", i, "antiblock/" + ItemDye.field_150921_b[i] + "-antiBlock");
|
||||
antiBlock.carverHelper.addVariation("tile.antiBlock." + ItemDye.field_150921_b[i] + ".desc", i, new SubmapManagerAntiblock(ItemDye.field_150921_b[i]));
|
||||
}
|
||||
|
||||
antiBlock.carverHelper.registerAll(antiBlock, "antiBlock");
|
||||
@@ -361,7 +361,7 @@ public enum Features {
|
||||
|
||||
@Override
|
||||
void addBlocks() {
|
||||
BlockMarbleCarpet carpet = (BlockMarbleCarpet) new BlockMarbleCarpet(Material.cloth).setCreativeTab(ChiselTabs.tabOtherChiselBlocks).setHardness(0.1F).setStepSound(Block.soundTypeCloth)
|
||||
BlockCarvableCarpet carpet = (BlockCarvableCarpet) new BlockCarvableCarpet(Material.cloth).setCreativeTab(ChiselTabs.tabOtherChiselBlocks).setHardness(0.1F).setStepSound(Block.soundTypeCloth)
|
||||
.setLightOpacity(0).setStepSound(Block.soundTypeCloth);
|
||||
|
||||
carpet.carverHelper.addVariation("tile.carpet.0.desc", 0, new SubmapManagerCarpetFloor("white"));
|
||||
@@ -1158,7 +1158,7 @@ public enum Features {
|
||||
void addBlocks() {
|
||||
CarvableStairsMaker makerIceStairs = new CarvableStairsMaker(Blocks.ice);
|
||||
|
||||
// TODO makerIceStairs.carverHelper.addVariation("tile.ice_stairs.0.desc", 0, Blocks.ice);
|
||||
makerIceStairs.carverHelper.addVariation("tile.ice_stairs.0.desc", 0, Blocks.ice);
|
||||
makerIceStairs.carverHelper.addVariation("tile.ice_stairs.1.desc", 1, "ice/a1-ice-light");
|
||||
makerIceStairs.carverHelper.addVariation("tile.ice_stairs.2.desc", 2, "ice/a1-stonecobble-icecobble");
|
||||
makerIceStairs.carverHelper.addVariation("tile.ice_stairs.3.desc", 3, "ice/a1-netherbrick-ice");
|
||||
@@ -1830,7 +1830,7 @@ public enum Features {
|
||||
void addBlocks() {
|
||||
CarvableStairsMaker makerPackedIceStairs = new CarvableStairsMaker(Blocks.packed_ice);
|
||||
|
||||
// TODO makerPackedIceStairs.carverHelper.addVariation("tile.packedice_stairs.0.desc", 0, Blocks.packed_ice);
|
||||
makerPackedIceStairs.carverHelper.addVariation("tile.packedice_stairs.0.desc", 0, Blocks.packed_ice);
|
||||
makerPackedIceStairs.carverHelper.addVariation("tile.packedice_stairs.1.desc", 1, "ice/a1-ice-light");
|
||||
makerPackedIceStairs.carverHelper.addVariation("tile.packedice_stairs.2.desc", 2, "ice/a1-stonecobble-icecobble");
|
||||
makerPackedIceStairs.carverHelper.addVariation("tile.packedice_stairs.3.desc", 3, "ice/a1-netherbrick-ice");
|
||||
@@ -1905,8 +1905,7 @@ public enum Features {
|
||||
void addBlocks() {
|
||||
BlockPresent present = (BlockPresent) new BlockPresent().setCreativeTab(ChiselTabs.tabOtherChiselBlocks).setHardness(2.0F).setResistance(10.0F).setBlockName("chisel.present");
|
||||
for (int i = 0; i < 16; i++) {
|
||||
// TODO
|
||||
present.carverHelper.addVariation("tile.chisel.present.desc", i, "paper/box");
|
||||
present.carverHelper.addVariation("tile.chisel.present.desc", i, "planks_oak", "minecraft");
|
||||
}
|
||||
present.carverHelper.registerAll(present, "present", ItemBlockPresent.class);
|
||||
Carving.chisel.registerOre("present", "chest");
|
||||
|
||||
@@ -36,6 +36,7 @@ public class CarvableHelper {
|
||||
public CarvableHelper(Block block) {
|
||||
this.theBlock = block;
|
||||
}
|
||||
|
||||
public void addVariation(String description, int metadata, ISubmapManager<? extends RenderBlocks> manager) {
|
||||
addVariation(description, metadata, null, manager);
|
||||
}
|
||||
@@ -87,18 +88,20 @@ public class CarvableHelper {
|
||||
|
||||
ICarvingVariation var = CarvingUtils.getDefaultVariationFor(theBlock, metadata, metadata);
|
||||
TextureType type = TextureType.getTypeFor(this, modid, texture);
|
||||
if (type == TextureType.CUSTOM && customManager == null) {
|
||||
if (type == TextureType.CUSTOM && customManager == null && block == null) {
|
||||
throw new IllegalArgumentException(String.format("Could not find texture %s, and no custom texture manager was provided.", texture));
|
||||
}
|
||||
|
||||
IVariationInfo info;
|
||||
ISubmapManager<?> manager;
|
||||
if (customManager != null) {
|
||||
info = new VariationInfoBase(var, description, customManager);
|
||||
manager = customManager;
|
||||
} else if (block != null) {
|
||||
manager = type.createManagerFor(var, block, blockMeta);
|
||||
} else {
|
||||
info = new VariationInfoBase(var, description, type.createManagerFor(var, texture));
|
||||
manager = type.createManagerFor(var, texture);
|
||||
}
|
||||
|
||||
// TODO handling for block texture override params
|
||||
info = new VariationInfoBase(var, description, manager);
|
||||
|
||||
infoList.add(info);
|
||||
infoMap[metadata] = info;
|
||||
|
||||
@@ -311,6 +311,10 @@ public enum TextureType {
|
||||
return new SubmapManagerDefault(this, variation, texturePath);
|
||||
}
|
||||
|
||||
public ISubmapManager<RenderBlocks> createManagerFor(ICarvingVariation variation, Block block, int meta) {
|
||||
return new SubmapManagerExistingIcon(this, variation, block, meta);
|
||||
}
|
||||
|
||||
protected Object registerIcons(ICarvingVariation variation, String modName, String texturePath, IIconRegister register) {
|
||||
return register.registerIcon(modName + ":" + texturePath);
|
||||
}
|
||||
@@ -356,17 +360,14 @@ public enum TextureType {
|
||||
}
|
||||
}
|
||||
|
||||
private static class SubmapManagerDefault implements ISubmapManager<RenderBlocks> {
|
||||
|
||||
private TextureType type;
|
||||
private ICarvingVariation variation;
|
||||
private Object cachedObject;
|
||||
private String texturePath;
|
||||
private abstract static class SubmapManagerBase<T extends RenderBlocks> implements ISubmapManager<T> {
|
||||
protected final TextureType type;
|
||||
protected ICarvingVariation variation;
|
||||
protected Object cachedObject;
|
||||
|
||||
private SubmapManagerDefault(TextureType type, ICarvingVariation variation, String texturePath) {
|
||||
private SubmapManagerBase(TextureType type, ICarvingVariation variation) {
|
||||
this.type = type;
|
||||
this.variation = variation;
|
||||
this.texturePath = texturePath;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -378,15 +379,10 @@ public enum TextureType {
|
||||
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) {
|
||||
return type.getIcon(variation, cachedObject, world, x, y, z, side, world.getBlockMetadata(x, y, z));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerIcons(String modName, Block block, IIconRegister register) {
|
||||
cachedObject = type.registerIcons(variation, modName, texturePath, register);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RenderBlocks createRenderContext(RenderBlocks rendererOld, IBlockAccess world) {
|
||||
return type.createRenderContext(rendererOld, world, cachedObject);
|
||||
public T createRenderContext(RenderBlocks rendererOld, IBlockAccess world) {
|
||||
return (T) type.createRenderContext(rendererOld, world, cachedObject);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -397,4 +393,45 @@ public enum TextureType {
|
||||
public void postRenderSide(RenderBlocks renderer, IBlockAccess world, int x, int y, int z, ForgeDirection side) {
|
||||
}
|
||||
}
|
||||
|
||||
private static class SubmapManagerDefault extends SubmapManagerBase<RenderBlocks> {
|
||||
|
||||
private String texturePath;
|
||||
|
||||
private SubmapManagerDefault(TextureType type, ICarvingVariation variation, String texturePath) {
|
||||
super(type, variation);
|
||||
this.texturePath = texturePath;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerIcons(String modName, Block block, IIconRegister register) {
|
||||
cachedObject = type.registerIcons(variation, modName, texturePath, register);
|
||||
}
|
||||
}
|
||||
|
||||
private static class SubmapManagerExistingIcon extends SubmapManagerBase<RenderBlocks> {
|
||||
|
||||
private Block block;
|
||||
private int meta;
|
||||
|
||||
private SubmapManagerExistingIcon(TextureType type, ICarvingVariation variation, Block block, int meta) {
|
||||
super(type, variation);
|
||||
this.block = block;
|
||||
this.meta = meta;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(int side, int meta) {
|
||||
return block.getIcon(side, this.meta);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) {
|
||||
return getIcon(side, world.getBlockMetadata(x, y, z));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerIcons(String modName, Block block, IIconRegister register) {
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4,30 +4,14 @@ import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.EnumCreatureType;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
|
||||
import com.cricketcraft.chisel.Chisel;
|
||||
import com.cricketcraft.chisel.api.ICarvable;
|
||||
import com.cricketcraft.chisel.api.carving.CarvableHelper;
|
||||
|
||||
public class BlockCarvableAntiBlock extends BlockCarvableColor implements ICarvable {
|
||||
|
||||
public CarvableHelper carverHelper;
|
||||
|
||||
public BlockCarvableAntiBlock() {
|
||||
super(Material.rock);
|
||||
carverHelper = new CarvableHelper(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType() {
|
||||
return Chisel.renderCTMNoLightId;
|
||||
}
|
||||
|
||||
/*
|
||||
@Override
|
||||
public boolean renderAsNormalBlock() {
|
||||
return false;
|
||||
}
|
||||
*/
|
||||
@Override
|
||||
public boolean canCreatureSpawn(EnumCreatureType type, IBlockAccess world, int x, int y, int z) {
|
||||
return false;
|
||||
|
||||
+4
-4
@@ -16,11 +16,11 @@ import com.cricketcraft.chisel.api.ICarvable;
|
||||
import com.cricketcraft.chisel.api.carving.CarvableHelper;
|
||||
import com.cricketcraft.chisel.api.carving.IVariationInfo;
|
||||
|
||||
public class BlockMarbleCarpet extends BlockCarpet implements ICarvable {
|
||||
public class BlockCarvableCarpet extends BlockCarpet implements ICarvable {
|
||||
|
||||
public CarvableHelper carverHelper;
|
||||
|
||||
public BlockMarbleCarpet(Material m) {
|
||||
public BlockCarvableCarpet(Material m) {
|
||||
carverHelper = new CarvableHelper(this);
|
||||
}
|
||||
|
||||
@@ -48,10 +48,10 @@ public class BlockMarbleCarpet extends BlockCarpet implements ICarvable {
|
||||
public void getSubBlocks(Item item, CreativeTabs tabs, List list) {
|
||||
carverHelper.registerSubBlocks(this, tabs, list);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int getRenderType() {
|
||||
return Chisel.renderCarpetId;
|
||||
return Chisel.renderCTMId;
|
||||
}
|
||||
|
||||
@Override
|
||||
+6
-6
@@ -9,23 +9,23 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class BlockMarbleLamp extends BlockCarvable {
|
||||
public class BlockCarvableLamp extends BlockCarvable {
|
||||
|
||||
BlockMarbleLamp blockUnpowered;
|
||||
BlockMarbleLamp blockPowered;
|
||||
BlockCarvableLamp blockUnpowered;
|
||||
BlockCarvableLamp blockPowered;
|
||||
boolean powered;
|
||||
|
||||
public BlockMarbleLamp() {
|
||||
public BlockCarvableLamp() {
|
||||
super(Material.redstoneLight);
|
||||
|
||||
powered = false;
|
||||
blockUnpowered = this;
|
||||
blockPowered = new BlockMarbleLamp(this);
|
||||
blockPowered = new BlockCarvableLamp(this);
|
||||
|
||||
setHardness(0.3F);
|
||||
}
|
||||
|
||||
public BlockMarbleLamp(BlockMarbleLamp unpoweredVersion) {
|
||||
public BlockCarvableLamp(BlockCarvableLamp unpoweredVersion) {
|
||||
super(Material.redstoneLight);
|
||||
|
||||
carverHelper = unpoweredVersion.carverHelper;
|
||||
@@ -39,7 +39,7 @@ public class BlockCarvablePillar extends BlockCarvable {
|
||||
var = carverHelper.infoList.get(0);
|
||||
return var.getSubmapManager().getIcon(0, metadata);
|
||||
|
||||
// TODO this...
|
||||
// TODO fix pillars
|
||||
// if (index >= 4)
|
||||
// return var.iconTop;
|
||||
// if (var.seamsCtmVert == null)
|
||||
|
||||
+2
-2
@@ -11,11 +11,11 @@ import net.minecraft.util.IIcon;
|
||||
|
||||
import com.cricketcraft.chisel.api.carving.CarvableHelper;
|
||||
|
||||
public class BlockMarbleWall extends BlockWall {
|
||||
public class BlockCarvableWall extends BlockWall {
|
||||
|
||||
CarvableHelper carverHelper;
|
||||
|
||||
public BlockMarbleWall(Block block) {
|
||||
public BlockCarvableWall(Block block) {
|
||||
super(block);
|
||||
|
||||
carverHelper = new CarvableHelper(this);
|
||||
@@ -23,7 +23,7 @@ public class RenderBlocksCTM extends RenderBlocks {
|
||||
* ZERO is a special case, it is the absolute min point of the block. X, Y, Z, or any combination means that the axes listed in the name are at 1. X, Y, Z, or any combination followed by HALF
|
||||
* means that those axes are at 0.5. X, Y, Z, or any combination after a HALF means those axes are at 1.
|
||||
*/
|
||||
enum Vert {
|
||||
protected enum Vert {
|
||||
// @formatter:off
|
||||
ZERO(0, 0, 0),
|
||||
XYZ(1, 1, 1),
|
||||
@@ -108,7 +108,7 @@ public class RenderBlocksCTM extends RenderBlocks {
|
||||
*
|
||||
* Each sub-side contains 4 {@link Vert} objects representing its position on the block.
|
||||
*/
|
||||
enum SubSide {
|
||||
protected enum SubSide {
|
||||
// @formatter:off
|
||||
XNEG_LB(ZERO, Z_HALF, YZ_HALF, Y_HALF), XNEG_RB(Z_HALF, Z, Y_HALF_Z, YZ_HALF), XNEG_RT(YZ_HALF, Y_HALF_Z, YZ, Z_HALF_Y), XNEG_LT(Y_HALF, YZ_HALF, Z_HALF_Y, Y),
|
||||
XPOS_LB(XZ, Z_HALF_X, YZ_HALF_X, Y_HALF_XZ), XPOS_RB(Z_HALF_X, X, Y_HALF_X, YZ_HALF_X), XPOS_RT(YZ_HALF_X, Y_HALF_X, XY, Z_HALF_XY), XPOS_LT(Y_HALF_XZ, YZ_HALF_X, Z_HALF_XY, XYZ),
|
||||
@@ -152,38 +152,39 @@ public class RenderBlocksCTM extends RenderBlocks {
|
||||
}
|
||||
}
|
||||
|
||||
private static CTM ctm = CTM.getInstance();
|
||||
protected static CTM ctm = CTM.getInstance();
|
||||
|
||||
// globals added to save the JVM some trouble. No need to constantly create
|
||||
// and destroy ints if we don't have to
|
||||
int blockLightBitChannel = 0;
|
||||
int redBitChannel = 0;
|
||||
int greenBitChannel = 0;
|
||||
int blueBitChannel = 0;
|
||||
int sunlightBitChannel = 0;
|
||||
protected int blockLightBitChannel = 0;
|
||||
protected int redBitChannel = 0;
|
||||
protected int greenBitChannel = 0;
|
||||
protected int blueBitChannel = 0;
|
||||
protected int sunlightBitChannel = 0;
|
||||
|
||||
public RenderBlocksCTM() {
|
||||
super();
|
||||
renderMaxX = renderMaxY = renderMaxZ = 1;
|
||||
}
|
||||
|
||||
Tessellator tessellator;
|
||||
double minU, maxU;
|
||||
double minV, maxV;
|
||||
int[] lightingCache = new int[4];
|
||||
float[] redCache = new float[4];
|
||||
float[] grnCache = new float[4];
|
||||
float[] bluCache = new float[4];
|
||||
protected Tessellator tessellator;
|
||||
protected double minU, maxU;
|
||||
protected double minV, maxV;
|
||||
protected int[] lightingCache = new int[4];
|
||||
protected float[] redCache = new float[4];
|
||||
protected float[] grnCache = new float[4];
|
||||
protected float[] bluCache = new float[4];
|
||||
public TextureSubmap submap;
|
||||
public TextureSubmap submapSmall;
|
||||
public RenderBlocks rendererOld;
|
||||
public ISubmapManager<RenderBlocksCTM> manager;
|
||||
|
||||
int[][] lightmap = new int[3][3];
|
||||
float[][] redmap = new float[3][3];
|
||||
float[][] grnmap = new float[3][3];
|
||||
float[][] blumap = new float[3][3];
|
||||
protected int[][] lightmap = new int[3][3];
|
||||
protected float[][] redmap = new float[3][3];
|
||||
protected float[][] grnmap = new float[3][3];
|
||||
protected float[][] blumap = new float[3][3];
|
||||
|
||||
int bx, by, bz;
|
||||
protected int bx, by, bz;
|
||||
|
||||
@Override
|
||||
public boolean renderStandardBlock(Block block, int x, int y, int z) {
|
||||
@@ -220,7 +221,7 @@ public class RenderBlocksCTM extends RenderBlocks {
|
||||
* shakes fist in anger
|
||||
*/
|
||||
// @formatter:on
|
||||
void fillLightmap(int bottomLeft, int bottomRight, int topRight, int topLeft) {
|
||||
protected void fillLightmap(int bottomLeft, int bottomRight, int topRight, int topLeft) {
|
||||
lightmap[0][0] = bottomLeft;
|
||||
lightmap[2][0] = bottomRight;
|
||||
lightmap[2][2] = topRight;
|
||||
@@ -234,7 +235,7 @@ public class RenderBlocksCTM extends RenderBlocks {
|
||||
lightmap[1][1] = avg(bottomLeft, bottomRight, topRight, topLeft);
|
||||
}
|
||||
|
||||
void fillColormap(float bottomLeft, float bottomRight, float topRight, float topLeft, float[][] map) {
|
||||
protected void fillColormap(float bottomLeft, float bottomRight, float topRight, float topLeft, float[][] map) {
|
||||
map[0][0] = bottomLeft;
|
||||
map[2][0] = bottomRight;
|
||||
map[2][2] = topRight;
|
||||
@@ -248,7 +249,7 @@ public class RenderBlocksCTM extends RenderBlocks {
|
||||
map[1][1] = (bottomLeft + bottomRight + topRight + topLeft) / 4.0F;
|
||||
}
|
||||
|
||||
void getLight(int x, int y) {
|
||||
protected void getLight(int x, int y) {
|
||||
lightingCache[0] = lightmap[0 + x][0 + y];
|
||||
lightingCache[1] = lightmap[1 + x][0 + y];
|
||||
lightingCache[2] = lightmap[1 + x][1 + y];
|
||||
@@ -273,7 +274,7 @@ public class RenderBlocksCTM extends RenderBlocks {
|
||||
/**
|
||||
* This works around a bug in CLC atm
|
||||
*/
|
||||
int avg(int... lightVals) {
|
||||
private int avg(int... lightVals) {
|
||||
blockLightBitChannel = 0;
|
||||
redBitChannel = 0;
|
||||
greenBitChannel = 0;
|
||||
@@ -292,7 +293,7 @@ public class RenderBlocksCTM extends RenderBlocks {
|
||||
| ((blueBitChannel / lightVals.length) & 0xF0000) | ((sunlightBitChannel / lightVals.length) & 0xF00000);
|
||||
}
|
||||
|
||||
void side(SubSide side, int iconIndex) {
|
||||
protected void side(SubSide side, int iconIndex) {
|
||||
|
||||
IIcon icon;
|
||||
TextureSubmap map;
|
||||
@@ -341,13 +342,13 @@ public class RenderBlocksCTM extends RenderBlocks {
|
||||
} else {
|
||||
int tex[] = ctm.getSubmapIndices(blockAccess, bx, by, bz, 4);
|
||||
|
||||
pre(ForgeDirection.WEST);
|
||||
|
||||
fillLightmap(brightnessBottomRight, brightnessTopRight, brightnessTopLeft, brightnessBottomLeft);
|
||||
fillColormap(colorRedBottomRight, colorRedTopRight, colorRedTopLeft, colorRedBottomLeft, redmap);
|
||||
fillColormap(colorGreenBottomRight, colorGreenTopRight, colorGreenTopLeft, colorGreenBottomLeft, grnmap);
|
||||
fillColormap(colorBlueBottomRight, colorBlueTopRight, colorBlueTopLeft, colorBlueBottomLeft, blumap);
|
||||
|
||||
pre(ForgeDirection.WEST);
|
||||
|
||||
getLight(0, 0);
|
||||
side(XNEG_LB, tex[0]);
|
||||
getLight(1, 0);
|
||||
@@ -373,13 +374,13 @@ public class RenderBlocksCTM extends RenderBlocks {
|
||||
} else {
|
||||
int tex[] = ctm.getSubmapIndices(blockAccess, bx, by, bz, 5);
|
||||
|
||||
pre(ForgeDirection.EAST);
|
||||
|
||||
fillLightmap(brightnessTopLeft, brightnessBottomLeft, brightnessBottomRight, brightnessTopRight);
|
||||
fillColormap(colorRedTopLeft, colorRedBottomLeft, colorRedBottomRight, colorRedTopRight, redmap);
|
||||
fillColormap(colorGreenTopLeft, colorGreenBottomLeft, colorGreenBottomRight, colorGreenTopRight, grnmap);
|
||||
fillColormap(colorBlueTopLeft, colorBlueBottomLeft, colorBlueBottomRight, colorBlueTopRight, blumap);
|
||||
|
||||
pre(ForgeDirection.EAST);
|
||||
|
||||
|
||||
getLight(0, 0);
|
||||
side(XPOS_LB, tex[0]);
|
||||
getLight(1, 0);
|
||||
@@ -391,7 +392,6 @@ public class RenderBlocksCTM extends RenderBlocks {
|
||||
|
||||
post(ForgeDirection.EAST);
|
||||
}
|
||||
rendererOld.clearOverrideBlockTexture();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -406,13 +406,13 @@ public class RenderBlocksCTM extends RenderBlocks {
|
||||
} else {
|
||||
int tex[] = ctm.getSubmapIndices(blockAccess, bx, by, bz, 2);
|
||||
|
||||
pre(ForgeDirection.NORTH);
|
||||
|
||||
fillLightmap(brightnessBottomRight, brightnessTopRight, brightnessTopLeft, brightnessBottomLeft);
|
||||
fillColormap(colorRedBottomRight, colorRedTopRight, colorRedTopLeft, colorRedBottomLeft, redmap);
|
||||
fillColormap(colorGreenBottomRight, colorGreenTopRight, colorGreenTopLeft, colorGreenBottomLeft, grnmap);
|
||||
fillColormap(colorBlueBottomRight, colorBlueTopRight, colorBlueTopLeft, colorBlueBottomLeft, blumap);
|
||||
|
||||
pre(ForgeDirection.NORTH);
|
||||
|
||||
getLight(0, 0);
|
||||
side(ZNEG_LB, tex[0]);
|
||||
getLight(1, 0);
|
||||
@@ -424,7 +424,6 @@ public class RenderBlocksCTM extends RenderBlocks {
|
||||
|
||||
post(ForgeDirection.NORTH);
|
||||
}
|
||||
rendererOld.clearOverrideBlockTexture();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -439,12 +438,12 @@ public class RenderBlocksCTM extends RenderBlocks {
|
||||
} else {
|
||||
int tex[] = ctm.getSubmapIndices(blockAccess, bx, by, bz, 3);
|
||||
|
||||
pre(ForgeDirection.SOUTH);
|
||||
|
||||
fillLightmap(brightnessBottomLeft, brightnessBottomRight, brightnessTopRight, brightnessTopLeft);
|
||||
fillColormap(colorRedBottomLeft, colorRedBottomRight, colorRedTopRight, colorRedTopLeft, redmap);
|
||||
fillColormap(colorGreenBottomLeft, colorGreenBottomRight, colorGreenTopRight, colorGreenTopLeft, grnmap);
|
||||
fillColormap(colorBlueBottomLeft, colorBlueBottomRight, colorBlueTopRight, colorBlueTopLeft, blumap);
|
||||
|
||||
pre(ForgeDirection.SOUTH);
|
||||
|
||||
getLight(0, 0);
|
||||
side(ZPOS_LB, tex[0]);
|
||||
@@ -457,7 +456,6 @@ public class RenderBlocksCTM extends RenderBlocks {
|
||||
|
||||
post(ForgeDirection.SOUTH);
|
||||
}
|
||||
rendererOld.clearOverrideBlockTexture();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -472,13 +470,13 @@ public class RenderBlocksCTM extends RenderBlocks {
|
||||
} else {
|
||||
int tex[] = ctm.getSubmapIndices(blockAccess, bx, by, bz, 0);
|
||||
|
||||
pre(ForgeDirection.DOWN);
|
||||
|
||||
fillLightmap(brightnessBottomLeft, brightnessBottomRight, brightnessTopRight, brightnessTopLeft);
|
||||
fillColormap(colorRedBottomLeft, colorRedBottomRight, colorRedTopRight, colorRedTopLeft, redmap);
|
||||
fillColormap(colorGreenBottomLeft, colorGreenBottomRight, colorGreenTopRight, colorGreenTopLeft, grnmap);
|
||||
fillColormap(colorBlueBottomLeft, colorBlueBottomRight, colorBlueTopRight, colorBlueTopLeft, blumap);
|
||||
|
||||
pre(ForgeDirection.DOWN);
|
||||
|
||||
|
||||
getLight(0, 0);
|
||||
side(YNEG_LB, tex[0]);
|
||||
getLight(1, 0);
|
||||
@@ -490,7 +488,6 @@ public class RenderBlocksCTM extends RenderBlocks {
|
||||
|
||||
post(ForgeDirection.DOWN);
|
||||
}
|
||||
rendererOld.clearOverrideBlockTexture();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -505,13 +502,13 @@ public class RenderBlocksCTM extends RenderBlocks {
|
||||
} else {
|
||||
int tex[] = ctm.getSubmapIndices(blockAccess, bx, by, bz, 1);
|
||||
|
||||
pre(ForgeDirection.UP);
|
||||
|
||||
fillLightmap(brightnessTopRight, brightnessTopLeft, brightnessBottomLeft, brightnessBottomRight);
|
||||
fillColormap(colorRedTopRight, colorRedTopLeft, colorRedBottomLeft, colorRedBottomRight, redmap);
|
||||
fillColormap(colorGreenTopRight, colorGreenTopLeft, colorGreenBottomLeft, colorGreenBottomRight, grnmap);
|
||||
fillColormap(colorBlueTopRight, colorBlueTopLeft, colorBlueBottomLeft, colorBlueBottomRight, blumap);
|
||||
|
||||
pre(ForgeDirection.UP);
|
||||
|
||||
getLight(0, 0);
|
||||
side(YPOS_LB, tex[0]);
|
||||
getLight(1, 0);
|
||||
@@ -523,14 +520,13 @@ public class RenderBlocksCTM extends RenderBlocks {
|
||||
|
||||
post(ForgeDirection.UP);
|
||||
}
|
||||
rendererOld.clearOverrideBlockTexture();
|
||||
}
|
||||
|
||||
private void pre(ForgeDirection face) {
|
||||
protected void pre(ForgeDirection face) {
|
||||
manager.preRenderSide(this, blockAccess, bx, by, bz, face);
|
||||
}
|
||||
|
||||
private void post(ForgeDirection face) {
|
||||
protected void post(ForgeDirection face) {
|
||||
manager.postRenderSide(this, blockAccess, bx, by, bz, face);
|
||||
}
|
||||
}
|
||||
@@ -1,310 +0,0 @@
|
||||
package com.cricketcraft.chisel.client.render;
|
||||
|
||||
import com.cricketcraft.chisel.api.rendering.CTM;
|
||||
import com.cricketcraft.chisel.api.rendering.TextureSubmap;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.util.IIcon;
|
||||
|
||||
// TODO rewrite this to use the updated RenderBlocksCTM code
|
||||
public class RenderBlocksCTMFullbright extends RenderBlocks {
|
||||
|
||||
private static CTM ctm = CTM.getInstance();
|
||||
|
||||
RenderBlocksCTMFullbright() {
|
||||
super();
|
||||
resetVertices();
|
||||
}
|
||||
|
||||
Tessellator tessellator;
|
||||
double[] X = new double[26];
|
||||
double[] Y = new double[26];
|
||||
double[] Z = new double[26];
|
||||
double[] U = new double[26];
|
||||
double[] V = new double[26];
|
||||
TextureSubmap submap;
|
||||
TextureSubmap submapSmall;
|
||||
RenderBlocks rendererOld;
|
||||
|
||||
int bx, by, bz;
|
||||
|
||||
@Override
|
||||
public boolean renderStandardBlock(Block block, int x, int y, int z) {
|
||||
bx = x;
|
||||
by = y;
|
||||
bz = z;
|
||||
|
||||
tessellator = Tessellator.instance;
|
||||
tessellator.setColorOpaque_F(1.0F, 1.0F, 1.0F);
|
||||
|
||||
tessellator.addTranslation(x, y, z);
|
||||
|
||||
boolean res = super.renderStandardBlock(block, x, y, z);
|
||||
|
||||
tessellator.addTranslation(-x, -y, -z);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
void side(int a, int b, int c, int d, int iconIndex, boolean flip) {
|
||||
IIcon icon;
|
||||
TextureSubmap map;
|
||||
if (iconIndex >= 16) {
|
||||
iconIndex -= 16;
|
||||
map = submapSmall;
|
||||
} else {
|
||||
map = submap;
|
||||
}
|
||||
int x = iconIndex % map.getWidth();
|
||||
int y = iconIndex / map.getHeight();
|
||||
icon = map.getSubIcon(x, y);
|
||||
|
||||
double u0 = icon.getMaxU();
|
||||
double u1 = icon.getMinU();
|
||||
double v0 = icon.getMaxV();
|
||||
double v1 = icon.getMinV();
|
||||
|
||||
U[a] = flip ? u1 : u1;
|
||||
U[b] = flip ? u0 : u1;
|
||||
U[c] = flip ? u0 : u0;
|
||||
U[d] = flip ? u1 : u0;
|
||||
|
||||
V[a] = flip ? v1 : v1;
|
||||
V[b] = flip ? v1 : v0;
|
||||
V[c] = flip ? v0 : v0;
|
||||
V[d] = flip ? v0 : v1;
|
||||
|
||||
vert(a);
|
||||
vert(b);
|
||||
vert(c);
|
||||
vert(d);
|
||||
}
|
||||
|
||||
void vert(int index) {
|
||||
tessellator.setColorOpaque_F(1.0F, 1.0F, 1.0F);
|
||||
tessellator.setBrightness(0xF000F0);
|
||||
tessellator.addVertexWithUV(X[index], Y[index], Z[index], U[index], V[index]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderFaceXNeg(Block block, double x, double y, double z, IIcon icon) {
|
||||
if (rendererOld != null && rendererOld.hasOverrideBlockTexture()) {
|
||||
IIcon i = rendererOld.overrideBlockTexture;
|
||||
|
||||
tessellator.addVertexWithUV(0.0, 1.0, 0.0, i.getMinU(), i.getMinV());
|
||||
tessellator.addVertexWithUV(0.0, 0.0, 0.0, i.getMinU(), i.getMaxV());
|
||||
tessellator.addVertexWithUV(0.0, 0.0, 1.0, i.getMaxU(), i.getMaxV());
|
||||
tessellator.addVertexWithUV(0.0, 1.0, 1.0, i.getMaxU(), i.getMinV());
|
||||
} else {
|
||||
int tex[] = ctm.getSubmapIndices(blockAccess, bx, by, bz, 4);
|
||||
|
||||
side(1, 14, 9, 23, tex[0], false);
|
||||
side(23, 9, 17, 5, tex[1], false);
|
||||
side(9, 19, 4, 17, tex[3], false);
|
||||
side(14, 0, 19, 9, tex[2], false);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderFaceXPos(Block block, double x, double y, double z, IIcon icon) {
|
||||
if (rendererOld != null && rendererOld.hasOverrideBlockTexture()) {
|
||||
IIcon i = rendererOld.overrideBlockTexture;
|
||||
|
||||
tessellator.addVertexWithUV(1.0, 1.0, 1.0, i.getMaxU(), i.getMinV());
|
||||
tessellator.addVertexWithUV(1.0, 0.0, 1.0, i.getMaxU(), i.getMaxV());
|
||||
tessellator.addVertexWithUV(1.0, 0.0, 0.0, i.getMinU(), i.getMaxV());
|
||||
tessellator.addVertexWithUV(1.0, 1.0, 0.0, i.getMinU(), i.getMinV());
|
||||
} else {
|
||||
int tex[] = ctm.getSubmapIndices(blockAccess, bx, by, bz, 5);
|
||||
|
||||
side(11, 21, 3, 15, tex[3], false);
|
||||
side(16, 7, 21, 11, tex[2], false);
|
||||
side(25, 11, 15, 2, tex[1], false);
|
||||
side(6, 16, 11, 25, tex[0], false);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderFaceZNeg(Block block, double x, double y, double z, IIcon icon) {
|
||||
if (rendererOld != null && rendererOld.hasOverrideBlockTexture()) {
|
||||
IIcon i = rendererOld.overrideBlockTexture;
|
||||
|
||||
tessellator.addVertexWithUV(1.0, 1.0, 0.0, i.getMaxU(), i.getMinV());
|
||||
tessellator.addVertexWithUV(1.0, 0.0, 0.0, i.getMaxU(), i.getMaxV());
|
||||
tessellator.addVertexWithUV(0.0, 0.0, 0.0, i.getMinU(), i.getMaxV());
|
||||
tessellator.addVertexWithUV(0.0, 1.0, 0.0, i.getMinU(), i.getMinV());
|
||||
} else {
|
||||
int tex[] = ctm.getSubmapIndices(blockAccess, bx, by, bz, 2);
|
||||
|
||||
side(2, 15, 8, 22, tex[0], false);
|
||||
side(15, 3, 18, 8, tex[2], false);
|
||||
side(8, 18, 0, 14, tex[3], false);
|
||||
side(22, 8, 14, 1, tex[1], false);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderFaceZPos(Block block, double x, double y, double z, IIcon icon) {
|
||||
if (rendererOld != null && rendererOld.hasOverrideBlockTexture()) {
|
||||
IIcon i = rendererOld.overrideBlockTexture;
|
||||
|
||||
tessellator.addVertexWithUV(0.0, 1.0, 1.0, i.getMinU(), i.getMinV());
|
||||
tessellator.addVertexWithUV(0.0, 0.0, 1.0, i.getMinU(), i.getMaxV());
|
||||
tessellator.addVertexWithUV(1.0, 0.0, 1.0, i.getMaxU(), i.getMaxV());
|
||||
tessellator.addVertexWithUV(1.0, 1.0, 1.0, i.getMaxU(), i.getMinV());
|
||||
} else {
|
||||
int tex[] = ctm.getSubmapIndices(blockAccess, bx, by, bz, 3);
|
||||
|
||||
side(17, 4, 20, 10, tex[2], false);
|
||||
side(5, 17, 10, 24, tex[0], false);
|
||||
side(24, 10, 16, 6, tex[1], false);
|
||||
side(10, 20, 7, 16, tex[3], false);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderFaceYNeg(Block block, double x, double y, double z, IIcon icon) {
|
||||
if (rendererOld != null && rendererOld.hasOverrideBlockTexture()) {
|
||||
IIcon i = rendererOld.overrideBlockTexture;
|
||||
|
||||
tessellator.addVertexWithUV(0.0, 0.0, 1.0, i.getMinU(), i.getMaxV());
|
||||
tessellator.addVertexWithUV(0.0, 0.0, 0.0, i.getMinU(), i.getMinV());
|
||||
tessellator.addVertexWithUV(1.0, 0.0, 0.0, i.getMaxU(), i.getMinV());
|
||||
tessellator.addVertexWithUV(1.0, 0.0, 1.0, i.getMaxU(), i.getMaxV());
|
||||
} else {
|
||||
int tex[] = ctm.getSubmapIndices(blockAccess, bx, by, bz, 0);
|
||||
|
||||
side(13, 21, 7, 20, tex[3], true);
|
||||
side(19, 13, 20, 4, tex[2], true);
|
||||
side(0, 18, 13, 19, tex[0], true);
|
||||
side(18, 3, 21, 13, tex[1], true);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderFaceYPos(Block block, double x, double y, double z, IIcon icon) {
|
||||
if (rendererOld != null && rendererOld.hasOverrideBlockTexture()) {
|
||||
IIcon i = rendererOld.overrideBlockTexture;
|
||||
|
||||
tessellator.addVertexWithUV(0.0, 1.0, 0.0, i.getMinU(), i.getMinV());
|
||||
tessellator.addVertexWithUV(0.0, 1.0, 1.0, i.getMinU(), i.getMaxV());
|
||||
tessellator.addVertexWithUV(1.0, 1.0, 1.0, i.getMaxU(), i.getMaxV());
|
||||
tessellator.addVertexWithUV(1.0, 1.0, 0.0, i.getMaxU(), i.getMinV());
|
||||
} else {
|
||||
int tex[] = ctm.getSubmapIndices(blockAccess, bx, by, bz, 1);
|
||||
|
||||
side(12, 24, 6, 25, tex[3], false);
|
||||
side(22, 12, 25, 2, tex[1], false);
|
||||
side(1, 23, 12, 22, tex[0], false);
|
||||
side(23, 5, 24, 12, tex[2], false);
|
||||
}
|
||||
}
|
||||
|
||||
void resetVertices() {
|
||||
X[0] = 0;
|
||||
Z[0] = 0;
|
||||
Y[0] = 0;
|
||||
|
||||
X[1] = 0;
|
||||
Z[1] = 0;
|
||||
Y[1] = 1;
|
||||
|
||||
X[2] = 1;
|
||||
Z[2] = 0;
|
||||
Y[2] = 1;
|
||||
|
||||
X[3] = 1;
|
||||
Z[3] = 0;
|
||||
Y[3] = 0;
|
||||
|
||||
X[4] = 0;
|
||||
Z[4] = 1;
|
||||
Y[4] = 0;
|
||||
|
||||
X[5] = 0;
|
||||
Z[5] = 1;
|
||||
Y[5] = 1;
|
||||
|
||||
X[6] = 1;
|
||||
Z[6] = 1;
|
||||
Y[6] = 1;
|
||||
|
||||
X[7] = 1;
|
||||
Z[7] = 1;
|
||||
Y[7] = 0;
|
||||
|
||||
X[8] = 0.5;
|
||||
Z[8] = 0;
|
||||
Y[8] = 0.5;
|
||||
|
||||
X[9] = 0;
|
||||
Z[9] = 0.5;
|
||||
Y[9] = 0.5;
|
||||
|
||||
X[10] = 0.5;
|
||||
Z[10] = 1;
|
||||
Y[10] = 0.5;
|
||||
|
||||
X[11] = 1;
|
||||
Z[11] = 0.5;
|
||||
Y[11] = 0.5;
|
||||
|
||||
X[12] = 0.5;
|
||||
Z[12] = 0.5;
|
||||
Y[12] = 1;
|
||||
|
||||
X[13] = 0.5;
|
||||
Z[13] = 0.5;
|
||||
Y[13] = 0;
|
||||
|
||||
X[14] = 0;
|
||||
Z[14] = 0;
|
||||
Y[14] = 0.5;
|
||||
|
||||
X[15] = 1;
|
||||
Z[15] = 0;
|
||||
Y[15] = 0.5;
|
||||
|
||||
X[16] = 1;
|
||||
Z[16] = 1;
|
||||
Y[16] = 0.5;
|
||||
|
||||
X[17] = 0;
|
||||
Z[17] = 1;
|
||||
Y[17] = 0.5;
|
||||
|
||||
X[18] = 0.5;
|
||||
Z[18] = 0;
|
||||
Y[18] = 0;
|
||||
|
||||
X[19] = 0;
|
||||
Z[19] = 0.5;
|
||||
Y[19] = 0;
|
||||
|
||||
X[20] = 0.5;
|
||||
Z[20] = 1;
|
||||
Y[20] = 0;
|
||||
|
||||
X[21] = 1;
|
||||
Z[21] = 0.5;
|
||||
Y[21] = 0;
|
||||
|
||||
X[22] = 0.5;
|
||||
Z[22] = 0;
|
||||
Y[22] = 1;
|
||||
|
||||
X[23] = 0;
|
||||
Z[23] = 0.5;
|
||||
Y[23] = 1;
|
||||
|
||||
X[24] = 0.5;
|
||||
Z[24] = 1;
|
||||
Y[24] = 1;
|
||||
|
||||
X[25] = 1;
|
||||
Z[25] = 0.5;
|
||||
Y[25] = 1;
|
||||
}
|
||||
}
|
||||
@@ -42,9 +42,11 @@ public class RendererCTM implements ISimpleBlockRenderingHandler {
|
||||
|
||||
if (!rendererOld.hasOverrideBlockTexture() && var != null) {
|
||||
RenderBlocks rb = var.getSubmapManager().createRenderContext(rendererOld, world);
|
||||
if (rb != null) {
|
||||
if (rb.getClass() == RenderBlocksCTM.class) {
|
||||
if (rb != null && rb != rendererOld) {
|
||||
rb.blockAccess = world;
|
||||
if (rb instanceof RenderBlocksCTM) {
|
||||
((RenderBlocksCTM)rb).manager = (ISubmapManager<RenderBlocksCTM>) var.getSubmapManager();
|
||||
((RenderBlocksCTM)rb).rendererOld = rendererOld;
|
||||
}
|
||||
return rb.renderStandardBlock(block, x, y, z);
|
||||
}
|
||||
|
||||
@@ -1,69 +0,0 @@
|
||||
package com.cricketcraft.chisel.client.render;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.cricketcraft.chisel.Chisel;
|
||||
import com.cricketcraft.chisel.utils.Drawing;
|
||||
|
||||
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
|
||||
import cpw.mods.fml.client.registry.RenderingRegistry;
|
||||
|
||||
public class RendererCTMFullbright implements ISimpleBlockRenderingHandler {
|
||||
|
||||
public RenderBlocksCTMFullbright rendererCTMNoLight = new RenderBlocksCTMFullbright();
|
||||
|
||||
public RendererCTMFullbright() {
|
||||
if (Chisel.renderCTMNoLightId == 0) {
|
||||
Chisel.renderCTMNoLightId = RenderingRegistry.getNextAvailableRenderId();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) {
|
||||
GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
Drawing.drawBlock(block, metadata, renderer);
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
GL11.glTranslatef(0.5F, 0.5F, 0.5F);
|
||||
}
|
||||
|
||||
// TODO this needs to go...amalgamate into RendererCTM
|
||||
@Override
|
||||
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks rendererOld) {
|
||||
// int meta = world.getBlockMetadata(x, y, z);
|
||||
//
|
||||
// IVariationInfo var = ((ICarvable) block).getVariation(world, x, y, z, meta);
|
||||
//
|
||||
// if (var != null && var.getType() == TextureType.CTMX) {
|
||||
// rendererCTMNoLight.blockAccess = world;
|
||||
// rendererCTMNoLight.renderMaxX = 1.0;
|
||||
// rendererCTMNoLight.renderMaxY = 1.0;
|
||||
// rendererCTMNoLight.renderMaxZ = 1.0;
|
||||
//
|
||||
// rendererCTMNoLight.submap = var.submap;
|
||||
// rendererCTMNoLight.submapSmall = var.submapSmall;
|
||||
//
|
||||
// rendererCTMNoLight.rendererOld = rendererOld;
|
||||
//
|
||||
// return rendererCTMNoLight.renderStandardBlock(block, x, y, z);
|
||||
// } else {
|
||||
// return rendererOld.renderStandardBlock(block, x, y, z);
|
||||
// }
|
||||
return rendererOld.renderStandardBlock(block, x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRender3DInInventory(int renderId) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderId() {
|
||||
return Chisel.renderCTMNoLightId;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
package com.cricketcraft.chisel.client.render;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
|
||||
import com.cricketcraft.chisel.api.rendering.TextureSubmap;
|
||||
|
||||
public class SubmapManagerAntiblock extends SubmapManagerBase<RenderBlocksCTM> {
|
||||
|
||||
private static final RenderBlocksCTM rb = new RenderBlocksCTM() {
|
||||
|
||||
@Override
|
||||
protected void fillLightmap(int bottomLeft, int bottomRight, int topRight, int topLeft) {
|
||||
int maxLight = 0xF000F0;
|
||||
super.fillLightmap(maxLight, maxLight, maxLight, maxLight);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void fillColormap(float bottomLeft, float bottomRight, float topRight, float topLeft, float[][] map) {
|
||||
int color = 0xFFFFFF;
|
||||
super.fillColormap(color, color, color, color, map);
|
||||
}
|
||||
};
|
||||
|
||||
private String color;
|
||||
private TextureSubmap submap, submapSmall;
|
||||
|
||||
public SubmapManagerAntiblock(String color) {
|
||||
this.color = color;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(int side, int meta) {
|
||||
return submapSmall.getBaseIcon();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerIcons(String modName, Block block, IIconRegister register) {
|
||||
submap = new TextureSubmap(register.registerIcon(modName + ":antiblock/" + color + "-antiBlock-ctm"), 4, 4);
|
||||
submapSmall = new TextureSubmap(register.registerIcon(modName + ":antiblock/" + color + "-antiBlock"), 2, 2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RenderBlocksCTM createRenderContext(RenderBlocks rendererOld, IBlockAccess world) {
|
||||
rb.submap = submap;
|
||||
rb.submapSmall = submapSmall;
|
||||
return rb;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package com.cricketcraft.chisel.client.render;
|
||||
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import com.cricketcraft.chisel.api.rendering.ISubmapManager;
|
||||
|
||||
|
||||
public abstract class SubmapManagerBase<T extends RenderBlocks> implements ISubmapManager<T> {
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) {
|
||||
return getIcon(side, world.getBlockMetadata(x, y, z));
|
||||
}
|
||||
|
||||
@Override
|
||||
public T createRenderContext(RenderBlocks rendererOld, IBlockAccess world) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void preRenderSide(T renderer, IBlockAccess world, int x, int y, int z, ForgeDirection side) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postRenderSide(T renderer, IBlockAccess world, int x, int y, int z, ForgeDirection side) {
|
||||
}
|
||||
}
|
||||
@@ -5,20 +5,17 @@ import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import com.cricketcraft.chisel.api.rendering.ISubmapManager;
|
||||
import com.cricketcraft.chisel.api.rendering.TextureSubmap;
|
||||
|
||||
public class SubmapManagerCarpetFloor extends SubmapManagerBase<RenderBlocksCTM> {
|
||||
|
||||
public class SubmapManagerCarpetFloor implements ISubmapManager<RenderBlocksCTM> {
|
||||
|
||||
private static RenderBlocksCTM rb = new RenderBlocksCTM();
|
||||
|
||||
|
||||
private TextureSubmap submap;
|
||||
private TextureSubmap submapSmall;
|
||||
private String color;
|
||||
|
||||
|
||||
public SubmapManagerCarpetFloor(String color) {
|
||||
this.color = color;
|
||||
}
|
||||
@@ -42,23 +39,9 @@ public class SubmapManagerCarpetFloor implements ISubmapManager<RenderBlocksCTM>
|
||||
|
||||
@Override
|
||||
public RenderBlocksCTM createRenderContext(RenderBlocks rendererOld, IBlockAccess world) {
|
||||
rb.blockAccess = world;
|
||||
rb.renderMaxX = 1.0;
|
||||
rb.renderMaxY = 1f / 16f;
|
||||
rb.renderMaxZ = 1.0;
|
||||
|
||||
rb.submap = submap;
|
||||
rb.submapSmall = submapSmall;
|
||||
|
||||
rb.rendererOld = rendererOld;
|
||||
return rb;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void preRenderSide(RenderBlocksCTM renderer, IBlockAccess world, int x, int y, int z, ForgeDirection side) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postRenderSide(RenderBlocksCTM renderer, IBlockAccess world, int x, int y, int z, ForgeDirection side) {
|
||||
}
|
||||
}
|
||||
+1
-16
@@ -5,16 +5,14 @@ import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import com.cricketcraft.chisel.api.rendering.CTM;
|
||||
import com.cricketcraft.chisel.api.rendering.ISubmapManager;
|
||||
import com.cricketcraft.chisel.api.rendering.TextureSubmap;
|
||||
import com.cricketcraft.chisel.init.ChiselBlocks;
|
||||
|
||||
import static com.cricketcraft.chisel.api.rendering.Dir.*;
|
||||
|
||||
public class SubmapManagerFakeController implements ISubmapManager<RenderBlocks> {
|
||||
public class SubmapManagerFakeController extends SubmapManagerBase<RenderBlocks> {
|
||||
|
||||
private TextureSubmap map;
|
||||
private CTM ctm = CTM.getInstance();
|
||||
@@ -46,17 +44,4 @@ public class SubmapManagerFakeController implements ISubmapManager<RenderBlocks>
|
||||
public void registerIcons(String modName, Block block, IIconRegister register) {
|
||||
map = new TextureSubmap(register.registerIcon(modName + ":futura/WIP/controllerWIP-ctm"), 2, 2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RenderBlocks createRenderContext(RenderBlocks rendererOld, IBlockAccess world) {
|
||||
return rendererOld;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void preRenderSide(RenderBlocks renderer, IBlockAccess world, int x, int y, int z, ForgeDirection side) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postRenderSide(RenderBlocks renderer, IBlockAccess world, int x, int y, int z, ForgeDirection side) {
|
||||
}
|
||||
}
|
||||
@@ -43,15 +43,9 @@ public class SubmapManagerSlab implements ISubmapManager<RenderBlocksCTM> {
|
||||
|
||||
@Override
|
||||
public RenderBlocksCTM createRenderContext(RenderBlocks rendererOld, IBlockAccess world) {
|
||||
rb.blockAccess = world;
|
||||
rb.renderMaxX = 1.0;
|
||||
rb.renderMaxY = 1f / 2f;
|
||||
rb.renderMaxZ = 1.0;
|
||||
|
||||
rb.submap = submap;
|
||||
rb.submapSmall = submapSmall;
|
||||
|
||||
rb.rendererOld = rendererOld;
|
||||
return rb;
|
||||
}
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ public final class ChiselBlocks {
|
||||
public static final BlockCarvableSlab limestone_slab = null;
|
||||
public static final BlockCarvableSlab marble_pillar_slab = null;
|
||||
public static final BlockCarvable cobblestone = null;
|
||||
public static final BlockMarbleWall cobblestoneWall = null;
|
||||
public static final BlockCarvableWall cobblestoneWall = null;
|
||||
public static final BlockCarvableGlass glass = null;
|
||||
public static final BlockCarvableGlass glass2 = null;
|
||||
public static final BlockCarvablePane glass_pane = null;
|
||||
@@ -54,7 +54,7 @@ public final class ChiselBlocks {
|
||||
public static final BlockCarvable fantasyblock = null;
|
||||
public static final BlockCarvable fantasyblock2 = null;
|
||||
public static final BlockCarvable carpet_block = null;
|
||||
public static final BlockMarbleCarpet carpet = null;
|
||||
public static final BlockCarvableCarpet carpet = null;
|
||||
public static final BlockCarvable bookshelf = null;
|
||||
public static final BlockCarvable tyrian = null;
|
||||
public static final BlockCarvable dirt = null;
|
||||
|
||||
@@ -40,7 +40,6 @@ public class ClientProxy extends CommonProxy {
|
||||
RenderingRegistry.registerBlockHandler(new RendererEldritch());
|
||||
RenderingRegistry.registerBlockHandler(new RendererCTM());
|
||||
RenderingRegistry.registerBlockHandler(new RendererLayeredGlow());
|
||||
RenderingRegistry.registerBlockHandler(new RendererCTMFullbright());
|
||||
RenderingRegistry.registerBlockHandler(new RendererSimpleLayered());
|
||||
|
||||
RenderingRegistry.registerBlockHandler(new RendererMultiLayer());
|
||||
|
||||
Reference in new issue
Block a user