Lambda Posted December 23, 2016 Posted December 23, 2016 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; } } Quote Relatively new to modding. Currently developing: https://github.com/LambdaXV/DynamicGenerators
Lambda Posted December 23, 2016 Author Posted December 23, 2016 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 Quote Relatively new to modding. Currently developing: https://github.com/LambdaXV/DynamicGenerators
Animefan8888 Posted December 23, 2016 Posted December 23, 2016 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. Quote 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.
Lambda Posted December 24, 2016 Author Posted December 24, 2016 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. Quote Relatively new to modding. Currently developing: https://github.com/LambdaXV/DynamicGenerators
Animefan8888 Posted December 24, 2016 Posted December 24, 2016 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. Quote 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.
Lambda Posted December 24, 2016 Author Posted December 24, 2016 I was able to find EntityLivingBase#attemptTeleport , however it seems to send me to the corner of the block, not up. player.attemptTeleport(this.pos.getX(), this.pos.getY() + 5, this.pos.getZ()); Quote Relatively new to modding. Currently developing: https://github.com/LambdaXV/DynamicGenerators
Lambda Posted December 24, 2016 Author Posted December 24, 2016 okay, will repilcate it however, I'm still having an issue with the realitive positioning.. orginal coords 19,64,256 plus: this.pos.getX(), this.pos.getY()+5d, this.pos.getZ() equals: 20,635.0,256 This is where I'm confused though. Quote Relatively new to modding. Currently developing: https://github.com/LambdaXV/DynamicGenerators
Lambda Posted December 24, 2016 Author Posted December 24, 2016 just println... edit: System.out.println(this.pos.getX() + "," + this.pos.getY()+5d + "," + this.pos.getZ()); Quote Relatively new to modding. Currently developing: https://github.com/LambdaXV/DynamicGenerators
Lambda Posted December 24, 2016 Author Posted December 24, 2016 Oh, I am stupid.. Yeah your right, I was adding them in the println.. Now to try to teleport entities. Quote Relatively new to modding. Currently developing: https://github.com/LambdaXV/DynamicGenerators
Lambda Posted December 24, 2016 Author Posted December 24, 2016 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! Quote Relatively new to modding. Currently developing: https://github.com/LambdaXV/DynamicGenerators
Recommended Posts
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.