Jump to content

[solved-ish]Entity collision happening client side but not server side


hydroflame

Recommended Posts

not compared to most problem, this time the right thing is happening on server side but not on client side

 

so heres how it goes, im spawning an entity server side (some sort of AOE that will damage living inside it)

it gets spawn client side too, but this entity will move itself client side because it doesnt like to be in collision with blocks (the aoe doesnt care about living)

 

so i spawn the entity 1 block deep in the ground, server side will keep it there but client side will move it one block up to the surface.

 

here my onupdate method, on the constructor i have noClip = true; but that doesnt seem to change anything

 

@Override
public void onUpdate(){
	this.lastTickPosX = this.posX;
        this.lastTickPosY = this.posY;
        this.lastTickPosZ = this.posZ;
        updateEntity();
        ticksExisted++;
        if(ticksExisted > tickAlive()){
        	this.setDead();
        	return;
        }
        
        if (!this.worldObj.isRemote)
        {
        	if(caster == null){
        		this.setDead();
        		return;
        	}
            List list = this.worldObj.getEntitiesWithinAABBExcludingEntity(this, this.boundingBox);
            EntityLiving entityliving = caster;
            EntityLiving touched;
            for (int j = 0; j < list.size(); ++j)
            {
                Entity entity1 = (Entity)list.get(j);

                if (entity1.canBeCollidedWith()&& entity1 instanceof EntityLiving)
                {
                	onImpact((EntityLiving)entity1);
                }
            }

        }

 

im thinking maybe the game clinet side moves the bounding box around when he gets collision with block but i cant seem to find where, and more importantly, how to prevent it

 

any help is appreciated, thanks ^^

 

edit: by saving the posX/Y/Z at the begining of the update method and restoring at the end i have determined that thsi change does NOT happen during the update phase :\, which actually leaves me even more clueless as to why this is happening

 

 

 

SOLUTION:

 

so further investigation demonstrate that a packet sent from the server (Packet30Entity) was causing this change. now why this packet had different data then the actual server values that i cannot tell exactly but it seems that it has something to do with the function expand(double, double, double) that the physics engine calls on server side

 

my solution was to simply Override the setPositionAndRotation2 method from Entity and leave it blank, anyway in my case the movement are very precise and should require sync between the server and the client

 

 

 

 

... 3 view only and 2 of them are mine for my 2 edits ... jeez was this question that retarded ?

how to debug 101:http://www.minecraftforge.net/wiki/Debug_101

-hydroflame, author of the forge revolution-

Link to comment
Share on other sites

  • 10 months later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

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