public class BaseRenderer
extends net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer
implements cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler, net.minecraftforge.client.IItemRenderer
ISimpleBlockRenderingHandler, TileEntitySpecialRenderer, and
IItemRenderer. Provides easy registration of the renderer, and automatically sets up the context for the rendering.| Modifier and Type | Field and Description |
|---|---|
protected int |
baseBrightness
Base brightness of the block.
|
protected net.minecraft.block.Block |
block
Block to render (ISBRH/TESR).
|
protected int |
blockMetadata
Metadata of the block to render (ISBRH/TESR).
|
protected static net.minecraft.util.IIcon[] |
damagedIcons
The damaged icons.
|
protected net.minecraft.client.renderer.DestroyBlockProgress |
destroyBlockProgress
Current block destroy progression (for TESR).
|
protected int |
drawMode
Mode of rendering (GL constant).
|
protected Face |
face
Current face being rendered.
|
protected boolean |
getBlockDamage
Whether the damage for the blocks should be handled by this
BaseRenderer (for TESR). |
protected boolean |
isShifted
Whether render coordinates already shifted (ISBRH).
|
protected net.minecraftforge.client.IItemRenderer.ItemRenderType |
itemRenderType
ItemRenderType of item rendering (ITEM).
|
protected net.minecraft.item.ItemStack |
itemStack
ItemStack to render (ITEM).
|
protected net.minecraft.util.IIcon |
overrideTexture
An override texture set by the renderer.
|
protected RenderParameters |
params
Current parameters for the face being rendered.
|
protected float |
partialTick
Partial tick time (for TESR).
|
protected net.minecraft.client.renderer.RenderBlocks |
renderBlocks
RenderBlocks reference (ISBRH).
|
protected int |
renderId
Id of this
BaseRenderer. |
protected int |
renderType
Type of rendering :
TYPE_ISBRH_WORLD, TYPE_ISBRH_INVENTORY, TYPE_ITEM_INVENTORY or
TYPE_TESR_WORLD. |
protected RenderParameters |
rp
Current parameters for the shape being rendered.
|
protected Shape |
shape
Current shape being rendered.
|
protected net.minecraft.client.renderer.Tessellator |
t
Tessellator reference.
|
protected net.minecraft.tileentity.TileEntity |
tileEntity
TileEntity currently drawing (for TESR).
|
static int |
TYPE_ISBRH_INVENTORY
Defines rendering for inventory with ISBRH.
|
static int |
TYPE_ISBRH_WORLD
Defines rendering for world.
|
static int |
TYPE_ITEM_INVENTORY
Defines rendering for inventory with IItemRenderer.
|
static int |
TYPE_TESR_WORLD
Defines rendering for TESR.
|
protected boolean |
vertexDrawn
Whether at least one vertex has been drawn.
|
protected net.minecraft.world.IBlockAccess |
world
Current world reference (ISBRH/TESR).
|
protected int |
x
Position of the block (ISBRH/TESR).
|
protected int |
y
Position of the block (ISBRH/TESR).
|
protected int |
z
Position of the block (ISBRH/TESR).
|
| Constructor and Description |
|---|
BaseRenderer()
Instantiates a new
BaseRenderer. |
| Modifier and Type | Method and Description |
|---|---|
void |
applyTexture(Shape shape)
Applies the texture to the
Shape. |
void |
applyTexture(Shape shape,
RenderParameters parameters)
Applies the texture to the
Shape with specified RenderParameters. |
protected int |
calcVertexBrightness(Vertex vertex,
int[][] aoMatrix)
Calculates the ambient occlusion brightness for a
Vertex. |
protected int |
calcVertexColor(Vertex vertex,
int[][] aoMatrix)
Calculates the ambient occlusion for a
Vertex and also apply the side dependent shade. |
protected void |
calcVertexesPosition(net.minecraft.util.AxisAlignedBB bounds)
Modifies the
vertexes coordinates relative to the bounds specified. |
void |
clean()
Cleans the current renderer state.
|
void |
disableTextures()
Disables textures.
|
void |
draw()
Triggers a draw.
|
void |
drawFace(Face face)
Draws a
Face with its own RenderParameters. |
protected void |
drawFace(Face f,
RenderParameters faceParams)
Draws a
Face with specified RenderParameters. |
void |
drawShape(Shape shape)
Draws a
Shape without RenderParameters (default will be used). |
void |
drawShape(Shape s,
RenderParameters params)
Draws a
Shape with specified RenderParameters. |
protected void |
drawVertex(Vertex vertex,
int number)
Draws a single
Vertex. |
protected void |
drawVertexes(Vertex[] vertexes)
* Draws an array of
vertexes (usually Face.getVertexes()). |
void |
enableBlending()
Enables the blending for the rendering.
|
void |
enableTextures()
Enables textures
|
protected int |
getAoBrightness(int b1,
int b2,
int b3,
int base)
Does the actual brightness calculation (copied from net.minecraft.client.renderer.BlocksRenderer.java)
|
protected int |
getBaseBrightness()
Gets the base brightness for the current
Face. |
protected float |
getBlockAmbientOcclusion(net.minecraft.world.IBlockAccess world,
int x,
int y,
int z)
Gets the block ambient occlusion value.
|
protected net.minecraft.client.renderer.DestroyBlockProgress |
getBlockDestroyProgress()
Gets the destroy block progress for this rendering.
|
protected java.util.Map |
getDamagedBlocks()
Gets and hold reference to damagedBlocks from Minecraft.renderGlobal via reflection.
|
protected net.minecraft.util.IIcon |
getIcon(RenderParameters params)
Gets the IIcon corresponding to the specified
RenderParameters. |
protected int |
getMixedBrightnessForBlock(net.minecraft.world.IBlockAccess world,
int x,
int y,
int z)
Gets the mix brightness for a block (sky + block source).
|
float |
getPartialTick()
Gets the partialTick for this frame.
|
protected net.minecraft.util.AxisAlignedBB |
getRenderBounds()
Gets the rendering bounds.
|
int |
getRenderId()
Gets the render id of this
BaseRenderer. |
boolean |
handleRenderType(net.minecraft.item.ItemStack item,
net.minecraftforge.client.IItemRenderer.ItemRenderType type)
Checks whether to use this
BaseRenderer for the specified IItemRenderer.ItemRenderType. |
protected void |
initialize()
Initializes this
BaseRenderer. |
protected boolean |
isCurrentBlockDestroyProgress(net.minecraft.client.renderer.DestroyBlockProgress dbp)
Checks whether the DestroyBlockProgress specified should apply for this TESR.
|
void |
next()
Triggers a draw and restart drawing with current
drawMode. |
void |
next(int drawMode)
Triggers a draw and restart drawing with drawMode.
|
void |
prepare(int renderType,
double... data)
Prepares the
Tessellator and the GL states for the renderType. |
void |
registerFor(java.lang.Class... listClass)
Registers this
BaseRenderer to be used for rendering for specified classes. |
void |
registerFor(net.minecraft.item.Item item)
Registers this
BaseRenderer to be used for rendering the specified item. |
void |
render()
Main rendering method.
|
void |
renderDestroyProgress()
Renders the destroy progress manually for TESR.
|
void |
renderInventoryBlock(net.minecraft.block.Block block,
int metadata,
int modelId,
net.minecraft.client.renderer.RenderBlocks renderer)
Renders inventory block.
|
void |
renderItem(net.minecraftforge.client.IItemRenderer.ItemRenderType type,
net.minecraft.item.ItemStack item,
java.lang.Object... data)
Renders the item.
|
void |
renderStandard()
Renders the block using the default Minecraft rendering system.
|
void |
renderStandard(net.minecraft.client.renderer.RenderBlocks renderer)
Renders the blocks using the default Minecraft rendering system with the specified renderer.
|
void |
renderTileEntityAt(net.minecraft.tileentity.TileEntity te,
double x,
double y,
double z,
float partialTick)
Renders a
TileEntitySpecialRenderer. |
boolean |
renderWorldBlock(net.minecraft.world.IBlockAccess world,
int x,
int y,
int z,
net.minecraft.block.Block block,
int modelId,
net.minecraft.client.renderer.RenderBlocks renderer)
Renders world block.
|
void |
reset()
Resets data so this
BaseRenderer can be reused. |
void |
set(net.minecraft.block.Block block)
Sets informations for this
BaseRenderer. |
void |
set(net.minecraft.block.Block block,
int blockMetadata)
Sets informations for this
BaseRenderer. |
void |
set(net.minecraft.world.IBlockAccess world,
net.minecraft.block.Block block,
int x,
int y,
int z,
int metadata)
Sets informations for this
BaseRenderer. |
void |
set(net.minecraftforge.client.IItemRenderer.ItemRenderType type,
net.minecraft.item.ItemStack itemStack)
Sets informations for this
BaseRenderer. |
void |
set(int blockMetadata)
Sets informations for this
BaseRenderer. |
void |
set(int x,
int y,
int z)
Sets informations for this
BaseRenderer. |
void |
set(net.minecraft.tileentity.TileEntity te,
float partialTick)
Sets informations for this
BaseRenderer. |
boolean |
shouldRender3DInInventory(int modelId)
Checks whether this
BaseRenderer should handle the rendering in inventory |
protected boolean |
shouldRenderFace(Face face)
Checks if a
Face should be rendered. |
boolean |
shouldUseRenderHelper(net.minecraftforge.client.IItemRenderer.ItemRenderType type,
net.minecraft.item.ItemStack item,
net.minecraftforge.client.IItemRenderer.ItemRendererHelper helper)
Checks whether a render helper should be used for this
BaseRenderer. |
void |
startDrawing()
Tells the
Tessellator to start drawing GL_QUADS. |
void |
startDrawing(int drawMode)
Tells the
Tessellator to start drawing drawMode. |
void |
tessellatorShift()
Shifts the
Tessellator for ISBRH rendering. |
void |
tessellatorUnshift()
Unshifts the
Tessellator for ISBRH rendering. |
public static final int TYPE_ISBRH_WORLD
public static final int TYPE_ISBRH_INVENTORY
public static final int TYPE_ITEM_INVENTORY
public static final int TYPE_TESR_WORLD
protected static net.minecraft.util.IIcon[] damagedIcons
protected int renderId
BaseRenderer.protected net.minecraft.client.renderer.Tessellator t
protected net.minecraft.world.IBlockAccess world
protected net.minecraft.client.renderer.RenderBlocks renderBlocks
protected net.minecraft.block.Block block
protected int blockMetadata
protected int x
protected int y
protected int z
protected net.minecraft.item.ItemStack itemStack
protected net.minecraftforge.client.IItemRenderer.ItemRenderType itemRenderType
protected int renderType
TYPE_ISBRH_WORLD, TYPE_ISBRH_INVENTORY, TYPE_ITEM_INVENTORY or
TYPE_TESR_WORLD.protected int drawMode
protected boolean isShifted
protected Shape shape
protected Face face
protected RenderParameters rp
protected RenderParameters params
protected int baseBrightness
protected net.minecraft.util.IIcon overrideTexture
protected net.minecraft.tileentity.TileEntity tileEntity
protected float partialTick
protected boolean getBlockDamage
BaseRenderer (for TESR).protected net.minecraft.client.renderer.DestroyBlockProgress destroyBlockProgress
protected boolean vertexDrawn
public BaseRenderer()
BaseRenderer.public float getPartialTick()
public void reset()
BaseRenderer can be reused.public void set(net.minecraft.world.IBlockAccess world,
net.minecraft.block.Block block,
int x,
int y,
int z,
int metadata)
BaseRenderer.world - the worldblock - the blockx - the xy - the yz - the zmetadata - the metadatapublic void set(net.minecraft.block.Block block)
BaseRenderer.block - the blockpublic void set(int blockMetadata)
BaseRenderer.blockMetadata - the block metadatapublic void set(net.minecraft.block.Block block,
int blockMetadata)
BaseRenderer.block - the blockblockMetadata - the block metadatapublic void set(int x,
int y,
int z)
BaseRenderer.x - the xy - the yz - the zpublic void set(net.minecraft.tileentity.TileEntity te,
float partialTick)
BaseRenderer.te - the tepartialTick - the partial tickpublic void set(net.minecraftforge.client.IItemRenderer.ItemRenderType type,
net.minecraft.item.ItemStack itemStack)
BaseRenderer.type - the typeitemStack - the item stackpublic void renderInventoryBlock(net.minecraft.block.Block block,
int metadata,
int modelId,
net.minecraft.client.renderer.RenderBlocks renderer)
renderInventoryBlock in interface cpw.mods.fml.client.registry.ISimpleBlockRenderingHandlerblock - the blockmetadata - the metadatamodelId - renderIdrenderer - RenderBlockspublic boolean renderWorldBlock(net.minecraft.world.IBlockAccess world,
int x,
int y,
int z,
net.minecraft.block.Block block,
int modelId,
net.minecraft.client.renderer.RenderBlocks renderer)
renderWorldBlock in interface cpw.mods.fml.client.registry.ISimpleBlockRenderingHandlerworld - the worldx - the xy - the yz - the zblock - the blockmodelId - renderIdrenderer - RenderBlockspublic boolean shouldRender3DInInventory(int modelId)
BaseRenderer should handle the rendering in inventoryshouldRender3DInInventory in interface cpw.mods.fml.client.registry.ISimpleBlockRenderingHandlermodelId - renderIdBaseRenderer should be used for rendering the block in inventorypublic boolean handleRenderType(net.minecraft.item.ItemStack item,
net.minecraftforge.client.IItemRenderer.ItemRenderType type)
BaseRenderer for the specified IItemRenderer.ItemRenderType.handleRenderType in interface net.minecraftforge.client.IItemRendereritem - the itemtype - ItemRenderTypeBaseRenderer should be used for rendering the block in inventorypublic boolean shouldUseRenderHelper(net.minecraftforge.client.IItemRenderer.ItemRenderType type,
net.minecraft.item.ItemStack item,
net.minecraftforge.client.IItemRenderer.ItemRendererHelper helper)
BaseRenderer.shouldUseRenderHelper in interface net.minecraftforge.client.IItemRenderertype - the typeitem - the itemhelper - the helperpublic void renderItem(net.minecraftforge.client.IItemRenderer.ItemRenderType type,
net.minecraft.item.ItemStack item,
java.lang.Object... data)
renderItem in interface net.minecraftforge.client.IItemRenderertype - the typeitem - the itemdata - the datapublic void renderTileEntityAt(net.minecraft.tileentity.TileEntity te,
double x,
double y,
double z,
float partialTick)
TileEntitySpecialRenderer.renderTileEntityAt in class net.minecraft.client.renderer.tileentity.TileEntitySpecialRendererte - the TileEntityx - the xy - the yz - the zpartialTick - the partial tickpublic void prepare(int renderType,
double... data)
Tessellator and the GL states for the renderType. data is only used for TESR.renderType - the render typedata - the datapublic void startDrawing()
Tessellator to start drawing GL_QUADS.public void startDrawing(int drawMode)
Tessellator to start drawing drawMode.drawMode - the draw modepublic void next()
drawMode.public void next(int drawMode)
drawMode - the draw modepublic void draw()
public void clean()
public void tessellatorShift()
Tessellator for ISBRH rendering.public void tessellatorUnshift()
Tessellator for ISBRH rendering.public void enableBlending()
public void disableTextures()
public void enableTextures()
protected void initialize()
BaseRenderer. Does nothing by default.public void renderStandard()
public void renderStandard(net.minecraft.client.renderer.RenderBlocks renderer)
renderer - the rendererpublic void render()
public void renderDestroyProgress()
destroyBlockProgress is not null.public void drawShape(Shape shape)
Shape without RenderParameters (default will be used).shape - the shapepublic void drawShape(Shape s, RenderParameters params)
Shape with specified RenderParameters.s - the sparams - the paramspublic void drawFace(Face face)
Face with its own RenderParameters.face - the faceprotected void drawFace(Face f, RenderParameters faceParams)
Face with specified RenderParameters.f - the ffaceParams - the face paramsprotected void drawVertexes(Vertex[] vertexes)
vertexes (usually Face.getVertexes()).vertexes - the vertexesprotected void drawVertex(Vertex vertex, int number)
Vertex.vertex - the vertexnumber - the offset inside the face. (Used for AO)protected net.minecraft.util.IIcon getIcon(RenderParameters params)
RenderParameters.params - the paramsprotected boolean shouldRenderFace(Face face)
Face should be rendered. RenderParameters.direction needs to be defined for the face.face - the facepublic void applyTexture(Shape shape)
Shape.RenderParameters.applyTexture set to
false to prevent reapplying texture when rendering.shape - the shapepublic void applyTexture(Shape shape, RenderParameters parameters)
Shape with specified RenderParameters.RenderParameters.applyTexture set to
false to prevent reapplying texture when rendering.shape - the shapeparameters - the parametersprotected int calcVertexColor(Vertex vertex, int[][] aoMatrix)
Vertex and also apply the side dependent shade.vertex - the vertexaoMatrix - the ao matrixprotected int getBaseBrightness()
Face.protected int calcVertexBrightness(Vertex vertex, int[][] aoMatrix)
Vertex. aoMatrix is the list of block coordinates necessary to
compute AO. Only first 3 blocks are used.vertex - the vertexaoMatrix - the ao matrixprotected int getAoBrightness(int b1,
int b2,
int b3,
int base)
b1 - the b1b2 - the b2b3 - the b3base - the baseprotected float getBlockAmbientOcclusion(net.minecraft.world.IBlockAccess world,
int x,
int y,
int z)
world - the worldx - the xy - the yz - the zprotected int getMixedBrightnessForBlock(net.minecraft.world.IBlockAccess world,
int x,
int y,
int z)
world - the worldx - the xy - the yz - the zprotected net.minecraft.util.AxisAlignedBB getRenderBounds()
protected void calcVertexesPosition(net.minecraft.util.AxisAlignedBB bounds)
vertexes coordinates relative to the bounds specified.bounds - the boundsprotected java.util.Map getDamagedBlocks()
protected net.minecraft.client.renderer.DestroyBlockProgress getBlockDestroyProgress()
protected boolean isCurrentBlockDestroyProgress(net.minecraft.client.renderer.DestroyBlockProgress dbp)
dbp - the dbppublic int getRenderId()
BaseRenderer.getRenderId in interface cpw.mods.fml.client.registry.ISimpleBlockRenderingHandlerpublic void registerFor(java.lang.Class... listClass)
BaseRenderer to be used for rendering for specified classes.listClass - the list classpublic void registerFor(net.minecraft.item.Item item)
BaseRenderer to be used for rendering the specified item.item - the item