public class MalisisRenderer extends net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer implements cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler, net.minecraftforge.client.IItemRenderer, IRenderWorldLast
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
MalisisRenderer (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 (TESR/IRWL).
|
protected net.minecraft.client.renderer.RenderBlocks |
renderBlocks
RenderBlocks reference (ISBRH).
|
protected net.minecraft.client.renderer.RenderGlobal |
renderGlobal
RenderGlobal reference (IRWL)
|
protected int |
renderId
Id of this
MalisisRenderer . |
protected RenderType |
renderType
Type of rendering.
|
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).
|
protected boolean |
vertexDrawn
Whether at least one vertex has been drawn.
|
protected net.minecraft.world.IBlockAccess |
world
Current world reference (ISBRH/TESR/IRWL).
|
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 |
---|
MalisisRenderer()
Instantiates a new
MalisisRenderer . |
Modifier and Type | Method and Description |
---|---|
protected void |
_initialize()
_initialize.
|
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 void |
bindTexture(net.minecraft.util.ResourceLocation resourceLocaltion) |
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 . |
void |
drawString(java.lang.String text,
float x,
float y,
float z,
int color,
boolean shadow)
Draws a string at the specified coordinates, with color and shadow.
|
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.
|
static net.minecraft.client.gui.FontRenderer |
getFontRenderer() |
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
MalisisRenderer . |
static int |
getStringHeight()
Gets the rendering height of strings according to fontscale.
|
static int |
getStringWidth(java.lang.String str)
Gets rendering width of a string.
|
boolean |
handleRenderType(net.minecraft.item.ItemStack item,
net.minecraftforge.client.IItemRenderer.ItemRenderType type)
Checks whether to use this
MalisisRenderer for the specified IItemRenderer.ItemRenderType . |
protected void |
initialize()
Initializes this
MalisisRenderer . |
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(RenderType renderType,
double... data)
Prepares the
Tessellator and the GL states for the renderType. |
void |
registerFor(java.lang.Class... listClass)
Registers this
MalisisRenderer to be used for rendering for specified classes. |
void |
registerFor(net.minecraft.item.Item item)
Registers this
MalisisRenderer to be used for rendering the specified item. |
void |
registerForRenderWorldLast()
Registers this
MalisisRenderer to be used for RenderWorldLastEvent . |
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 |
renderWorldLastEvent(net.minecraftforge.client.event.RenderWorldLastEvent event,
net.minecraft.world.IBlockAccess world)
Renders when
RenderWorldLastEvent is called. |
void |
reset()
Resets data so this
MalisisRenderer can be reused. |
void |
set(net.minecraft.block.Block block)
Sets informations for this
MalisisRenderer . |
void |
set(net.minecraft.block.Block block,
int blockMetadata)
Sets informations for this
MalisisRenderer . |
void |
set(net.minecraft.world.IBlockAccess world)
Sets informations for this
MalisisRenderer . |
void |
set(net.minecraft.world.IBlockAccess world,
net.minecraft.block.Block block,
int x,
int y,
int z,
int metadata)
Sets informations for this
MalisisRenderer . |
void |
set(net.minecraftforge.client.IItemRenderer.ItemRenderType type,
net.minecraft.item.ItemStack itemStack)
Sets informations for this
MalisisRenderer . |
void |
set(int blockMetadata)
Sets informations for this
MalisisRenderer . |
void |
set(int x,
int y,
int z)
Sets informations for this
MalisisRenderer . |
void |
set(net.minecraft.tileentity.TileEntity te,
float partialTick)
Sets informations for this
MalisisRenderer . |
boolean |
shouldRender(net.minecraftforge.client.event.RenderWorldLastEvent event,
net.minecraft.world.IBlockAccess world)
Whether the renderer should render.
|
boolean |
shouldRender3DInInventory(int modelId)
Checks whether this
MalisisRenderer should handle the rendering in inventory |
protected boolean |
shouldRenderFace(Face face)
Checks if a
Face should be rendered. |
boolean |
shouldSetViewportPosition()
Whether to set the translations based on player current position and partialTick.
|
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
MalisisRenderer . |
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. |
protected static net.minecraft.util.IIcon[] damagedIcons
protected int renderId
MalisisRenderer
.protected net.minecraft.client.renderer.Tessellator t
protected net.minecraft.world.IBlockAccess world
protected net.minecraft.client.renderer.RenderBlocks renderBlocks
protected boolean isShifted
protected net.minecraft.block.Block block
protected int blockMetadata
protected int x
protected int y
protected int z
protected net.minecraft.tileentity.TileEntity tileEntity
protected float partialTick
protected net.minecraft.item.ItemStack itemStack
protected net.minecraftforge.client.IItemRenderer.ItemRenderType itemRenderType
protected net.minecraft.client.renderer.RenderGlobal renderGlobal
protected RenderType renderType
protected int drawMode
protected Shape shape
protected Face face
protected RenderParameters rp
protected RenderParameters params
protected int baseBrightness
protected net.minecraft.util.IIcon overrideTexture
protected boolean getBlockDamage
MalisisRenderer
(for TESR).protected net.minecraft.client.renderer.DestroyBlockProgress destroyBlockProgress
protected boolean vertexDrawn
public MalisisRenderer()
MalisisRenderer
.public float getPartialTick()
public void reset()
MalisisRenderer
can be reused.public void set(net.minecraft.world.IBlockAccess world, net.minecraft.block.Block block, int x, int y, int z, int metadata)
MalisisRenderer
.world
- the worldblock
- the blockx
- the xy
- the yz
- the zmetadata
- the metadatapublic void set(net.minecraft.world.IBlockAccess world)
MalisisRenderer
.world
- the worldpublic void set(net.minecraft.block.Block block)
MalisisRenderer
.block
- the blockpublic void set(int blockMetadata)
MalisisRenderer
.blockMetadata
- the block metadatapublic void set(net.minecraft.block.Block block, int blockMetadata)
MalisisRenderer
.block
- the blockblockMetadata
- the block metadatapublic void set(int x, int y, int z)
MalisisRenderer
.x
- the xy
- the yz
- the zpublic void set(net.minecraft.tileentity.TileEntity te, float partialTick)
MalisisRenderer
.te
- the tepartialTick
- the partial tickpublic void set(net.minecraftforge.client.IItemRenderer.ItemRenderType type, net.minecraft.item.ItemStack itemStack)
MalisisRenderer
.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.ISimpleBlockRenderingHandler
block
- 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.ISimpleBlockRenderingHandler
world
- the worldx
- the xy
- the yz
- the zblock
- the blockmodelId
- renderIdrenderer
- RenderBlockspublic boolean shouldRender3DInInventory(int modelId)
MalisisRenderer
should handle the rendering in inventoryshouldRender3DInInventory
in interface cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler
modelId
- renderIdMalisisRenderer
should be used for rendering the block in inventorypublic boolean handleRenderType(net.minecraft.item.ItemStack item, net.minecraftforge.client.IItemRenderer.ItemRenderType type)
MalisisRenderer
for the specified IItemRenderer.ItemRenderType
.handleRenderType
in interface net.minecraftforge.client.IItemRenderer
item
- the itemtype
- ItemRenderTypeMalisisRenderer
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)
MalisisRenderer
.shouldUseRenderHelper
in interface net.minecraftforge.client.IItemRenderer
type
- 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.IItemRenderer
type
- 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.TileEntitySpecialRenderer
te
- the TileEntityx
- the xy
- the yz
- the zpartialTick
- the partial tickpublic boolean shouldSetViewportPosition()
IRenderWorldLast
shouldSetViewportPosition
in interface IRenderWorldLast
public boolean shouldRender(net.minecraftforge.client.event.RenderWorldLastEvent event, net.minecraft.world.IBlockAccess world)
IRenderWorldLast
shouldRender
in interface IRenderWorldLast
event
- the eventworld
- the worldpublic void renderWorldLastEvent(net.minecraftforge.client.event.RenderWorldLastEvent event, net.minecraft.world.IBlockAccess world)
IRenderWorldLast
RenderWorldLastEvent
is called.renderWorldLastEvent
in interface IRenderWorldLast
event
- the eventworld
- the worldpublic void prepare(RenderType renderType, double... data)
Tessellator
and the GL states for the renderType. data is only used for TESR and IRWL.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 bindTexture(net.minecraft.util.ResourceLocation resourceLocaltion)
bindTexture
in class net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer
protected final void _initialize()
protected void initialize()
MalisisRenderer
. 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)public void drawString(java.lang.String text, float x, float y, float z, int color, boolean shadow)
text
- the textx
- the xy
- the yz
- the zcolor
- the colorshadow
- the shadowprotected 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()
MalisisRenderer
.getRenderId
in interface cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler
public void registerFor(java.lang.Class... listClass)
MalisisRenderer
to be used for rendering for specified classes.listClass
- the list classpublic void registerFor(net.minecraft.item.Item item)
MalisisRenderer
to be used for rendering the specified item.item
- the itempublic void registerForRenderWorldLast()
MalisisRenderer
to be used for RenderWorldLastEvent
.public static net.minecraft.client.gui.FontRenderer getFontRenderer()
public static int getStringWidth(java.lang.String str)
str
- the strpublic static int getStringHeight()