Jump to content

Make a block only collidable for a specific entity


MosquitoFRA

Recommended Posts

In fact, I'm not used to this method. I found an example:

public void addCollisionBoxToList(IBlockState state, World worldIn, BlockPos pos, AxisAlignedBB entityBox, List<AxisAlignedBB> collidingBoxes, @Nullable Entity entityIn) {
        super.addCollisionBoxToList(pos, entityBox, collidingBoxes, under);

        super.addCollisionBoxToList(pos, entityBox, collidingBoxes, middle);

        super.addCollisionBoxToList(pos, entityBox, collidingBoxes, top);
    }

 

So what do I have to do with these information?

Link to comment
Share on other sites

public void addCollisionBoxToList(IBlockState state, World worldIn, BlockPos pos, AxisAlignedBB entityBox, List<AxisAlignedBB> collidingBoxes, @Nullable Entity entityIn)

     if(entity.projectiles)

    {   super.addCollisionBoxToList(pos, entityBox, collidingBoxes, under);

        super.addCollisionBoxToList(pos, entityBox, collidingBoxes, middle);

        super.addCollisionBoxToList(pos, entityBox, collidingBoxes, top);
    }

Is it like this?

Link to comment
Share on other sites

For the entity, it's entityLiving (I think it's for projectiles).
And I don't know to do this null check

     { if(EntityLiving)

        super.addCollisionBoxToList(pos, entityBox, collidingBoxes, under);

        super.addCollisionBoxToList(pos, entityBox, collidingBoxes, middle);

        super.addCollisionBoxToList(pos, entityBox, collidingBoxes, top);
    }

 

Edited by MosquitoFRA
Link to comment
Share on other sites

What diesieben was trying to say is that you should learn how to check if an entity is of a given instance or has some particular properties defined in the entity class. I'm pretty sure that the entity class itself has no "projectiles" property, and even if it does i don't think it's a boolean by the name. That being said, you should do something like this (assuming you are using Forge 1.12.2)

 

@Override
public void addCollisionBoxToList(IBlockState state, World worldIn, BlockPos pos, AxisAlignedBB entityBox, List<AxisAlignedBB> collidingBoxes, Entity entityIn, boolean isActualState) {
  if(entityIn instanceof EntityPlayer) {
    // Do stuff
  }
}

 

In this case you check if the entity that collides with the block is a player. If so then you can do whatever you want (like adding the collision box). 

Don't blame me if i always ask for your help. I just want to learn to be better :)

Link to comment
Share on other sites

On 11/4/2018 at 5:29 PM, JimiIT92 said:

...


@Override
public void addCollisionBoxToList(IBlockState state, World worldIn, BlockPos pos, AxisAlignedBB entityBox, List<AxisAlignedBB> collidingBoxes, Entity entityIn, boolean isActualState) {
  if(entityIn instanceof EntityPlayer) {
    // Do stuff
  }
}

...

And now you've just give him the code which he can copy-paste without learning anything from it.

Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support.

 

1.12 -> 1.13 primer by williewillus.

 

1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support.

 

http://www.howoldisminecraft1710.today/

Link to comment
Share on other sites

@Override
          public void addCollisionBoxToList(IBlockState state, World worldIn, BlockPos pos, AxisAlignedBB entityBox, List<AxisAlignedBB> collidingBoxes, Entity entityIn, boolean isActualState) {
               if(entityIn instanceof EntityPlayer) {
                         public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) {
               return new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 1.0D, 1.0D);
                    }
               }
          }

I have this but it doesn't work

Edited by MosquitoFRA
Link to comment
Share on other sites

Learn java. Just the basics, 5 minutes of learning java and you will understand how horribly wrong that is on every level

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.github.io/tutorials

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

Link to comment
Share on other sites

@Override
          public void addCollisionBoxToList(IBlockState state, World worldIn, BlockPos pos, AxisAlignedBB entityBox, List<AxisAlignedBB> collidingBoxes, Entity entityIn, boolean isActualState) {
               if(entityIn instanceof EntityPlayer) {
                         getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) {
               return new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 1.0D, 1.0D);
                    }
               }
          }

I tried this but it didn't work

Link to comment
Share on other sites

Learn Java.

Learn Java.

Learn Java.

 

Learn Java.

Edited by larsgerrits

Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support.

 

1.12 -> 1.13 primer by williewillus.

 

1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support.

 

http://www.howoldisminecraft1710.today/

Link to comment
Share on other sites

Ok, do you know what a method is?

right now your trying to define a method inside another method. This will never* work. I see you tried to fix your issue by removing “public AxisAlignedBB”, but your still trying to define a method inside a method, you’ve just now mangled the inner method. What you need to do where your trying to define the second (where your sure the entity is a player) method is run some code adding custom bounding boxes (look at fences), and otherwise (if the entity is not a player) call super (or run other logic).

 

 

*unless your instantiating an anonymous class (which you won’t learn about for a long time and may never need)

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.github.io/tutorials

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

Link to comment
Share on other sites

This has been said before “these formums are not a java tutorial”. Feel free to pm me on Discord (Cadiboo#8887) if you want help with this though

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.github.io/tutorials

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

Link to comment
Share on other sites

Sorry, but I don't have Discord.

          @Override
          class collisionBox {
               public AxisAlignedBB addCollisionBoxToList(IBlockState state, World worldIn, BlockPos pos, AxisAlignedBB entityBox, List<AxisAlignedBB> collidingBoxes, Entity entityIn, boolean isActualState) {
                    if(entityIn instanceof EntityPlayer) {
                         class boundingBox {
                              void getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) {
                                   return super.AxisAlignedBB[](0.0D, 0.0D, 0.0D, 1.0D, 1.0D, 1.0D);
                              }
                         } 
                    }
               }
          }

I tried to correct the code as best as I could and search again on Google, but I can't figure it out.

Link to comment
Share on other sites

56 minutes ago, MosquitoFRA said:

Sorry, but I don't have Discord.


          @Override
          class collisionBox {
               public AxisAlignedBB addCollisionBoxToList(IBlockState state, World worldIn, BlockPos pos, AxisAlignedBB entityBox, List<AxisAlignedBB> collidingBoxes, Entity entityIn, boolean isActualState) {
                    if(entityIn instanceof EntityPlayer) {
                         class boundingBox {
                              void getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) {
                                   return super.AxisAlignedBB[](0.0D, 0.0D, 0.0D, 1.0D, 1.0D, 1.0D);
                              }
                         } 
                    }
               }
          }

I tried to correct the code as best as I could and search again on Google, but I can't figure it out.

Please, just go learn Java first. You have absolutely no idea what you are doing. That code won't even compile your IDE should be yelling its head off at you. 

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

1 hour ago, Animefan8888 said:

go learn Java

 

On 11/6/2018 at 12:54 PM, Cadiboo said:

these formums are not a java tutorial

As I said though you can pm me for some help

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.github.io/tutorials

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

Link to comment
Share on other sites

I recommended discord because it

- doesn’t have a 1 minute delay between messages

- is something pretty much every gamer/programmer has

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.github.io/tutorials

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

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

    • 🤑DAFTAR & LOGIN🤑 🤑DAFTAR & LOGIN🤑 🤑DAFTAR & LOGIN🤑   Daftar Slot Asusslot adalah bocoran slot rekomendasi gacor dari Asusslot yang bisa anda temukan di SLOT Asusslot. Situs SLOT Asusslot hari ini yang kami bagikan di sini adalah yang terbaik dan bersiaplah untuk mengalami sensasi tak terlupakan dalam permainan slot online. Temukan game SLOT Asusslot terbaik dengan 100 pilihan provider ternama yang dipercaya akan memberikan kepuasan dan kemenangan hari ini untuk meraih x500. RTP SLOT Asusslot merupakan SLOT Asusslot hari ini yang telah menjadi pilihan utama bagi pemain judi online di seluruh Indonesia. Setiap harinya jutaan pemain memasuki dunia maya untuk memperoleh hiburan seru dan kemenangan besar dalam bermain slot dengan adanya bocoran RTP SLOT Asusslot. Tidak ada yang lebih menyenangkan daripada mengungguli mesin slot dan meraih jackpot x500 yang menggiurkan di situs SLOT Asusslot hari ini yang telah disediakan SLOT Asusslot. Menangkan jackpot besar x500 rajanya maxwin dari segala slot dan raih kemenangan spektakuler di situs Asusslot terbaik 2024 adalah tempat yang menyediakan mesin slot dengan peluang kemenangan lebih tinggi daripada situs slot lainnya. Bagi anda yang mencari pengalaman judi slot paling seru dan mendebarkan, situs bo SLOT Asusslot terbaik 2024 adalah pilihan yang tepat. Jelajahi dunia slot online melalui situs SLOT Asusslot di link SLOT Asusslot.
    • 🤑DAFTAR & LOGIN🤑 🤑DAFTAR & LOGIN🤑 🤑DAFTAR & LOGIN🤑 Daftar Slot Galeri555 adalah bocoran slot rekomendasi gacor dari Galeri555 yang bisa anda temukan di SLOT Galeri555. Situs SLOT Galeri555 hari ini yang kami bagikan di sini adalah yang terbaik dan bersiaplah untuk mengalami sensasi tak terlupakan dalam permainan slot online. Temukan game SLOT Galeri555 terbaik dengan 100 pilihan provider ternama yang dipercaya akan memberikan kepuasan dan kemenangan hari ini untuk meraih x500. RTP SLOT Galeri555 merupakan SLOT Galeri555 hari ini yang telah menjadi pilihan utama bagi pemain judi online di seluruh Indonesia. Setiap harinya jutaan pemain memasuki dunia maya untuk memperoleh hiburan seru dan kemenangan besar dalam bermain slot dengan adanya bocoran RTP SLOT Galeri555. Tidak ada yang lebih menyenangkan daripada mengungguli mesin slot dan meraih jackpot x500 yang menggiurkan di situs SLOT Galeri555 hari ini yang telah disediakan SLOT Galeri555. Menangkan jackpot besar x500 rajanya maxwin dari segala slot dan raih kemenangan spektakuler di situs Galeri555 terbaik 2024 adalah tempat yang menyediakan mesin slot dengan peluang kemenangan lebih tinggi daripada situs slot lainnya. Bagi anda yang mencari pengalaman judi slot paling seru dan mendebarkan, situs bo SLOT Galeri555 terbaik 2024 adalah pilihan yang tepat. Jelajahi dunia slot online melalui situs SLOT Galeri555 di link SLOT Galeri555.
    • 🤑DAFTAR & LOGIN🤑 🤑DAFTAR & LOGIN🤑 🤑DAFTAR & LOGIN🤑 Daftar Slot Kocok303 adalah bocoran slot rekomendasi gacor dari Kocok303 yang bisa anda temukan di SLOT Kocok303. Situs SLOT Kocok303 hari ini yang kami bagikan di sini adalah yang terbaik dan bersiaplah untuk mengalami sensasi tak terlupakan dalam permainan slot online. Temukan game SLOT Kocok303 terbaik dengan 100 pilihan provider ternama yang dipercaya akan memberikan kepuasan dan kemenangan hari ini untuk meraih x500. RTP SLOT Kocok303 merupakan SLOT Kocok303 hari ini yang telah menjadi pilihan utama bagi pemain judi online di seluruh Indonesia. Setiap harinya jutaan pemain memasuki dunia maya untuk memperoleh hiburan seru dan kemenangan besar dalam bermain slot dengan adanya bocoran RTP SLOT Kocok303. Tidak ada yang lebih menyenangkan daripada mengungguli mesin slot dan meraih jackpot x500 yang menggiurkan di situs SLOT Kocok303 hari ini yang telah disediakan SLOT Kocok303. Menangkan jackpot besar x500 rajanya maxwin dari segala slot dan raih kemenangan spektakuler di situs Kocok303 terbaik 2024 adalah tempat yang menyediakan mesin slot dengan peluang kemenangan lebih tinggi daripada situs slot lainnya. Bagi anda yang mencari pengalaman judi slot paling seru dan mendebarkan, situs bo SLOT Kocok303 terbaik 2024 adalah pilihan yang tepat. Jelajahi dunia slot online melalui situs SLOT Kocok303 di link SLOT Kocok303.
    • 🤑DAFTAR & LOGIN🤑 🤑DAFTAR & LOGIN🤑 🤑DAFTAR & LOGIN🤑 Slot Aster88 adalah bocoran slot rekomendasi gacor dari Aster88 yang bisa anda temukan di SLOT Aster88. Situs SLOT Aster88 hari ini yang kami bagikan di sini adalah yang terbaik dan bersiaplah untuk mengalami sensasi tak terlupakan dalam permainan slot online. Temukan game SLOT Aster88 terbaik dengan 100 pilihan provider ternama yang dipercaya akan memberikan kepuasan dan kemenangan hari ini untuk meraih x500. RTP SLOT Aster88 merupakan SLOT Aster88 hari ini yang telah menjadi pilihan utama bagi pemain judi online di seluruh Indonesia. Setiap harinya jutaan pemain memasuki dunia maya untuk memperoleh hiburan seru dan kemenangan besar dalam bermain slot dengan adanya bocoran RTP SLOT Aster88. Tidak ada yang lebih menyenangkan daripada mengungguli mesin slot dan meraih jackpot x500 yang menggiurkan di situs SLOT Aster88 hari ini yang telah disediakan SLOT Aster88. Menangkan jackpot besar x500 rajanya maxwin dari segala slot dan raih kemenangan spektakuler di situs Aster88 terbaik 2024 adalah tempat yang menyediakan mesin slot dengan peluang kemenangan lebih tinggi daripada situs slot lainnya. Bagi anda yang mencari pengalaman judi slot paling seru dan mendebarkan, situs bo SLOT Aster88 terbaik 2024 adalah pilihan yang tepat. Jelajahi dunia slot online melalui situs SLOT Aster88 di link SLOT Aster88.
    • 🚀Link Daftar Klik Disini🚀 Tips Bermain Slot Bank Jago agar Meraih Maxwin dan Jackpot di MAXWINBET77 Bermain slot online Bank jago adalah cara yang seru dan mengasyikkan untuk mencari keuntungan besar di MAXWINBET77. Jika kamu ingin meningkatkan peluangmu untuk meraih maxwin dan jackpot secara terus-menerus, ada beberapa tips dan strategi yang bisa kamu terapkan. Berikut adalah panduan lengkapnya: Pilih Slot dengan RTP Tinggi: RTP (Return to Player) adalah persentase rata-rata dari total taruhan yang dikembalikan kepada pemain sebagai kemenangan. Pilihlah mesin slot Bank jago yang memiliki RTP tinggi, karena ini meningkatkan peluangmu untuk meraih kemenangan dalam jangka panjang. Kenali Fitur Bonus: Setiap slot Bank jago memiliki fitur bonus yang berbeda, seperti putaran gratis, simbol liar (wild), dan bonus game. Pelajari dengan baik fitur-fitur ini karena mereka dapat membantu meningkatkan peluang meraih kemenangan besar. Kelola Taruhan dengan Bijak: Tentukan batasan taruhan yang sesuai dengan budget dan jangan tergoda untuk bertaruh melebihi kemampuan finansialmu. Terapkan strategi taruhan yang bijak untuk memaksimalkan penggunaan saldo. Mainkan Slot Bank jago Progresif: Jika tujuanmu adalah meraih jackpot besar, coba mainkan slot Bank jago progresif di MAXWINBET77. Jackpot pada jenis slot Bank ini terus bertambah seiring dengan taruhan pemain lainnya, sehingga dapat mencapai jumlah yang sangat besar. Manfaatkan Promosi dan Bonus: MAXWINBET77 sering kali menawarkan promosi dan bonus kepada pemainnya. Manfaatkan bonus-bonus ini untuk meningkatkan peluangmu meraih kemenangan tanpa menggunakan modal tambahan. Berkonsentrasi dan Bersabar: Fokuslah saat bermain slot bank jago dan jangan terburu-buru. Bersabarlah meskipun tidak langsung mendapatkan hasil yang diharapkan. Kadang-kadang diperlukan waktu dan keberuntungan untuk mencapai maxwin atau jackpot. Baca Aturan Permainan: Sebelum bermain, pastikan untuk membaca aturan dan pembayaran pada slot Bank Jago yang dipilih. Mengetahui cara kerja mesin slot akan membantu mengoptimalkan strategi bermainmu. Dengan menerapkan tips-tips di atas dan tetap bermain secara bertanggung jawab, kamu dapat meningkatkan peluang meraih maxwin dan jackpot di Slot Bank Jago MAXWINBET77. Selamat bermain dan semoga sukses meraih kemenangan besar Anda Hari Ini.
  • Topics

×
×
  • Create New...

Important Information

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