I know that i can get a block to tell if an item is dropped on it but can you detect if a specific item is dropped on a block? thank you, any and all help is greatly appreciated. :]
New question:
id like to have it check if a certain block is with in a certain radius and have it so it cant grow within a radius of another block, how would i go about doing that?
ah i thought itd be something like that ill give it a go and see how it turns out
while i test this out can you answer another question
Id like to add to this code:
public void updateTick(World par1World, int par2, int par3, int par4, Random par5Random)
{
if (par5Random.nextInt(1) == 0)
{
byte byte0 = 4;
int i = 5;
int k = (par2 + par5Random.nextInt(3)) - 1;
int i1 = (par3 + par5Random.nextInt(2)) - par5Random.nextInt(2);
int k1 = (par4 + par5Random.nextInt(3)) - 1;
for (int l1 = 0; l1 < par5Random.nextInt(20) + 4; l1++)
{
if (par1World.isAirBlock(k, i1, k1) && canBlockStay(par1World, k, i1, k1))
{
par2 = k;
par3 = i1;
par4 = k1;
}
k = (par2 + par5Random.nextInt(3)) - 1;
i1 = (par3 + par5Random.nextInt(2)) - par5Random.nextInt(2);
k1 = (par4 + par5Random.nextInt(3)) - 1;
if (par1World.isAirBlock(k, i1, k1) && canBlockStay(par1World, k, i1, k1))
{
par1World.setBlockWithNotify(k, i1, k1, blockID);
}
}
}
}
id like to have it check if a certain block is with in a certain radius and have it so it cant grow within a radius of another block, how would i go about doing that?
id like to have it check if a certain block is with in a certain radius and have it so it cant grow within a radius of another block, how would i go about doing that?
So it can't grow within X blocks of another block? Hmm, that should be an interesting one to come up with. How far away from said block is it that you are trying to get? Two blocks? Three blocks? And would this be just going straight out from it, at corners, both, on the same level or multiple?
So it can't grow within X blocks of another block? Hmm, that should be an interesting one to come up with. How far away from said block is it that you are trying to get? Two blocks? Three blocks? And would this be just going straight out from it, at corners, both, on the same level or multiple?
i think itd help to explain the function, the idea im going for is a spore block that will be on the ground that block will have to be present within say a 9x9x9 for the other block "haze" (as im calling it) to stay or be created in, but i dont want this haze blocks to be within 3 blocks of the ooze that i have. is this something i can do? im not afraid to be ambitious so as long as its do able im gonna go for it.
i think itd help to explain the function, the idea im going for is a spore block that will be on the ground that block will have to be present within say a 9x9x9 for the other block "haze" (as im calling it) to stay or be created in, but i dont want this haze blocks to be within 3 blocks of the ooze that i have. is this something i can do? im not afraid to be ambitious so as long as its do able im gonna go for it.
I believe it should be possible. You'd just have to check all blocks that are within 3 blocks of where the spore hopes to grow, and if there is no ooze then go ahead and spawn. Otherwise don't. You'd probably do it in the canBlockStay() function, since that is already being called for when it spreads. Also, I think then that if haze is too close to a spore then the spore should drop. In theory.
Actually, do you remember that set of for loops you removed to help make it spread more? You could probably use a variant of that same thing to check for this.
In case you don't remember
for (int j = par2 - byte0; j <= par2 + byte0; j++)
{
for (int l = par4 - byte0; l <= par4 + byte0; l++)
{
for (int j1 = par3 - 1; j1 <= par3 + 1; j1++)
{
if (par1World.getBlockId(j, j1, l) == blockID && --i <= 0)
{
return;
}
}
}
I believe it should be possible. You'd just have to check all blocks that are within 3 blocks of where the spore hopes to grow, and if there is no ooze then go ahead and spawn. Otherwise don't. You'd probably do it in the canBlockStay() function, since that is already being called for when it spreads. Also, I think then that if haze is too close to a spore then the spore should drop. In theory.
Actually, do you remember that set of for loops you removed to help make it spread more? You could probably use a variant of that same thing to check for this.
In case you don't remember
for (int j = par2 - byte0; j <= par2 + byte0; j++)
{
for (int l = par4 - byte0; l <= par4 + byte0; l++)
{
for (int j1 = par3 - 1; j1 <= par3 + 1; j1++)
{
if (par1World.getBlockId(j, j1, l) == blockID && --i <= 0)
{
return;
}
}
}
yeah i was kind of thinking it would probably work close to the same as that loop. and i kind of want it to be like the haze is being created by the spore blocks, the idea is to be some infectious cloud that looms over the ooze block.
EntityItem collidedItem = null; and below is the item related code
its giving me this error: The method setBlockWithNotify(int, int, int, int) in the type World is not applicable for the arguments (int,
int, int)
also says Syntax error on token "]", ; expected for the same line
EntityItem collidedItem = null; and below is the item related code
its giving me this error: The method setBlockWithNotify(int, int, int, int) in the type World is not applicable for the arguments (int,
int, int)
also says Syntax error on token "]", ; expected for the same line
You've set the Y coordinate for the X coord, the Z for the Y, the BlockID for the Z, and left the Block ID empty
I'am just not having any luck with this, ive added i ive looked at other classes like grass and such and i keep getting that error
Which, the set block or the searching for nearby blocks of a certain type? Quick question, will you be using this in your Spore class so it cannot be too close to haze, or haze so it cannot be too close to spore?
Which, the set block or the searching for nearby blocks of a certain type? Quick question, will you be using this in your Spore class so it cannot be too close to haze, or haze so it cannot be too close to spore?
the setblock
public void onEntityCollidedWithBlock(World world, int i, int j, int k, Entity entity)
{
EntityItem collidedItem = null;
if(entity instanceof EntityItem)
{
collidedItem = (EntityItem)entity;
if(collidedItem.item.itemID == Item.bone.shiftedIndex && world.getBlockId(j, k, i) == mod_CreepInfection.Ooze.blockID)
{
World.setBlockWithNotify(i, j, k, mod_CreepInfection.Spore.blockID);
}
}
still getting "Cannot make a static reference to the non-static method setBlockWithNotify(int, int, int, int) from the type World"
this code here will be related to spores creation, but the for loop is what im looking into for the haze block. to clarify its function i want it where haze checks to see if theres a spore within range, annd itll check to make sure its not within range of the ooze block.
public void onEntityCollidedWithBlock(World world, int i, int j, int k, Entity entity)
{
EntityItem collidedItem = null;
if(entity instanceof EntityItem)
{
collidedItem = (EntityItem)entity;
if(collidedItem.item.itemID == Item.bone.shiftedIndex && world.getBlockId(j, k, i) == mod_CreepInfection.Ooze.blockID)
{
World.setBlockWithNotify(i, j, k, mod_CreepInfection.Spore.blockID);
}
}
still getting "Cannot make a static reference to the non-static method setBlockWithNotify(int, int, int, int) from the type World"
this code here will be related to spores creation, but the for loop is what im looking into for the haze block. to clarify its function i want it where haze checks to see if theres a spore within range, annd itll check to make sure its not within range of the ooze block.
The problem is you're using "World."
This is trying to use the actual World class, and not a variable with the "type" of World
Use "world" instead, which is the actual parameter (which happens to be the instance of the World object the game is using) anything executing this method has to pass to it.
The problem is you're using "World."
This is trying to use the actual World class, and not a variable with the "type" of World
Use "world" instead, which is the actual parameter (which happens to be the instance of the World object the game is using) anything executing this method has to pass to it.
If you still need help with the function that checks blocks I can probably help you with that too, but I'll need specific information about exactly how the area is to be checked, including how far above and below the centerpoint to check, and how far away.
I've done a decent bit with blocks interacting with their environment recently.
If you still need help with the function that checks blocks I can probably help you with that too, but I'll need specific information about exactly how the area is to be checked, including how far above and below the centerpoint to check, and how far away.
I've done a decent bit with blocks interacting with their environment recently.
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
New question:
Edit: Would that be this code?
on my other block i was using this code:
i figured it could be applied to detect certain items on the block
Oh definitely. I'm not quite sure how items work, but I know that most use EntityItem when dropped. You'd need to modify it to be something such as
Of course if you are wanting it to be a type of block that is dropped, you'd use
ah i thought itd be something like that ill give it a go and see how it turns out
while i test this out can you answer another question
Id like to add to this code:
id like to have it check if a certain block is with in a certain radius and have it so it cant grow within a radius of another block, how would i go about doing that?
So it can't grow within X blocks of another block? Hmm, that should be an interesting one to come up with. How far away from said block is it that you are trying to get? Two blocks? Three blocks? And would this be just going straight out from it, at corners, both, on the same level or multiple?
i think itd help to explain the function, the idea im going for is a spore block that will be on the ground that block will have to be present within say a 9x9x9 for the other block "haze" (as im calling it) to stay or be created in, but i dont want this haze blocks to be within 3 blocks of the ooze that i have. is this something i can do? im not afraid to be ambitious so as long as its do able im gonna go for it.
I believe it should be possible. You'd just have to check all blocks that are within 3 blocks of where the spore hopes to grow, and if there is no ooze then go ahead and spawn. Otherwise don't. You'd probably do it in the canBlockStay() function, since that is already being called for when it spreads. Also, I think then that if haze is too close to a spore then the spore should drop. In theory.
Actually, do you remember that set of for loops you removed to help make it spread more? You could probably use a variant of that same thing to check for this.
In case you don't remember
yeah i was kind of thinking it would probably work close to the same as that loop. and i kind of want it to be like the haze is being created by the spore blocks, the idea is to be some infectious cloud that looms over the ooze block.
EntityItem collidedItem = null; and below is the item related code
its giving me this error: The method setBlockWithNotify(int, int, int, int) in the type World is not applicable for the arguments (int,
int, int)
also says Syntax error on token "]", ; expected for the same line
You've set the Y coordinate for the X coord, the Z for the Y, the BlockID for the Z, and left the Block ID empty
setBlockWithNotify(i, j, k, mod_CreepInfection.Spore.blockID)
Edit: Currently that for loop checks 4 blocks straight out, but it doesn't do at corners etc.
I'am just not having any luck with this, ive added i ive looked at other classes like grass and such and i keep getting that error
Which, the set block or the searching for nearby blocks of a certain type? Quick question, will you be using this in your Spore class so it cannot be too close to haze, or haze so it cannot be too close to spore?
the setblock
still getting "Cannot make a static reference to the non-static method setBlockWithNotify(int, int, int, int) from the type World"
this code here will be related to spores creation, but the for loop is what im looking into for the haze block. to clarify its function i want it where haze checks to see if theres a spore within range, annd itll check to make sure its not within range of the ooze block.
The problem is you're using "World."
This is trying to use the actual World class, and not a variable with the "type" of World
Use "world" instead, which is the actual parameter (which happens to be the instance of the World object the game is using) anything executing this method has to pass to it.
well look at that no more errors
time to test
If you still need help with the function that checks blocks I can probably help you with that too, but I'll need specific information about exactly how the area is to be checked, including how far above and below the centerpoint to check, and how far away.
I've done a decent bit with blocks interacting with their environment recently.
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