Jump to content

[1.10.2][SOLVED] Teleport to the players spawn point


MCrafterzz

Recommended Posts

  • Replies 77
  • Created
  • Last Reply

Top Posters In This Topic

So the way you have it set for the player will work however as far as I can tell onEntityCollidedWithBlock doesn't get called for Item Entities.

That is why...

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.

Link to comment
Share on other sites

Everything after the else crashes because you are trying to cast entityWhatever into EntityPlayerMP which is not always possible.

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.

Link to comment
Share on other sites

And how should I fix that?

You would need to scan manually like the hopper does.

Then find a way to set the location of the Entity.

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.

Link to comment
Share on other sites

Changed to:

@Override

public void onEntityCollidedWithBlock(World worldIn, BlockPos pos, IBlockState state, Entity entityIn) {

if (!worldIn.isRemote) {

entityIn.posX = worldIn.getSpawnPoint().getX();

entityIn.posY = worldIn.getSpawnPoint().getY();

entityIn.posZ = worldIn.getSpawnPoint().getZ();

entityIn.playSound(SoundEvents.ENTITY_ENDERPEARL_THROW, 0.5f, 0.5f);

worldIn.spawnParticle(EnumParticleTypes.PORTAL, entityIn.getPosition().getX(),

entityIn.getPosition().getY(), entityIn.getPosition().getZ(), 0, 0, 10, 0);

}

}

 

But it doesn't work :c It does the same as setLocationAndAngles that /tp uses but only setting the location

Link to comment
Share on other sites

TP Command:

p_189862_0_.setLocationAndAngles(p_189862_1_.getResult(), p_189862_2_.getResult(), p_189862_3_.getResult(), f2, f3);

 

public void setLocationAndAngles(double x, double y, double z, float yaw, float pitch)

    {

        this.posX = x;

        this.posY = y;

        this.posZ = z;

        this.prevPosX = this.posX;

        this.prevPosY = this.posY;

        this.prevPosZ = this.posZ;

        this.lastTickPosX = this.posX;

        this.lastTickPosY = this.posY;

        this.lastTickPosZ = this.posZ;

        this.rotationYaw = yaw;

        this.rotationPitch = pitch;

        this.setPosition(this.posX, this.posY, this.posZ);

    }

 

My code:

entityIn.posX = worldIn.getSpawnPoint().getX();

entityIn.posY = worldIn.getSpawnPoint().getY();

entityIn.posZ = worldIn.getSpawnPoint().getZ();

 

 

So what is the big difference!!! Can't you just send a example how it should be instead of saying to look on the /tp command all the time

Link to comment
Share on other sites

Updated code (that works):

@Override

public void onEntityCollidedWithBlock(World worldIn, BlockPos pos, IBlockState state, Entity entityIn) {

if (!worldIn.isRemote) {

float x = worldIn.getSpawnPoint().getX() + 0.5f;

float y = worldIn.getSpawnPoint().getY();

float z = worldIn.getSpawnPoint().getZ() + 0.5f;

entityIn.setPosition(x, y, z);

entityIn.playSound(SoundEvents.ENTITY_ENDERPEARL_THROW, 0.5f, 0.5f);

worldIn.spawnParticle(EnumParticleTypes.PORTAL, entityIn.getPosition().getX(),

entityIn.getPosition().getY(), entityIn.getPosition().getZ(), 0, 10, 0, 0);

}

}

 

But the particles doesn't spawn :c

Link to comment
Share on other sites

Did you put it before or after the if. it should be after if you want it to happen at the players new location.

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.

Link to comment
Share on other sites

After (I think):

@Override

public void onEntityCollidedWithBlock(World worldIn, BlockPos pos, IBlockState state, Entity entityIn) {

if (!worldIn.isRemote) {

float x = worldIn.getSpawnPoint().getX();

float y = worldIn.getSpawnPoint().getY();

float z = worldIn.getSpawnPoint().getZ();

if (entityIn instanceof EntityPlayerMP) {

EntityPlayerMP player = (EntityPlayerMP) entityIn;

BlockPos spawnPoint = player.getBedLocation(player.worldObj.provider.getDimension());

player.setPosition(spawnPoint.getX(), spawnPoint.getY(), spawnPoint.getZ());

} else {

entityIn.setPosition(x, y, z);

}

}

entityIn.playSound(SoundEvents.ENTITY_ENDERPEARL_THROW, 1, 1);

worldIn.spawnParticle(EnumParticleTypes.PORTAL, entityIn.getPosition().getX(), entityIn.getPosition().getY(),

entityIn.getPosition().getZ(), 0, 5, 0, 0);

worldIn.spawnParticle(EnumParticleTypes.PORTAL, entityIn.getPosition().getX() + 0.25f,

entityIn.getPosition().getY(), entityIn.getPosition().getZ(), 0, 5, 0, 0);

worldIn.spawnParticle(EnumParticleTypes.PORTAL, entityIn.getPosition().getX(), entityIn.getPosition().getY(),

entityIn.getPosition().getZ() + 0.25f, 0, 5, 0, 0);

worldIn.spawnParticle(EnumParticleTypes.PORTAL, entityIn.getPosition().getX() - 0.25,

entityIn.getPosition().getY(), entityIn.getPosition().getZ(), 0, 5, 0, 0);

worldIn.spawnParticle(EnumParticleTypes.PORTAL, entityIn.getPosition().getX(), entityIn.getPosition().getY(),

entityIn.getPosition().getZ() - 0.25f, 0, 5, 0, 0);

}

Link to comment
Share on other sites

something like this maybe?

 

@Override

  public void onEntityCollidedWithBlock(World worldIn, BlockPos pos, IBlockState state, Entity entityIn) {

      if (!worldIn.isRemote) {

        float x = worldIn.getSpawnPoint().getX();

        float y = worldIn.getSpawnPoint().getY();

        float z = worldIn.getSpawnPoint().getZ();

        if (entityIn instanceof EntityPlayerMP) {

            EntityPlayerMP player = (EntityPlayerMP) entityIn;

            BlockPos spawnPoint = player.getBedLocation(player.worldObj.provider.getDimension());

            player.setPosition(spawnPoint.getX(), spawnPoint.getY(), spawnPoint.getZ());

            entityIn.playSound(SoundEvents.ENTITY_ENDERPEARL_THROW, 1, 1);

      worldIn.spawnParticle(EnumParticleTypes.PORTAL, entityIn.getPosition().getX(), entityIn.getPosition().getY(),

            entityIn.getPosition().getZ(), 0, 5, 0, 0);

      worldIn.spawnParticle(EnumParticleTypes.PORTAL, entityIn.getPosition().getX() + 0.25f,

            entityIn.getPosition().getY(), entityIn.getPosition().getZ(), 0, 5, 0, 0);

      worldIn.spawnParticle(EnumParticleTypes.PORTAL, entityIn.getPosition().getX(), entityIn.getPosition().getY(),

            entityIn.getPosition().getZ() + 0.25f, 0, 5, 0, 0);

      worldIn.spawnParticle(EnumParticleTypes.PORTAL, entityIn.getPosition().getX() - 0.25,

            entityIn.getPosition().getY(), entityIn.getPosition().getZ(), 0, 5, 0, 0);

      worldIn.spawnParticle(EnumParticleTypes.PORTAL, entityIn.getPosition().getX(), entityIn.getPosition().getY(),

            entityIn.getPosition().getZ() - 0.25f, 0, 5, 0, 0);

  } else {

            entityIn.setPosition(x, y, z);

  entityIn.playSound(SoundEvents.ENTITY_ENDERPEARL_THROW, 1, 1);

      worldIn.spawnParticle(EnumParticleTypes.PORTAL, entityIn.getPosition().getX(), entityIn.getPosition().getY(),

            entityIn.getPosition().getZ(), 0, 5, 0, 0);

      worldIn.spawnParticle(EnumParticleTypes.PORTAL, entityIn.getPosition().getX() + 0.25f,

            entityIn.getPosition().getY(), entityIn.getPosition().getZ(), 0, 5, 0, 0);

      worldIn.spawnParticle(EnumParticleTypes.PORTAL, entityIn.getPosition().getX(), entityIn.getPosition().getY(),

            entityIn.getPosition().getZ() + 0.25f, 0, 5, 0, 0);

      worldIn.spawnParticle(EnumParticleTypes.PORTAL, entityIn.getPosition().getX() - 0.25,

            entityIn.getPosition().getY(), entityIn.getPosition().getZ(), 0, 5, 0, 0);

      worldIn.spawnParticle(EnumParticleTypes.PORTAL, entityIn.getPosition().getX(), entityIn.getPosition().getY(),

            entityIn.getPosition().getZ() - 0.25f, 0, 5, 0, 0);

         

}

      }

  }

 

and change all the getposition() with the respective spawnpoint (I don't have computer here, only copy and paste)

also, learn to use spoilers

Link to comment
Share on other sites

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




  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • Cairbos tempat daftar Akun pro Thailand merupakan id yang dirancang agar dalam bermain judi online di situs slot server Thailand gacor gampang menang.Akun pro server Thailand ini memiliki keunggulan yang bisa dinikmati oleh setiap pemain untuk bisa memudahkan dalam mendapatkan kemenangan jackpot bonus yang besar hingga perkalian yang tidak disangka-sangka dan belum pernah dirasakan sebelumnya. Pencarian Google.com Terkait Artikel Forums: akun pro thailand server pro thailand situs server thailand slot thailand bo server thailand  
    • Cairbet.net  List 10 Situs Togel Terpercaya Hadiah 4D 11Juta Legal Di Indonesia Halloo sobat pecinta situs togel online terbaik dan terpercaya di seluruh dunia, salam hangat dan salam sejahtera buat anda semua yang telah berkenan untuk berkunjung ke situs Bandar Togel Hadiah 4D 10 Juta Terpercaya dan Resmi ini. Semoga apa yang anda harapkan bisa segera anda dapatkan dengan bermain bersama kami di agen togel hadiah 4d 10 juta terpercaya ini. Pecinta Sobat Togel. Saat ini, kemajuan sedang dibuat. Ada banyak cara untuk mendapatkan uang secara instan dan mudah. Salah satunya adalah dengan bermain togel online. Hanya dengan bermain togel di situs bandar togel terpercaya hadiah terbesar. Untuk menemukan situs bandar togel hadiah 4d 10 juta terpercaya 2023 pasti sangat sulit. Karena itulah kami menyediakan Daftar Bandar Togel Terpercaya di Indonesia yang tujuannya untuk memudahkan para togelers agar bisa memilih 5 bandar togel terpercaya tentunya sudah banyak bettor yang bergabung di situs toto togel terbesar tersebut. List Nama Pasaran Togel Terpercaya WLA Terlengkap 2023 Dari 5 agen togel terbaik ini kami merekomendasikan situs togel toto resmi sebagai bandar togel hadiah 4d 10 juta terpercaya dan terbesar di Indonesia. Dari sekian banyak pasaran togel internasional pada bidang bandar situs togel terbesar dan slot hadiah terbesar atau situs resmi pasang togel di Asia tentunya kita tidak akan mampu memainkan semuanya. Itulah alasannya mengapa bettor lovers harus memainkan permainan togel online setelah melalui proses penyertaan Daftar 5 Situs Bandar Togel Terpercaya terlebih dahulu. Pada web agen togel terpercaya, tentunya Daftar 5 Situs Togel Terbesar selalu menyajikan nama nama 5 pasaran togel WLA terbaik di bandar togel pasaran WLA terbanyak 2023 yang memberikan pengeluaran tercepat. Termasuk dalam daftar 5 bandar togel terpercaya yang memiliki lisensi resmi Pagcor dan diakui di Indonesia. Situs bandar togel hadiah 4d 3d 2d terpercaya dengan Prize 123 hadiah terbesar juga memiliki jenis pasaran yang sangat lengkap, berikut jenis pasaran resminya : Situs Togel Terpercaya Hongkong Pools Situs Togel Terpercaya Pools Singapura Situs Togel Terpercaya Sydney Pools Situs Togel Terpercaya Taiwan Pools Situs TogeL Toto Macau IDN Cara Daftar Akun di Situs Bandar Togel Hadiah 4D 11 Juta Terpercaya Online 24 Jam 1. Pastikan Anda berusia di atas 18 tahun 2. Kunjungi situs 5 Bandar Togel Terpercaya 3. Klik tombol Daftar/Daftar 4. Isi Data Pribadi Anda dengan baik dan benar 5. Isikan nama pengguna akun 6. Isikan password sesuai selera anda 7. Masukkan email yang aktif 24 jam 8. Masukkan nomor ponsel yang dapat dihubungi 9. Pilih jenis pembayaran (Bank Lokal atau E-wallet) 10. Isi nama akun 11. Masukkan nomor akun Anda 12. Selesai. Sebelum mendaftar. Pastikan jaringan internet yang anda gunakan cepat dan tentunya stabil. Karena untuk bermain togel online. Anda harus memiliki koneksi yang baik untuk bermain atau mendaftar akun togel di Daftar Bandar Togel Terpercaya. Oleh karena itu kami merekomendasikan untuk menggunakan koneksi Wi-Fi saat bermain togel online di Situs Bandar Togel Hadiah 10 Juta 4 Hari Terbesar.   Pencarian Di google.co.id: situs togel terpercaya togel online bo togel terpercaya bandar togel online togel 4d 11jt
    • CAIRBOS adalah website game cuan terlengkap dengan fitu free spinner high rtp, dapatkan banyak bonus dengan daftar dan top up sekarang juga di ASIATOGEL88 tempat link alternatif untuk login cairbos.
    • ➢Product Name — Jungle Beast Pro ➢Main Benefits — Improvement strength and performance Loss Fat Weight Enhance the size and length of the private part Better Mood Enhance Metabolism More Mental Focus ➢ Composition — Natural Organic Compound ➢ Side-Effects—NA ➢ Rating: —⭐⭐⭐⭐⭐ ➢ Availability — Online ➢ Where to Buy - Click Here to Rush Your Order from the Official Website   Jungle Beast Pro:- The complement’s specific mixture of substances works synergistically to support the dilation of blood vessels, allowing a extra volume of blood to circulate the penile chambers. This elevated blood go with the flow facilitates to engorge the penile tissues, resulting in a extra full-size and fully erect penis.   Official Website:- http://worldtrade24x7.com/JungleBeastPro   FACEBOOK PAGES:- https://www.facebook.com/JungleBeastProReviews/ https://www.facebook.com/JungleBeastProPrice/   Watch:- https://youtu.be/y45UUAFKZqw   Official Blogs:- https://groups.google.com/g/mozilla.dev.platform/c/qRDiPfC269s/m/ij5_Tcw5AwAJ https://groups.google.com/g/comp.os.vms/c/J2Y5kQkgRzA/m/X8XI9Zd5AwAJ https://groups.google.com/g/hr.rec.bicikli/c/Y3RKMunPBsk/m/bwXTqebHAAAJ https://groups.google.com/g/comp.os.vms/c/5rCRH0b8KL8/m/DWMLCp58AwAJ https://groups.google.com/g/mozilla.dev.platform/c/fSMJFLMuhpI/m/9zAFJ-M8AwAJ https://groups.google.com/a/chromium.org/g/chromium-reviews/c/7Rfc0A5lBAg/m/VlcHRh1dAgAJ https://groups.google.com/g/hr.rec.bicikli/c/BAffTJP4hXA/m/hG7p743PAAAJ https://groups.google.com/g/mozilla.dev.platform/c/hMYVFPHTTNo/m/gPQUcmZCAwAJ https://sites.google.com/view/jungle-beast-pro-buy/ https://worldtrade24x7.blogspot.com/2023/12/Jungle-Beast-Pro.html https://official-jungle-beast-pro.company.site/ https://junglebeastproprice.godaddysites.com/ https://jungle-b-e-a-s-t-pro-cost.jimdosite.com/ https://j-u-n-g-l-e-beast-pro.jimdosite.com/ https://gamma.app/public/Jungle-Beast-Pro-USA-UK-AU-Reviews-l2ooy5p5zngpl33?mode=doc https://gamma.app/public/Jungle-Beast-Pro-Reviews-Does-It-Work-What-They-Wont-Say-Before-B-3v7zhfwlrmruk0d?mode=doc https://caramellaapp.com/junglebeastproreviews/GPEjewN7G/jungle-beast-pro https://sketchfab.com/3d-models/jungle-beast-pro-reviews-usa-buy-cd7c5be3b1ca4de498c94a5f2aaf2ab6 https://devfolio.co/projects/jungle-beast-pro-reviews-benefits-and-buy-6458 https://www.sunflower-cissp.com/glossary/cissp/6998/jungle-beast-pro-unleashed-insider-tips-and-tricks
    • Philomath University, Kuje, Abuja ,Direct Entry 2023/(2024 Admission form/Post Utme Is Out ☎️080-398-16237 Or 08039816237 Admin office On How To Purchase The Form And Register Online Before The Closing Date ☎️O8039816237 to apply, Pre-Degree/Remedial/Part-time form call O8O36640134 The University Direct Entry form/Jupeb Form/Ijmb Form/ Form For 2023/2024 is out 08039816237 (0)8O3–981–6237 For Inquiry on how to apply and Process Admission
  • Topics

×
×
  • Create New...

Important Information

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