Jump to content

Recommended Posts

Posted

Hey there!

 

So I have this TE that teleports the items above them to another location... for testing purposes I have it set so that it will move 5 blocks up realitive to the TE.. however it seems to send the items hundreds of blocks away, instead of 5 above.. Any fix?

 

Here is the code:

    @Override
    public void updateEntity() {
        if (!world.isRemote) {
            itemsAbove = this.world.getEntitiesWithinAABB(EntityItem.class, new AxisAlignedBB(this.pos.getX()-1, this.pos.getY(), this.pos.getZ() -1, this.pos.getX() + 1, this.pos.getY() + 2, this.pos.getZ() + 1));
            if(!this.isRedstonePowered && !this.isPulseMode) {
                this.doWork();
            }
        }
    }

    public void doWork() {
        if(itemsAbove.size() != 0) {
            for(EntityItem item : itemsAbove) {
                item.move(MoverType.PLAYER, this.pos.getX(),this.pos.getY()+1,this.pos.getZ());
                System.out.println(item.getPosition());
                System.out.println("Send Items!");
            }
        }else {
            return;
        }
    }

Relatively new to modding.

Currently developing:

https://github.com/LambdaXV/DynamicGenerators

Posted

Okay, can someone tell me why:

this.pos.getX() + "," + this.pos.getY()+5 + "," + this.pos.getZ()

 

and original pos being :

19,64,256

 

equals:

 

19,635,256

Do you know the definition of the word move? Look at the method you are using.

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Posted

Oh, yeah thought that would just move the entity to coords...

 

Sorry about that!

 

However, trying to use this:

                player.setLocationAndAngles(this.pos.getX(), this.pos.getY() + 5, this.pos.getZ(), player.cameraYaw, player.cameraPitch);

 

Doesn't seem to do it either :/

 

Wait I realized I change the subject, I'm trying to move the player right now.

Relatively new to modding.

Currently developing:

https://github.com/LambdaXV/DynamicGenerators

Posted

Oh, yeah thought that would just move the entity to coords...

 

Sorry about that!

 

However, trying to use this:

                player.setLocationAndAngles(this.pos.getX(), this.pos.getY() + 5, this.pos.getZ(), player.cameraYaw, player.cameraPitch);

 

Doesn't seem to do it either :/

 

Wait I realized I change the subject, I'm trying to move the player right now.

Look at the teleport command, you will need to do what it does to move the player.

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Posted

Jesus, the teleport command is so hard to recompile with all the unlabeled parameters.

 

However, I was able to dig this out of there:

                        ((EntityPlayerMP)entity).connection.setPlayerLocation(entity1.posX, entity1.posY, entity1.posZ, entity1.rotationYaw, entity1.rotationPitch);

 

Which seemed to work!

 

However, for some reason, my TEs now need a block update to start ticking again :/

 

Thanks for your help!

 

Relatively new to modding.

Currently developing:

https://github.com/LambdaXV/DynamicGenerators

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.