Jump to content

GUI Phantom Item, GUI Shift-Click and TileEntity Redstone Strength


ss7

Recommended Posts

Hello,

 

I've got 3 problems.

 

1. I've got my GUI working, but when i try to decrease the stack size of a slot in a method, it decreases it, but leaves a phantom item when i open the GUI and when i take out the item and right click with it it's gone. It tried running onInventoryChanged(), but that doesn't worked.

 

2. I returned in the method getInventoryStackLimit the value 15, and i can only put 15 items in the slot and get the rest back, but when i shift-click the itemstack in it just deletes the rest.

 

3. I would like to know how to get the strength of the redstone signal on the sides of a block with a TileEntity. I tried onNeighbourBlockChange() at my Block class, and setting the variable redstonestrenght at the TileEntity to par1World.getBlockPowerInput(par2, par3, par4). But when i have 2 blocks and power 1 block the other gets also powered

 

I know that's a LOT of questions, but i'm new to Forge Modding, and have done some Bukkit Plugin Modding before.

 

ss7

You sir are a god damn hero.

Link to comment
Share on other sites

I'm not sure about #3, but here are my thoughts on the other two.

 

1. I'm fairly certain that is a server-client issue, as in the client says you have a different amount of items than the server says you have. It's some sort of de-sync issue that could be attributed to a lot of different things. Just go into the debugging tool and work your way through it as it's running on the client, then the server, and see where they start to disagree.

 

2. Override the transferStackInSlot method and make sure it will only try to transfer 15, or however many makes 15, at a time to a single slot and leave the rest. I'm not really sure why it would be deleting it, because the default minecraft code will only transfer up to the slot limit and leave the rest.

 

 

Link to comment
Share on other sites

Hello,

 

Thank you for your answer!

 

To #2:

 

I copied the code from the ContainerFurnace, but that also removes the stack. And when i don't override that method i get an error, because the javadoc says: Called when a player shift-clicks on a slot. You must override this or you will crash when someone does that.

 

ss7

You sir are a god damn hero.

Link to comment
Share on other sites

#3:

Make sure you variable isn't static, that you change the value on server side, and save the value within NBT.

 

Hello,

 

You are AWESOME, yes my variable was public ans static and now the wireless crazy redstone problem is solved! But when i try to place 2 bridges and power them at once, no bridge extends. And what do you mean with server side? With packets?

 

ss7

You sir are a god damn hero.

Link to comment
Share on other sites

Hello,

 

I've tried it with if (world.isRemote == false)

                            {

                                tileentity.redstonestrength = world.getBlockPowerInput(par2, par3, par4);

                            }

 

but that doesn't seem to work. When i place 2 bridgeblocks i can't power them at once ):.

 

ss7

You sir are a god damn hero.

Link to comment
Share on other sites

Redstone will trigger neighbour block change only if its power has changed.

Nothing happens until the neighbouring redstone receive power.

 

In a more detailed sequence:

-first redstone powered (tick 0)

-first redstone triggers neighbour block change

-second redstone receives neighbour block change

-second redstone powered (tick 1)

-second redstone triggers neighbour block change

...

-last redstone powered (tick n)

-last redstone triggers neighbour block change

-your block is powered (tick n+1)

 

To power two blocks simultaneously, you need to take the delay into account.

Unless you make the first block wait for the second to be powered, or you don't need them activated at the exact same time.

Link to comment
Share on other sites

boolean RemoveBlockValid(int x, int y, int z)
        {
                if (worldObj.getBlockId(x, y, z) == Block.cobblestone.blockID)

You are only removing cobblestone blocks here.

 

You are using nextplaceblock and nextplaceblock as field, but they are not reset to false on each update tick of your entity.

This means the tile entity will try to place or remove blocks, whether there are unmovable blocks or not within the line. ( if you have a gold block in your cobblestone line to remove, it will not be removed, but all others will, which looks kinda strange for a bridge)

@Override
        public void updateEntity()
        {
                ticks++;
               
                if (ticks == 20)
                {
                        ticks = 0;
                       
                        //ModLoader.getMinecraftInstance().thePlayer.addChatMessage(blockspushed + "/" + redstonestrength);
                       
                if (blockspushed < redstonestrength)
                {                      
                            switch(worldObj.getBlockMetadata(xCoord, yCoord, zCoord))
                            {
                       
                            case 1:
                                nextplaceblock = PlaceBlockValid(xCoord, yCoord, zCoord - blockspushed);
                            break;
                               
                            case 2:
                                    nextplaceblock = PlaceBlockValid(xCoord, yCoord, zCoord + blockspushed);
                            break;
                               
                            case 3:
                                    nextplaceblock = PlaceBlockValid(xCoord - blockspushed, yCoord, zCoord);
                            break;
                       
                            case 4:
                                    nextplaceblock = PlaceBlockValid(xCoord + blockspushed, yCoord, zCoord);
                            break;
                       
                            }  
                       
                            if (nextplaceblock)
                            {
                                blockspushed++;
                            }
                }
               
                else
                {
                        switch(worldObj.getBlockMetadata(xCoord, yCoord, zCoord))
                        {
                       
                        case 1:
                                nextremoveblock = RemoveBlockValid(xCoord, yCoord, zCoord + blockspushed);
                        break;
                               
                        case 2:
                                nextremoveblock = RemoveBlockValid(xCoord, yCoord, zCoord - blockspushed);
                        break;
                               
                        case 3:
                                nextremoveblock = RemoveBlockValid(xCoord - blockspushed, yCoord, zCoord);
                        break;
                       
                        case 4:
                                nextremoveblock = RemoveBlockValid(xCoord + blockspushed, yCoord, zCoord);
                        break;
                       
                        }

                        if (nextremoveblock)
                        {
                                blockspushed--;
                        }
                }
                }
        }

The blocks will also start being removed as soon as blockspushed == redstonestrength. You should probably make this a case where things are stable.

Link to comment
Share on other sites

Hello,

 

That with the cobblestone is for testing purposes only, cause i don't no how to a ItemBlock or a ItemStack to a Block.

 

Reset, do you mean this:

 

nextplaceblock = false;
         nextremoveblock = false;

 

I tried everything for the blockspushed == redstonestrength, e.g. i checked if blockspushed != 2, but that doesn't worked.

 

And after the one blocks removed, no other blocks get removed  :'(

 

ss7

 

 

You sir are a god damn hero.

Link to comment
Share on other sites

@Override
        public void updateEntity()
        {
                ticks++;
               
                if (ticks == 20)
                {
                        ticks = 0;
                       
                        //ModLoader.getMinecraftInstance().thePlayer.addChatMessage(blockspushed + "/" + redstonestrength);
                 
                if (blockspushed < redstonestrength)
                {                      
                            switch(worldObj.getBlockMetadata(xCoord, yCoord, zCoord))
                            {
                       
                            case 1:
                                nextplaceblock = PlaceBlockValid(xCoord, yCoord, zCoord - blockspushed);
                            break;
                               
                            case 2:
                                    nextplaceblock = PlaceBlockValid(xCoord, yCoord, zCoord + blockspushed);
                            break;
                               
                            case 3:
                                    nextplaceblock = PlaceBlockValid(xCoord - blockspushed, yCoord, zCoord);
                            break;
                       
                            case 4:
                                    nextplaceblock = PlaceBlockValid(xCoord + blockspushed, yCoord, zCoord);
                            break;
                       
                            }  
                       
                            if (nextplaceblock)
                            {
                                blockspushed++;
                                nextplaceblock=false;
                            }
                }
                else if(blockspushed > redstonestrength)
                {
                        switch(worldObj.getBlockMetadata(xCoord, yCoord, zCoord))
                        {
                       
                        case 1:
                                nextremoveblock = RemoveBlockValid(xCoord, yCoord, zCoord + blockspushed);
                        break;
                               
                        case 2:
                                nextremoveblock = RemoveBlockValid(xCoord, yCoord, zCoord - blockspushed);
                        break;
                               
                        case 3:
                                nextremoveblock = RemoveBlockValid(xCoord - blockspushed, yCoord, zCoord);
                        break;
                       
                        case 4:
                                nextremoveblock = RemoveBlockValid(xCoord + blockspushed, yCoord, zCoord);
                        break;
                       
                        }

                        if (nextremoveblock)
                        {
                                blockspushed--;
                                nextremoveblock = false;
                        }
                }
                }
        }

Something like this.

Link to comment
Share on other sites

Hello,

 

I've tried your code but that doesn't worked. On the x axis the block is still being removed, on the z axis not. And it looks like the block is being removed, but on the client side, because i can't walk into it. Also the bridge doesn't remove. Even with the else if. I've tried printing the blockspushed and the redstonestrength into the chat, but at the end it's 15/0 so it should do it. And it prints it twice in the chat, the second is 0/0 at the x axis, and 1/0 at the z axis. That's also weird.

 

ss7

You sir are a god damn hero.

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

    • LINK DAFTAR : KLIK DISINI LINK DAFTAR : KLIK DISINI   Slot SHOPEEPAY adalah situs slot deposit SHOPEEPAY Ribu paling gacor di indonesia pada tahun 2023. Situs slot SHOPEEPAY kini menyediakan layanan deposit pakai aplikasi shopee yang amat gacor sampai detik ini. MAXWINBET77 Situs slot SHOPEEPAY saat ini menggunakan layanan deposit dari e-wallet shopee adalah alat pembayaran dempet digital lewat SHOPEEPAY. Slot SHOPEEPAY saat ini menjadi situs slot ternama dengan banyak nya keunggulan di dalam situs slot SHOPEEPAY ini. Slot deposit SHOPEEPAY hadir untuk menyedia kan sarana deposit paling termurah di indonesia. Deposit slot SHOPEEPAY hanya dengan modal 5000 Ribu saja kamu sudah bisa mainkan semua jenis game yang ada di dalam situs slot SHOPEEPAY Ribu seperti gates of olympus, mahjong ways 2, Legacy of Kong Maxways dan Koi Gate yang saat ini banyak sekali di cari orang karna tingkatan kemenangan nya paling besar dan mudah jackpot. TRIK DAN TRIK BERMAIN PALING JITU / SLOT DEPOSIT SHOPEEPAY Pilih Game Slot Gacor Yang Sesuai Dengan Preferensi Dan Anggaran Anda Ada banyak tipe game slot gacor yang bisa Anda pilih, mulai dari yang bertema klasik, petualangan, mitologi, sampai film. Pilihlah game slot gacor yang menarik bagi anda dan cocok dengan volatilitas dan RTP yang anda inginkan. Volatilitas yakni tingkat risiko dan varians dalam permainan, sedangkan RTP yakni prosentase pengembalian kepada pemain. Pilihlah game slot gacor dengan volatilitas dan RTP yang pantas dengan anggaran dan tujuan anda. Manajemen Bankroll Yang Baik Bankroll ialah jumlah uang yang Anda siapkan untuk bermain slot gacor. Penting bagi anda untuk mengelola bankroll anda dengan bagus supaya tidak kehabisan uang atau terjebak dalam kecanduan judi. Tentukan jumlah maksimal yang mau anda pertaruhkan per sesi, per hari, atau per minggu, dan jangan melebihi batas tersebut. Juga, tentukan jumlah kemenangan yang mau anda capai atau jumlah kerugian yang bisa anda terima, dan stop bermain dikala mencapai salah satu dari keduanya. Manfaatkan Bonus Dan Promosi Situs slot gacor Neobank menawarkan bonus dan promosi menarik kepada para pemainnya, seperti bonus new member, bonus deposit, bonus cashback, bonus referral, bonus turnover, jackpot progresif, turnamen, freebet, dan lainnya. Manfaatkan bonus dan promosi ini untuk meningkatkan modal dan peluang kemenangan anda. Tetapi, pastikan juga untuk membaca syarat dan ketentuan yang berlaku agar tidak terjebak dalam prasyarat taruhan atau batasan penarikan yang tidak menguntungkan. Pelajari Paytable Dan Fitur Game Sebelum bermain slot gacor Neobank, pastikan Anda mempelajari paytable dan fitur game. Paytable yaitu tabel yang menonjolkan skor masing masing simbol dan kombinasi kemenangan dalam game. Fitur game yaitu fitur tambahan yang bisa meningkatkan kesempatan kemenangan Anda, seperti wild, scatter, cuma cuma spins, bonus games, multiplier, dsb. Dengan mempelajari paytable dan fitur game, Anda bisa mengenal simbol mana yang semestinya Anda targetkan ketika bermain.
    • Link Daftar : KLIK DISINI  Link Login : KLIK DISINI  Link RTP   : KLIK DISINI  Link Gacor Slot Dana   : KLIK DISINI slot deposit dana 5000 ribu via dana adalah permainan slot dana gacor dengan menyediakan slot server thailand deposit dana. dan slot deposit dana adalah slot terbesar di thailand. anda cukup daftar disini dan mainkan disini slot deposit 5000 ribu via dana sudah dipastikan dengan deposit dana akan membuat akun anda menjadi akun special. situs deposit dana adalah situs yang terpercaya dan terakurat. Slot dana merupakan situs slot deposit dana yang sangat trending dan sangat dikenal luas di masyarakat. dengan adanya MAXWINBET77 anda bisa mendapatkan keuntungan besar setiap hari tanpa adanya potongan  yang pastinya menguntungkan bagi anda. situs slot dana  maxwinbet77 adalah situs slot dana terbaik 2024 dan dijamin mudah maxwin. PERMAINAN YANG ADA DI SLOT DANA MAXWINBET77: - TOGEL 4D - SLOT ONLINE - LIVE CASINO - SPORTSBOOK - ARCADE TEMBAK IKAN - SABUNG AYAM Saat Ini Slot Dana Maxwinbet77 Menyediakan Bonus Berupa : - Bonus New Member - Bonus Deposit Harian - Bonus Cashback - Bonus 2D TERBALIK - Bonus Prize 2 & Prize 3 - Bonus Refferal DAFATR DISINI
    • LINK DAFTAR : KLIK DISINI LINK DAFTAR : KLIK DISINI   Slot seabank meruapakan salah satu situs slot paling gacor deposit seabank 100% mudah maxwin, hari ini situs slot seabank meghadirkan permainan slot dengan kemudahan bergabung hanya dengan menggunakan aplikasi Seabank langsung bisa join dengan bandar slot Seabank terbaik dan terpercaya no.1 di indonesia. Slot Seabank resmi di daftar situs slot deposit pakai Seabank 5000 Gampang Maxwin dimana aplikasi Seabank tersebut telah sanggat membantu para bosku untuk bermain slot online deposit via Seabank saat ini slot Seabank ini membantu dalam mempermudah transaksi disaat bosku ingin deposit melakukan pembayaran. kini orang orang ingin bermian judi online khusus nya games slot tidak perlu khawatir lagi apabila tidak memilikui saldo di ATM, sebab dengan adanya aplikasi Seabank sudah memberikan dampak signifikan buat perjudian di indonesia. Selain slot pakai Seabank, terdapat beberapa aplikasi e-wallet yang dapat di gunakan untuk bertansaksi antara lain, slot deposit 5000 Seabank, slot dana, slot ovo, slot pulsa tanpa potongan, dan slot shopeepay mudah menang bisa bosku pakai untuk setoran Seabank resmi terbaru. intinya slot online deposit Seabank memberikan jamianan kemudahan saat main games slot gacor uang asli terbaik di indonesia bos.
    • LINK DAFTAR : KLIK DISINI LINK DAFTAR : KLIK DISINI   Slot deposit bank bsi merupakan salah satu situs slot gacor deposit bank bsi 24 jam mudah maxwin tanpa batas. hari ini slot deposit bank bsi menawarkan bonus terbesar untuk player yang sudah bergabung di situs slot bank bsi ini, dengan ada nya slot bank bsi sanget mempermudah player untuk melakukan transaksi deposit dengan bank bsi. Sebagai Situs Slot Deposit Bank Bsi meyediakan banyak permainan seperti slot online, live casino, sabung ayam, tembak ikan, sportbook semua game tersebuat sangat aman dan terpercaya. Beramin slot bank bsi sangat mudah hanya dengan niminal deposit 5000 ribu saja anda sudah bisa bermain di semua game yang sudah di sediakan oleh situs slot bank bsi. Slot bank bsi adalah saranan untuk Pemain yang mencari pengalaman bermain slot gacor sekarang dapat menemukan metode pembayaran beragam di berbagai situs slot gacor yang tersebar luas di seluruh negeri. Munculnya situs Slot Bank BSI, kini para pemain dapat menikmati kemudahan dan kenyamanan dalam melakukan transaksi pembayaran. Bahkan memungkinkan pemain untuk fokus sepenuhnya pada permainan yang mereka nikmati sepanjang waktu. Ini adalah langkah penting dalam memperluas aksesibilitas judi slot online di Indonesia dan memberikan pengalaman bermain yang lebih baik kepada para pecinta slot gacor.    
    • Sometimes love could be the worst experience. you get to love and trust your partner only to feel regret over it. i have been married for 7 years now and i found some sudden change in my partner attitude, i tried talking about it but he complains i'm nagging a lot . i tried to ignore his attitude but it became unbearable so i was advised to hire a hacker to help me gain access to his phone so i had know if he is cheating or not so i was introduced to [ Remote spy hacker @ g m ail . c o m ] and this expert helped me gain access to his phone without his notice. i got to see his messages, photos, call recordings and many more . Now i can see his cheating and that's the reason for the attitude all along.
  • Topics

×
×
  • Create New...

Important Information

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