mirror of
https://github.com/GTNewHorizons/Chisel.git
synced 2026-11-16 10:45:02 +00:00
Some class renaming, move TextureSubmap to API and improve its methods
This commit is contained in:
1 parent
c2fa40d57e
commit
d50f2c9da5
36 files changed
+373
-294
No files matched your search
@@ -2666,7 +2666,7 @@ public enum Features {
|
||||
voidstone.carverHelper.registerAll(voidstone, "voidstone");
|
||||
Carving.chisel.registerOre("voidstone", "voidstone");
|
||||
|
||||
BlockMarbleTexturedOre voidstone2 = (BlockMarbleTexturedOre) new BlockMarbleTexturedOre(Material.rock, Chisel.MOD_ID + ":voidstone/animated/void").setStepSound(Block.soundTypeStone)
|
||||
BlockMultiLayer voidstone2 = (BlockMultiLayer) new BlockMultiLayer(Material.rock, Chisel.MOD_ID + ":voidstone/animated/void").setStepSound(Block.soundTypeStone)
|
||||
.setCreativeTab(ChiselTabs.tabStoneChiselBlocks).setHardness(5.0F).setResistance(10.0F);
|
||||
voidstone2.carverHelper.addVariation("tile.voidstone.0.desc", 0, "voidstone/animated/raw");
|
||||
voidstone2.carverHelper.addVariation("tile.voidstone.1.desc", 1, "voidstone/animated/quarters");
|
||||
|
||||
@@ -6,8 +6,16 @@ import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import static net.minecraftforge.common.util.ForgeDirection.*;
|
||||
|
||||
/**
|
||||
* Think of this class as a "Two dimensional ForgeDirection, with diagonals".
|
||||
* <p>
|
||||
* It represents the eight different directions a face of a block can connect with CTM, and contains the logic for determining if a block is indeed connected in that direction.
|
||||
* <p>
|
||||
* Note that, for example, {@link #TOP_RIGHT} does not mean connected to the {@link #TOP} and {@link #RIGHT}, but connected in the diagonal direction represented by {@link #TOP_RIGHT}. This is used
|
||||
* for inner corner rendering.
|
||||
*/
|
||||
public enum Dir {
|
||||
|
||||
// @formatter:off
|
||||
TOP(UP),
|
||||
TOP_RIGHT(UP, EAST),
|
||||
RIGHT(EAST),
|
||||
@@ -18,8 +26,11 @@ public enum Dir {
|
||||
TOP_LEFT(UP, WEST);
|
||||
// @formatter:on
|
||||
|
||||
private static final ForgeDirection NORMAL = SOUTH;
|
||||
/**
|
||||
* All values of this enum, used to prevent unnecessary allocation via {@link #values()}.
|
||||
*/
|
||||
public static final Dir[] VALUES = values();
|
||||
private static final ForgeDirection NORMAL = SOUTH;
|
||||
|
||||
private ForgeDirection[] dirs;
|
||||
|
||||
@@ -27,6 +38,27 @@ public enum Dir {
|
||||
this.dirs = dirs;
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds if this block is connected for the given side in this Dir.
|
||||
*
|
||||
* @param inst
|
||||
* The CTM instance to use for logic.
|
||||
* @param world
|
||||
* The world the block is in.
|
||||
* @param x
|
||||
* The x coordinate of your block.
|
||||
* @param y
|
||||
* The y coordinate of your block.
|
||||
* @param z
|
||||
* The z coordinate of your block.
|
||||
* @param sideIdx
|
||||
* The side index of the current face. This equivalent to {@link ForgeDirection#ordinal()}
|
||||
* @param block
|
||||
* The block being rendered.
|
||||
* @param meta
|
||||
* The metadata of the block.
|
||||
* @return True if the block is connected in the given Dir, false otherwise.
|
||||
*/
|
||||
public boolean isConnected(CTM inst, IBlockAccess world, int x, int y, int z, int sideIdx, Block block, int meta) {
|
||||
ForgeDirection side = getOrientation(sideIdx);
|
||||
ForgeDirection[] dirs = getNormalizedDirs(side);
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
package com.cricketcraft.chisel.api.client;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
|
||||
public interface ISubmapManager {
|
||||
|
||||
/**
|
||||
* Gets the icon for item rendering, based on side and item metadata.
|
||||
*
|
||||
* @param side
|
||||
* Side of the ItemBlock.
|
||||
* @param meta
|
||||
* Metadata of the ItemBlock.
|
||||
* @return The IIcon for rendering.
|
||||
*/
|
||||
IIcon getIcon(int side, int meta);
|
||||
|
||||
/**
|
||||
* Gets the icon for world rendering, based on world position and side.
|
||||
*/
|
||||
IIcon getIcon(IBlockAccess world, int x, int y, int z, int side);
|
||||
|
||||
/**
|
||||
* Hook for registering any custom icons you might need in this class. Will be called during the normal block method.
|
||||
*
|
||||
* @param modName
|
||||
* The mod ID this submap was registered to.
|
||||
* @param block
|
||||
* The block being registered for.
|
||||
* @param register
|
||||
* The IIconRegister instance.
|
||||
*/
|
||||
void registerIcons(String modName, Block block, IIconRegister register);
|
||||
}
|
||||
@@ -0,0 +1,164 @@
|
||||
package com.cricketcraft.chisel.api.client;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraftforge.client.event.TextureStitchEvent;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
/**
|
||||
* This class is used to split up a large IIcon into smaller "submapped" icons used for CTM and other texture manipulation.
|
||||
*/
|
||||
public class TextureSubmap {
|
||||
|
||||
private static List<TextureSubmap> submaps = Lists.newArrayList();
|
||||
private static TextureSubmap dummy = new TextureSubmap(null, 0, 0);
|
||||
static {
|
||||
MinecraftForge.EVENT_BUS.register(dummy);
|
||||
}
|
||||
|
||||
private int width, height;
|
||||
private IIcon baseIcon;
|
||||
private IIcon[][] icons;
|
||||
|
||||
/**
|
||||
* Construct a new submap. A submap is not required to be square, but it is required to be rectangular.
|
||||
*
|
||||
* @param baseIcon
|
||||
* The IIcon to submap.
|
||||
* @param width
|
||||
* The width of the map, in icons.
|
||||
* @param height
|
||||
* The height of the map, in icons.
|
||||
*/
|
||||
public TextureSubmap(IIcon baseIcon, int width, int height) {
|
||||
this.baseIcon = baseIcon;
|
||||
this.width = width;
|
||||
this.height = height;
|
||||
this.icons = new IIcon[width][height];
|
||||
submaps.add(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* The width, in icons, of the submap.
|
||||
*/
|
||||
public int getWidth() {
|
||||
return width;
|
||||
}
|
||||
|
||||
/**
|
||||
* The height, in icons, of the submap.
|
||||
*/
|
||||
public int getHeight() {
|
||||
return height;
|
||||
}
|
||||
|
||||
/**
|
||||
* The large "base" icon used for the submap.
|
||||
*/
|
||||
public IIcon getBaseIcon() {
|
||||
return baseIcon;
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds and returns the sub-icon at the given coordinates. For example, if you have a 3 by 3 submap, calling {@code getSubIcon(1, 1)} will return the center subicon.
|
||||
*/
|
||||
public IIcon getSubIcon(int x, int y) {
|
||||
x = x % icons.length;
|
||||
return icons[x][y % icons[x].length];
|
||||
}
|
||||
|
||||
/**
|
||||
* For internal use only, this is used to create the virtual "subicons" used in the map.
|
||||
*/
|
||||
@SubscribeEvent
|
||||
public final void TexturesStitched(TextureStitchEvent.Post event) {
|
||||
for (int x = 0; x < width; x++) {
|
||||
for (int y = 0; y < height; y++) {
|
||||
icons[x][y] = new TextureVirtual(getBaseIcon(), width, height, x, y);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private class TextureVirtual implements IIcon {
|
||||
|
||||
private int width, height;
|
||||
private float umin, umax, vmin, vmax;
|
||||
private String name;
|
||||
private IIcon parentIcon;
|
||||
|
||||
private TextureVirtual(IIcon parent, int w, int h, int x, int y) {
|
||||
parentIcon = parent;
|
||||
|
||||
umin = parentIcon.getInterpolatedU(16.0 * (x) / w);
|
||||
umax = parentIcon.getInterpolatedU(16.0 * (x + 1) / w);
|
||||
vmin = parentIcon.getInterpolatedV(16.0 * (y) / h);
|
||||
vmax = parentIcon.getInterpolatedV(16.0 * (y + 1) / h);
|
||||
|
||||
name = parentIcon.getIconName() + "|" + x + "." + y;
|
||||
|
||||
width = parentIcon.getIconWidth();
|
||||
height = parentIcon.getIconHeight();
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public float getMinU() {
|
||||
return umin;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public float getMaxU() {
|
||||
return umax;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public float getInterpolatedU(double d0) {
|
||||
return (float) (umin + (umax - umin) * d0 / 16.0);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public float getMinV() {
|
||||
return vmin;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public float getMaxV() {
|
||||
return vmax;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public float getInterpolatedV(double d0) {
|
||||
return (float) (vmin + (vmax - vmin) * d0 / 16.0);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public String getIconName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getIconWidth() {
|
||||
return width;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getIconHeight() {
|
||||
return height;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -14,7 +14,7 @@ import net.minecraft.world.IBlockAccess;
|
||||
import com.cricketcraft.chisel.api.ICarvable;
|
||||
import com.cricketcraft.chisel.carving.CarvableHelper;
|
||||
import com.cricketcraft.chisel.carving.CarvableVariation;
|
||||
import com.cricketcraft.chisel.client.render.BlockMarblePaneRenderer;
|
||||
import com.cricketcraft.chisel.client.render.RendererCTMPane;
|
||||
import com.cricketcraft.chisel.init.ChiselTabs;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
@@ -46,7 +46,7 @@ public class BlockCarvablePane extends BlockPane implements ICarvable {
|
||||
|
||||
@Override
|
||||
public int getRenderType() {
|
||||
return BlockMarblePaneRenderer.id;
|
||||
return RendererCTMPane.id;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -5,7 +5,7 @@ import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
|
||||
import com.cricketcraft.chisel.carving.CarvableVariation;
|
||||
import com.cricketcraft.chisel.client.render.BlockMarblePillarRenderer;
|
||||
import com.cricketcraft.chisel.client.render.RendererPillar;
|
||||
|
||||
public class BlockCarvablePillar extends BlockCarvable {
|
||||
|
||||
@@ -17,7 +17,7 @@ public class BlockCarvablePillar extends BlockCarvable {
|
||||
|
||||
@Override
|
||||
public int getRenderType() {
|
||||
return BlockMarblePillarRenderer.id;
|
||||
return RendererPillar.id;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -31,9 +31,9 @@ public class BlockCarvablePillar extends BlockCarvable {
|
||||
}
|
||||
|
||||
public IIcon getCtmIcon(int index, int metadata) {
|
||||
//Workaround to prevent crash with invalid meta
|
||||
// Workaround to prevent crash with invalid meta
|
||||
CarvableVariation var = null;
|
||||
if(metadata <= carverHelper.variations.size())
|
||||
if (metadata <= carverHelper.variations.size())
|
||||
var = carverHelper.variations.get(metadata);
|
||||
else
|
||||
var = carverHelper.variations.get(0);
|
||||
@@ -42,7 +42,7 @@ public class BlockCarvablePillar extends BlockCarvable {
|
||||
return var.iconTop;
|
||||
if (var.seamsCtmVert == null)
|
||||
return var.icon;
|
||||
return var.seamsCtmVert.icons[index];
|
||||
return var.seamsCtmVert.getSubIcon(index % 2, index / 2);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -17,7 +17,7 @@ import net.minecraft.world.World;
|
||||
import com.cricketcraft.chisel.api.ICarvable;
|
||||
import com.cricketcraft.chisel.carving.CarvableHelper;
|
||||
import com.cricketcraft.chisel.carving.CarvableVariation;
|
||||
import com.cricketcraft.chisel.client.render.BlockMarbleStairsRenderer;
|
||||
import com.cricketcraft.chisel.client.render.RendererStairs;
|
||||
|
||||
public class BlockCarvableStairs extends BlockStairs implements ICarvable {
|
||||
|
||||
@@ -57,7 +57,7 @@ public class BlockCarvableStairs extends BlockStairs implements ICarvable {
|
||||
|
||||
@Override
|
||||
public int getRenderType() {
|
||||
return BlockMarbleStairsRenderer.id;
|
||||
return RendererStairs.id;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -7,7 +7,7 @@ import net.minecraft.world.World;
|
||||
|
||||
import com.cricketcraft.chisel.client.GeneralChiselClient;
|
||||
|
||||
public class BlockLavastone extends BlockMarbleTexturedOre {
|
||||
public class BlockLavastone extends BlockMultiLayer {
|
||||
|
||||
public BlockLavastone(Material mat, String baseIcon) {
|
||||
super(mat, baseIcon);
|
||||
|
||||
+3
-3
@@ -15,17 +15,17 @@ import com.cricketcraft.chisel.api.ICarvable;
|
||||
import com.cricketcraft.chisel.carving.CarvableHelper;
|
||||
import com.cricketcraft.chisel.carving.CarvableVariation;
|
||||
|
||||
public class BlockMarbleTexturedOre extends BlockTexturedOre implements ICarvable {
|
||||
public class BlockMultiLayer extends BlockMultiLayerBase implements ICarvable {
|
||||
|
||||
public CarvableHelper carverHelper;
|
||||
|
||||
public BlockMarbleTexturedOre(Material mat, String baseIcon) {
|
||||
public BlockMultiLayer(Material mat, String baseIcon) {
|
||||
super(mat, baseIcon);
|
||||
|
||||
carverHelper = new CarvableHelper();
|
||||
}
|
||||
|
||||
public BlockMarbleTexturedOre(Material mat, Block block) {
|
||||
public BlockMultiLayer(Material mat, Block block) {
|
||||
super(mat, block);
|
||||
|
||||
carverHelper = new CarvableHelper();
|
||||
+5
-5
@@ -5,22 +5,22 @@ import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.util.IIcon;
|
||||
|
||||
import com.cricketcraft.chisel.client.render.BlockTexturedOreRenderer;
|
||||
import com.cricketcraft.chisel.client.render.RendererMultiLayer;
|
||||
|
||||
public class BlockTexturedOre extends Block {
|
||||
public abstract class BlockMultiLayerBase extends Block {
|
||||
|
||||
public int currentPass;
|
||||
public Block base;
|
||||
public IIcon icon;
|
||||
String iconFile;
|
||||
|
||||
public BlockTexturedOre(Material mat, Block base) {
|
||||
public BlockMultiLayerBase(Material mat, Block base) {
|
||||
super(mat);
|
||||
|
||||
this.base = base;
|
||||
}
|
||||
|
||||
public BlockTexturedOre(Material mat, String iconFile) {
|
||||
public BlockMultiLayerBase(Material mat, String iconFile) {
|
||||
super(mat);
|
||||
|
||||
this.iconFile = iconFile;
|
||||
@@ -33,7 +33,7 @@ public class BlockTexturedOre extends Block {
|
||||
|
||||
@Override
|
||||
public int getRenderType() {
|
||||
return BlockTexturedOreRenderer.id;
|
||||
return RendererMultiLayer.id;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -13,7 +13,7 @@ import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import com.cricketcraft.chisel.client.render.BlockSnakeStoneRenderer;
|
||||
import com.cricketcraft.chisel.client.render.RendererSnakeStone;
|
||||
|
||||
public class BlockSnakestone extends Block {
|
||||
|
||||
@@ -62,7 +62,7 @@ public class BlockSnakestone extends Block {
|
||||
|
||||
@Override
|
||||
public int getRenderType() {
|
||||
return BlockSnakeStoneRenderer.id;
|
||||
return RendererSnakeStone.id;
|
||||
}
|
||||
|
||||
static final int[] rotRemap = { 0, 3, 1, 2 };
|
||||
|
||||
@@ -2,7 +2,7 @@ package com.cricketcraft.chisel.block;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
|
||||
public class BlockWaterstone extends BlockMarbleTexturedOre {
|
||||
public class BlockWaterstone extends BlockMultiLayer {
|
||||
|
||||
public BlockWaterstone(Material mat, String baseIcon) {
|
||||
super(mat, baseIcon);
|
||||
|
||||
@@ -20,7 +20,7 @@ import org.apache.commons.lang3.ArrayUtils;
|
||||
import com.cricketcraft.chisel.Chisel;
|
||||
import com.cricketcraft.chisel.api.client.CTM;
|
||||
import com.cricketcraft.chisel.api.client.ISubmapManager;
|
||||
import com.cricketcraft.chisel.client.render.TextureSubmap;
|
||||
import com.cricketcraft.chisel.api.client.TextureSubmap;
|
||||
import com.cricketcraft.chisel.compat.fmp.FMPIMC;
|
||||
import com.cricketcraft.chisel.item.ItemCarvable;
|
||||
import com.cricketcraft.chisel.utils.GeneralClient;
|
||||
@@ -199,24 +199,24 @@ public class CarvableHelper {
|
||||
if (side < 2)
|
||||
return variation.iconTop;
|
||||
else
|
||||
return variation.seamsCtmVert.icons[0];
|
||||
return variation.seamsCtmVert.getSubIcon(0, 0);
|
||||
case CTMH:
|
||||
if (side < 2)
|
||||
return variation.iconTop;
|
||||
else
|
||||
return variation.seamsCtmVert.icons[0];
|
||||
return variation.seamsCtmVert.getSubIcon(0, 0);
|
||||
case V9:
|
||||
return variation.variations9.icons[4];
|
||||
return variation.variations9.getSubIcon(1, 1);
|
||||
case V4:
|
||||
return variation.variations9.icons[0];
|
||||
return variation.variations9.getSubIcon(0, 0);
|
||||
case CTMX:
|
||||
return variation.icon;
|
||||
case R16:
|
||||
return variation.variations9.icons[5];
|
||||
return variation.variations9.getSubIcon(1, 1);
|
||||
case R9:
|
||||
return variation.variations9.icons[4];
|
||||
return variation.variations9.getSubIcon(1, 1);
|
||||
case R4:
|
||||
return variation.variations9.icons[0];
|
||||
return variation.variations9.getSubIcon(0, 0);
|
||||
case CUSTOM:
|
||||
return variation.manager.getIcon(side, metadata);
|
||||
}
|
||||
@@ -239,13 +239,6 @@ public class CarvableHelper {
|
||||
case TOPSIDE:
|
||||
case TOPBOTSIDE:
|
||||
return getIcon(side, metadata);
|
||||
// case CTM3:
|
||||
// int tex = CTM.getTexture(world, x, y, z, side);
|
||||
//
|
||||
// int row = tex / 16;
|
||||
// int col = tex % 16;
|
||||
//
|
||||
// return variation.ctm.seams[col / 4].icons[col % 4 + row * 4];
|
||||
case CTMV: {
|
||||
if (side < 2)
|
||||
return variation.iconTop;
|
||||
@@ -255,12 +248,12 @@ public class CarvableHelper {
|
||||
boolean botConnected = ctm.isConnected(world, x, y - 1, z, side, block, metadata);
|
||||
|
||||
if (topConnected && botConnected)
|
||||
return variation.seamsCtmVert.icons[2];
|
||||
return variation.seamsCtmVert.getSubIcon(0, 1);
|
||||
if (topConnected && !botConnected)
|
||||
return variation.seamsCtmVert.icons[3];
|
||||
return variation.seamsCtmVert.getSubIcon(1, 1);
|
||||
if (!topConnected && botConnected)
|
||||
return variation.seamsCtmVert.icons[1];
|
||||
return variation.seamsCtmVert.icons[0];
|
||||
return variation.seamsCtmVert.getSubIcon(1, 0);
|
||||
return variation.seamsCtmVert.getSubIcon(0, 0);
|
||||
}
|
||||
case CTMH:
|
||||
if (side < 2)
|
||||
@@ -281,12 +274,12 @@ public class CarvableHelper {
|
||||
}
|
||||
|
||||
if (p && n)
|
||||
return variation.seamsCtmVert.icons[1];
|
||||
return variation.seamsCtmVert.getSubIcon(1, 0);
|
||||
else if (p)
|
||||
return variation.seamsCtmVert.icons[reverse ? 2 : 3];
|
||||
return variation.seamsCtmVert.getSubIcon(reverse ? 0 : 1, 1);
|
||||
else if (n)
|
||||
return variation.seamsCtmVert.icons[reverse ? 3 : 2];
|
||||
return variation.seamsCtmVert.icons[0];
|
||||
return variation.seamsCtmVert.getSubIcon(reverse ? 0 : 1, 1);
|
||||
return variation.seamsCtmVert.getSubIcon(0, 0);
|
||||
case V9:
|
||||
case V4:
|
||||
int variationSize = (variation.type == TextureType.V9) ? 3 : 2;
|
||||
@@ -320,7 +313,7 @@ public class CarvableHelper {
|
||||
index = textureZ + textureY * variationSize;
|
||||
}
|
||||
|
||||
return variation.variations9.icons[index];
|
||||
return variation.variations9.getSubIcon(index % variationSize, index / variationSize);
|
||||
case CTMX:
|
||||
return variation.icon;
|
||||
case R16:
|
||||
@@ -334,10 +327,11 @@ public class CarvableHelper {
|
||||
while (indexRan < 0) {
|
||||
indexRan = indexRan + 10000;
|
||||
}
|
||||
int size = variation.type == TextureType.V4 ? 2 : 3;
|
||||
|
||||
// rand.setSeed(indexRan); // Broken
|
||||
|
||||
return variation.variations9.icons[ /* rand */indexRan % ((variation.type == TextureType.R9) ? 9 : 4)];
|
||||
return variation.variations9.getSubIcon(indexRan % size, indexRan / size);
|
||||
case CUSTOM:
|
||||
return variation.manager.getIcon(world, x, y, z, side);
|
||||
}
|
||||
@@ -405,6 +399,8 @@ public class CarvableHelper {
|
||||
variation.iconTop = variation.block.getIcon(1, variation.blockMeta);
|
||||
variation.iconBot = variation.block.getIcon(0, variation.blockMeta);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@@ -421,13 +417,6 @@ public class CarvableHelper {
|
||||
variation.iconTop = register.registerIcon(modName + ":" + variation.texture + "-top");
|
||||
variation.iconBot = register.registerIcon(modName + ":" + variation.texture + "-bottom");
|
||||
break;
|
||||
// case CTM3:
|
||||
// CarvableVariationCTM ctm = new CarvableVariationCTM();
|
||||
// ctm.seams[0] = new TextureSubmap(register.registerIcon(modName + ":" + variation.texture + "-ctm1"), 4, 4);
|
||||
// ctm.seams[1] = new TextureSubmap(register.registerIcon(modName + ":" + variation.texture + "-ctm2"), 4, 4);
|
||||
// ctm.seams[2] = new TextureSubmap(register.registerIcon(modName + ":" + variation.texture + "-ctm3"), 4, 4);
|
||||
// variation.ctm = ctm;
|
||||
// break;
|
||||
case CTMV:
|
||||
variation.seamsCtmVert = new TextureSubmap(register.registerIcon(modName + ":" + variation.texture + "-ctmv"), 2, 2);
|
||||
variation.iconTop = register.registerIcon(modName + ":" + variation.texture + "-top");
|
||||
|
||||
@@ -5,8 +5,8 @@ import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.util.IIcon;
|
||||
|
||||
import com.cricketcraft.chisel.api.client.ISubmapManager;
|
||||
import com.cricketcraft.chisel.api.client.TextureSubmap;
|
||||
import com.cricketcraft.chisel.carving.CarvableHelper.TextureType;
|
||||
import com.cricketcraft.chisel.client.render.TextureSubmap;
|
||||
|
||||
public class CarvableVariation {
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ import com.cricketcraft.chisel.Chisel;
|
||||
|
||||
import cpw.mods.fml.client.registry.RenderingRegistry;
|
||||
|
||||
public class BlockCarpetRenderer extends BlockAdvancedMarbleRenderer {
|
||||
public class BlockCarpetRenderer extends RendererCTM {
|
||||
|
||||
public BlockCarpetRenderer() {
|
||||
super();
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.cricketcraft.chisel.client.render;
|
||||
|
||||
import com.cricketcraft.chisel.api.client.CTM;
|
||||
import com.cricketcraft.chisel.api.client.TextureSubmap;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
@@ -246,7 +247,17 @@ public class RenderBlocksCTM extends RenderBlocks {
|
||||
}
|
||||
|
||||
void side(SubSide side, int iconIndex) {
|
||||
IIcon icon = iconIndex >= 16 ? submapSmall.icons[iconIndex - 16] : submap.icons[iconIndex];
|
||||
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 umax = icon.getMaxU();
|
||||
double umin = icon.getMinU();
|
||||
|
||||
@@ -11,22 +11,22 @@ public class RenderBlocksCTMCarpet extends RenderBlocksCTM {
|
||||
|
||||
@Override
|
||||
public void renderFaceXNeg(Block block, double x, double y, double z, IIcon icon) {
|
||||
rendererOld.renderFaceXNeg(block, 0, 0, 0, submapSmall.icon);
|
||||
rendererOld.renderFaceXNeg(block, 0, 0, 0, submapSmall.getBaseIcon());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderFaceXPos(Block block, double x, double y, double z, IIcon icon) {
|
||||
rendererOld.renderFaceXPos(block, 0, 0, 0, submapSmall.icon);
|
||||
rendererOld.renderFaceXPos(block, 0, 0, 0, submapSmall.getBaseIcon());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderFaceZNeg(Block block, double x, double y, double z, IIcon icon) {
|
||||
rendererOld.renderFaceZNeg(block, 0, 0, 0, submapSmall.icon);
|
||||
rendererOld.renderFaceZNeg(block, 0, 0, 0, submapSmall.getBaseIcon());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderFaceZPos(Block block, double x, double y, double z, IIcon icon) {
|
||||
rendererOld.renderFaceZPos(block, 0, 0, 0, submapSmall.icon);
|
||||
rendererOld.renderFaceZPos(block, 0, 0, 0, submapSmall.getBaseIcon());
|
||||
}
|
||||
|
||||
}
|
||||
+16
-4
@@ -1,17 +1,19 @@
|
||||
package com.cricketcraft.chisel.client.render;
|
||||
|
||||
import com.cricketcraft.chisel.api.client.CTM;
|
||||
import com.cricketcraft.chisel.api.client.TextureSubmap;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.util.IIcon;
|
||||
|
||||
public class RenderBlocksCTMNoLight extends RenderBlocks {
|
||||
// TODO rewrite this to use the updated RenderBlocksCTM code
|
||||
public class RenderBlocksCTMFullbright extends RenderBlocks {
|
||||
|
||||
private static CTM ctm = CTM.getInstance();
|
||||
|
||||
RenderBlocksCTMNoLight() {
|
||||
RenderBlocksCTMFullbright() {
|
||||
super();
|
||||
resetVertices();
|
||||
}
|
||||
@@ -47,8 +49,18 @@ public class RenderBlocksCTMNoLight extends RenderBlocks {
|
||||
}
|
||||
|
||||
void side(int a, int b, int c, int d, int iconIndex, boolean flip) {
|
||||
IIcon icon = iconIndex >= 16 ? submapSmall.icons[iconIndex - 16] : submap.icons[iconIndex];
|
||||
|
||||
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();
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.cricketcraft.chisel.client.render;
|
||||
|
||||
import com.cricketcraft.chisel.api.client.CTM;
|
||||
import com.cricketcraft.chisel.api.client.TextureSubmap;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
@@ -35,11 +36,11 @@ public class RenderBlocksColumn extends RenderBlocks {
|
||||
sides[1] = iconTop;
|
||||
|
||||
if (yp && yn)
|
||||
sides[2] = submap.icons[2];
|
||||
sides[2] = submap.getSubIcon(0, 1);
|
||||
else if (yp)
|
||||
sides[2] = submap.icons[3];
|
||||
sides[2] = submap.getSubIcon(1, 1);
|
||||
else
|
||||
sides[2] = submap.icons[1];
|
||||
sides[2] = submap.getSubIcon(1, 0);
|
||||
|
||||
sides[3] = sides[4] = sides[5] = sides[2];
|
||||
} else {
|
||||
@@ -62,14 +63,14 @@ public class RenderBlocksColumn extends RenderBlocks {
|
||||
|
||||
// for some reason along the x axis the bottom texture on the ends is backwards. This flips it around.
|
||||
if (xp && xn) {
|
||||
sides[1] = submap.icons[2];
|
||||
sides[1] = submap.getSubIcon(0, 1);
|
||||
sides[0] = sides[1];
|
||||
} else if (xp) {
|
||||
sides[1] = submap.icons[3];
|
||||
sides[0] = submap.icons[1];
|
||||
sides[1] = submap.getSubIcon(1, 1);
|
||||
sides[0] = submap.getSubIcon(1, 0);
|
||||
} else {
|
||||
sides[1] = submap.icons[1];
|
||||
sides[0] = submap.icons[3];
|
||||
sides[1] = submap.getSubIcon(1, 0);
|
||||
sides[0] = submap.getSubIcon(1, 1);
|
||||
}
|
||||
sides[2] = sides[3] = sides[1];
|
||||
} else {
|
||||
@@ -93,16 +94,16 @@ public class RenderBlocksColumn extends RenderBlocks {
|
||||
sides[3] = iconTop;
|
||||
|
||||
if (zp && zn)
|
||||
sides[0] = submap.icons[2];
|
||||
sides[0] = submap.getSubIcon(0, 1);
|
||||
else if (zp)
|
||||
sides[0] = submap.icons[1];
|
||||
sides[0] = submap.getSubIcon(1, 0);
|
||||
else
|
||||
sides[0] = submap.icons[3];
|
||||
sides[0] = submap.getSubIcon(1, 1);
|
||||
|
||||
sides[1] = sides[4] = sides[5] = sides[0];
|
||||
} else {
|
||||
sides[0] = sides[1] = iconTop;
|
||||
sides[2] = sides[3] = sides[4] = sides[5] = submap.icons[0];
|
||||
sides[2] = sides[3] = sides[4] = sides[5] = submap.getSubIcon(0, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
-51
@@ -1,51 +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.utils.Drawing;
|
||||
|
||||
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
|
||||
import cpw.mods.fml.client.registry.RenderingRegistry;
|
||||
|
||||
public class RenderStandardBlockNoSunlight implements ISimpleBlockRenderingHandler {
|
||||
|
||||
static int id;
|
||||
|
||||
public RenderStandardBlockNoSunlight() {
|
||||
id = RenderingRegistry.getNextAvailableRenderId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderInventoryBlock(Block block, int meta, int modelID, RenderBlocks renderer) {
|
||||
GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
|
||||
Drawing.drawBlock(block, meta, renderer);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
|
||||
if (meta != 0)
|
||||
renderer.overrideBlockTexture = block.getIcon(0, meta);
|
||||
renderer.setRenderBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
|
||||
renderer.renderStandardBlockWithColorMultiplier(block, x, y, z, 1.0F, 1.0F, 1.0F);
|
||||
renderer.overrideBlockTexture = null;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRender3DInInventory(int renderId) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
}
|
||||
+2
-3
@@ -8,7 +8,6 @@ import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.cricketcraft.chisel.Chisel;
|
||||
import com.cricketcraft.chisel.api.ICarvable;
|
||||
import com.cricketcraft.chisel.carving.CarvableHelper;
|
||||
import com.cricketcraft.chisel.carving.CarvableHelper.TextureType;
|
||||
import com.cricketcraft.chisel.carving.CarvableVariation;
|
||||
import com.cricketcraft.chisel.utils.Drawing;
|
||||
@@ -16,12 +15,12 @@ import com.cricketcraft.chisel.utils.Drawing;
|
||||
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
|
||||
import cpw.mods.fml.client.registry.RenderingRegistry;
|
||||
|
||||
public class BlockAdvancedMarbleRenderer implements ISimpleBlockRenderingHandler {
|
||||
public class RendererCTM implements ISimpleBlockRenderingHandler {
|
||||
|
||||
public RenderBlocksCTM rendererCTM = new RenderBlocksCTM();
|
||||
RenderBlocksColumn rendererColumn = new RenderBlocksColumn();
|
||||
|
||||
public BlockAdvancedMarbleRenderer() {
|
||||
public RendererCTM() {
|
||||
if (Chisel.renderCTMId == 0) {
|
||||
Chisel.renderCTMId = RenderingRegistry.getNextAvailableRenderId();
|
||||
}
|
||||
+4
-5
@@ -8,19 +8,18 @@ import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.cricketcraft.chisel.Chisel;
|
||||
import com.cricketcraft.chisel.api.ICarvable;
|
||||
import com.cricketcraft.chisel.carving.CarvableHelper;
|
||||
import com.cricketcraft.chisel.carving.CarvableVariation;
|
||||
import com.cricketcraft.chisel.carving.CarvableHelper.TextureType;
|
||||
import com.cricketcraft.chisel.carving.CarvableVariation;
|
||||
import com.cricketcraft.chisel.utils.Drawing;
|
||||
|
||||
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
|
||||
import cpw.mods.fml.client.registry.RenderingRegistry;
|
||||
|
||||
public class BlockCTMNoLightRenderer implements ISimpleBlockRenderingHandler {
|
||||
public class RendererCTMFullbright implements ISimpleBlockRenderingHandler {
|
||||
|
||||
public RenderBlocksCTMNoLight rendererCTMNoLight = new RenderBlocksCTMNoLight();
|
||||
public RenderBlocksCTMFullbright rendererCTMNoLight = new RenderBlocksCTMFullbright();
|
||||
|
||||
public BlockCTMNoLightRenderer() {
|
||||
public RendererCTMFullbright() {
|
||||
if (Chisel.renderCTMNoLightId == 0) {
|
||||
Chisel.renderCTMNoLightId = RenderingRegistry.getNextAvailableRenderId();
|
||||
}
|
||||
+2
-2
@@ -15,11 +15,11 @@ import com.cricketcraft.chisel.utils.Drawing;
|
||||
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
|
||||
import cpw.mods.fml.client.registry.RenderingRegistry;
|
||||
|
||||
public class BlockMarblePaneRenderer implements ISimpleBlockRenderingHandler {
|
||||
public class RendererCTMPane implements ISimpleBlockRenderingHandler {
|
||||
|
||||
public static int id;
|
||||
|
||||
public BlockMarblePaneRenderer() {
|
||||
public RendererCTMPane() {
|
||||
id = RenderingRegistry.getNextAvailableRenderId();
|
||||
}
|
||||
|
||||
+2
-2
@@ -12,9 +12,9 @@ import com.cricketcraft.chisel.utils.Drawing;
|
||||
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
|
||||
import cpw.mods.fml.client.registry.RenderingRegistry;
|
||||
|
||||
public class BlockEldritchRenderer implements ISimpleBlockRenderingHandler {
|
||||
public class RendererEldritch implements ISimpleBlockRenderingHandler {
|
||||
|
||||
public BlockEldritchRenderer() {
|
||||
public RendererEldritch() {
|
||||
Chisel.renderEldritchId = RenderingRegistry.getNextAvailableRenderId();
|
||||
}
|
||||
|
||||
+3
-4
@@ -1,25 +1,24 @@
|
||||
package com.cricketcraft.chisel.client.render;
|
||||
|
||||
import com.cricketcraft.chisel.config.Configurations;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.item.ItemDye;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.cricketcraft.chisel.Chisel;
|
||||
import com.cricketcraft.chisel.block.BlockCarvableGlow;
|
||||
import com.cricketcraft.chisel.config.Configurations;
|
||||
import com.cricketcraft.chisel.utils.Drawing;
|
||||
import com.cricketcraft.chisel.utils.GeneralClient;
|
||||
|
||||
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
|
||||
import cpw.mods.fml.client.registry.RenderingRegistry;
|
||||
|
||||
public class BlockGlowRenderer implements ISimpleBlockRenderingHandler {
|
||||
public class RendererLayeredGlow implements ISimpleBlockRenderingHandler {
|
||||
|
||||
public BlockGlowRenderer() {
|
||||
public RendererLayeredGlow() {
|
||||
Chisel.renderGlowId = RenderingRegistry.getNextAvailableRenderId();
|
||||
}
|
||||
|
||||
+7
-7
@@ -1,6 +1,6 @@
|
||||
package com.cricketcraft.chisel.client.render;
|
||||
|
||||
import com.cricketcraft.chisel.block.BlockTexturedOre;
|
||||
import com.cricketcraft.chisel.block.BlockMultiLayerBase;
|
||||
import com.cricketcraft.chisel.utils.Drawing;
|
||||
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
|
||||
import cpw.mods.fml.client.registry.RenderingRegistry;
|
||||
@@ -10,21 +10,21 @@ import net.minecraft.init.Blocks;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
public class BlockTexturedOreRenderer implements ISimpleBlockRenderingHandler {
|
||||
public class RendererMultiLayer implements ISimpleBlockRenderingHandler {
|
||||
|
||||
float bot = -0.001f, top = 1.0f - bot;
|
||||
public static int id;
|
||||
|
||||
public BlockTexturedOreRenderer() {
|
||||
public RendererMultiLayer() {
|
||||
id = RenderingRegistry.getNextAvailableRenderId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderInventoryBlock(Block blck, int meta, int modelID, RenderBlocks renderer) {
|
||||
if (blck == null || !(blck instanceof BlockTexturedOre))
|
||||
if (blck == null || !(blck instanceof BlockMultiLayerBase))
|
||||
return;
|
||||
|
||||
BlockTexturedOre block = (BlockTexturedOre) blck;
|
||||
BlockMultiLayerBase block = (BlockMultiLayerBase) blck;
|
||||
|
||||
if (block.icon != null) {
|
||||
renderer.overrideBlockTexture = block.icon;
|
||||
@@ -44,9 +44,9 @@ public class BlockTexturedOreRenderer implements ISimpleBlockRenderingHandler {
|
||||
|
||||
@Override
|
||||
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block blck, int modelId, RenderBlocks renderer) {
|
||||
if (blck == null || !(blck instanceof BlockTexturedOre))
|
||||
if (blck == null || !(blck instanceof BlockMultiLayerBase))
|
||||
return false;
|
||||
BlockTexturedOre block = (BlockTexturedOre) blck;
|
||||
BlockMultiLayerBase block = (BlockMultiLayerBase) blck;
|
||||
|
||||
if (block.currentPass == 0) {
|
||||
if (block.icon != null) {
|
||||
+2
-2
@@ -13,11 +13,11 @@ import com.cricketcraft.chisel.utils.Drawing;
|
||||
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
|
||||
import cpw.mods.fml.client.registry.RenderingRegistry;
|
||||
|
||||
public class BlockMarblePillarRenderer implements ISimpleBlockRenderingHandler {
|
||||
public class RendererPillar implements ISimpleBlockRenderingHandler {
|
||||
|
||||
public static int id;
|
||||
|
||||
public BlockMarblePillarRenderer() {
|
||||
public RendererPillar() {
|
||||
id = RenderingRegistry.getNextAvailableRenderId();
|
||||
}
|
||||
|
||||
+2
-2
@@ -14,9 +14,9 @@ import com.cricketcraft.chisel.utils.Drawing;
|
||||
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
|
||||
import cpw.mods.fml.client.registry.RenderingRegistry;
|
||||
|
||||
public class BlockRoadLineRenderer implements ISimpleBlockRenderingHandler {
|
||||
public class RendererRoadLine implements ISimpleBlockRenderingHandler {
|
||||
|
||||
public BlockRoadLineRenderer() {
|
||||
public RendererRoadLine() {
|
||||
Chisel.roadLineId = RenderingRegistry.getNextAvailableRenderId();
|
||||
}
|
||||
|
||||
+2
-2
@@ -13,9 +13,9 @@ import com.cricketcraft.chisel.utils.Drawing;
|
||||
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
|
||||
import cpw.mods.fml.client.registry.RenderingRegistry;
|
||||
|
||||
public class BlockLayeredRenderer implements ISimpleBlockRenderingHandler {
|
||||
public class RendererSimpleLayered implements ISimpleBlockRenderingHandler {
|
||||
|
||||
public BlockLayeredRenderer() {
|
||||
public RendererSimpleLayered() {
|
||||
Chisel.renderLayeredId = RenderingRegistry.getNextAvailableRenderId();
|
||||
}
|
||||
|
||||
+2
-2
@@ -12,11 +12,11 @@ import com.cricketcraft.chisel.utils.Drawing;
|
||||
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
|
||||
import cpw.mods.fml.client.registry.RenderingRegistry;
|
||||
|
||||
public class BlockSnakeStoneRenderer implements ISimpleBlockRenderingHandler {
|
||||
public class RendererSnakeStone implements ISimpleBlockRenderingHandler {
|
||||
|
||||
public static int id;
|
||||
|
||||
public BlockSnakeStoneRenderer() {
|
||||
public RendererSnakeStone() {
|
||||
id = RenderingRegistry.getNextAvailableRenderId();
|
||||
}
|
||||
|
||||
+2
-2
@@ -12,11 +12,11 @@ import com.cricketcraft.chisel.utils.Drawing;
|
||||
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
|
||||
import cpw.mods.fml.client.registry.RenderingRegistry;
|
||||
|
||||
public class BlockMarbleStairsRenderer implements ISimpleBlockRenderingHandler {
|
||||
public class RendererStairs implements ISimpleBlockRenderingHandler {
|
||||
|
||||
public static int id;
|
||||
|
||||
public BlockMarbleStairsRenderer() {
|
||||
public RendererStairs() {
|
||||
id = RenderingRegistry.getNextAvailableRenderId();
|
||||
}
|
||||
|
||||
+6
-5
@@ -7,6 +7,7 @@ import net.minecraft.world.IBlockAccess;
|
||||
|
||||
import com.cricketcraft.chisel.api.client.CTM;
|
||||
import com.cricketcraft.chisel.api.client.ISubmapManager;
|
||||
import com.cricketcraft.chisel.api.client.TextureSubmap;
|
||||
import com.cricketcraft.chisel.init.ChiselBlocks;
|
||||
|
||||
import static com.cricketcraft.chisel.api.client.Dir.*;
|
||||
@@ -22,20 +23,20 @@ public class SubmapManagerFakeController implements ISubmapManager {
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(int side, int meta) {
|
||||
return map.icons[0];
|
||||
return map.getSubIcon(0, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) {
|
||||
ctm.buildConnectionMap(world, x, y, z, side, ChiselBlocks.futura, 2);
|
||||
if (ctm.connectedAnd(TOP, BOTTOM, LEFT, RIGHT)) {
|
||||
return map.icons[3];
|
||||
return map.getSubIcon(1, 1);
|
||||
} else if (ctm.connectedAnd(TOP, BOTTOM)) {
|
||||
return map.icons[2];
|
||||
return map.getSubIcon(0, 1);
|
||||
} else if (ctm.connectedAnd(LEFT, RIGHT)) {
|
||||
return map.icons[1];
|
||||
return map.getSubIcon(1, 0);
|
||||
} else {
|
||||
return map.icons[0];
|
||||
return map.getSubIcon(0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,32 +0,0 @@
|
||||
package com.cricketcraft.chisel.client.render;
|
||||
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraftforge.client.event.TextureStitchEvent;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
|
||||
public class TextureSubmap {
|
||||
|
||||
public int width, height;
|
||||
public IIcon icon;
|
||||
public IIcon icons[];
|
||||
|
||||
public TextureSubmap(IIcon i, int w, int h) {
|
||||
icon = i;
|
||||
width = w;
|
||||
height = h;
|
||||
icons = new IIcon[width * height];
|
||||
|
||||
MinecraftForge.EVENT_BUS.register(this);
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void TexturesStitched(TextureStitchEvent.Post event) {
|
||||
|
||||
for (int x = 0; x < width; x++) {
|
||||
for (int y = 0; y < height; y++) {
|
||||
icons[y * width + x] = new TextureVirtual(icon, width, height, x, y);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,81 +0,0 @@
|
||||
package com.cricketcraft.chisel.client.render;
|
||||
|
||||
import net.minecraft.util.IIcon;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class TextureVirtual implements IIcon {
|
||||
|
||||
private int width, height;
|
||||
private float umin, umax, vmin, vmax;
|
||||
private String name;
|
||||
private IIcon parentIcon;
|
||||
|
||||
TextureVirtual(IIcon parent, int w, int h, int x, int y) {
|
||||
parentIcon = parent;
|
||||
|
||||
umin = parentIcon.getInterpolatedU(16.0 * (x) / w);
|
||||
umax = parentIcon.getInterpolatedU(16.0 * (x + 1) / w);
|
||||
vmin = parentIcon.getInterpolatedV(16.0 * (y) / h);
|
||||
vmax = parentIcon.getInterpolatedV(16.0 * (y + 1) / h);
|
||||
|
||||
name = parentIcon.getIconName() + "|" + x + "." + y;
|
||||
|
||||
width = parentIcon.getIconWidth();
|
||||
height = parentIcon.getIconHeight();
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public float getMinU() {
|
||||
return umin;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public float getMaxU() {
|
||||
return umax;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public float getInterpolatedU(double d0) {
|
||||
return (float) (umin + (umax - umin) * d0 / 16.0);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public float getMinV() {
|
||||
return vmin;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public float getMaxV() {
|
||||
return vmax;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public float getInterpolatedV(double d0) {
|
||||
return (float) (vmin + (vmax - vmin) * d0 / 16.0);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public String getIconName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getIconWidth() {
|
||||
return width;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getIconHeight() {
|
||||
return height;
|
||||
}
|
||||
}
|
||||
@@ -69,7 +69,7 @@ public final class ChiselBlocks {
|
||||
public static final BlockCarvable laboratoryblock = null;
|
||||
|
||||
public static final BlockCarvable voidstone = null;
|
||||
public static final BlockMarbleTexturedOre voidstone2 = null;
|
||||
public static final BlockMultiLayer voidstone2 = null;
|
||||
public static final BlockCarvablePillar voidstonePillar = null;
|
||||
public static final BlockCarvablePillar voidstonePillar2 = null;
|
||||
public static final BlockSnakestone stone_snakestone = null;
|
||||
|
||||
@@ -32,20 +32,19 @@ public class ClientProxy extends CommonProxy {
|
||||
|
||||
@Override
|
||||
public void init() {
|
||||
RenderingRegistry.registerBlockHandler(new BlockMarbleStairsRenderer());
|
||||
RenderingRegistry.registerBlockHandler(new BlockMarblePaneRenderer());
|
||||
RenderingRegistry.registerBlockHandler(new BlockRoadLineRenderer());
|
||||
RenderingRegistry.registerBlockHandler(new BlockSnakeStoneRenderer());
|
||||
RenderingRegistry.registerBlockHandler(new RenderStandardBlockNoSunlight());
|
||||
RenderingRegistry.registerBlockHandler(new BlockMarblePillarRenderer());
|
||||
RenderingRegistry.registerBlockHandler(new BlockEldritchRenderer());
|
||||
RenderingRegistry.registerBlockHandler(new BlockAdvancedMarbleRenderer());
|
||||
RenderingRegistry.registerBlockHandler(new RendererStairs());
|
||||
RenderingRegistry.registerBlockHandler(new RendererCTMPane());
|
||||
RenderingRegistry.registerBlockHandler(new RendererRoadLine());
|
||||
RenderingRegistry.registerBlockHandler(new RendererSnakeStone());
|
||||
RenderingRegistry.registerBlockHandler(new RendererPillar());
|
||||
RenderingRegistry.registerBlockHandler(new RendererEldritch());
|
||||
RenderingRegistry.registerBlockHandler(new RendererCTM());
|
||||
RenderingRegistry.registerBlockHandler(new BlockCarpetRenderer());
|
||||
RenderingRegistry.registerBlockHandler(new BlockGlowRenderer());
|
||||
RenderingRegistry.registerBlockHandler(new BlockCTMNoLightRenderer());
|
||||
RenderingRegistry.registerBlockHandler(new BlockLayeredRenderer());
|
||||
RenderingRegistry.registerBlockHandler(new RendererLayeredGlow());
|
||||
RenderingRegistry.registerBlockHandler(new RendererCTMFullbright());
|
||||
RenderingRegistry.registerBlockHandler(new RendererSimpleLayered());
|
||||
|
||||
RenderingRegistry.registerBlockHandler(new BlockTexturedOreRenderer());
|
||||
RenderingRegistry.registerBlockHandler(new RendererMultiLayer());
|
||||
|
||||
RenderAutoChisel rac = new RenderAutoChisel();
|
||||
RenderingRegistry.registerBlockHandler(rac);
|
||||
|
||||
Reference in new issue
Block a user