[1.8.1] Structure Maker
+5
lcass
groxmapper
austin56101
dannydobbi
Strengthowns
9 posters
MC Modding :: Modding :: Singleplayer Modding :: Tutorials
Page 1 of 1
[1.8.1] Structure Maker
Structure Maker
- Spoiler:
- mod_Namehere
- Code:
package net.minecraft.src;
public class mod_Namehere extends BaseMod
{
public static final Block Namehere;
public mod_Namehere()
{
ModLoader.AddName(Namehere, "Namehere Block");
ModLoader.RegisterBlock(Namehere);
}
public String Version()
{
return "1.8.1";
}
static
{
Namehere = (new BlockNamehere(181, ModLoader.addOverride("/terrain.png", "/Namehere.png"))).setHardness(0.0F).setBlockName("Namehere");
}
}
BlockNamehere- Code:
package net.minecraft.src;
public class BlockNamehere extends Block
{
private World worldObj;
protected BlockNamehere(int i, int j)
{
super(i, j, Material.ground);
}
public void onBlockClicked(World world, int i, int j, int k, EntityPlayer entityplayer)
{
world.setBlockWithNotify(i, j + 1, k, Block.dirt.blockID);
world.setBlockWithNotify(i, j + 2, k, Block.dirt.blockID);
world.setBlockWithNotify(i, j + 3, k, Block.dirt.blockID);
world.setBlockWithNotify(i, j + 4, k, Block.dirt.blockID);
world.setBlockWithNotify(i, j + 5, k, Block.dirt.blockID);
world.setBlockWithNotify(i, j + 6, k, Block.dirt.blockID);
world.setBlockWithNotify(i, j + 7, k, Block.dirt.blockID);
world.setBlockWithNotify(i, j + 8, k, Block.dirt.blockID);
}
}
Help: mod_Namehere
1. Note: The way the code is done in this may look different but it makes thingsHelp: BlockNamehere
1. Everything is same as normal except for the "onBlockClicked" method.
2. In the "world.setBlockWithNotify" statements, the i, j, k letters stand for the coordinates x, y, z. After that it is saying what block it will put at those coordinates.
3. Optionally, if you are using the same block over and over and want to make it easier to write, you could set an integer like this:- Code:
public void onBlockClicked(World world, int i, int j, int k, EntityPlayer entityplayer)
{
int block = Block.dirt.blockID;
world.setBlockWithNotify(i, j + 1, k, block);
world.setBlockWithNotify(i, j + 2, k, block);
world.setBlockWithNotify(i, j + 3, k, block);
world.setBlockWithNotify(i, j + 4, k, block);
world.setBlockWithNotify(i, j + 5, k, block);
world.setBlockWithNotify(i, j + 6, k, block);
world.setBlockWithNotify(i, j + 7, k, block);
world.setBlockWithNotify(i, j + 8, k, block);
}
Then you would only have to write "block" to make it use dirt.
There you have it, a nice easy way to make a house or any structure you want!
Re: [1.8.1] Structure Maker
could you help me, i dont understand how to make them spawn in different places
Last edited by dannydobbi on Tue Oct 25, 2011 3:56 pm; edited 1 time in total
dannydobbi- Member
- Posts : 1
Join date : 2011-10-25
Re: [1.8.1] Structure Maker
yeah ok i really dont understand how to make structures
i looked at the coding
thats the church and i dont understand anything about it xD
well the placements at least lol
is there a program i can use the i build it on there then it gen this code?
i looked at the coding
- Code:
placeVoid(world, structureboundingbox, 1, 1, 1, 3, 3, 7, 0, 0, false);
placeVoid(world, structureboundingbox, 1, 5, 1, 3, 9, 3, 0, 0, false);
placeVoid(world, structureboundingbox, 1, 0, 0, 3, 0, 8, Block.cobblestone.blockID, Block.cobblestone.blockID, false);
placeVoid(world, structureboundingbox, 1, 1, 0, 3, 10, 0, Block.cobblestone.blockID, Block.cobblestone.blockID, false);
placeVoid(world, structureboundingbox, 0, 1, 1, 0, 10, 3, Block.cobblestone.blockID, Block.cobblestone.blockID, false);
placeVoid(world, structureboundingbox, 4, 1, 1, 4, 10, 3, Block.cobblestone.blockID, Block.cobblestone.blockID, false);
placeVoid(world, structureboundingbox, 0, 0, 4, 0, 4, 7, Block.cobblestone.blockID, Block.cobblestone.blockID, false);
placeVoid(world, structureboundingbox, 4, 0, 4, 4, 4, 7, Block.cobblestone.blockID, Block.cobblestone.blockID, false);
placeVoid(world, structureboundingbox, 1, 1, 8, 3, 4, 8, Block.cobblestone.blockID, Block.cobblestone.blockID, false);
placeVoid(world, structureboundingbox, 1, 5, 4, 3, 10, 4, Block.cobblestone.blockID, Block.cobblestone.blockID, false);
placeVoid(world, structureboundingbox, 1, 5, 5, 3, 5, 7, Block.cobblestone.blockID, Block.cobblestone.blockID, false);
placeVoid(world, structureboundingbox, 0, 9, 0, 4, 9, 4, Block.cobblestone.blockID, Block.cobblestone.blockID, false);
placeVoid(world, structureboundingbox, 0, 4, 0, 4, 4, 4, Block.cobblestone.blockID, Block.cobblestone.blockID, false);
placeBlockAtCurrentPosition(world, Block.cobblestone.blockID, 0, 0, 11, 2, structureboundingbox);
placeBlockAtCurrentPosition(world, Block.cobblestone.blockID, 0, 4, 11, 2, structureboundingbox);
placeBlockAtCurrentPosition(world, Block.cobblestone.blockID, 0, 2, 11, 0, structureboundingbox);
placeBlockAtCurrentPosition(world, Block.cobblestone.blockID, 0, 2, 11, 4, structureboundingbox);
placeBlockAtCurrentPosition(world, Block.cobblestone.blockID, 0, 1, 1, 6, structureboundingbox);
placeBlockAtCurrentPosition(world, Block.cobblestone.blockID, 0, 1, 1, 7, structureboundingbox);
placeBlockAtCurrentPosition(world, Block.cobblestone.blockID, 0, 2, 1, 7, structureboundingbox);
placeBlockAtCurrentPosition(world, Block.cobblestone.blockID, 0, 3, 1, 6, structureboundingbox);
placeBlockAtCurrentPosition(world, Block.cobblestone.blockID, 0, 3, 1, 7, structureboundingbox);
placeBlockAtCurrentPosition(world, Block.stairCompactCobblestone.blockID, func_35009_c(Block.stairCompactCobblestone.blockID, 3), 1, 1, 5, structureboundingbox);
placeBlockAtCurrentPosition(world, Block.stairCompactCobblestone.blockID, func_35009_c(Block.stairCompactCobblestone.blockID, 3), 2, 1, 6, structureboundingbox);
placeBlockAtCurrentPosition(world, Block.stairCompactCobblestone.blockID, func_35009_c(Block.stairCompactCobblestone.blockID, 3), 3, 1, 5, structureboundingbox);
placeBlockAtCurrentPosition(world, Block.stairCompactCobblestone.blockID, func_35009_c(Block.stairCompactCobblestone.blockID, 1), 1, 2, 7, structureboundingbox);
placeBlockAtCurrentPosition(world, Block.stairCompactCobblestone.blockID, func_35009_c(Block.stairCompactCobblestone.blockID, 0), 3, 2, 7, structureboundingbox);
placeBlockAtCurrentPosition(world, Block.thinGlass.blockID, 0, 0, 2, 2, structureboundingbox);
placeBlockAtCurrentPosition(world, Block.thinGlass.blockID, 0, 0, 3, 2, structureboundingbox);
placeBlockAtCurrentPosition(world, Block.thinGlass.blockID, 0, 4, 2, 2, structureboundingbox);
placeBlockAtCurrentPosition(world, Block.thinGlass.blockID, 0, 4, 3, 2, structureboundingbox);
placeBlockAtCurrentPosition(world, Block.thinGlass.blockID, 0, 0, 6, 2, structureboundingbox);
placeBlockAtCurrentPosition(world, Block.thinGlass.blockID, 0, 0, 7, 2, structureboundingbox);
placeBlockAtCurrentPosition(world, Block.thinGlass.blockID, 0, 4, 6, 2, structureboundingbox);
placeBlockAtCurrentPosition(world, Block.thinGlass.blockID, 0, 4, 7, 2, structureboundingbox);
placeBlockAtCurrentPosition(world, Block.thinGlass.blockID, 0, 2, 6, 0, structureboundingbox);
placeBlockAtCurrentPosition(world, Block.thinGlass.blockID, 0, 2, 7, 0, structureboundingbox);
placeBlockAtCurrentPosition(world, Block.thinGlass.blockID, 0, 2, 6, 4, structureboundingbox);
placeBlockAtCurrentPosition(world, Block.thinGlass.blockID, 0, 2, 7, 4, structureboundingbox);
placeBlockAtCurrentPosition(world, Block.thinGlass.blockID, 0, 0, 3, 6, structureboundingbox);
placeBlockAtCurrentPosition(world, Block.thinGlass.blockID, 0, 4, 3, 6, structureboundingbox);
placeBlockAtCurrentPosition(world, Block.thinGlass.blockID, 0, 2, 3, 8, structureboundingbox);
placeBlockAtCurrentPosition(world, Block.torchWood.blockID, 0, 2, 4, 7, structureboundingbox);
placeBlockAtCurrentPosition(world, Block.torchWood.blockID, 0, 1, 4, 6, structureboundingbox);
placeBlockAtCurrentPosition(world, Block.torchWood.blockID, 0, 3, 4, 6, structureboundingbox);
placeBlockAtCurrentPosition(world, Block.torchWood.blockID, 0, 2, 4, 5, structureboundingbox);
thats the church and i dont understand anything about it xD
well the placements at least lol
is there a program i can use the i build it on there then it gen this code?
austin56101- Moderator
- Posts : 85
Join date : 2011-10-22
Age : 28
Location : Cali!
Re: [1.8.1] Structure Maker
Strengthowns wrote:I don't know where you got that code from, just use my sort of code.
He got it from actual Structure**** files used to generate villages, strongholds and I think nether fortresses. Stuff in there's a fair bit more complicated than normal generation. (prolly so everything fits together in pieces?)
groxmapper- Member
- Posts : 27
Join date : 2011-10-24
Re: [1.8.1] Structure Maker
Yeah I did
But do you know of a program?^
But do you know of a program?^
austin56101- Moderator
- Posts : 85
Join date : 2011-10-22
Age : 28
Location : Cali!
Re: [1.8.1] Structure Maker
Ok austin all the bits that go 10,5,0,2,3, there the coords of the blocks also thats notch's he uses a seperate class file for the npc village that converts it into a readable coord format
Re: [1.8.1] Structure Maker
look if yo uwant a demo on how to use it I will gladly do one here is my code. it makes a hut (need to fix the doors)
- Code:
package net.minecraft.src;
public class hut extends Block
{
private World worldObj;
protected hut(int i, int j)
{
super(i, j, Material.ground);
}
public void onBlockClicked(World world, int i, int j, int k, EntityPlayer entityplayer)
{
world.setBlockWithNotify(i, j, k, Block.planks.blockID);
world.setBlockWithNotify(i, j, k+1, Block.planks.blockID);
world.setBlockWithNotify(i, j, k+2, Block.planks.blockID);
world.setBlockWithNotify(i, j, k+3, Block.planks.blockID);
world.setBlockWithNotify(i, j, k+4, Block.planks.blockID);
world.setBlockWithNotify(i, j, k+5, Block.planks.blockID);
world.setBlockWithNotify(i+1, j, k, Block.planks.blockID);
world.setBlockWithNotify(i+1, j, k+1, Block.planks.blockID);
world.setBlockWithNotify(i+1, j, k+2, Block.planks.blockID);
world.setBlockWithNotify(i+1, j, k+3, Block.planks.blockID);
world.setBlockWithNotify(i+1, j, k+4, Block.planks.blockID);
world.setBlockWithNotify(i+1, j, k+5, Block.planks.blockID);
world.setBlockWithNotify(i+2, j, k, Block.planks.blockID);
world.setBlockWithNotify(i+2, j, k+1, Block.planks.blockID);
world.setBlockWithNotify(i+2, j, k+2, Block.planks.blockID);
world.setBlockWithNotify(i+2, j, k+3, Block.planks.blockID);
world.setBlockWithNotify(i+2, j, k+4, Block.planks.blockID);
world.setBlockWithNotify(i+2, j, k+5, Block.planks.blockID);
world.setBlockWithNotify(i+3, j, k, Block.planks.blockID);
world.setBlockWithNotify(i+3, j, k+1, Block.planks.blockID);
world.setBlockWithNotify(i+3, j, k+2, Block.planks.blockID);
world.setBlockWithNotify(i+3, j, k+3, Block.planks.blockID);
world.setBlockWithNotify(i+3, j, k+4, Block.planks.blockID);
world.setBlockWithNotify(i+3, j, k+5, Block.planks.blockID);
world.setBlockWithNotify(i+4, j, k, Block.planks.blockID);
world.setBlockWithNotify(i+4, j, k+1, Block.planks.blockID);
world.setBlockWithNotify(i+4, j, k+2, Block.planks.blockID);
world.setBlockWithNotify(i+4, j, k+3, Block.planks.blockID);
world.setBlockWithNotify(i+4, j, k+4, Block.planks.blockID);
world.setBlockWithNotify(i+4, j, k+5, Block.planks.blockID);
world.setBlockWithNotify(i+5, j, k, Block.planks.blockID);
world.setBlockWithNotify(i+5, j, k+1, Block.planks.blockID);
world.setBlockWithNotify(i+5, j, k+2, Block.planks.blockID);
world.setBlockWithNotify(i+5, j, k+3, Block.planks.blockID);
world.setBlockWithNotify(i+5, j, k+4, Block.planks.blockID);
world.setBlockWithNotify(i+5, j, k+5, Block.planks.blockID);
world.setBlockWithNotify(i, j+1, k, Block.planks.blockID);
world.setBlockWithNotify(i+2, j+1, k+1, Block.chest.blockID);
world.setBlockWithNotify(i+3, j+1, k+1, Block.chest.blockID);
world.setBlockWithNotify(i+1, j+1, k+1, Block.workbench.blockID);
world.setBlockWithNotify(i+3, j+1, k+3, Block.torchWood.blockID);
world.setBlockWithNotify(i+1, j+1, k, Block.planks.blockID);
world.setBlockWithNotify(i+2, j+1, k, Block.planks.blockID);
world.setBlockWithNotify(i+3, j+1, k, Block.planks.blockID);
world.setBlockWithNotify(i+4, j+1, k, Block.planks.blockID);
world.setBlockWithNotify(i+5, j+1, k, Block.planks.blockID);
world.setBlockWithNotify(i+5, j+1, k+1, Block.doorWood.blockID);
world.setBlockWithNotify(i+5, j+1, k+2, Block.planks.blockID);
world.setBlockWithNotify(i+5, j+1, k+3, Block.planks.blockID);
world.setBlockWithNotify(i+5, j+1, k+4, Block.planks.blockID);
world.setBlockWithNotify(i+5, j+1, k+5, Block.planks.blockID);
world.setBlockWithNotify(i+4, j+1, k+5, Block.planks.blockID);
world.setBlockWithNotify(i+3, j+1, k+5, Block.planks.blockID);
world.setBlockWithNotify(i+2, j+1, k+5, Block.planks.blockID);
world.setBlockWithNotify(i+1, j+1, k+5, Block.planks.blockID);
world.setBlockWithNotify(i, j+1, k+5, Block.planks.blockID);
world.setBlockWithNotify(i, j+1, k+4, Block.planks.blockID);
world.setBlockWithNotify(i, j+1, k+3, Block.planks.blockID);
world.setBlockWithNotify(i, j+1, k+2, Block.planks.blockID);
world.setBlockWithNotify(i, j+1, k+1, Block.planks.blockID);
world.setBlockWithNotify(i, j+1, k, Block.planks.blockID);
world.setBlockWithNotify(i, j+2, k, Block.planks.blockID);
world.setBlockWithNotify(i, j+2, k+1, Block.planks.blockID);
world.setBlockWithNotify(i, j+2, k+2, Block.glass.blockID);
world.setBlockWithNotify(i, j+2, k+3, Block.glass.blockID);
world.setBlockWithNotify(i, j+2, k+4, Block.glass.blockID);
world.setBlockWithNotify(i, j+2, k+5, Block.planks.blockID);
world.setBlockWithNotify(i+1, j+2, k+5, Block.planks.blockID);
world.setBlockWithNotify(i+2, j+2, k+5, Block.glass.blockID);
world.setBlockWithNotify(i+3, j+2, k+5, Block.glass.blockID);
world.setBlockWithNotify(i+4, j+2, k+5, Block.glass.blockID);
world.setBlockWithNotify(i+5, j+2, k+5, Block.planks.blockID);
world.setBlockWithNotify(i+5, j+2, k+4, Block.planks.blockID);
world.setBlockWithNotify(i+5, j+2, k+3, Block.glass.blockID);
world.setBlockWithNotify(i+5, j+2, k+2, Block.glass.blockID);
world.setBlockWithNotify(i+5, j+2, k, Block.planks.blockID);
world.setBlockWithNotify(i+4, j+2, k, Block.planks.blockID);
world.setBlockWithNotify(i+3, j+2, k, Block.glass.blockID);
world.setBlockWithNotify(i+2, j+2, k, Block.glass.blockID);
world.setBlockWithNotify(i+1, j+2, k, Block.glass.blockID);
world.setBlockWithNotify(i, j+2, k, Block.planks.blockID);
world.setBlockWithNotify(i, j+3, k, Block.planks.blockID);
world.setBlockWithNotify(i, j+3, k+1, Block.planks.blockID);
world.setBlockWithNotify(i, j+3, k+2, Block.planks.blockID);
world.setBlockWithNotify(i, j+3, k+3, Block.planks.blockID);
world.setBlockWithNotify(i, j+3, k+4, Block.planks.blockID);
world.setBlockWithNotify(i, j+3, k+5, Block.planks.blockID);
world.setBlockWithNotify(i+1, j+3, k, Block.planks.blockID);
world.setBlockWithNotify(i+1, j+3, k+1, Block.planks.blockID);
world.setBlockWithNotify(i+1, j+3, k+2, Block.planks.blockID);
world.setBlockWithNotify(i+1, j+3, k+3, Block.planks.blockID);
world.setBlockWithNotify(i+1, j+3, k+4, Block.planks.blockID);
world.setBlockWithNotify(i+1, j+3, k+5, Block.planks.blockID);
world.setBlockWithNotify(i+2, j+3, k, Block.planks.blockID);
world.setBlockWithNotify(i+2, j+3, k+1, Block.planks.blockID);
world.setBlockWithNotify(i+2, j+3, k+2, Block.planks.blockID);
world.setBlockWithNotify(i+2, j+3, k+3, Block.planks.blockID);
world.setBlockWithNotify(i+2, j+3, k+4, Block.planks.blockID);
world.setBlockWithNotify(i+2, j+3, k+5, Block.planks.blockID);
world.setBlockWithNotify(i+3, j+3, k, Block.planks.blockID);
world.setBlockWithNotify(i+3, j+3, k+1, Block.planks.blockID);
world.setBlockWithNotify(i+3, j+3, k+2, Block.planks.blockID);
world.setBlockWithNotify(i+3, j+3, k+3, Block.planks.blockID);
world.setBlockWithNotify(i+3, j+3, k+4, Block.planks.blockID);
world.setBlockWithNotify(i+3, j+3, k+5, Block.planks.blockID);
world.setBlockWithNotify(i+4, j+3, k, Block.planks.blockID);
world.setBlockWithNotify(i+4, j+3, k+1, Block.planks.blockID);
world.setBlockWithNotify(i+4, j+3, k+2, Block.planks.blockID);
world.setBlockWithNotify(i+4, j+3, k+3, Block.planks.blockID);
world.setBlockWithNotify(i+4, j+3, k+4, Block.planks.blockID);
world.setBlockWithNotify(i+4, j+3, k+5, Block.planks.blockID);
world.setBlockWithNotify(i+5, j+3, k, Block.planks.blockID);
world.setBlockWithNotify(i+5, j+3, k+1, Block.planks.blockID);
world.setBlockWithNotify(i+5, j+3, k+2, Block.planks.blockID);
world.setBlockWithNotify(i+5, j+3, k+3, Block.planks.blockID);
world.setBlockWithNotify(i+5, j+3, k+4, Block.planks.blockID);
world.setBlockWithNotify(i+5, j+3, k+5, Block.planks.blockID);
}
}
Re: [1.8.1] Structure Maker
this might sound really stupid but... could someone help me on the X,Y and Z axis pait please(i,j and k)
IRRob- Member
- Posts : 2
Join date : 2011-10-27
Age : 27
Location : liverpool
Re: [1.8.1] Structure Maker
this does seem pretty complex, ima hold up on it for a while
austin56101- Moderator
- Posts : 85
Join date : 2011-10-22
Age : 28
Location : Cali!
Re: [1.8.1] Structure Maker
like, if i wanted say a 10x10x10 square would the coords be i+10 k+10 j+10.(or something like that?) oh and hi again its ftmproductions from youtube
IRRob- Member
- Posts : 2
Join date : 2011-10-27
Age : 27
Location : liverpool
Re: [1.8.1] Structure Maker
IRRob wrote:like, if i wanted say a 10x10x10 square would the coords be i+10 k+10 j+10.(or something like that?) oh and hi again its ftmproductions from youtube
- Code:
int size = 10;
for(int x = 0; x < size; x++)
{
for(int y = 0; y < size; y++)
{
for(int z = 0; z < size; z++)
{
world.setBlockWithNotify(i + x, j + y, k + z, 1);
}
}
}
This would make a 10 X 10 filled (NOT hollow) block of stone. This is the most basic way of doing it; it has no checks to see if it would fit and has no checks for any other random requirement; it will work every time.
groxmapper- Member
- Posts : 27
Join date : 2011-10-24
Re: [1.8.1] Structure Maker
lol my code for a house does not use any loops... 1 line of code per block... lots of lines!
Re: [1.8.1] Structure Maker
how did you do it then I would like to know belive me I plan on making a mansion block I cant really be botherd doing what I am nowthe undecided t wrote:lol my code for a house does not use any loops... 1 line of code per block... lots of lines!
Re: [1.8.1] Structure Maker
Then you use the setblockwithnotify method as described above your post. you put a line of this:
world.setBlockWithNotify(i, j + 1, k, Block.dirt.blockID);
for every block, right now the j + 1 stand for it sets a block 1 block above the block you clicked, since j = y and y is the vertical axis
if you want to make a 3x3 square with the block you click in the middle it would be:
world.setBlockWithNotify(i, j + 1, k, Block.dirt.blockID);
for every block, right now the j + 1 stand for it sets a block 1 block above the block you clicked, since j = y and y is the vertical axis
if you want to make a 3x3 square with the block you click in the middle it would be:
- Code:
world.setBlockWithNotify(i, j, k, Block.dirt.blockID);
world.setBlockWithNotify(i + 1, j, k, Block.dirt.blockID);
world.setBlockWithNotify(i - 1, j, k, Block.dirt.blockID);
world.setBlockWithNotify(i + 1, j, k + 1, Block.dirt.blockID);
world.setBlockWithNotify(i, j, k + 1, Block.dirt.blockID);
world.setBlockWithNotify(i - 1, j, k + 1, Block.dirt.blockID);
world.setBlockWithNotify(i, j, k - 1, Block.dirt.blockID);
world.setBlockWithNotify(i + 1, j, k - 1, Block.dirt.blockID);
world.setBlockWithNotify(i - 1, j, k - 1, Block.dirt.blockID);
ikke009- Member
- Posts : 65
Join date : 2011-10-24
Age : 30
Location : The netherlands
Re: [1.8.1] Structure Maker
No I don't mean like that I mean like in theudecidedT's code he got from the village my items change ALOT
Re: [1.8.1] Structure Maker
Love the tutorials. Especially this one. Curious, is there a way to randomly place a certain block in in the structure? Like, for instance, the occasional mossy cobblestone in a cobble structure? It would be nice to randomize the structures a bit so that they're not always the same.
The Snoo- Member
- Posts : 1
Join date : 2011-11-09
MC Modding :: Modding :: Singleplayer Modding :: Tutorials
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum