Jump to content

Recommended Posts

Posted

so, my idea of doing it was  to make a  variable bounding/collision box  and then an onentitycollision event

however, to do this you'd need to be able to be walking through the bounding/collision box

 

 

the point of this is to blow an entity up and leave it floating there untill it moves away from the blocks underneath

 

If anyone knows how to do this, or maybe has a better solution please tell me! :)

Posted

List list = worldObj.getEntitiesWithinAABB(Entity.class, AxisAlignedBB.getBoundingBox((float) xCoord, (float) yCoord, (float) zCoord, (float) (xCoord + 1), (float) (yCoord + 2), (float) (zCoord + 1)));

 

that should give you a list of every entity in or above your TileEntity, shouldn't be too difficult to modify it to do what you need. i recommend you change the Entity.class part to something more specific.

Posted

List list = worldObj.getEntitiesWithinAABB(Entity.class, AxisAlignedBB.getBoundingBox((float) xCoord, (float) yCoord, (float) zCoord, (float) (xCoord + 1), (float) (yCoord + 2), (float) (zCoord + 1)));

 

that should give you a list of every entity in or above your TileEntity, shouldn't be too difficult to modify it to do what you need. i recommend you change the Entity.class part to something more specific.

 

im sorry im kind of a beginner X D

the only thing i couldnt make work was the worldObj  any suggestions on how to declare it?

Posted

List list = worldObj.getEntitiesWithinAABB(Entity.class, AxisAlignedBB.getBoundingBox((float) xCoord, (float) yCoord, (float) zCoord, (float) (xCoord + 1), (float) (yCoord + 2), (float) (zCoord + 1)));

 

that should give you a list of every entity in or above your TileEntity, shouldn't be too difficult to modify it to do what you need. i recommend you change the Entity.class part to something more specific.

 

im sorry im kind of a beginner X D

the only thing i couldnt make work was the worldObj  any suggestions on how to declare it?

never mind, i just figured out how to fix it :P

however it still doesnt make a collision box... or maybe im just doing something wrong, let me play around with it a lil more :P

Posted

unfortunately (as far as i know) it is not possible to make a collation box that extends outside of your cubic meter box as that the collation detection function will not even look at your collation box unless the entity is colliding with the cubic meter space assigned to your block. so to check for entities outside this area, you have to manually call collision detection every tick or so.

Posted

unfortunately (as far as i know) it is not possible to make a collation box that extends outside of your cubic meter box as that the collation detection function will not even look at your collation box unless the entity is colliding with the cubic meter space assigned to your block. so to check for entities outside this area, you have to manually call collision detection every tick or so.

so do you have any other suggestions of detecting an entity and then give velocity to that entity while being 10 blocks close

 

this is what the objective is : the entity is walking over the block it gets pushed up untill its 10 blocks higher then the block itself

idc what  other way i need to do it i just want it to work :)

Posted

i'm afraid running that in the updateEntity function of a TileEntity is the only way i know of to find entities outside the space your block occupies. as for pushing entities, i have never tried it before but the first thing that comes to mind is just simply adding some number to the posY of the entity:

 

    @Override

    public void updateEntity()

    {

          List list = worldObj.getEntitiesWithinAABB(Entity.class, AxisAlignedBB.getBoundingBox((float) (xCoord -9), (float) yCoord, (float) (zCoord - 9), (float) (xCoord + 11), (float) (yCoord + 11), (float) (zCoord + 11)));

          for(int i=0; i < list.size(); i++)

          {

              Entity e = (Entity) list.get(i);

              e.posY += 0.1D;

          }

    }

Posted

i'm afraid running that in the updateEntity function of a TileEntity is the only way i know of to find entities outside the space your block occupies. as for pushing entities, i have never tried it before but the first thing that comes to mind is just simply adding some number to the posY of the entity:

 

    @Override

    public void updateEntity()

    {

          List list = worldObj.getEntitiesWithinAABB(Entity.class, AxisAlignedBB.getBoundingBox((float) (xCoord -9), (float) yCoord, (float) (zCoord - 9), (float) (xCoord + 11), (float) (yCoord + 11), (float) (zCoord + 11)));

          for(int i=0; i < list.size(); i++)

          {

              Entity e = (Entity) list.get(i);

              e.posY += 0.1D;

          }

    }

it didnt work out and i couldnt seem to fix it :S

this still leaves me without a fix :(

Posted

Could it be possible to create a condition that takes the coordinates of the player and of the block/tileentity, and subtracts the distance from one of the two and takes the absolute value of your result and then uses an if statement? Im not 100% sure but sounds like it would work if you knew how to do it.

This is the creator of the Rareores mod! Be sure to check it out at

Posted

Could it be possible to create a condition that takes the coordinates of the player and of the block/tileentity, and subtracts the distance from one of the two and takes the absolute value of your result and then uses an if statement? Im not 100% sure but sounds like it would work if you knew how to do it.

yes but what would trigger the event of moving the entity.....

Posted

i'm guessing from the pm you sent me that you don't have your TileEntity set up properly. for starters the class you put it in needs to extend TileEntity.

 

public class CustomTileEntity extends TileEntity
{
     @Override
     public void updateEntity()
     {
          //your code here
     }
}

 

and then your bock needs to tell minecraft that it has a TileEntity

 

public class BlockCustom extends Block implements ITileEntityProvider
{
     @Override
     public TileEntity createNewTileEntity(World par1World)
     {
          return new CustomTileEntity();
     }
}

 

and then you need to register your TileEntity

 

     @Init
     public void load(FMLInitializationEvent event)
     {
          //some code
          GameRegistry.registerTileEntity(CustomTileEntity.class, "CustomTileEntity");
          //some more code
     }

Posted

i'm guessing from the pm you sent me that you don't have your TileEntity set up properly. for starters the class you put it in needs to extend TileEntity.

 

public class CustomTileEntity extends TileEntity
{
     @Override
     public void updateEntity()
     {
          //your code here
     }
}

 

and then your bock needs to tell minecraft that it has a TileEntity

 

public class BlockCustom extends Block implements ITileEntityProvider
{
     @Override
     public TileEntity createNewTileEntity(World par1World)
     {
          return new CustomTileEntity();
     }
}

 

and then you need to register your TileEntity

 

     @Init
     public void load(FMLInitializationEvent event)
     {
          //some code
          GameRegistry.registerTileEntity(CustomTileEntity.class, "CustomTileEntity");
          //some more code
     }

oh im sorry lol ....  this is my first time modding... so i didnt know

but ima try adding this as quick as i can and then hopefully it will work :D

Posted

i'm guessing from the pm you sent me that you don't have your TileEntity set up properly. for starters the class you put it in needs to extend TileEntity.

 

public class CustomTileEntity extends TileEntity
{
     @Override
     public void updateEntity()
     {
          //your code here
     }
}

 

and then your bock needs to tell minecraft that it has a TileEntity

 

public class BlockCustom extends Block implements ITileEntityProvider
{
     @Override
     public TileEntity createNewTileEntity(World par1World)
     {
          return new CustomTileEntity();
     }
}

 

and then you need to register your TileEntity

 

     @Init
     public void load(FMLInitializationEvent event)
     {
          //some code
          GameRegistry.registerTileEntity(CustomTileEntity.class, "CustomTileEntity");
          //some more code
     }

 

OMFG DUDE IT FINALLY WORKS THANK YOU SO MUCH!!!!!!!!!

however your values were very very off  when u went in a 20 block radius of the block it would already push you

however another friend helped me fix the coord values

so now it finally works :D

!!!!!

Guest
This topic is now closed to further replies.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.