use of com.enderio.core.common.vecmath.Vector3d in project EnderIO by SleepyTrousers.
the class BlockCapBank method getSelectedBoundingBox.
@Override
@SideOnly(Side.CLIENT)
@Deprecated
@Nonnull
public AxisAlignedBB getSelectedBoundingBox(@Nonnull IBlockState bs, @Nonnull World world, @Nonnull BlockPos pos) {
TileCapBank tr = getTileEntity(world, pos);
if (tr == null) {
return super.getSelectedBoundingBox(bs, world, pos);
}
ICapBankNetwork network = tr.getNetwork();
if (!tr.getType().isMultiblock() || network == null) {
return super.getSelectedBoundingBox(bs, world, pos);
}
Vector3d min = new Vector3d(Double.MAX_VALUE, Double.MAX_VALUE, Double.MAX_VALUE);
Vector3d max = new Vector3d(-Double.MAX_VALUE, -Double.MAX_VALUE, -Double.MAX_VALUE);
for (TileCapBank bc : network.getMembers()) {
int x = bc.getPos().getX();
int y = bc.getPos().getY();
int z = bc.getPos().getZ();
min.x = Math.min(min.x, x);
max.x = Math.max(max.x, x + 1);
min.y = Math.min(min.y, y);
max.y = Math.max(max.y, y + 1);
min.z = Math.min(min.z, z);
max.z = Math.max(max.z, z + 1);
}
return new AxisAlignedBB(min.x, min.y, min.z, max.x, max.y, max.z);
}
use of com.enderio.core.common.vecmath.Vector3d in project EnderIO by SleepyTrousers.
the class TravelEntitySpecialRenderer method renderTileEntity.
@Override
public void renderTileEntity(@Nonnull T te, @Nonnull IBlockState blockState, float partialTicks, int destroyStage) {
Vector3d eye = Util.getEyePositionEio(Minecraft.getMinecraft().player);
Vector3d loc = new Vector3d(te.getPos().getX() + 0.5, te.getPos().getY() + 0.5, te.getPos().getZ() + 0.5);
double maxDistance = TravelController.instance.isTravelItemActiveForRendering(Minecraft.getMinecraft().player) ? TravelSource.STAFF.getMaxDistanceTravelledSq() : TravelSource.BLOCK.getMaxDistanceTravelledSq();
if (eye.distanceSquared(loc) > maxDistance) {
return;
}
double sf = TravelController.instance.getScaleForCandidate(loc);
boolean highlight = TravelController.instance.isBlockSelected(te.getLocation());
TravelController.instance.addCandidate(te.getLocation());
Minecraft.getMinecraft().entityRenderer.disableLightmap();
GlStateManager.enableRescaleNormal();
GlStateManager.disableDepth();
GlStateManager.disableLighting();
renderBlock(te.getPos(), te.getWorld(), sf, highlight);
renderItemLabel(te.getItemLabel(), sf);
renderLabel(te.getLabel(), sf, highlight);
GlStateManager.disableRescaleNormal();
GlStateManager.enableDepth();
Minecraft.getMinecraft().entityRenderer.enableLightmap();
}
use of com.enderio.core.common.vecmath.Vector3d in project EnderIO by SleepyTrousers.
the class IoConfigRenderer method doTileEntityRenderPass.
private void doTileEntityRenderPass(@Nonnull NNList<BlockPos> blocks, final int pass) {
blocks.apply(new Callback<BlockPos>() {
@Override
public void apply(@Nonnull BlockPos pos) {
TileEntity tile = world.getTileEntity(pos);
if (tile != null) {
if (tile.shouldRenderInPass(pass)) {
Vector3d at = new Vector3d(eye.x, eye.y, eye.z);
at.x += pos.getX() - origin.x;
at.y += pos.getY() - origin.y;
at.z += pos.getZ() - origin.z;
if (tile.getClass() == TileEntityChest.class) {
TileEntityChest chest = (TileEntityChest) tile;
if (NullHelper.untrust(chest.adjacentChestXNeg) != null) {
tile = chest.adjacentChestXNeg;
at.x--;
} else if (NullHelper.untrust(chest.adjacentChestZNeg) != null) {
tile = chest.adjacentChestZNeg;
at.z--;
}
}
TileEntityRendererDispatcher.instance.render(tile, at.x, at.y, at.z, 0);
}
}
}
});
}
use of com.enderio.core.common.vecmath.Vector3d in project EnderIO by SleepyTrousers.
the class IoConfigRenderer method renderScene.
private void renderScene() {
GlStateManager.enableCull();
GlStateManager.enableRescaleNormal();
RenderHelper.disableStandardItemLighting();
mc.entityRenderer.disableLightmap();
RenderUtil.bindBlockTexture();
GlStateManager.disableLighting();
GlStateManager.enableTexture2D();
GlStateManager.enableAlpha();
final Vector3d trans = new Vector3d((-origin.x) + eye.x, (-origin.y) + eye.y, (-origin.z) + eye.z);
BlockRenderLayer oldRenderLayer = MinecraftForgeClient.getRenderLayer();
try {
NNList.of(BlockRenderLayer.class).apply(new Callback<BlockRenderLayer>() {
@Override
public void apply(@Nonnull BlockRenderLayer layer) {
ForgeHooksClient.setRenderLayer(layer);
setGlStateForPass(layer, false);
doWorldRenderPass(trans, configurables, layer);
}
});
if (renderNeighbours) {
NNList.of(BlockRenderLayer.class).apply(new Callback<BlockRenderLayer>() {
@Override
public void apply(@Nonnull BlockRenderLayer layer) {
ForgeHooksClient.setRenderLayer(layer);
setGlStateForPass(layer, true);
doWorldRenderPass(trans, neighbours, layer);
}
});
}
} finally {
ForgeHooksClient.setRenderLayer(oldRenderLayer);
}
RenderHelper.enableStandardItemLighting();
GlStateManager.enableLighting();
TileEntityRendererDispatcher.instance.entityX = origin.x - eye.x;
TileEntityRendererDispatcher.instance.entityY = origin.y - eye.y;
TileEntityRendererDispatcher.instance.entityZ = origin.z - eye.z;
TileEntityRendererDispatcher.staticPlayerX = origin.x - eye.x;
TileEntityRendererDispatcher.staticPlayerY = origin.y - eye.y;
TileEntityRendererDispatcher.staticPlayerZ = origin.z - eye.z;
for (int pass = 0; pass < 2; pass++) {
ForgeHooksClient.setRenderPass(pass);
setGlStateForPass(pass, false);
doTileEntityRenderPass(configurables, pass);
if (renderNeighbours) {
setGlStateForPass(pass, true);
doTileEntityRenderPass(neighbours, pass);
}
}
ForgeHooksClient.setRenderPass(-1);
setGlStateForPass(0, false);
}
use of com.enderio.core.common.vecmath.Vector3d in project EnderIO by SleepyTrousers.
the class BlockSceneRenderer method renderScene.
private void renderScene() {
GlStateManager.enableCull();
GlStateManager.enableRescaleNormal();
RenderHelper.disableStandardItemLighting();
mc.entityRenderer.disableLightmap();
RenderUtil.bindBlockTexture();
GlStateManager.disableLighting();
GlStateManager.enableTexture2D();
GlStateManager.enableAlpha();
final LayerRenderer layerRenderer = new LayerRenderer(new Vector3d((-origin.x) + eye.x, (-origin.y) + eye.y, (-origin.z) + eye.z));
BlockRenderLayer oldRenderLayer = MinecraftForgeClient.getRenderLayer();
try {
NNList.of(BlockRenderLayer.class).apply(layerRenderer);
} finally {
ForgeHooksClient.setRenderLayer(oldRenderLayer);
GlStateManager.depthMask(true);
}
}
Aggregations