Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

[1.11] Getting Parameter From Recipe Exception.

Featured Replies

  • Author

Thanks.. However now if the entity isnt there it seems to crash, even though I try to put countless null checks.. here is the error:

Time: 12/18/16 10:46 PM
Description: Ticking block entity

java.lang.NullPointerException: Ticking block entity
at com.lambda.plentifulmisc.tile.magic.TileEntitySacrificeStand.updateEntity(TileEntitySacrificeStand.java:93)
at com.lambda.plentifulmisc.tile.TileEntityBase.update(TileEntityBase.java:184)
at net.minecraft.world.World.updateEntities(World.java:1968)
at net.minecraft.world.WorldServer.updateEntities(WorldServer.java:646)
at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:794)
at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:698)
at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:156)
at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:547)
at java.lang.Thread.run(Thread.java:745)


A detailed walkthrough of the error, its code path and all known details is as follows:
---------------------------------------------------------------------------------------

-- Head --
Thread: Client thread
Stacktrace:
at com.lambda.plentifulmisc.tile.magic.TileEntitySacrificeStand.updateEntity(TileEntitySacrificeStand.java:93)
at com.lambda.plentifulmisc.tile.TileEntityBase.update(TileEntityBase.java:184)

 

@

                                    if (StandRecipeHandler.sacrifice.isInstance(entityLivingBases.get(i))) {

 

Here is the entire updated te..

  if (recipe.isSacrifice) {
                        List<EntityLivingBase> entityLivingBases = this.worldObj.getEntitiesWithinAABB(EntityLivingBase.class, new AxisAlignedBB(this.getPos().getX() - 3, this.getPos().getY() - 3, this.getPos().getY() - 3, this.getPos().getX() + 3, this.getPos().getY() + 3, this.getPos().getZ() + 3));
                        for (int i = 0; i < entityLivingBases.size(); i++) {
                            if (entityLivingBases.get(i) != null) {
                                if (modifierStands != null) {
                                    if (StandRecipeHandler.sacrifice.isInstance(entityLivingBases.get(i))) {
                                        this.recipeForRenderIndex = PlentifulMiscAPI.STAND_RECIPES.indexOf(recipe);
                                        this.processTime++;
                                        boolean done = this.processTime >= recipe.time;

                                        EntityLivingBase entityNear = entityLivingBases.get(i);

                                        //So it cannot be killed / moved during the sacrifice.
                                        entityNear.setHealth(9999f);

                                        for (TileEntityDisplayStand stand : modifierStands) {

                                            if (done) {
                                                stand.slots.decrStackSize(0, 1);
                                            }
                                        }

                                        if (this.processTime % 5 == 0 && this.worldObj instanceof WorldServer) {
                                            boolean almostDone = this.processTime + 40 >= recipe.time;
                                            if (!almostDone) {
                                                ((WorldServer) this.worldObj).spawnParticle(EnumParticleTypes.PORTAL, false, this.pos.getX() + .5, this.pos.getY() + 1, this.pos.getZ() + .5, 10, 0, 0, 0, 0.5D);
                                            }
                                        }

                                        ((WorldServer) this.worldObj).spawnParticle(EnumParticleTypes.CRIT_MAGIC, false, entityNear.posX, entityNear.posY, entityNear.posZ, 10, 0, 0, 0, 10D);


                                        if (lineMode) {
                                            this.drawDamageLaser(this.pos.getX() - 6.5, this.pos.getY() + .75, this.pos.getZ() + 6.5, this.pos.getX() + 6.5, this.pos.getY() + .75, this.pos.getZ() + 6.5, new float[]{0f / 255f, 50f / 255f, 255f / 255f});
                                            this.drawDamageLaser(this.pos.getX() - 6.5, this.pos.getY() + .75, this.pos.getZ() + 6.5, this.pos.getX() - 6.5, this.pos.getY() + .75, this.pos.getZ() - 6.5, new float[]{0f / 255f, 50f / 255f, 255f / 255f});
                                            this.drawDamageLaser(this.pos.getX() + 6.5, this.pos.getY() + .75, this.pos.getZ() - 6.5, this.pos.getX() + 6.5, this.pos.getY() + .75, this.pos.getZ() + 6.5, new float[]{0f / 255f, 50f / 255f, 255f / 255f});
                                            this.drawDamageLaser(this.pos.getX() - 6.5, this.pos.getY() + .75, this.pos.getZ() - 6.5, this.pos.getX() + 6.5, this.pos.getY() + .75, this.pos.getZ() - 6.5, new float[]{0f / 255f, 50f / 255f, 255f / 255f});
                                        }

                                        if (done) {
                                            ((WorldServer) this.worldObj).spawnParticle(EnumParticleTypes.FIREWORKS_SPARK, false, this.pos.getX() + 0.5, this.pos.getY() + 1.1, this.pos.getZ() + 0.5, 100, 0, 0, 0, 0.25D);

                                            //ensure the sacrifice dies.
                                            entityNear.setHealth(0.1f);

                                            entityNear.attackEntityFrom(DamageSource.lightningBolt, 10f);
                                            this.worldObj.spawnEntityInWorld(new EntityLightningBolt(this.worldObj, entityNear.getPosition().getX(), entityNear.getPosition().getY(), entityNear.getPosition().getZ(), false));
                                            this.worldObj.spawnEntityInWorld(new EntityLightningBolt(this.worldObj, this.pos.getX(), this.pos.getY(), this.pos.getZ(), false));

                                            this.slots.setStackInSlot(0, recipe.output.copy());
                                            this.markDirty();

                                            this.processTime = 0;
                                            this.recipeForRenderIndex = -1;
                                        }

                                        break;
                                    } else {
                                        this.processTime = 0;
                                        this.recipeForRenderIndex = -1;
                                    }
                                }
                            }
                        }
                    }

 

Thanks..

Relatively new to modding.

Currently developing:

https://github.com/LambdaXV/DynamicGenerators

What is recipe.isSacrifice and what if recipe.sacrifice is null? And instead of getting and checking instances, why not just do

World.getEntitiesWithinAABB(recipe.sacrifice, aabb); 
//aabb should just be a variable instead of a new one everytime. Which you would initialize in the onLoad (I believe that is the name)method.

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.

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...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.