use of net.minecraftforge.common.property.IExtendedBlockState in project pnc-repressurized by TeamPneumatic.
the class CamoModel method handleBlockState.
private IBakedModel handleBlockState(IBlockState state) {
if (state instanceof IExtendedBlockState) {
IExtendedBlockState ext = (IExtendedBlockState) state;
IBlockState camoState = ext.getValue(BlockPneumaticCraftCamo.CAMO_STATE);
if (camoState != null && !(camoState.getBlock() instanceof BlockPneumaticCraftCamo)) {
BlockModelShapes blockModelShapes = Minecraft.getMinecraft().getBlockRendererDispatcher().getBlockModelShapes();
return blockModelShapes.getModelForState(camoState);
}
}
return originalModel;
}
use of net.minecraftforge.common.property.IExtendedBlockState in project pnc-repressurized by TeamPneumatic.
the class PressureGlassBakedModel method getQuads.
@Override
public List<BakedQuad> getQuads(@Nullable IBlockState state, @Nullable EnumFacing side, long rand) {
if (!(state instanceof IExtendedBlockState) || side == null) {
return Collections.emptyList();
}
IExtendedBlockState extendedBlockState = (IExtendedBlockState) state;
List<BakedQuad> quads = new ArrayList<>();
switch(side) {
case DOWN:
int down = extendedBlockState.getValue(BlockPressureChamberGlass.DOWN);
quads.add(createQuad(new Vec3d(1, 0, 0), new Vec3d(1, 0, 1), new Vec3d(0, 0, 1), new Vec3d(0, 0, 0), SPRITES[down]));
break;
case UP:
int up = extendedBlockState.getValue(BlockPressureChamberGlass.UP);
quads.add(createQuad(new Vec3d(0, 1, 0), new Vec3d(0, 1, 1), new Vec3d(1, 1, 1), new Vec3d(1, 1, 0), SPRITES[up]));
break;
case NORTH:
int north = extendedBlockState.getValue(BlockPressureChamberGlass.NORTH);
quads.add(createQuad(new Vec3d(1, 1, 0), new Vec3d(1, 0, 0), new Vec3d(0, 0, 0), new Vec3d(0, 1, 0), SPRITES[north]));
break;
case SOUTH:
int south = extendedBlockState.getValue(BlockPressureChamberGlass.SOUTH);
quads.add(createQuad(new Vec3d(0, 1, 1), new Vec3d(0, 0, 1), new Vec3d(1, 0, 1), new Vec3d(1, 1, 1), SPRITES[south]));
break;
case WEST:
int west = extendedBlockState.getValue(BlockPressureChamberGlass.WEST);
quads.add(createQuad(new Vec3d(0, 1, 0), new Vec3d(0, 0, 0), new Vec3d(0, 0, 1), new Vec3d(0, 1, 1), SPRITES[west]));
break;
case EAST:
int east = extendedBlockState.getValue(BlockPressureChamberGlass.EAST);
quads.add(createQuad(new Vec3d(1, 1, 1), new Vec3d(1, 0, 1), new Vec3d(1, 0, 0), new Vec3d(1, 1, 0), SPRITES[east]));
break;
}
return quads;
}
use of net.minecraftforge.common.property.IExtendedBlockState 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();
}
use of net.minecraftforge.common.property.IExtendedBlockState in project XNet by McJty.
the class GenericCableBakedModel method getQuads.
@Override
public List<BakedQuad> getQuads(IBlockState state, EnumFacing side, long rand) {
IExtendedBlockState extendedBlockState = (IExtendedBlockState) state;
FacadeBlockId facadeId = extendedBlockState.getValue(GenericCableBlock.FACADEID);
if (facadeId != null) {
IBlockState facadeState = facadeId.getBlockState();
if (!facadeState.getBlock().canRenderInLayer(facadeState, MinecraftForgeClient.getRenderLayer())) {
return Collections.emptyList();
}
IBakedModel model = Minecraft.getMinecraft().getBlockRendererDispatcher().getBlockModelShapes().getModelForState(facadeState);
try {
return model.getQuads(state, side, rand);
} catch (Exception e) {
return Collections.emptyList();
}
}
if (side != null || (state.getBlock() instanceof ConnectorBlock && MinecraftForgeClient.getRenderLayer() != BlockRenderLayer.CUTOUT_MIPPED)) {
return Collections.emptyList();
}
// Called with the blockstate from our block. Here we get the values of the six properties and pass that to
// our baked model implementation.
ConnectorType north = extendedBlockState.getValue(GenericCableBlock.NORTH);
ConnectorType south = extendedBlockState.getValue(GenericCableBlock.SOUTH);
ConnectorType west = extendedBlockState.getValue(GenericCableBlock.WEST);
ConnectorType east = extendedBlockState.getValue(GenericCableBlock.EAST);
ConnectorType up = extendedBlockState.getValue(GenericCableBlock.UP);
ConnectorType down = extendedBlockState.getValue(GenericCableBlock.DOWN);
CableColor cableColor = extendedBlockState.getValue(GenericCableBlock.COLOR);
int index = cableColor.ordinal();
initTextures();
CableTextures ct = cableTextures[index];
spriteCable = ct.spriteNormalCable;
GenericCableBlock block = (GenericCableBlock) state.getBlock();
if (block.isAdvancedConnector()) {
spriteConnector = ct.spriteAdvancedConnector;
} else {
spriteConnector = ct.spriteConnector;
}
Function<CablePatterns.SpriteIdx, TextureAtlasSprite> getSprite = idx -> getSpriteNormal(idx, index);
float hilight = 1.0f;
if (block instanceof ConnectorBlock) {
if (north != BLOCK && south != BLOCK && west != BLOCK && east != BLOCK && up != BLOCK && down != BLOCK) {
// To make connectors with no actual connections visible
hilight = 0.5f;
}
}
List<BakedQuad> quads = new ArrayList<>();
// Thickness of the cable. .0 would be full block, .5 is infinitely thin.
double o = .4;
// Thickness of the connector as it is put on the connecting block
double p = .1;
// The wideness of the connector
double q = .2;
if (up == CABLE) {
quads.add(createQuad(v(1 - o, 1, o), v(1 - o, 1, 1 - o), v(1 - o, 1 - o, 1 - o), v(1 - o, 1 - o, o), spriteCable, hilight));
quads.add(createQuad(v(o, 1, 1 - o), v(o, 1, o), v(o, 1 - o, o), v(o, 1 - o, 1 - o), spriteCable, hilight));
quads.add(createQuad(v(o, 1, o), v(1 - o, 1, o), v(1 - o, 1 - o, o), v(o, 1 - o, o), spriteCable, hilight));
quads.add(createQuad(v(o, 1 - o, 1 - o), v(1 - o, 1 - o, 1 - o), v(1 - o, 1, 1 - o), v(o, 1, 1 - o), spriteCable, hilight));
} else if (up == BLOCK) {
quads.add(createQuad(v(1 - o, 1 - p, o), v(1 - o, 1 - p, 1 - o), v(1 - o, 1 - o, 1 - o), v(1 - o, 1 - o, o), spriteCable, hilight));
quads.add(createQuad(v(o, 1 - p, 1 - o), v(o, 1 - p, o), v(o, 1 - o, o), v(o, 1 - o, 1 - o), spriteCable, hilight));
quads.add(createQuad(v(o, 1 - p, o), v(1 - o, 1 - p, o), v(1 - o, 1 - o, o), v(o, 1 - o, o), spriteCable, hilight));
quads.add(createQuad(v(o, 1 - o, 1 - o), v(1 - o, 1 - o, 1 - o), v(1 - o, 1 - p, 1 - o), v(o, 1 - p, 1 - o), spriteCable, hilight));
quads.add(createQuad(v(1 - q, 1 - p, q), v(1 - q, 1, q), v(1 - q, 1, 1 - q), v(1 - q, 1 - p, 1 - q), spriteSide, hilight));
quads.add(createQuad(v(q, 1 - p, 1 - q), v(q, 1, 1 - q), v(q, 1, q), v(q, 1 - p, q), spriteSide, hilight));
quads.add(createQuad(v(q, 1, q), v(1 - q, 1, q), v(1 - q, 1 - p, q), v(q, 1 - p, q), spriteSide, hilight));
quads.add(createQuad(v(q, 1 - p, 1 - q), v(1 - q, 1 - p, 1 - q), v(1 - q, 1, 1 - q), v(q, 1, 1 - q), spriteSide, hilight));
quads.add(createQuad(v(q, 1 - p, q), v(1 - q, 1 - p, q), v(1 - q, 1 - p, 1 - q), v(q, 1 - p, 1 - q), spriteConnector, hilight));
quads.add(createQuad(v(q, 1, q), v(q, 1, 1 - q), v(1 - q, 1, 1 - q), v(1 - q, 1, q), spriteSide, hilight));
} else {
CablePatterns.QuadSetting pattern = CablePatterns.findPattern(west, south, east, north);
quads.add(createQuad(v(o, 1 - o, 1 - o), v(1 - o, 1 - o, 1 - o), v(1 - o, 1 - o, o), v(o, 1 - o, o), getSprite.apply(pattern.getSprite()), pattern.getRotation(), hilight));
}
if (down == CABLE) {
quads.add(createQuad(v(1 - o, o, o), v(1 - o, o, 1 - o), v(1 - o, 0, 1 - o), v(1 - o, 0, o), spriteCable, hilight));
quads.add(createQuad(v(o, o, 1 - o), v(o, o, o), v(o, 0, o), v(o, 0, 1 - o), spriteCable, hilight));
quads.add(createQuad(v(o, o, o), v(1 - o, o, o), v(1 - o, 0, o), v(o, 0, o), spriteCable, hilight));
quads.add(createQuad(v(o, 0, 1 - o), v(1 - o, 0, 1 - o), v(1 - o, o, 1 - o), v(o, o, 1 - o), spriteCable, hilight));
} else if (down == BLOCK) {
quads.add(createQuad(v(1 - o, o, o), v(1 - o, o, 1 - o), v(1 - o, p, 1 - o), v(1 - o, p, o), spriteCable, hilight));
quads.add(createQuad(v(o, o, 1 - o), v(o, o, o), v(o, p, o), v(o, p, 1 - o), spriteCable, hilight));
quads.add(createQuad(v(o, o, o), v(1 - o, o, o), v(1 - o, p, o), v(o, p, o), spriteCable, hilight));
quads.add(createQuad(v(o, p, 1 - o), v(1 - o, p, 1 - o), v(1 - o, o, 1 - o), v(o, o, 1 - o), spriteCable, hilight));
quads.add(createQuad(v(1 - q, 0, q), v(1 - q, p, q), v(1 - q, p, 1 - q), v(1 - q, 0, 1 - q), spriteSide, hilight));
quads.add(createQuad(v(q, 0, 1 - q), v(q, p, 1 - q), v(q, p, q), v(q, 0, q), spriteSide, hilight));
quads.add(createQuad(v(q, p, q), v(1 - q, p, q), v(1 - q, 0, q), v(q, 0, q), spriteSide, hilight));
quads.add(createQuad(v(q, 0, 1 - q), v(1 - q, 0, 1 - q), v(1 - q, p, 1 - q), v(q, p, 1 - q), spriteSide, hilight));
quads.add(createQuad(v(q, p, 1 - q), v(1 - q, p, 1 - q), v(1 - q, p, q), v(q, p, q), spriteConnector, hilight));
quads.add(createQuad(v(q, 0, 1 - q), v(q, 0, q), v(1 - q, 0, q), v(1 - q, 0, 1 - q), spriteSide, hilight));
} else {
CablePatterns.QuadSetting pattern = CablePatterns.findPattern(west, north, east, south);
quads.add(createQuad(v(o, o, o), v(1 - o, o, o), v(1 - o, o, 1 - o), v(o, o, 1 - o), getSprite.apply(pattern.getSprite()), pattern.getRotation(), hilight));
}
if (east == CABLE) {
quads.add(createQuad(v(1, 1 - o, 1 - o), v(1, 1 - o, o), v(1 - o, 1 - o, o), v(1 - o, 1 - o, 1 - o), spriteCable, hilight));
quads.add(createQuad(v(1, o, o), v(1, o, 1 - o), v(1 - o, o, 1 - o), v(1 - o, o, o), spriteCable, hilight));
quads.add(createQuad(v(1, 1 - o, o), v(1, o, o), v(1 - o, o, o), v(1 - o, 1 - o, o), spriteCable, hilight));
quads.add(createQuad(v(1, o, 1 - o), v(1, 1 - o, 1 - o), v(1 - o, 1 - o, 1 - o), v(1 - o, o, 1 - o), spriteCable, hilight));
} else if (east == BLOCK) {
quads.add(createQuad(v(1 - p, 1 - o, 1 - o), v(1 - p, 1 - o, o), v(1 - o, 1 - o, o), v(1 - o, 1 - o, 1 - o), spriteCable, hilight));
quads.add(createQuad(v(1 - p, o, o), v(1 - p, o, 1 - o), v(1 - o, o, 1 - o), v(1 - o, o, o), spriteCable, hilight));
quads.add(createQuad(v(1 - p, 1 - o, o), v(1 - p, o, o), v(1 - o, o, o), v(1 - o, 1 - o, o), spriteCable, hilight));
quads.add(createQuad(v(1 - p, o, 1 - o), v(1 - p, 1 - o, 1 - o), v(1 - o, 1 - o, 1 - o), v(1 - o, o, 1 - o), spriteCable, hilight));
quads.add(createQuad(v(1 - p, 1 - q, 1 - q), v(1, 1 - q, 1 - q), v(1, 1 - q, q), v(1 - p, 1 - q, q), spriteSide, hilight));
quads.add(createQuad(v(1 - p, q, q), v(1, q, q), v(1, q, 1 - q), v(1 - p, q, 1 - q), spriteSide, hilight));
quads.add(createQuad(v(1 - p, 1 - q, q), v(1, 1 - q, q), v(1, q, q), v(1 - p, q, q), spriteSide, hilight));
quads.add(createQuad(v(1 - p, q, 1 - q), v(1, q, 1 - q), v(1, 1 - q, 1 - q), v(1 - p, 1 - q, 1 - q), spriteSide, hilight));
quads.add(createQuad(v(1 - p, q, 1 - q), v(1 - p, 1 - q, 1 - q), v(1 - p, 1 - q, q), v(1 - p, q, q), spriteConnector, hilight));
quads.add(createQuad(v(1, q, 1 - q), v(1, q, q), v(1, 1 - q, q), v(1, 1 - q, 1 - q), spriteSide, hilight));
} else {
CablePatterns.QuadSetting pattern = CablePatterns.findPattern(down, north, up, south);
quads.add(createQuad(v(1 - o, o, o), v(1 - o, 1 - o, o), v(1 - o, 1 - o, 1 - o), v(1 - o, o, 1 - o), getSprite.apply(pattern.getSprite()), pattern.getRotation(), hilight));
}
if (west == CABLE) {
quads.add(createQuad(v(o, 1 - o, 1 - o), v(o, 1 - o, o), v(0, 1 - o, o), v(0, 1 - o, 1 - o), spriteCable, hilight));
quads.add(createQuad(v(o, o, o), v(o, o, 1 - o), v(0, o, 1 - o), v(0, o, o), spriteCable, hilight));
quads.add(createQuad(v(o, 1 - o, o), v(o, o, o), v(0, o, o), v(0, 1 - o, o), spriteCable, hilight));
quads.add(createQuad(v(o, o, 1 - o), v(o, 1 - o, 1 - o), v(0, 1 - o, 1 - o), v(0, o, 1 - o), spriteCable, hilight));
} else if (west == BLOCK) {
quads.add(createQuad(v(o, 1 - o, 1 - o), v(o, 1 - o, o), v(p, 1 - o, o), v(p, 1 - o, 1 - o), spriteCable, hilight));
quads.add(createQuad(v(o, o, o), v(o, o, 1 - o), v(p, o, 1 - o), v(p, o, o), spriteCable, hilight));
quads.add(createQuad(v(o, 1 - o, o), v(o, o, o), v(p, o, o), v(p, 1 - o, o), spriteCable, hilight));
quads.add(createQuad(v(o, o, 1 - o), v(o, 1 - o, 1 - o), v(p, 1 - o, 1 - o), v(p, o, 1 - o), spriteCable, hilight));
quads.add(createQuad(v(0, 1 - q, 1 - q), v(p, 1 - q, 1 - q), v(p, 1 - q, q), v(0, 1 - q, q), spriteSide, hilight));
quads.add(createQuad(v(0, q, q), v(p, q, q), v(p, q, 1 - q), v(0, q, 1 - q), spriteSide, hilight));
quads.add(createQuad(v(0, 1 - q, q), v(p, 1 - q, q), v(p, q, q), v(0, q, q), spriteSide, hilight));
quads.add(createQuad(v(0, q, 1 - q), v(p, q, 1 - q), v(p, 1 - q, 1 - q), v(0, 1 - q, 1 - q), spriteSide, hilight));
quads.add(createQuad(v(p, q, q), v(p, 1 - q, q), v(p, 1 - q, 1 - q), v(p, q, 1 - q), spriteConnector, hilight));
quads.add(createQuad(v(0, q, q), v(0, q, 1 - q), v(0, 1 - q, 1 - q), v(0, 1 - q, q), spriteSide, hilight));
} else {
CablePatterns.QuadSetting pattern = CablePatterns.findPattern(down, south, up, north);
quads.add(createQuad(v(o, o, 1 - o), v(o, 1 - o, 1 - o), v(o, 1 - o, o), v(o, o, o), getSprite.apply(pattern.getSprite()), pattern.getRotation(), hilight));
}
if (north == CABLE) {
quads.add(createQuad(v(o, 1 - o, o), v(1 - o, 1 - o, o), v(1 - o, 1 - o, 0), v(o, 1 - o, 0), spriteCable, hilight));
quads.add(createQuad(v(o, o, 0), v(1 - o, o, 0), v(1 - o, o, o), v(o, o, o), spriteCable, hilight));
quads.add(createQuad(v(1 - o, o, 0), v(1 - o, 1 - o, 0), v(1 - o, 1 - o, o), v(1 - o, o, o), spriteCable, hilight));
quads.add(createQuad(v(o, o, o), v(o, 1 - o, o), v(o, 1 - o, 0), v(o, o, 0), spriteCable, hilight));
} else if (north == BLOCK) {
quads.add(createQuad(v(o, 1 - o, o), v(1 - o, 1 - o, o), v(1 - o, 1 - o, p), v(o, 1 - o, p), spriteCable, hilight));
quads.add(createQuad(v(o, o, p), v(1 - o, o, p), v(1 - o, o, o), v(o, o, o), spriteCable, hilight));
quads.add(createQuad(v(1 - o, o, p), v(1 - o, 1 - o, p), v(1 - o, 1 - o, o), v(1 - o, o, o), spriteCable, hilight));
quads.add(createQuad(v(o, o, o), v(o, 1 - o, o), v(o, 1 - o, p), v(o, o, p), spriteCable, hilight));
quads.add(createQuad(v(q, 1 - q, p), v(1 - q, 1 - q, p), v(1 - q, 1 - q, 0), v(q, 1 - q, 0), spriteSide, hilight));
quads.add(createQuad(v(q, q, 0), v(1 - q, q, 0), v(1 - q, q, p), v(q, q, p), spriteSide, hilight));
quads.add(createQuad(v(1 - q, q, 0), v(1 - q, 1 - q, 0), v(1 - q, 1 - q, p), v(1 - q, q, p), spriteSide, hilight));
quads.add(createQuad(v(q, q, p), v(q, 1 - q, p), v(q, 1 - q, 0), v(q, q, 0), spriteSide, hilight));
quads.add(createQuad(v(q, q, p), v(1 - q, q, p), v(1 - q, 1 - q, p), v(q, 1 - q, p), spriteConnector, hilight));
quads.add(createQuad(v(q, q, 0), v(q, 1 - q, 0), v(1 - q, 1 - q, 0), v(1 - q, q, 0), spriteSide, hilight));
} else {
CablePatterns.QuadSetting pattern = CablePatterns.findPattern(west, up, east, down);
quads.add(createQuad(v(o, 1 - o, o), v(1 - o, 1 - o, o), v(1 - o, o, o), v(o, o, o), getSprite.apply(pattern.getSprite()), pattern.getRotation(), hilight));
}
if (south == CABLE) {
quads.add(createQuad(v(o, 1 - o, 1), v(1 - o, 1 - o, 1), v(1 - o, 1 - o, 1 - o), v(o, 1 - o, 1 - o), spriteCable, hilight));
quads.add(createQuad(v(o, o, 1 - o), v(1 - o, o, 1 - o), v(1 - o, o, 1), v(o, o, 1), spriteCable, hilight));
quads.add(createQuad(v(1 - o, o, 1 - o), v(1 - o, 1 - o, 1 - o), v(1 - o, 1 - o, 1), v(1 - o, o, 1), spriteCable, hilight));
quads.add(createQuad(v(o, o, 1), v(o, 1 - o, 1), v(o, 1 - o, 1 - o), v(o, o, 1 - o), spriteCable, hilight));
} else if (south == BLOCK) {
quads.add(createQuad(v(o, 1 - o, 1 - p), v(1 - o, 1 - o, 1 - p), v(1 - o, 1 - o, 1 - o), v(o, 1 - o, 1 - o), spriteCable, hilight));
quads.add(createQuad(v(o, o, 1 - o), v(1 - o, o, 1 - o), v(1 - o, o, 1 - p), v(o, o, 1 - p), spriteCable, hilight));
quads.add(createQuad(v(1 - o, o, 1 - o), v(1 - o, 1 - o, 1 - o), v(1 - o, 1 - o, 1 - p), v(1 - o, o, 1 - p), spriteCable, hilight));
quads.add(createQuad(v(o, o, 1 - p), v(o, 1 - o, 1 - p), v(o, 1 - o, 1 - o), v(o, o, 1 - o), spriteCable, hilight));
quads.add(createQuad(v(q, 1 - q, 1), v(1 - q, 1 - q, 1), v(1 - q, 1 - q, 1 - p), v(q, 1 - q, 1 - p), spriteSide, hilight));
quads.add(createQuad(v(q, q, 1 - p), v(1 - q, q, 1 - p), v(1 - q, q, 1), v(q, q, 1), spriteSide, hilight));
quads.add(createQuad(v(1 - q, q, 1 - p), v(1 - q, 1 - q, 1 - p), v(1 - q, 1 - q, 1), v(1 - q, q, 1), spriteSide, hilight));
quads.add(createQuad(v(q, q, 1), v(q, 1 - q, 1), v(q, 1 - q, 1 - p), v(q, q, 1 - p), spriteSide, hilight));
quads.add(createQuad(v(q, 1 - q, 1 - p), v(1 - q, 1 - q, 1 - p), v(1 - q, q, 1 - p), v(q, q, 1 - p), spriteConnector, hilight));
quads.add(createQuad(v(q, 1 - q, 1), v(q, q, 1), v(1 - q, q, 1), v(1 - q, 1 - q, 1), spriteSide, hilight));
} else {
CablePatterns.QuadSetting pattern = CablePatterns.findPattern(west, down, east, up);
quads.add(createQuad(v(o, o, 1 - o), v(1 - o, o, 1 - o), v(1 - o, 1 - o, 1 - o), v(o, 1 - o, 1 - o), getSprite.apply(pattern.getSprite()), pattern.getRotation(), hilight));
}
return quads;
}
use of net.minecraftforge.common.property.IExtendedBlockState in project XNet by McJty.
the class GenericCableBlock method getStateInternal.
public IBlockState getStateInternal(IBlockState state, IBlockAccess world, BlockPos pos) {
IExtendedBlockState extendedBlockState = (IExtendedBlockState) state;
CableColor color = state.getValue(COLOR);
ConnectorType north = getConnectorType(color, world, pos, EnumFacing.NORTH);
ConnectorType south = getConnectorType(color, world, pos, EnumFacing.SOUTH);
ConnectorType west = getConnectorType(color, world, pos, EnumFacing.WEST);
ConnectorType east = getConnectorType(color, world, pos, EnumFacing.EAST);
ConnectorType up = getConnectorType(color, world, pos, EnumFacing.UP);
ConnectorType down = getConnectorType(color, world, pos, EnumFacing.DOWN);
return extendedBlockState.withProperty(NORTH, north).withProperty(SOUTH, south).withProperty(WEST, west).withProperty(EAST, east).withProperty(UP, up).withProperty(DOWN, down);
}
Aggregations