ill take any help i can get,
so theres 3 block, spore, haze and ooze, ooze spreads out on its own, so will haze but haze will have to have a spore block within a 9x9x9 area but cant be within 3 blocks (in any direction) of an ooze block
Is the haze going to be spawned from code in the spore block?
yes initially it will be spawned from the spore block
I'll look at it tomorrow. Right now I'm dealing with my own set of loops...which has gone out of control and nearly caused my system to run out of memory for the umpteenth time, and I'm probably making one stupid ass typo. It would be cruel and unusual punishment to make you go through the same, seeing as it's apparently NOT MY DAY.
Note: 9 cubed rapidly becomes a resource intensive number when the number of blocks becomes more than a few, be aware of this.
I'll look at it tomorrow. Right now I'm dealing with my own set of loops...which has gone out of control and nearly caused my system to run out of memory for the umpteenth time, and I'm probably making one stupid ass typo. It would be cruel and unusual punishment to make you go through the same, seeing as it's apparently NOT MY DAY.
Note: 9 cubed rapidly becomes a resource intensive number when the number of blocks becomes more than a few, be aware of this.
yeah i know that feel, youve alrdy helped a good bit, the haze idea ive been kinda ify on a friends suggested it and it was a cool idea but its been trouble from the start so it may easily be tossed out
but Ill play with it for a bit and see
yeah i know that feel, youve alrdy helped a good bit, the haze idea ive been kinda ify on a friends suggested it and it was a cool idea but its been trouble from the start so it may easily be tossed out
but Ill play with it for a bit and see
I fixed my own dumb problem and reminded myself (hopefully for the last time) that doing a certain something that I've done multiple times before results in an infinite loop...
for(int xToPlaceIn = x - radiusSmall; xToPlaceIn <= x + radiusSmall; xToPlaceIn++)
Now that that's over with I'll probably be able to knock your basic code out like nothing.
Also should haze only replace air blocks? I would assume so, just posing the question before I go to sleep.
I fixed my own dumb problem and reminded myself (hopefully for the last time) that doing a certain something that I've done multiple times before results in an infinite loop...
for(int xToPlaceIn = x - radiusSmall; xToPlaceIn <= x + radiusSmall; xToPlaceIn++)
Now that that's over with I'll probably be able to knock your basic code out like nothing.
Also should haze only replace air blocks? I would assume so, just posing the question before I go to sleep.
Well I've come up with a basic thing for you. Doesn't work entirely, corners don't seem to be looked at (Although after looking at it I thought they should. Odd.) Sadly it doesn't run this unless either it is called to spread or you place a block next to it.
For testing I used diamond blocks. Also, it looks like up/down isn't accounted for yet either. Oh well, things to look at tomorrow if able.
public boolean canBlockStay(World par1World, int par2, int par3, int par4)
{
byte byte0 = 3;
int i = 5;
for (int j = par2 - byte0; j <= par2 + byte0; j++)
{
for (int l = par4 - byte0; l <= par4 + byte0; l++)
{
for (int j1 = par3 - byte0; j1 <= par3 + byte0; j1++)
{
if (par1World.getBlockId(j, j1, l) == Block.blockDiamond.blockID)
{
return false;
}
}
}
}
}
Well I've come up with a basic thing for you. Doesn't work entirely, corners don't seem to be looked at (Although after looking at it I thought they should. Odd.) Sadly it doesn't run this unless either it is called to spread or you place a block next to it.
For testing I used diamond blocks. Also, it looks like up/down isn't accounted for yet either. Oh well, things to look at tomorrow if able.
public boolean canBlockStay(World par1World, int par2, int par3, int par4)
{
byte byte0 = 3;
int i = 5;
for (int j = par2 - byte0; j <= par2 + byte0; j++)
{
for (int l = par4 - byte0; l <= par4 + byte0; l++)
{
for (int j1 = par3 - byte0; j1 <= par3 + byte0; j1++)
{
if (par1World.getBlockId(j, j1, l) == Block.blockDiamond.blockID)
{
return false;
}
}
}
}
}
Your method you're using to detect entities on blocks should have a parameter of Entity, yes?
If so, detect whether or not that entity is an instance of Item, containing the ItemStack of the item you wish to do special stuff when the item is on the block.
Your method you're using to detect entities on blocks should have a parameter of Entity, yes?
If so, detect whether or not that entity is an instance of Item, containing the ItemStack of the item you wish to do special stuff when the item is on the block.
Yeaaaahhh it would help to read what's been answered Drew
package net.minecraft.src;
import java.util.Random;
public class BlockRedundantNameBlock1 extends Block
{
protected BlockRedundantNameBlock1(int id)
{
super(id, Material.rock);
}
public int tickRate()
{
return 60;
}
public void updateTick(World world, int x, int y, int z, Random random)
{
/* Loop checking 9 by 9 by 9 area */
for (int posY1 = y - 9; posY1 <= y + 9; posY1++)
for (int posX1 = x - 9; posX1 <= x + 9; posX1++)
for (int posZ1 = z - 9; posZ1 <= z + 9; posZ1++)
{
if (((posY1 <= 256) && (posY1 > 0)))
{
/* If there's a block of air at the coordinates given by the loop then place a block of haze and start it updating at a tickrate of 60 */
if(world.isAirBlock(posX1, posY1, posZ1))
{
/* Replace stone with the haze block */
world.setBlockWithNotify(posX1, posY1, posZ1, Block.stone.blockID);
world.scheduleBlockUpdate(posX1, posY1, posZ1, Block.stone.blockID, 60);
}
}
}
}
}
The block of haze:
package net.minecraft.src;
import java.util.Random;
public class BlockRendundantNameBlock2 extends Block
{
public boolean canBePlaced;
protected BlockRendundantNameBlock2(int id)
{
super(id, Material.rock);
}
/* 1 tick per 3 seconds */
public int tickRate()
{
return 60;
}
/* Checks 3 by 3 by 3 area and returns the ID of blocks */
public int blockCheckLoop(World world, int x, int y, int z)
{
int posXChecked = 0;
int posYChecked = 0;
int posZChecked = 0;
for (int posY1 = y - 3; posY1 <= y + 3; posY1++)
for (int posX1 = x - 3; posX1 <= x + 3; posX1++)
for (int posZ1 = z - 3; posZ1 <= z + 3; posZ1++)
{
posXChecked = posX1;
posYChecked = posY1;
posZChecked = posZ1;
}
int blockChecked = world.getBlockId(posXChecked, posYChecked, posZChecked);
/* Just to make sure the coordinates are actually being assigned to the variables */
System.out.println("X: " + posXChecked + "Y: " + posYChecked + "Z: " + posZChecked);
return blockChecked;
}
/* Block can only be placed if blockCheckLoop doesn't return the ID of the ooze block */
public boolean canPlaceBlockAt(World world, int x, int y, int z)
{
/* Change to ID of ooze */
return this.blockCheckLoop(world, x, y, z) != Block.dirt.blockID;
}
/* If the block can't stay, remove it (set it to an air block) */
public void updateTick(World world, int x, int y, int z, Random random)
{
if(!this.canBlockStay(world, x, y, z))
{
world.setBlock(x, y, z, 0);
}
}
I haven't actually tested this but it should work as intended. I'll leave tying it into your own code up to you.
If you need more help I'll be glad to oblige.
package net.minecraft.src;
import java.util.Random;
public class BlockRedundantNameBlock1 extends Block
{
protected BlockRedundantNameBlock1(int id)
{
super(id, Material.rock);
}
public int tickRate()
{
return 60;
}
public void updateTick(World world, int x, int y, int z, Random random)
{
/* Loop checking 9 by 9 by 9 area */
for (int posY1 = y - 9; posY1 <= y + 9; posY1++)
for (int posX1 = x - 9; posX1 <= x + 9; posX1++)
for (int posZ1 = z - 9; posZ1 <= z + 9; posZ1++)
{
if (((posY1 <= 256) && (posY1 > 0)))
{
/* If there's a block of air at the coordinates given by the loop then place a block of haze and start it updating at a tickrate of 60 */
if(world.isAirBlock(posX1, posY1, posZ1))
{
/* Replace stone with the haze block */
world.setBlockWithNotify(posX1, posY1, posZ1, Block.stone.blockID);
world.scheduleBlockUpdate(posX1, posY1, posZ1, Block.stone.blockID, 60);
}
}
}
}
}
The block of haze:
package net.minecraft.src;
import java.util.Random;
public class BlockRendundantNameBlock2 extends Block
{
public boolean canBePlaced;
protected BlockRendundantNameBlock2(int id)
{
super(id, Material.rock);
}
/* 1 tick per 3 seconds */
public int tickRate()
{
return 60;
}
/* Checks 3 by 3 by 3 area and returns the ID of blocks */
public int blockCheckLoop(World world, int x, int y, int z)
{
int posXChecked = 0;
int posYChecked = 0;
int posZChecked = 0;
for (int posY1 = y - 3; posY1 <= y + 3; posY1++)
for (int posX1 = x - 3; posX1 <= x + 3; posX1++)
for (int posZ1 = z - 3; posZ1 <= z + 3; posZ1++)
{
posXChecked = posX1;
posYChecked = posY1;
posZChecked = posZ1;
}
int blockChecked = world.getBlockId(posXChecked, posYChecked, posZChecked);
/* Just to make sure the coordinates are actually being assigned to the variables */
System.out.println("X: " + posXChecked + "Y: " + posYChecked + "Z: " + posZChecked);
return blockChecked;
}
/* Block can only be placed if blockCheckLoop doesn't return the ID of the ooze block */
public boolean canPlaceBlockAt(World world, int x, int y, int z)
{
/* Change to ID of ooze */
return this.blockCheckLoop(world, x, y, z) != Block.dirt.blockID;
}
/* If the block can't stay, remove it (set it to an air block) */
public void updateTick(World world, int x, int y, int z, Random random)
{
if(!this.canBlockStay(world, x, y, z))
{
world.setBlock(x, y, z, 0);
}
}
I haven't actually tested this but it should work as intended. I'll leave tying it into your own code up to you.
If you need more help I'll be glad to oblige.
it worked but i didnt see this part returnthis.blockCheckLoop(world, x, y, z)!=Block.dirt.blockID; and after i changed it to the ooze block it just wouldnt do anything,
it worked but i didnt see this part returnthis.blockCheckLoop(world, x, y, z)!=Block.dirt.blockID; and after i changed it to the ooze block it just wouldnt do anything,
yeah it worked but it filled every avialable space id like it to stay a distance away from ooze (other wise ooze cant spread)
What it should be doing is filling in all the available air blocks with haze, then the haze block itself it supposed to be checking for blocks of ooze in its vicinity and destroying itself if it finds ooze within 3 blocks, since I used canPlaceBlockAt() it should also be checking for ooze when you try and place the block.
I only made it check for ooze blocks and modify itself in the event that it detects one, so that shouldn't be preventing the spread of the ooze block itself unless you also code ooze to avoid haze.
Is the haze going to be spawned from code in the spore block?
I'll look at it tomorrow. Right now I'm dealing with my own set of loops...which has gone out of control and nearly caused my system to run out of memory for the umpteenth time, and I'm probably making one stupid ass typo. It would be cruel and unusual punishment to make you go through the same, seeing as it's apparently NOT MY DAY.
Note: 9 cubed rapidly becomes a resource intensive number when the number of blocks becomes more than a few, be aware of this.
yeah i know that feel, youve alrdy helped a good bit, the haze idea ive been kinda ify on a friends suggested it and it was a cool idea but its been trouble from the start so it may easily be tossed out
but Ill play with it for a bit and see
I fixed my own dumb problem and reminded myself (hopefully for the last time) that doing a certain something that I've done multiple times before results in an infinite loop...
!= infinite loop
== infinite loop
Now that that's over with I'll probably be able to knock your basic code out like nothing.
Also should haze only replace air blocks? I would assume so, just posing the question before I go to sleep.
yep only air
For testing I used diamond blocks. Also, it looks like up/down isn't accounted for yet either. Oh well, things to look at tomorrow if able.
And, in your updateTick()
It doesn't work quite right yet, but it is a start.
a start is better then nothing! ill mess around with it some, lets hope tomorrow brings something good :]
Just as a warning, I have found that, for some reason, a part of that code can cause the game to crash. I'm not sure how, but it does.
weve moved on to a new subject sorry
Yeaaaahhh it would help to read what's been answered Drew
The block that will spawn the haze:
The block of haze:
I haven't actually tested this but it should work as intended. I'll leave tying it into your own code up to you.
If you need more help I'll be glad to oblige.
it worked but i didnt see this part return this.blockCheckLoop(world, x, y, z) != Block.dirt.blockID;
and after i changed it to the ooze block it just wouldnt do anything,
Did it work with dirt?
yeah it worked but it filled every avialable space id like it to stay a distance away from ooze (other wise ooze cant spread)
What it should be doing is filling in all the available air blocks with haze, then the haze block itself it supposed to be checking for blocks of ooze in its vicinity and destroying itself if it finds ooze within 3 blocks, since I used canPlaceBlockAt() it should also be checking for ooze when you try and place the block.
I only made it check for ooze blocks and modify itself in the event that it detects one, so that shouldn't be preventing the spread of the ooze block itself unless you also code ooze to avoid haze.
It probably just isn't getting tick updates scheduled (I left that part out...woops :D)
Try adding this into the file (possibly into the files for the other blocks too)