-
Notifications
You must be signed in to change notification settings - Fork 497
/
FactoryProxyClient.java
86 lines (74 loc) · 3.13 KB
/
FactoryProxyClient.java
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
package buildcraft.factory;
import java.lang.reflect.Method;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.util.Icon;
import net.minecraft.world.World;
import buildcraft.BuildCraftCore;
import buildcraft.BuildCraftFactory;
import buildcraft.core.EntityBlock;
import buildcraft.core.render.RenderVoid;
import buildcraft.core.render.RenderingEntityBlocks;
import buildcraft.core.render.RenderingEntityBlocks.EntityRenderIndex;
import buildcraft.factory.gui.GuiAutoCrafting;
import buildcraft.factory.render.RenderHopper;
import buildcraft.factory.render.RenderRefinery;
import buildcraft.factory.render.RenderTank;
import cpw.mods.fml.client.registry.ClientRegistry;
import cpw.mods.fml.client.registry.RenderingRegistry;
public class FactoryProxyClient extends FactoryProxy {
private Icon pumpTexture;
private Icon drillTexture;
private Icon drillHeadTexture;
@Override
public void initializeTileEntities() {
super.initializeTileEntities();
ClientRegistry.bindTileEntitySpecialRenderer(TileTank.class, new RenderTank());
ClientRegistry.bindTileEntitySpecialRenderer(TileRefinery.class, new RenderRefinery());
RenderingEntityBlocks.blockByEntityRenders.put(new EntityRenderIndex(BuildCraftFactory.refineryBlock, 0), new RenderRefinery());
if (!BuildCraftFactory.hopperDisabled) {
ClientRegistry.bindTileEntitySpecialRenderer(TileHopper.class, new RenderHopper());
RenderingEntityBlocks.blockByEntityRenders.put(new EntityRenderIndex(BuildCraftFactory.hopperBlock, 0), new RenderHopper());
}
}
@Override
public void initializeEntityRenders() {
RenderingRegistry.registerEntityRenderingHandler(EntityMechanicalArm.class, new RenderVoid());
TextureMap terrainTextures = Minecraft.getMinecraft().renderEngine.textureMapItems;
pumpTexture = terrainTextures.registerIcons("buildcraft:blockPumpTubeTexture");
drillTexture = terrainTextures.registerIcons("buildcraft:blockDrillTexture");
drillHeadTexture = terrainTextures.registerIcons("buildcraft:blockDrillHeadTexture");
}
@Override
public void initializeNEIIntegration() {
try {
Class<?> neiRenderer = Class.forName("codechicken.nei.DefaultOverlayRenderer");
Method method = neiRenderer.getMethod("registerGuiOverlay", Class.class, String.class, int.class, int.class);
method.invoke(null, GuiAutoCrafting.class, "crafting", 5, 11);
BuildCraftCore.bcLog.fine("NEI detected, adding NEI overlay");
} catch (Exception e) {
BuildCraftCore.bcLog.fine("NEI not detected.");
}
}
@Override
public EntityBlock newPumpTube(World w)
{
EntityBlock eb = super.newPumpTube(w);
eb.texture = pumpTexture;
return eb;
}
@Override
public EntityBlock newDrill(World w, double i, double j, double k, double l, double d, double e)
{
EntityBlock eb = super.newDrill(w, i, j, k, l, d, e);
eb.texture = drillTexture;
return eb;
}
@Override
public EntityBlock newDrillHead(World w, double i, double j, double k, double l, double d, double e)
{
EntityBlock eb = super.newDrillHead(w, i, j, k, l, d, e);
eb.texture = drillHeadTexture;
return eb;
}
}