I have recently been trying to make a pyramid (1 block, not a structure). But I don't know how. I tried looking at Greg's mods, and Carpenter's Slopes, but they did not help me as I only wanted to make a pyramid block, and not slopes Does anyone know how to do this? Thanks
no, this will be just like a normal block, but with the textures facing inwards towards the top
If its not the normal everyday 6 sided cube then its not a textured block, its a modeled block. I'm not very sure about the code, but you can use programs like Techne to model it. I'm also pretty interested in this type of thing.
A model can only do boxes, but the textures can make the block appear to be modeled, while really it is a normal block, which the textures facing inwards. Another good example of this is http://www.minecraftforum.net/topic/1776056-15xforge-extra-utilities-v024g/ The spike block is exactly what I am trying to do.
Ill do everything for you. Ill make the texture and ill put the code for the block.
Update:
Code:
Things to add to main class file:
package PackageName;
import net.minecraft.item.ItemStack;
import com.jcraft.jorbis.Block;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.common.registry.LanguageRegistry;
public class ClassNameHere
{
//I will not put any other code but what you need. Just copy and paste this stuff and change everything to your specifications
public static Block PyramidName;//put this with all the other Item/Block declartions
//Inside your load area
//You now have to add a new Class file for the PyramidBlock set it as the name Here "PyramidName = new PyramidName(<= that is the name of the class file)"
PyramidName = new PyramidName(IDNumber, "pyramidName").setUnlocalizedName("textureFileName(dont put the .png aat the end)").setHardness(#.#F).setStepSound(ChooseFromListBelow).setResistance(#.#F);
GameRegistry.registerBlock(PyramidName, "In-Game Name");
LanguageRegistry.addName(PyramidName, "In-Game Name");//Just put this as the name of the one above
GameRegistry.addRecipe(new ItemStack(RubyBlock, 1), new Object[]
{
" T ","TTT"," ",
'T', material,
});
GameRegistry.addRecipe(new ItemStack(RubyBlock, 1), new Object[]
{
" "," T ","TTT",
'T', material,
});
}
New Block class file:
package your.package;
import java.util.Random;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.creativetab.CreativeTabs;
public class PyramidName extends Block {
public PyramidName(int par1, String texture) {
super(par1, Material.rock);
setCreativeTab(CreativeTabs.tabBlock); //place in creative tabs
}
public int idDropped(int par1, Random par2Random, int par3)
{
return MainClassFileNameHere.PyramidNameHere.blockID;
}
public int quantityDropped(Random random)
{
return 1; //how much of the block will drop when broken
}
//most people say this is unneeded I put it anyway
public String getTextureFile(){
return "/textures/blocks/textureName.png";
}
}
For "special blocks" like that you can register a custom model renderer.
In your ClientProxy:
public static RenderMyBlock renderMyBlock;
public static int myRenderId;
// Called in PreInit
@Override
public void registerRenderers() {
renderMyBlock = new RenderMyBlock();
myRenderId = RenderingRegistry.getNextAvailableRenderId();
RenderingRegistry.registerBlockHandler(myRenderId, renderMyBlock);
}
In your Block class:
@Override
public int getRenderType() {
return ClientProxy.myRenderId;
}
And finally the Render class:
(Copied from one of my renderers, so just replace the names as you wish... This is the class to use for "RenderMyBlock")
This will render a small pane (still blocky!) facing in different directions depending on metadata and will render the block in inventory too.
Of course, this is not the shape you want. But from here you can expand. Either draw the block using GL11 calls or use an imported Model. Tutorial on how to get such a model: http://minalien.com/...cedmodelloader/ Minalien uses a TileEntity renderer, but you can render the model in your block render class just as well. (just remember to respect the coordinates of the block to be rendered, either way you do it. If your model is missing, try digging a space around the block and see if you just "misplaced' the model.)
import net.minecraft.block.Block;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.world.IBlockAccess;
import org.lwjgl.opengl.GL11;
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
import founderio.medievalworks.ClientProxyMedieval;
import founderio.medievalworks.common.blocks.BlockTarget;
public class RenderTarget implements ISimpleBlockRenderingHandler {
@Override
public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) {
renderer.setRenderBounds(0F, 0F, 0.5F - BlockTarget.boundsWidth / 2, 1F, 1F, 0.5F + BlockTarget.boundsWidth / 2);
Tessellator var4 = Tessellator.instance;
GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
var4.startDrawingQuads();
var4.setNormal(0.0F, -1.0F, 0.0F);
renderer.renderFaceYNeg(block, 0.0D, 0.0D, 0.0D, block.getIcon(0, 3));
var4.draw();
var4.startDrawingQuads();
var4.setNormal(0.0F, 1.0F, 0.0F);
renderer.renderFaceYPos(block, 0.0D, 0.0D, 0.0D, block.getIcon(1, 3));
var4.draw();
var4.startDrawingQuads();
var4.setNormal(0.0F, 0.0F, -1.0F);
renderer.renderFaceZNeg(block, 0.0D, 0.0D, 0.0D, block.getIcon(2, 3));
var4.draw();
var4.startDrawingQuads();
var4.setNormal(0.0F, 0.0F, 1.0F);
renderer.renderFaceZPos(block, 0.0D, 0.0D, 0.0D, block.getIcon(3, 3));
var4.draw();
var4.startDrawingQuads();
var4.setNormal(-1.0F, 0.0F, 0.0F);
renderer.renderFaceXNeg(block, 0.0D, 0.0D, 0.0D, block.getIcon(4, 3));
var4.draw();
var4.startDrawingQuads();
var4.setNormal(1.0F, 0.0F, 0.0F);
renderer.renderFaceXPos(block, 0.0D, 0.0D, 0.0D, block.getIcon(5, 3));
var4.draw();
GL11.glTranslatef(0.5F, 0.5F, 0.5F);
}
@Override
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
block.setBlockBoundsBasedOnState(world, x, y, z);
// renderer.func_83018_a(block);
int metaData = world.getBlockMetadata(x, y, z);
int isAttached = metaData & 1;
int rotation = ((metaData & 15) >> 1) + 2;
// minx, y, z, maxx, y, z
// this.setBlockBounds(0F, 0F, 0F, 1F, 1F, 1F);
if (isAttached == 1) {
switch (rotation) {
case 0:
case 1:
// Impossible
break;
case 2:
renderer.setRenderBounds(0F, 0F, 1F - BlockTarget.boundsWidth, 1F, 1F, 1F);
break;
case 3:
renderer.setRenderBounds(0F, 0F, 0F, 1F, 1F, BlockTarget.boundsWidth);
break;
case 4:
renderer.setRenderBounds(1F - BlockTarget.boundsWidth, 0F, 0F, 1F, 1F, 1F);
break;
case 5:
renderer.setRenderBounds(0F, 0F, 0F, BlockTarget.boundsWidth, 1F, 1F);
break;
}
} else {
switch (rotation) {
case 0:
case 1:
// Impossible
break;
case 2:
case 3:
renderer.setRenderBounds(0F, 0F, 0.5F - BlockTarget.boundsWidth / 2, 1F, 1F, 0.5F + BlockTarget.boundsWidth / 2);
break;
case 4:
case 5:
renderer.setRenderBounds(0.5F - BlockTarget.boundsWidth / 2, 0F, 0F, 0.5F + BlockTarget.boundsWidth / 2, 1F, 1F);
break;
}
}
renderer.renderStandardBlock(block, x, y, z);
return true;
}
@Override
public boolean shouldRender3DInInventory() {
return true;
}
@Override
public int getRenderId() {
return ClientProxyMedieval.targetRenderId;
}
}
Ky6000 may be right, after looking at the class files of extra utilities, and this is with out decompiling his code, it does not appear as though the pyramid is using a block model. It seems to be rendered, and as I dont know anything about rendering I can not help. However I would think Ky6000 is right about the not being a model part unless the files dont have direct names showing this is the model for this block and so on, at least not without decompiling as I said.....
Ky6000 may be right, after looking at the class files of extra utilities, and this is with out decompiling his code, it does not appear as though the pyramid is using a block model. It seems to be rendered, and as I dont know anything about rendering I can not help. However I would think Ky6000 is right about the not being a model part unless the files dont have direct names showing this is the model for this block and so on, at least not without decompiling as I said.....
As I posted, you can do this with manual render calls... So that may be how they did that. the model is simple enough...
Just five faces, nothing more...
Ky6000 may be right, after looking at the class files of extra utilities, and this is with out decompiling his code, it does not appear as though the pyramid is using a block model. It seems to be rendered, and as I dont know anything about rendering I can not help. However I would think Ky6000 is right about the not being a model part unless the files dont have direct names showing this is the model for this block and so on, at least not without decompiling as I said.....
If you made a normal Block texture and normal Block then every side would look like a pyramid. You can model things like this. I just don't know the code for making something modeled into a block. If you want I can make a actual model for you, and give you the auto generated code for it. Message me back if you want it modeled.
if its a modeled block you want help with, i know how to make one?
Aren't you the one asking for help? I was telling you if you want me to model the block for you in Techne, I can also give you the code that Techne auto-generates. The auto generated file is just The block but its drawn in Java code like @founderio's post. The last spoiler in his post is the drawing, but Techne can do that code automatically. Point is: If you want me to model the block for you, I can.
Aren't you the one asking for help? I was telling you if you want me to model the block for you in Techne, I can also give you the code that Techne auto-generates. The auto generated file is just The block but its drawn in Java code like @founderio's post. The last spoiler in his post is the drawing, but Techne can do that code automatically. Point is: If you want me to model the block for you, I can.
Me? No. I already know how to make a modled block, im asking the person whose asking for help if they want me to help them.
Only with an additional mod as a prerequisite. (You have to change the project type in Techne..)
It's called TurboModelThingy and without it you either have to use manual draw calls or an obj model.
i think you want to render your block similar to fire, (if you delete the fire's texture you'll see what i mean) so you'll probably want to check the Fire's classes.
so it is a modeled block.
If its not the normal everyday 6 sided cube then its not a textured block, its a modeled block. I'm not very sure about the code, but you can use programs like Techne to model it. I'm also pretty interested in this type of thing.
Update:
Code:
Things to add to main class file:
New Block class file:
Heres the texture download:
http://www.mediafire.com/download/xav6x89vi6nhbbg/pyramidTextureName.png
I promise you though, this will not work. You need a modeled block and a custom texture for this type of thing.
In your ClientProxy:
In your Block class:
And finally the Render class:
(Copied from one of my renderers, so just replace the names as you wish... This is the class to use for "RenderMyBlock")
This will render a small pane (still blocky!) facing in different directions depending on metadata and will render the block in inventory too.
Of course, this is not the shape you want. But from here you can expand. Either draw the block using GL11 calls or use an imported Model. Tutorial on how to get such a model: http://minalien.com/...cedmodelloader/ Minalien uses a TileEntity renderer, but you can render the model in your block render class just as well. (just remember to respect the coordinates of the block to be rendered, either way you do it. If your model is missing, try digging a space around the block and see if you just "misplaced' the model.)
Find out how I generate....coolAlias...world structure generation and rotation tool...
As I posted, you can do this with manual render calls... So that may be how they did that. the model is simple enough...
Just five faces, nothing more...
If you made a normal Block texture and normal Block then every side would look like a pyramid. You can model things like this. I just don't know the code for making something modeled into a block. If you want I can make a actual model for you, and give you the auto generated code for it. Message me back if you want it modeled.
Aren't you the one asking for help? I was telling you if you want me to model the block for you in Techne, I can also give you the code that Techne auto-generates. The auto generated file is just The block but its drawn in Java code like @founderio's post. The last spoiler in his post is the drawing, but Techne can do that code automatically. Point is: If you want me to model the block for you, I can.
Me? No. I already know how to make a modled block, im asking the person whose asking for help if they want me to help them.
Find out how I generate....coolAlias...world structure generation and rotation tool...
Only with an additional mod as a prerequisite. (You have to change the project type in Techne..)
It's called TurboModelThingy and without it you either have to use manual draw calls or an obj model.
You can make a massive triangle with boxes and then do GL11.glScalef(scaleX, scaleY, scaleZ);