public class MalisisRenderer<T extends net.minecraft.tileentity.TileEntity> extends net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer<T> implements IBlockRenderer, IRenderWorldLast
IItemRenderer.DummyModel| Modifier and Type | Field and Description |
|---|---|
protected int |
baseBrightness
Base brightness of the block.
|
protected static net.minecraft.client.renderer.VertexBuffer |
batchedBuffer
Batched buffer reference.
|
protected net.minecraft.block.Block |
block
Block to render (BLOCK/TESR).
|
protected net.minecraft.block.state.IBlockState |
blockState
Metadata of the block to render (BLOCK/TESR).
|
protected net.minecraft.client.renderer.VertexBuffer |
buffer
Currently used buffer.
|
protected net.minecraft.client.renderer.DestroyBlockProgress |
destroyBlockProgress
Current block destroy progression (for TESR).
|
protected int |
drawMode
Mode of rendering (GL constant).
|
protected boolean |
getBlockDamage
Whether the damage for the blocks should be handled by this
MalisisRenderer (for TESR). |
protected net.minecraft.item.Item |
item
Item to render (ITEM)
|
protected net.minecraft.item.ItemStack |
itemStack
ItemStack to render (ITEM).
|
static net.minecraft.client.renderer.vertex.VertexFormat |
malisisVertexFormat |
protected float |
partialTick
Partial tick time (TESR/IRWL).
|
protected net.minecraft.util.math.BlockPos |
pos
Position of the block (BLOCK/TESR).
|
protected net.minecraft.util.math.Vec3d |
posOffset
Vertex positions offset.
|
protected net.minecraft.client.renderer.RenderGlobal |
renderGlobal
RenderGlobal reference (IRWL)
|
protected RenderType |
renderType
Type of rendering.
|
protected T |
tileEntity
TileEntity currently drawing (TESR).
|
protected net.minecraft.client.renderer.block.model.ItemCameraTransforms.TransformType |
tranformType
Type of render for item (ITEM)
|
protected boolean |
vertexDrawn
Whether at least one vertex has been drawn.
|
protected net.minecraft.client.renderer.vertex.VertexFormat |
vertexFormat
Current used vertex format.
|
protected net.minecraft.world.IBlockAccess |
world
Current world reference (BLOCK/TESR/IRWL).
|
| Constructor and Description |
|---|
MalisisRenderer()
Instantiates a new
MalisisRenderer. |
| Modifier and Type | Method and Description |
|---|---|
protected void |
_initialize()
_initialize.
|
void |
applyTexture(Face face,
RenderParameters params)
Applies the texture to the
Face with specified RenderParameters. |
void |
applyTexture(Shape shape)
Applies the texture to the
Shape. |
void |
applyTexture(Shape shape,
RenderParameters params)
Applies the texture to the
Shape with specified RenderParameters. |
protected void |
bindTexture(net.minecraft.util.ResourceLocation resourceLocaltion) |
protected int |
calcVertexBrightness(Vertex vertex,
int number,
RenderParameters params)
Calculates the ambient occlusion brightness for a
Vertex. |
protected int |
calcVertexColor(Vertex vertex,
int number,
RenderParameters params)
Calculates the ambient occlusion for a
Vertex and also applies the side dependent shade. |
void |
clean()
Cleans the current renderer state.
|
static int |
colorMultiplier(net.minecraft.world.IBlockAccess world,
net.minecraft.util.math.BlockPos pos,
net.minecraft.block.state.IBlockState state) |
void |
disableBlending()
Disables blending for the rendering.
|
void |
disableTextures()
Disables textures.
|
void |
draw()
Triggers a draw.
|
protected void |
drawFace(Face face)
Draws a
Face with its own RenderParameters. |
protected void |
drawFace(Face face,
RenderParameters params)
Draws a
Face with specified RenderParameters. |
protected void |
drawModel(MalisisModel model,
RenderParameters params) |
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 |
drawText(MalisisFont font,
java.lang.String text,
float x,
float y,
float z,
FontRenderOptions fro)
Draws a string at the specified coordinates, with color and shadow.
|
protected void |
drawVertex(Vertex vertex,
int number,
RenderParameters params)
Draws a single
Vertex. |
void |
enableBlending()
Enables the blending for the rendering.
|
void |
enableTextures()
Enables textures
|
void |
endBillboard()
End billboard mode.
|
protected void |
ensureBlock(java.lang.Class<?>... blockClasses)
Limits the classes the block can be for this
MalisisRenderer. |
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(RenderParameters params)
Gets the base brightness for the current
Face. |
protected float |
getBlockAmbientOcclusion(net.minecraft.world.IBlockAccess world,
net.minecraft.util.math.BlockPos pos)
Gets the block ambient occlusion value.
|
net.minecraft.block.state.IBlockState |
getBlockState() |
protected Icon |
getIcon(Face face,
RenderParameters params)
Gets the
Icon corresponding to the specified RenderParameters. |
protected IIconProvider |
getIconProvider(RenderParameters params)
Gets the
IIconProvider either from parameters, the block or the item. |
net.minecraft.item.ItemStack |
getItemStack() |
protected int |
getMixedBrightnessForBlock(net.minecraft.world.IBlockAccess world,
net.minecraft.util.math.BlockPos pos)
Gets the mix brightness for a block (sky + block source).
|
static float |
getPartialTick() |
net.minecraft.util.math.BlockPos |
getPos() |
protected net.minecraft.util.math.AxisAlignedBB |
getRenderBounds(RenderParameters params)
Gets the rendering bounds.
|
static net.minecraft.util.BlockRenderLayer |
getRenderLayer()
Gets the current
BlockRenderLayer. |
RenderType |
getRenderType() |
T |
getTileEntity() |
javax.vecmath.Matrix4f |
getTransform(net.minecraft.item.Item item,
net.minecraft.client.renderer.block.model.ItemCameraTransforms.TransformType tranformType) |
net.minecraft.world.IBlockAccess |
getWorldAccess() |
protected void |
initialize()
Initializes this
MalisisRenderer. |
protected boolean |
isBatched() |
boolean |
isDrawing()
Checks if the
Tessellator is currently drawing. |
boolean |
isGui3d() |
void |
next()
Triggers a draw and restart drawing with current
drawMode. |
void |
next(int drawMode)
Triggers a draw and restart drawing with drawMode and current
VertexFormat. |
void |
next(int drawMode,
net.minecraft.client.renderer.vertex.VertexFormat vertexFormat)
Triggers a draw and restart drawing with current
drawMode and VertexFormat |
void |
next(net.minecraft.client.renderer.vertex.VertexFormat vertexFormat)
Triggers a draw and restart drawing with current
drawMode and specified VertexFormat |
void |
prepare(RenderType renderType,
double... data)
Prepares the
Tessellator and the GL states for the renderType. |
void |
registerFor(net.minecraft.block.Block block)
Registers this
MalisisRenderer to be used for rendering the Block. |
void |
registerFor(java.lang.Class<? extends T> clazz)
Registers this
MalisisRenderer to be used for rendering the TileEntity. |
void |
registerFor(net.minecraft.item.Item item)
Registers this
MalisisRenderer to be used for rendering the Item. |
void |
registerForRenderWorldLast()
Registers this
MalisisRenderer to be used for RenderWorldLastEvent. |
void |
render()
Main rendering method.
|
boolean |
renderBlock(net.minecraft.client.renderer.VertexBuffer wr,
net.minecraft.world.IBlockAccess world,
net.minecraft.util.math.BlockPos pos,
net.minecraft.block.state.IBlockState state) |
boolean |
renderItem(net.minecraft.item.ItemStack itemStack,
float partialTick) |
void |
renderStandard()
Renders the blocks using the default Minecraft rendering system.
|
void |
renderTileEntityAt(T te,
double x,
double y,
double z,
float partialTick,
int destroyStage)
Renders a
TileEntitySpecialRenderer. |
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.util.math.BlockPos pos)
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,
net.minecraft.util.math.BlockPos pos,
net.minecraft.block.state.IBlockState blockState)
Sets informations for this
MalisisRenderer. |
void |
set(net.minecraft.world.IBlockAccess world,
net.minecraft.util.math.BlockPos pos) |
void |
set(net.minecraft.block.state.IBlockState blockState)
Sets informations for this
MalisisRenderer. |
void |
set(net.minecraft.item.ItemStack itemStack)
Sets informations for this
MalisisRenderer. |
void |
set(T te,
float partialTick)
Sets informations for this
MalisisRenderer. |
protected void |
setBatched() |
void |
setBillboard(float x,
float y,
float z)
Sets billboard mode.
|
void |
setTransformType(net.minecraft.client.renderer.block.model.ItemCameraTransforms.TransformType transformType) |
boolean |
shouldRender(net.minecraftforge.client.event.RenderWorldLastEvent event,
net.minecraft.world.IBlockAccess world)
Whether the renderer should render.
|
protected boolean |
shouldRenderFace(Face face,
RenderParameters params)
Checks if a
Face should be rendered. |
protected boolean |
shouldRotateIcon(RenderParameters params) |
boolean |
shouldSetViewportPosition()
Whether to set the translations based on player current position and partialTick.
|
protected boolean |
smartCull(Face face,
RenderParameters params)
Culls a face based on the actual render bounds used and not block bounding box.
|
void |
startDrawing()
Tells the
Tessellator to start drawing with GL11.GL_QUADS and malisisVertexFormat. |
void |
startDrawing(int drawMode)
Tells the
Tessellator to start drawing with specified drawMode and malisisVertexFormat. |
void |
startDrawing(int drawMode,
net.minecraft.client.renderer.vertex.VertexFormat vertexFormat)
Tells the
Tessellator to start drawing with specified drawMode and specified VertexFormat. |
void |
startDrawing(net.minecraft.client.renderer.vertex.VertexFormat vertexFormat)
Tells the
Tessellator to start drawing with GL11.GL_QUADS and specified VertexFormat. |
protected static final net.minecraft.client.renderer.VertexBuffer batchedBuffer
public static net.minecraft.client.renderer.vertex.VertexFormat malisisVertexFormat
protected net.minecraft.client.renderer.VertexBuffer buffer
protected net.minecraft.client.renderer.vertex.VertexFormat vertexFormat
protected net.minecraft.world.IBlockAccess world
protected net.minecraft.util.math.BlockPos pos
protected net.minecraft.block.Block block
protected net.minecraft.block.state.IBlockState blockState
protected T extends net.minecraft.tileentity.TileEntity tileEntity
protected float partialTick
protected net.minecraft.item.ItemStack itemStack
protected net.minecraft.item.Item item
protected net.minecraft.client.renderer.block.model.ItemCameraTransforms.TransformType tranformType
protected net.minecraft.client.renderer.RenderGlobal renderGlobal
protected RenderType renderType
protected int drawMode
protected int baseBrightness
protected net.minecraft.util.math.Vec3d posOffset
protected boolean getBlockDamage
MalisisRenderer (for TESR).protected net.minecraft.client.renderer.DestroyBlockProgress destroyBlockProgress
protected boolean vertexDrawn
public MalisisRenderer()
MalisisRenderer.public RenderType getRenderType()
public net.minecraft.world.IBlockAccess getWorldAccess()
public net.minecraft.util.math.BlockPos getPos()
public net.minecraft.block.state.IBlockState getBlockState()
public net.minecraft.item.ItemStack getItemStack()
public T getTileEntity()
public void reset()
MalisisRenderer can be reused.public void set(net.minecraft.world.IBlockAccess world,
net.minecraft.block.Block block,
net.minecraft.util.math.BlockPos pos,
net.minecraft.block.state.IBlockState blockState)
MalisisRenderer.world - the worldblock - the blockpos - the posblockState - the block statepublic void set(net.minecraft.world.IBlockAccess world,
net.minecraft.util.math.BlockPos pos)
public void set(net.minecraft.world.IBlockAccess world)
MalisisRenderer.world - the worldpublic void set(net.minecraft.block.Block block)
MalisisRenderer.block - the blockpublic void set(net.minecraft.block.state.IBlockState blockState)
MalisisRenderer.blockState - the block statepublic void set(net.minecraft.util.math.BlockPos pos)
MalisisRenderer.pos - the pospublic void set(T te, float partialTick)
MalisisRenderer.te - the tepartialTick - the partial tickpublic void set(net.minecraft.item.ItemStack itemStack)
MalisisRenderer.itemStack - the item stackprotected void ensureBlock(java.lang.Class<?>... blockClasses)
MalisisRenderer.blockClasses - the block classesprotected void setBatched()
protected boolean isBatched()
public boolean renderBlock(net.minecraft.client.renderer.VertexBuffer wr,
net.minecraft.world.IBlockAccess world,
net.minecraft.util.math.BlockPos pos,
net.minecraft.block.state.IBlockState state)
renderBlock in interface IBlockRendererpublic boolean renderItem(net.minecraft.item.ItemStack itemStack,
float partialTick)
renderItem in interface IItemRendererpublic void setTransformType(net.minecraft.client.renderer.block.model.ItemCameraTransforms.TransformType transformType)
setTransformType in interface IItemRendererpublic boolean isGui3d()
isGui3d in interface IItemRendererpublic javax.vecmath.Matrix4f getTransform(net.minecraft.item.Item item,
net.minecraft.client.renderer.block.model.ItemCameraTransforms.TransformType tranformType)
getTransform in interface IItemRendererpublic void renderTileEntityAt(T te, double x, double y, double z, float partialTick, int destroyStage)
TileEntitySpecialRenderer.renderTileEntityAt in class net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer<T extends net.minecraft.tileentity.TileEntity>te - the TileEntityx - the xy - the yz - the zpartialTick - the partial tickpublic boolean shouldSetViewportPosition()
IRenderWorldLastshouldSetViewportPosition in interface IRenderWorldLastpublic boolean shouldRender(net.minecraftforge.client.event.RenderWorldLastEvent event,
net.minecraft.world.IBlockAccess world)
IRenderWorldLastshouldRender in interface IRenderWorldLastevent - the eventworld - the worldpublic void renderWorldLastEvent(net.minecraftforge.client.event.RenderWorldLastEvent event,
net.minecraft.world.IBlockAccess world)
IRenderWorldLastRenderWorldLastEvent is called.renderWorldLastEvent in interface IRenderWorldLastevent - 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 clean()
public void startDrawing()
Tessellator to start drawing with GL11.GL_QUADS and malisisVertexFormat.public void startDrawing(int drawMode)
Tessellator to start drawing with specified drawMode and malisisVertexFormat.drawMode - the draw modepublic void startDrawing(net.minecraft.client.renderer.vertex.VertexFormat vertexFormat)
Tessellator to start drawing with GL11.GL_QUADS and specified VertexFormat.vertexFormat - the vertex formatpublic void startDrawing(int drawMode,
net.minecraft.client.renderer.vertex.VertexFormat vertexFormat)
Tessellator to start drawing with specified drawMode and specified VertexFormat.drawMode - the draw modevertexFormat - the vertex formatpublic boolean isDrawing()
Tessellator is currently drawing.public void next()
drawMode.public void next(int drawMode)
VertexFormat.drawMode - the draw modepublic void next(net.minecraft.client.renderer.vertex.VertexFormat vertexFormat)
drawMode and specified VertexFormatvertexFormat - the vertex formatpublic void next(int drawMode,
net.minecraft.client.renderer.vertex.VertexFormat vertexFormat)
drawMode and VertexFormatdrawMode - the draw modevertexFormat - the vertex formatpublic void draw()
public void enableBlending()
public void disableBlending()
public void enableTextures()
public void disableTextures()
protected void bindTexture(net.minecraft.util.ResourceLocation resourceLocaltion)
bindTexture in class net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer<T extends net.minecraft.tileentity.TileEntity>public void setBillboard(float x,
float y,
float z)
x - the xy - the yz - the zpublic void endBillboard()
protected final void _initialize()
protected void initialize()
MalisisRenderer. Does nothing by default.public void renderStandard()
public void render()
protected void drawModel(MalisisModel model, RenderParameters params)
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 paramsprotected void drawFace(Face face)
Face with its own RenderParameters.face - the faceprotected void drawFace(Face face, RenderParameters params)
Face with specified RenderParameters.face - the fparams - the face paramsprotected void drawVertex(Vertex vertex, int number, RenderParameters params)
Vertex.vertex - the vertexnumber - the offset inside the face. (Used for AO)public void drawText(MalisisFont font, java.lang.String text, float x, float y, float z, FontRenderOptions fro)
font - the fonttext - the textx - the xy - the yz - the zfro - the froprotected boolean shouldRenderFace(Face face, RenderParameters params)
Face should be rendered. RenderParameters.direction needs to be defined for the face.face - the faceprotected boolean smartCull(Face face, RenderParameters params)
face - the faceparams - the paramspublic void applyTexture(Shape shape)
Shape.RenderParameters.applyTexture set to
false to prevent reapplying texture when rendering.shape - the shapepublic void applyTexture(Shape shape, RenderParameters params)
Shape with specified RenderParameters.RenderParameters.applyTexture set to
false to prevent reapplying texture when rendering.shape - the shapeparams - the parameterspublic void applyTexture(Face face, RenderParameters params)
face - the faceparams - the parametersprotected Icon getIcon(Face face, RenderParameters params)
Icon corresponding to the specified RenderParameters.block or item is an IIconProvider and give the right provider for the current context, gets the icon
from that provider.face - the faceparams - the paramsprotected IIconProvider getIconProvider(RenderParameters params)
IIconProvider either from parameters, the block or the item.protected boolean shouldRotateIcon(RenderParameters params)
protected int calcVertexColor(Vertex vertex, int number, RenderParameters params)
Vertex and also applies the side dependent shade.vertex - the vertexnumber - the numberparams - the paramsprotected int getBaseBrightness(RenderParameters params)
Face.params - the paramsprotected int calcVertexBrightness(Vertex vertex, int number, RenderParameters params)
Vertex. aoMatrix is the list of block coordinates necessary to
compute AO. Only first 3 blocks are used.vertex - the vertexnumber - the numberparams - the paramsprotected 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,
net.minecraft.util.math.BlockPos pos)
world - the worldpos - the posprotected int getMixedBrightnessForBlock(net.minecraft.world.IBlockAccess world,
net.minecraft.util.math.BlockPos pos)
world - the worldpos - the posprotected net.minecraft.util.math.AxisAlignedBB getRenderBounds(RenderParameters params)
params - the paramspublic static float getPartialTick()
public static net.minecraft.util.BlockRenderLayer getRenderLayer()
BlockRenderLayer.public void registerFor(net.minecraft.block.Block block)
block - the blockpublic void registerFor(net.minecraft.item.Item item)
item - the itempublic void registerFor(java.lang.Class<? extends T> clazz)
MalisisRenderer to be used for rendering the TileEntity.clazz - the clazzpublic void registerForRenderWorldLast()
MalisisRenderer to be used for RenderWorldLastEvent.public static int colorMultiplier(net.minecraft.world.IBlockAccess world,
net.minecraft.util.math.BlockPos pos,
net.minecraft.block.state.IBlockState state)