Search in sources :

Example 1 with Cuboid6

use of codechicken.lib.vec.Cuboid6 in project PneumaticCraft by MineMaarten.

the class PartPressureTube method getSubParts.

@Override
public Iterable<IndexedCuboid6> getSubParts() {
    Iterable<Cuboid6> boxList = getCollisionBoxes();
    LinkedList<IndexedCuboid6> partList = new LinkedList<IndexedCuboid6>();
    for (Cuboid6 c : boxList) partList.add(new IndexedCuboid6(0, c));
    return partList;
}
Also used : IndexedCuboid6(codechicken.lib.raytracer.IndexedCuboid6) IndexedCuboid6(codechicken.lib.raytracer.IndexedCuboid6) Cuboid6(codechicken.lib.vec.Cuboid6) LinkedList(java.util.LinkedList)

Example 2 with Cuboid6

use of codechicken.lib.vec.Cuboid6 in project GregTech by GregTechCE.

the class MetaTileEntityRenderer method handleRenderBlockDamage.

@Override
public void handleRenderBlockDamage(IBlockAccess world, BlockPos pos, IBlockState state, TextureAtlasSprite sprite, BufferBuilder buffer) {
    BlockMachine blockMachine = ((BlockMachine) state.getBlock());
    Collection<AxisAlignedBB> boxes = blockMachine.getSelectedBoundingBoxes(world, pos, state);
    List<Cuboid6> cuboid6List = boxes.stream().map(aabb -> new Cuboid6(aabb).subtract(pos)).collect(Collectors.toList());
    CCRenderState renderState = CCRenderState.instance();
    renderState.reset();
    renderState.bind(buffer);
    IVertexOperation[] pipeline = new IVertexOperation[2];
    pipeline[0] = new Translation(pos);
    pipeline[1] = new IconTransformation(sprite);
    BlockFace blockFace = blockFaces.get();
    for (Cuboid6 boundingBox : cuboid6List) {
        for (EnumFacing face : EnumFacing.VALUES) {
            blockFace.loadCuboidFace(boundingBox, face.getIndex());
            renderState.setPipeline(blockFace, 0, blockFace.verts.length, pipeline);
            renderState.render();
        }
    }
}
Also used : AxisAlignedBB(net.minecraft.util.math.AxisAlignedBB) ModelBakeEvent(net.minecraftforge.client.event.ModelBakeEvent) IconTransformation(codechicken.lib.vec.uv.IconTransformation) TransformType(net.minecraft.client.renderer.block.model.ItemCameraTransforms.TransformType) ModelResourceLocation(net.minecraft.client.renderer.block.model.ModelResourceLocation) Matrix4f(javax.vecmath.Matrix4f) Block(net.minecraft.block.Block) Pair(org.apache.commons.lang3.tuple.Pair) Map(java.util.Map) RenderHelper(net.minecraft.client.renderer.RenderHelper) GL11(org.lwjgl.opengl.GL11) ModelBlock(net.minecraft.client.renderer.block.model.ModelBlock) MetaTileEntity(gregtech.api.metatileentity.MetaTileEntity) NBTTagCompound(net.minecraft.nbt.NBTTagCompound) IIconRegister(codechicken.lib.texture.TextureUtils.IIconRegister) GlStateManager(net.minecraft.client.renderer.GlStateManager) IModelState(net.minecraftforge.common.model.IModelState) Collection(java.util.Collection) ItemTransformVec3f(net.minecraft.client.renderer.block.model.ItemTransformVec3f) Collectors(java.util.stream.Collectors) ICCBlockRenderer(codechicken.lib.render.block.ICCBlockRenderer) List(java.util.List) EnumBlockRenderType(net.minecraft.util.EnumBlockRenderType) IBakedModel(net.minecraft.client.renderer.block.model.IBakedModel) Translation(codechicken.lib.vec.Translation) BufferBuilder(net.minecraft.client.renderer.BufferBuilder) AxisAlignedBB(net.minecraft.util.math.AxisAlignedBB) IItemRenderer(codechicken.lib.render.item.IItemRenderer) IVertexOperation(codechicken.lib.render.pipeline.IVertexOperation) TextureUtils(codechicken.lib.texture.TextureUtils) HashMap(java.util.HashMap) BlockFace(codechicken.lib.render.BlockRenderer.BlockFace) DefaultVertexFormats(net.minecraft.client.renderer.vertex.DefaultVertexFormats) ItemStack(net.minecraft.item.ItemStack) Minecraft(net.minecraft.client.Minecraft) TRSRTransformation(net.minecraftforge.common.model.TRSRTransformation) MachineItemBlock(gregtech.api.block.machines.MachineItemBlock) IResource(net.minecraft.client.resources.IResource) IBlockAccess(net.minecraft.world.IBlockAccess) TextureAtlasSprite(net.minecraft.client.renderer.texture.TextureAtlasSprite) CCRenderState(codechicken.lib.render.CCRenderState) GTLog(gregtech.api.util.GTLog) TextureMap(net.minecraft.client.renderer.texture.TextureMap) EnumFacing(net.minecraft.util.EnumFacing) BlockPos(net.minecraft.util.math.BlockPos) IOException(java.io.IOException) BlockRenderingRegistry(codechicken.lib.render.block.BlockRenderingRegistry) InputStreamReader(java.io.InputStreamReader) IBlockState(net.minecraft.block.state.IBlockState) MinecraftForge(net.minecraftforge.common.MinecraftForge) GTValues(gregtech.api.GTValues) ResourceLocation(net.minecraft.util.ResourceLocation) SubscribeEvent(net.minecraftforge.fml.common.eventhandler.SubscribeEvent) ItemBlock(net.minecraft.item.ItemBlock) LightUtil(net.minecraftforge.client.model.pipeline.LightUtil) BlockMachine(gregtech.api.block.machines.BlockMachine) Cuboid6(codechicken.lib.vec.Cuboid6) IVertexOperation(codechicken.lib.render.pipeline.IVertexOperation) Translation(codechicken.lib.vec.Translation) BlockMachine(gregtech.api.block.machines.BlockMachine) BlockFace(codechicken.lib.render.BlockRenderer.BlockFace) EnumFacing(net.minecraft.util.EnumFacing) Cuboid6(codechicken.lib.vec.Cuboid6) CCRenderState(codechicken.lib.render.CCRenderState) IconTransformation(codechicken.lib.vec.uv.IconTransformation)

Aggregations

Cuboid6 (codechicken.lib.vec.Cuboid6)2 IndexedCuboid6 (codechicken.lib.raytracer.IndexedCuboid6)1 BlockFace (codechicken.lib.render.BlockRenderer.BlockFace)1 CCRenderState (codechicken.lib.render.CCRenderState)1 BlockRenderingRegistry (codechicken.lib.render.block.BlockRenderingRegistry)1 ICCBlockRenderer (codechicken.lib.render.block.ICCBlockRenderer)1 IItemRenderer (codechicken.lib.render.item.IItemRenderer)1 IVertexOperation (codechicken.lib.render.pipeline.IVertexOperation)1 TextureUtils (codechicken.lib.texture.TextureUtils)1 IIconRegister (codechicken.lib.texture.TextureUtils.IIconRegister)1 Translation (codechicken.lib.vec.Translation)1 IconTransformation (codechicken.lib.vec.uv.IconTransformation)1 GTValues (gregtech.api.GTValues)1 BlockMachine (gregtech.api.block.machines.BlockMachine)1 MachineItemBlock (gregtech.api.block.machines.MachineItemBlock)1 MetaTileEntity (gregtech.api.metatileentity.MetaTileEntity)1 GTLog (gregtech.api.util.GTLog)1 IOException (java.io.IOException)1 InputStreamReader (java.io.InputStreamReader)1 Collection (java.util.Collection)1