Jump to content

Game Crash from Apple Drop - 1.12.2


UM3 F0R TH3 W1N

Recommended Posts

I have recently been working on having my custom apple drop from oak trees and dark oak trees, however as I was testing it the game crashed, here's the crash log: https://hastebin.com/xifabokeci.sql.

Here's ApplesFromLeavesEvent.java: https://hastebin.com/alipepoqok.java.

If you need any other classes tell me.

Thanks for the help in advance!

 

Link to comment
Share on other sites

im currently testing this code here:

if(event.getState().getBlock() == Blocks.LEAVES.getDefaultState().withProperty(BlockOldLeaf.VARIANT, BlockPlanks.EnumType.OAK))
        {
            event.getDrops().add(new ItemStack(ItemInit.GREEN_APPLE));
            event.setDropChance(0.05f);
        }
        
        else if(event.getState().getBlock() == Blocks.LEAVES2.getDefaultState().withProperty(BlockNewLeaf.VARIANT, BlockPlanks.EnumType.DARK_OAK))
        {
            event.getDrops().add(new ItemStack(ItemInit.GREEN_APPLE));
            event.setDropChance(0.05f);
        }

Link to comment
Share on other sites

HarvestDropsEvent can be called for any block in the game, 99% of which won't have the BlockOldLeaf.VARIANT property in their block state. As you've seen, calling IBlockState#getValue with an invalid property throws an exception.

 

You need to check the Block itself first, use IBlockState#getBlock to get it and then check that it's equal to Blocks.LEAVES/Blocks.LEAVES2.

 

16 minutes ago, UM3 F0R TH3 W1N said:

if(event.getState().getBlock() == Blocks.LEAVES.getDefaultState().withProperty(BlockOldLeaf.VARIANT, BlockPlanks.EnumType.OAK))

IBlockState#getBlock returns a Block, which will never be equal to an IBlockState. You need to check the Block and the properties in two separate expressions within the if condition.

 

Edit: It looks like @diesieben07 already explained most of this in your previous threads. Please stop creating new threads for the same topic.

Edited by Choonster

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

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

    • Crypto Recovery Expert with Trustwizardhackworld Trustwizards Hackworld is Russia American Millennial Finance and Crypto Recovery Expert® and America’s Student School upgrade and Mobile spy™, and the founder of The Trustwizards Hackworld Crypto Recovery, a personal finance and recovery web-site dedicated to helping individuals and businesses escape from online investment and crypto perils and to start legitimate investing and building wealth for the future. You can learn more about him on the About Page, or on his personal web-site Trustwizardhackworld {.} com . He has been quoted in major publications including the New York Times, Washington Post, Fox, ABC, NBC, and more. He is also a regular contributor to Forbes. and Google search for Trustwizards Hackworld online for comments and reviews. I wholeheartedly recommend to anyone in need of digital asset recovery services. Their demonstrated ability to overcome seemingly impossible challenges, coupled with their unwavering commitment to their clients, makes them a trusted and reliable partner in the realm of digital asset recovery.
    • I tried this version, but it solved a part of my problem, there are still mods with this bug.    
    • I finally got to the server but when i got loaded in the game crashed https://pastebin.com/ADqmtkfR
    • Hi! I'm following Kaupenjoe's guide and making an entity, and I get a problem where two animations mix into one when my entity walks - idle  anim plays together with walking. As I'm pretty new into coding and modding, I don't know everything about what I do following his guide and I'd like to set up animations in specific way: 1. When entity is doing nothing, idle animation plays; 2. When entity is walking, only walk animation is playing Here's the code for this entity's animations, it only has 2 at the moment. What should I fix here to get the result I need? public final AnimationState idleAnimationState = new AnimationState(); private int idleAnimationTimeout = 0; @Override public void tick() { super.tick(); if(this.level().isClientSide()){ setupAnimationStates(); } } private void setupAnimationStates() { if(this.idleAnimationTimeout <= 0) { this.idleAnimationTimeout = this.random.nextInt(40) + 80; this.idleAnimationState.start(this.tickCount); } else { --this.idleAnimationTimeout; } } @Override protected void updateWalkAnimation(float pPartialTick) { float f; if(this.getPose() == Pose.STANDING) { f = Math.min(pPartialTick * 6F, 1f); } else { f = 0f; } this.walkAnimation.update(f, 0.2f); } Hopefully I got into right forum topic, I'm not very used to forum posting xDD  
    • DAFTAR WSOSLOT88 KLIK DISINI ATAU KETIK GOOGLE >> WSOSLOT88.COM       Slot Freebet Terbaru tanpa deposit dan tanpa syarat telah mengubah paradigma perjudian daring dengan memberikan kesempatan yang luar biasa bagi para pemain untuk menikmati permainan Slot tanpa tekanan finansial atau kendala persyaratan. Ini adalah langkah revolusioner dalam industri perjudian online yang mengutamakan pengalaman pemain. Dengan menawarkan kesempatan untuk mencoba berbagai permainan dan peluang menang tanpa modal, Slot freebet ini menjadi pilihan yang sangat menarik bagi para pecinta Slot di seluruh dunia. Jadi, jangan lewatkan kesempatan emas ini untuk merasakan sensasi keseruan permainan Slot tanpa harus membayar sepeser pun! Keyword terkait : Slot Freebet Slot Freebet Tanpa Deposit Slot Freebet Tanpa Syarat Slot Freebet Terbaru Slot Freebet Gratis Slot Freebet Tanpa Deposit 2024 Slot Freebet Tanpa Deposit Tanpa Syarat 2024 Slot Freebet 15k Tanpa Deposit Tanpa Syarat 2024 Slot Freebet 25k Tanpa Deposit Tanpa Syarat 2024 Slot Freebet 50k Tanpa Deposit Tanpa Syarat
  • Topics

×
×
  • Create New...

Important Information

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