use of crazypants.enderio.base.conduit.geom.CollidableComponent in project EnderIO by SleepyTrousers.
the class InsulatedRedstoneConduit method createCollidables.
@Override
@Nonnull
public Collection<CollidableComponent> createCollidables(@Nonnull CacheKey key) {
Collection<CollidableComponent> baseCollidables = super.createCollidables(key);
if (key.dir == null) {
return baseCollidables;
}
BoundingBox bb = ConduitGeometryUtil.instance.createBoundsForConnectionController(key.dir, key.offset);
CollidableComponent cc = new CollidableComponent(IRedstoneConduit.class, bb, key.dir, COLOR_CONTROLLER_ID);
List<CollidableComponent> result = new ArrayList<CollidableComponent>();
result.addAll(baseCollidables);
result.add(cc);
return result;
}
use of crazypants.enderio.base.conduit.geom.CollidableComponent in project EnderIO by SleepyTrousers.
the class ConduitBundleRenderer method addBreakingQuads.
private void addBreakingQuads(@Nonnull IConduitBundle bundle, @Nonnull List<BakedQuad> quads) {
Class<? extends IConduit> conduitType = null;
RayTraceResult hit = Minecraft.getMinecraft().objectMouseOver;
if (NullHelper.untrust(hit) != null && (hit.hitInfo instanceof CollidableComponent)) {
conduitType = ((CollidableComponent) hit.hitInfo).conduitType;
}
if (breakingAnimOnWholeConduit) {
for (IClientConduit c : bundle.getClientConduits()) {
if (conduitType == c.getClass() || conduitType == c.getBaseConduitType()) {
IConduitRenderer renderer = getRendererForConduit(c);
renderer.addBakedQuads(this, bundle, (IClientConduit.WithDefaultRendering) c, 1, BlockRenderLayer.CUTOUT, quads);
}
}
}
List<CollidableComponent> connectors = bundle.getConnectors();
for (CollidableComponent component : connectors) {
if (component != null) {
if (component.conduitType == conduitType || conduitType == null) {
IClientConduit.WithDefaultRendering conduit = (IClientConduit.WithDefaultRendering) bundle.getConduit(component.conduitType);
if (conduit != null) {
TextureAtlasSprite tex = conduit.getTextureForState(component);
BakedQuadBuilder.addBakedQuads(quads, component.bound, tex);
}
}
}
}
}
use of crazypants.enderio.base.conduit.geom.CollidableComponent in project EnderIO by SleepyTrousers.
the class DefaultConduitRenderer method renderDynamicEntity.
// ------------ Dynamic ---------------------------------------------
@Override
public void renderDynamicEntity(@Nonnull TileEntitySpecialRenderer conduitBundleRenderer, @Nonnull IConduitBundle te, @Nonnull IClientConduit.WithDefaultRendering conduit, double x, double y, double z, float partialTick, float worldLight) {
Collection<CollidableComponent> components = conduit.getCollidableComponents();
transmissionScaleFactor = conduit.getTransmitionGeometryScale();
for (CollidableComponent component : components) {
if (renderComponent(component)) {
float selfIllum = Math.max(worldLight, conduit.getSelfIlluminationForState(component));
final TextureAtlasSprite transmitionTextureForState = conduit.getTransmitionTextureForState(component);
if (isNSEWUD(component.dir) && transmitionTextureForState != null) {
Vector4f color = conduit.getTransmitionTextureColorForState(component);
renderTransmissionDynamic(conduit, transmitionTextureForState, color, component, selfIllum);
}
TextureAtlasSprite tex = conduit.getTextureForState(component);
if (tex == null) {
tex = Minecraft.getMinecraft().getTextureMapBlocks().getMissingSprite();
}
renderConduitDynamic(tex, conduit, component, selfIllum);
}
}
}
use of crazypants.enderio.base.conduit.geom.CollidableComponent in project EnderIO by SleepyTrousers.
the class PowerConduit method createCollidables.
@Override
@Nonnull
public Collection<CollidableComponent> createCollidables(@Nonnull CacheKey key) {
Collection<CollidableComponent> baseCollidables = super.createCollidables(key);
if (key.dir == null) {
return baseCollidables;
}
BoundingBox bb = ConduitGeometryUtil.instance.createBoundsForConnectionController(key.dir, key.offset);
CollidableComponent cc = new CollidableComponent(IPowerConduit.class, bb, key.dir, COLOR_CONTROLLER_ID);
List<CollidableComponent> result = new ArrayList<CollidableComponent>();
result.addAll(baseCollidables);
result.add(cc);
return result;
}
use of crazypants.enderio.base.conduit.geom.CollidableComponent in project EnderIO by SleepyTrousers.
the class ConduitBundleRenderer method addConduitQuads.
private void addConduitQuads(@Nonnull IBlockStateWrapper state, @Nonnull IConduitBundle bundle, float brightness, @Nonnull BlockRenderLayer layer, @Nonnull List<BakedQuad> quads) {
// Conduits
Set<EnumFacing> externals = new HashSet<EnumFacing>();
List<BoundingBox> wireBounds = new ArrayList<BoundingBox>();
if (bundle.hasFacade() && state.getYetaDisplayMode().isHideFacades()) {
wireBounds.add(BoundingBox.UNIT_CUBE);
}
for (IClientConduit c : bundle.getClientConduits()) {
// TODO Temporary Workaround
IClientConduit.WithDefaultRendering con = (IClientConduit.WithDefaultRendering) c;
if (state.getYetaDisplayMode().renderConduit(con)) {
IConduitRenderer renderer = getRendererForConduit(con);
renderer.addBakedQuads(this, bundle, con, brightness, layer, quads);
Set<EnumFacing> extCons = con.getExternalConnections();
for (EnumFacing dir : extCons) {
if (con.getConnectionMode(dir) != ConnectionMode.DISABLED && con.getConnectionMode(dir) != ConnectionMode.NOT_SET) {
externals.add(dir);
}
}
} else if (con != null) {
Collection<CollidableComponent> components = con.getCollidableComponents();
for (CollidableComponent component : components) {
addWireBounds(wireBounds, component);
}
}
}
// Internal connectors between conduits
List<CollidableComponent> connectors = bundle.getConnectors();
for (CollidableComponent component : connectors) {
if (component != null) {
if (component.conduitType != null) {
// TODO Make an actual check before assuming a default render
IClientConduit.WithDefaultRendering conduit = (IClientConduit.WithDefaultRendering) bundle.getConduit(component.conduitType);
if (conduit != null) {
if (state.getYetaDisplayMode().renderConduit(component.conduitType)) {
TextureAtlasSprite tex = conduit.getTextureForState(component);
if (tex == null) {
tex = Minecraft.getMinecraft().getTextureMapBlocks().getMissingSprite();
}
BakedQuadBuilder.addBakedQuads(quads, component.bound, tex);
} else {
addWireBounds(wireBounds, component);
}
}
} else if (state.getYetaDisplayMode().getDisplayMode().isAll()) {
TextureAtlasSprite tex = ConduitBundleRenderManager.instance.getConnectorIcon(component.data);
BakedQuadBuilder.addBakedQuads(quads, component.bound, tex);
}
}
}
// render these after the 'normal' conduits so help with proper blending
for (BoundingBox wireBound : wireBounds) {
BakedQuadBuilder.addBakedQuads(quads, wireBound, ConduitBundleRenderManager.instance.getWireFrameIcon());
}
// External connection terminations
for (EnumFacing dir : externals) {
addQuadsForExternalConnection(dir, quads);
}
if (quads.isEmpty() && !bundle.hasFacade()) {
BakedQuadBuilder.addBakedQuads(quads, BoundingBox.UNIT_CUBE.scale(.10), ConduitBundleRenderManager.instance.getWireFrameIcon());
BakedQuadBuilder.addBakedQuads(quads, BoundingBox.UNIT_CUBE.scale(.15), ConduitBundleRenderManager.instance.getWireFrameIcon());
BakedQuadBuilder.addBakedQuads(quads, BoundingBox.UNIT_CUBE.scale(.20), ConduitBundleRenderManager.instance.getWireFrameIcon());
BakedQuadBuilder.addBakedQuads(quads, BoundingBox.UNIT_CUBE.scale(.25), ConduitBundleRenderManager.instance.getWireFrameIcon());
}
}
Aggregations