Jump to content

[1.14.2] Custom Scaffolding


Yamahari

Recommended Posts

Hi, I made a custom scaffolding block and a corresponding item class that you can have a look at here:

https://github.com/Yamahari/ILikeWood/blob/master/src/main/java/yamahari/ilikewood/blocks/WoodenScaffoldingBlock.java

https://github.com/Yamahari/ILikeWood/blob/master/src/main/java/yamahari/ilikewood/items/WoodenScaffoldingItem.java

 

My issue is the following: https://imgur.com/jdwOKtN

Basically when I try to place a scaffolding block that is not of the same wood type as the block I aimed at, the autostacking feature doesn't work. I tracked it down to the following issue: When I use the "appropiate" scaffolding the "getBlockItemUseContext" method of my custom item is called with a BlockItemUseContext that has the position of the scaffolding block I aimed at. But if I use another wood type the function gets called with a context that contains the block that is one block off in the direction of the face I was aiming at, e.g. in the video that's an air block. This causes my "instanceof" checks in the "getBlockItemUseContext" method to fail. But I can't figure out why it's not passing the scaffolding block position in the context when it's a different wood type. Does BlockItem somehow change the logic of chosing the forwarded block position depending on whether or not the used item corresponds to the block that was registered to the BlockItem? 

Unbenannt.png

Unbenannt2.png

Edited by Yamahari
Link to comment
Share on other sites

https://github.com/Yamahari/ILikeWood/blob/master/src/main/java/yamahari/ilikewood/items/WoodenScaffoldingItem.java#L28

 

Oh geezus effing christ. If you're going to copy-paste vanilla code at least refactor all of the local variables so the code is fucking legible.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

  • Thanks 1

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

Omg this actually fixed it, thanks! ( You have no idea how hard I tried to fix this, I think I lost 50% of my hair :D )

@Override
    public boolean isReplaceable(BlockState blockStateIn, BlockItemUseContext blockItemUseContextIn) {
        //return blockItemUseContextIn.getItem().getItem() == this.asItem();
        for(Block block : Constants.SCAFFOLDINGS) {
            if(blockItemUseContextIn.getItem().getItem() == Item.getItemFromBlock(block)) return true;
        }
        return false;
    }

My question now is, why did this fix this, I don't get it :D

Link to comment
Share on other sites

I already explained why. The item instances are different. 

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

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

    • Ngamenslot adalah pilihan terbaik bagi Anda yang mencari situs terpercaya untuk bermain slot dan taruhan bola. Berikut adalah beberapa alasan mengapa Anda harus memilih Ngamenslot: Kombinasi Slot & Bola Kami menyajikan kombinasi terbaik antara permainan slot yang seru dan taruhan bola yang menegangkan. Dengan pilihan permainan yang beragam, setiap pemain dapat menikmati pengalaman bermain yang unik dan menyenangkan. Transaksi Mudah melalui Bank Ekonomi Kami menyediakan layanan transaksi yang mudah dan aman melalui Bank Ekonomi. Dengan dukungan dari sistem pembayaran yang terpercaya, Anda dapat melakukan deposit dan penarikan dana dengan cepat dan tanpa hambatan. Terpercaya dan Terjamin Ngamenslot telah terbukti sebagai situs terpercaya dengan ribuan pemain yang puas. Kami mengutamakan keamanan dan kenyamanan para pemain, sehingga Anda dapat bermain dengan tenang dan fokus pada permainan.  
    • Tambang88 adalah pilihan terbaik bagi Anda yang mencari pengalaman bermain slot gacor dengan transaksi mudah menggunakan Bank Sinarmas. Berikut adalah beberapa alasan mengapa Anda harus memilih Tambang88: Raja Slot Gacor Kami merupakan raja slot gacor dengan koleksi permainan terbaik yang menawarkan kesenangan bermain dan peluang kemenangan besar. Dengan fitur-fitur unggulan dan tema-tema menarik, setiap putaran permainan akan memberikan Anda pengalaman yang tak terlupakan. Transaksi Mudah dengan Bank Sinarmas Kami menyediakan layanan transaksi mudah melalui Bank Sinarmas untuk kenyamanan dan keamanan Anda. Dengan proses yang cepat dan efisien, Anda dapat melakukan deposit dan penarikan dana dengan lancar dan tanpa hambatan. Profesional dan Menguntungkan Tambang88 mengutamakan profesionalitas dalam memberikan layanan kepada para pemainnya. Kami juga menawarkan kesempatan untuk meraih keuntungan yang besar dengan jackpot dan hadiah-hadiah menarik lainnya.    
    • TRIK POLA SL0T GAC0R MAHJONG WAYS 1 DAN 2 HARI INI Sekarang Anda dapat meningkatkan peluang Bermain dengan langsung menggunakan situs resmi dari permainan Mahjong (PG SOFT). Cukup daftar dan siapkan hanya mulai dari 50K hingga 200K, Anda sudah memiliki peluang untuk memenangkan hadiah besar. Jika tidak memiliki dana sebanyak itu, Anda dapat mencoba dengan dana 50K dan memanfaatkan bonus member baru untuk menambah modal. Berikut adalah Situs Resmi Mahjong yang dapat Anda kunjungi: >> SITUS RESMI MAHJONG YANG TERBUKTI << >> SITUS RESMI MAHJONG YANG TERBUKTI << Setelah mendaftar, Anda dapat menggunakan pola yang sering saya gunakan: 🔥 25 Manual TURBO OFF 🔥 15 Manual TURBO ON 🔥 30 Auto TURBO OFF 🔥 10 Manual TURBO ON Pola ini biasanya memberikan hasil yang konsisten.
    • OLO4D adalah pilihan terbaik bagi Anda yang mencari pengalaman bermain slot gacor dengan transaksi mudah menggunakan Bank Bukopin. Berikut adalah beberapa alasan mengapa Anda harus memilih OLO4D: Slot Gacor Terbaik Kami menyajikan koleksi slot gacor terbaik yang menawarkan kesenangan bermain dan peluang kemenangan besar. Dengan fitur-fitur unggulan dan tema-tema menarik, setiap putaran permainan akan memberikan Anda pengalaman yang tak terlupakan. Transaksi Mudah dengan Bank Bukopin Kami menyediakan layanan transaksi mudah melalui Bank Bukopin untuk kenyamanan dan keamanan Anda. Dengan proses yang cepat dan efisien, Anda dapat melakukan deposit dan penarikan dana dengan lancar dan tanpa hambatan. Pasti Jackpot OLO4D memberikan jaminan bahwa setiap pemain pasti mendapatkan jackpot. Dengan peluang kemenangan yang tinggi, setiap putaran permainan bisa menjadi peluang untuk meraih keberuntungan besar.  
    • Balon168: Gampang Banjir Scatter Hitam Malam Ini Balon168 telah menjadi sorotan dalam dunia perjudian online, dan ada alasan kuat mengapa pemain semakin tertarik. Salah satu permainan unggulannya, yang dikenal dengan tingkat kemenangan yang tinggi, adalah varian "Gampang Banjir Scatter Hitam Malam Ini". Mari kita selami lebih dalam mengenai fenomena ini. Balon168: Destinasi Utama bagi Pecinta Slot     DAFTAR SEKARANG LINK VIP MAXWIN  
  • Topics

×
×
  • Create New...

Important Information

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