1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
|
package gregtech.common.render;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.item.ItemStack;
import net.minecraft.world.IBlockAccess;
import net.minecraftforge.common.util.ForgeDirection;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import gregtech.api.enums.Textures;
import gregtech.api.interfaces.ITexture;
public interface IRenderedBlock {
/** @return the Textures to be rendered */
@SideOnly(Side.CLIENT)
ITexture[] getTexture(Block aBlock, ForgeDirection side, int aRenderPass, boolean[] aShouldSideBeRendered);
@SideOnly(Side.CLIENT)
ITexture[] getTexture(Block aBlock, ForgeDirection side, boolean isActive, int aRenderPass);
/** gets the Amount of Render Passes for this TileEntity or similar Handler. Only gets called once per Rendering. */
@SideOnly(Side.CLIENT)
int getRenderPasses(Block aBlock);
/** if this uses said Render Pass or if it can be skipped entirely. */
@SideOnly(Side.CLIENT)
boolean usesRenderPass(int aRenderPass);
/** sets the Block Size rendered; return false for letting it select the normal Block Bounds. */
@SideOnly(Side.CLIENT)
boolean setBlockBounds(Block aBlock, int aRenderPass);
/** returning true stops all the other Rendering from happening. */
@SideOnly(Side.CLIENT)
default boolean renderItem(Block aBlock, RenderBlocks aRenderer) {
return false;
}
/** returning true stops all the other Rendering from happening. */
@SideOnly(Side.CLIENT)
default boolean renderBlock(Block aBlock, RenderBlocks aRenderer, IBlockAccess aWorld, int aX, int aY, int aZ) {
return false;
}
/** if this Block lets the TileEntity or a similar Handler do all the Inventory Render work. */
@SideOnly(Side.CLIENT)
IRenderedBlock passRenderingToObject(ItemStack aStack);
/** if this Block lets the TileEntity or a similar Handler do all the World Render work. */
@SideOnly(Side.CLIENT)
IRenderedBlock passRenderingToObject(IBlockAccess aWorld, int aX, int aY, int aZ);
class ErrorRenderer implements IRenderedBlockSideCheck, IRenderedBlock {
public static final ErrorRenderer INSTANCE = new ErrorRenderer();
public ITexture[] mErrorTexture = Textures.BlockIcons.ERROR_RENDERING;
@Override
public ITexture[] getTexture(Block aBlock, ForgeDirection side, int aRenderPass,
boolean[] aShouldSideBeRendered) {
return mErrorTexture;
}
@Override
public ITexture[] getTexture(Block aBlock, ForgeDirection side, boolean isActive, int aRenderPass) {
return mErrorTexture;
}
@Override
public int getRenderPasses(Block aBlock) {
return 1;
}
@Override
public boolean usesRenderPass(int aRenderPass) {
return true;
}
@Override
public boolean setBlockBounds(Block aBlock, int aRenderPass) {
aBlock.setBlockBounds(-0.25F, -0.25F, -0.25F, 1.25F, 1.25F, 1.25F);
return true;
}
@Override
public boolean renderFullBlockSide(Block aBlock, RenderBlocks aRenderer, ForgeDirection side) {
return true;
}
@Override
public IRenderedBlock passRenderingToObject(ItemStack aStack) {
return this;
}
@Override
public IRenderedBlock passRenderingToObject(IBlockAccess aWorld, int aX, int aY, int aZ) {
return this;
}
@Override
public boolean renderBlock(Block aBlock, RenderBlocks aRenderer, IBlockAccess aWorld, int aX, int aY, int aZ) {
aBlock.setBlockBounds(-0.25F, -0.25F, -0.25F, 1.25F, 1.25F, 1.25F);
GTRendererBlock.renderNegativeYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, mErrorTexture, false);
GTRendererBlock.renderPositiveYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, mErrorTexture, false);
GTRendererBlock.renderNegativeZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, mErrorTexture, false);
GTRendererBlock.renderPositiveZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, mErrorTexture, false);
GTRendererBlock.renderNegativeXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, mErrorTexture, false);
GTRendererBlock.renderPositiveXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, mErrorTexture, false);
return true;
}
}
}
|