Jump to content

robertcarr22

Members
  • Posts

    8
  • Joined

  • Last visited

Posts posted by robertcarr22

  1. The two params are:

     

    1) The entity class you are interested in.

    2) An axis aligned bounding box.*

     

    It's pretty widely used for things like splash potions and mob spawners.  Also pressure plates, if I recall correctly.

     

    *You can get one by calling AxisAlignedBoundingBox.getAABBFromPool(xmin, ymin, zmin, xmax, ymax, zmax) if I am recalling the class and method names correctly.

     

    Right okay I tried this code out: https://gist.github.com/robertcarr22/21f97f33584c3e0b8468

    and it works well in the south east direction but doesn't work at all in any other direction.

    This is probably because I've don't the maths for the bounding box wrong but Im not entirely sure..

     

    EDIT: Seems to be with the calculation of where the player is looking not the bounding box

     

    Okay it actually seems to be something wrong with detecting entities in the box. It detects entities in the bounding box when facing south east but not any other direction. I can't figure out what is going wrong :(

  2. Use:

     

      Side side = FMLCommonHandler.instance().getEffectiveSide();
                    if (side == Side.CLIENT) {
                        if(tickCooldown<=0){
                          ClientSideStuff
                          tickCooldown = 2;
                         }
                    }else{
              ServerStuff
    }

     

    the tick cooldown should be --'d every client side tick also.

     

     

    Thanks for this but i don't need to separate the client and server anymore I'm having a different problem :P

  3. The two params are:

     

    1) The entity class you are interested in.

    2) An axis aligned bounding box.*

     

    It's pretty widely used for things like splash potions and mob spawners.  Also pressure plates, if I recall correctly.

     

    *You can get one by calling AxisAlignedBoundingBox.getAABBFromPool(xmin, ymin, zmin, xmax, ymax, zmax) if I am recalling the class and method names correctly.

     

    Right okay I tried this code out: https://gist.github.com/robertcarr22/21f97f33584c3e0b8468

    and it works well in the south east direction but doesn't work at all in any other direction.

    This is probably because I've don't the maths for the bounding box wrong but Im not entirely sure..

     

    EDIT: Seems to be with the calculation of where the player is looking not the bounding box

  4. I did it with worldObj#getEntitiesWithinAABB and scan for every entity in the list(Maybe there is a better way, tell me if you have one afterwards).

     

    and this is partly(or all? I cant remember) copy from code of enderman to know if the obj is looking at by the player.

    --snip--

     

    never heard of that method… :/ what are the 2 params you put in the getEntitiesWithinAABB method? and where does that code get used?

  5. Minecraft is a client side only class.

    You should try to get the entity the player is pointing at in the server side without Minecraft#objectMouseOver.

    As it's client only, when the target is not null, it would be always client side.

     

    Ahhhh i see! Is there anyway to find the entity a player is looking at that will work on server side?

×
×
  • Create New...

Important Information

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