use of mcjty.xnet.blocks.facade.FacadeBlock in project XNet by McJty.
the class ModBlocks method init.
public static void init() {
controllerBlock = new ControllerBlock();
routerBlock = new RouterBlock();
facadeBlock = new FacadeBlock();
redstoneProxyBlock = new RedstoneProxyBlock();
redstoneProxyUBlock = new RedstoneProxyUBlock();
NetCableSetup.init();
}
use of mcjty.xnet.blocks.facade.FacadeBlock in project XNet by McJty.
the class RenderWorldLastEventHandler method renderCablesInt.
private static void renderCablesInt(RenderWorldLastEvent evt, Minecraft mc) {
EntityPlayerSP p = mc.player;
WorldClient world = mc.world;
double doubleX = p.lastTickPosX + (p.posX - p.lastTickPosX) * evt.getPartialTicks();
double doubleY = p.lastTickPosY + (p.posY - p.lastTickPosY) * evt.getPartialTicks();
double doubleZ = p.lastTickPosZ + (p.posZ - p.lastTickPosZ) * evt.getPartialTicks();
GlStateManager.pushMatrix();
GlStateManager.color(1.0f, 0, 0);
GlStateManager.glLineWidth(2);
GlStateManager.translate(-doubleX, -doubleY, -doubleZ);
GlStateManager.disableDepth();
GlStateManager.disableTexture2D();
Tessellator tessellator = Tessellator.getInstance();
BufferBuilder buffer = tessellator.getBuffer();
buffer.begin(GL11.GL_LINES, DefaultVertexFormats.POSITION_COLOR);
for (int dx = -20; dx <= 20; dx++) {
for (int dy = -20; dy <= 20; dy++) {
for (int dz = -20; dz <= 20; dz++) {
BlockPos c = p.getPosition().add(dx, dy, dz);
IBlockState state = world.getBlockState(c);
Block block = state.getBlock();
if (block instanceof FacadeBlock || block instanceof ConnectorBlock || block instanceof GenericCableBlock) {
IExtendedBlockState extendedBlockState;
if (state.getBlock() instanceof FacadeBlock) {
extendedBlockState = (IExtendedBlockState) ((FacadeBlock) state.getBlock()).getStateInternal(state, world, c);
} else {
extendedBlockState = (IExtendedBlockState) state.getBlock().getExtendedState(state, world, c);
}
FacadeBlockId facadeId = extendedBlockState.getValue(GenericCableBlock.FACADEID);
if (((!GeneralConfiguration.showNonFacadedCablesWhileSneaking) || (!p.isSneaking())) && facadeId == null && !(block instanceof FacadeBlock)) {
continue;
}
CableColor color = extendedBlockState.getValue(GenericCableBlock.COLOR);
float r = 0;
float g = 0;
float b = 0;
switch(color) {
case BLUE:
r = .4f;
g = .4f;
b = 1f;
break;
case RED:
r = 1f;
g = .4f;
b = .4f;
break;
case YELLOW:
r = 1f;
g = 1f;
b = .4f;
break;
case GREEN:
r = .4f;
g = 1f;
b = .4f;
break;
case ROUTING:
r = .7f;
g = .7f;
b = .7f;
break;
}
List<Rect> quads = getQuads(extendedBlockState);
for (Rect quad : quads) {
renderRect(buffer, quad, c, r, g, b, 0.5f);
}
}
}
}
}
tessellator.draw();
GlStateManager.enableTexture2D();
GlStateManager.popMatrix();
}
Aggregations