Jump to content

Recommended Posts

Posted

whenever i spawn the entity it crashes the client, then when i restart it entity is in world where it should be like nothing happened, any idea why its crashing?

 

if(!worldObj.isRemote) {

		            Entity spawn = null;

	                spawn = Ref.altarlisttier1(this.display);
	                spawn.setWorld(worldObj);

	                EntityLiving entityliving = spawn instanceof EntityLiving ? (EntityLiving)spawn : null;
                    spawn.setLocationAndAngles(pos.getX(), pos.getY()+1.25f, pos.getZ(), worldObj.rand.nextFloat() * 360.0F, 0.0F);


                        AnvilChunkLoader.spawnEntity(spawn, worldObj);
                        worldObj.playEvent(2004, pos, 0);

                        if (entityliving != null)
                        {
                            entityliving.spawnExplosionParticle();
                        }
		        }

 

Description: Ticking entity

java.lang.NullPointerException: Ticking entity
at net.minecraft.entity.ai.EntityAITasks.onUpdateTasks(EntityAITasks.java:64)
at net.minecraft.entity.EntityLiving.updateEntityActionState(EntityLiving.java:846)
at net.minecraft.entity.EntityLivingBase.onLivingUpdate(EntityLivingBase.java:2392)
at net.minecraft.entity.EntityLiving.onLivingUpdate(EntityLiving.java:643)
at net.minecraft.entity.EntityAgeable.onLivingUpdate(EntityAgeable.java:178)
at net.minecraft.entity.passive.EntityAnimal.onLivingUpdate(EntityAnimal.java:47)
at net.minecraft.entity.EntityLivingBase.onUpdate(EntityLivingBase.java:2218)
at net.minecraft.entity.EntityLiving.onUpdate(EntityLiving.java:342)
at net.minecraft.world.World.updateEntityWithOptionalForce(World.java:2106)
at net.minecraft.world.WorldServer.updateEntityWithOptionalForce(WorldServer.java:872)
at net.minecraft.world.World.updateEntity(World.java:2073)
at net.minecraft.world.World.updateEntities(World.java:1886)
at net.minecraft.world.WorldServer.updateEntities(WorldServer.java:644)
at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:783)
at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:687)
at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:156)
at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:536)
at java.lang.Thread.run(Unknown Source)


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

-- Head --
Thread: Client thread
Stacktrace:
at net.minecraft.entity.ai.EntityAITasks.onUpdateTasks(EntityAITasks.java:64)
at net.minecraft.entity.EntityLiving.updateEntityActionState(EntityLiving.java:846)
at net.minecraft.entity.EntityLivingBase.onLivingUpdate(EntityLivingBase.java:2392)
at net.minecraft.entity.EntityLiving.onLivingUpdate(EntityLiving.java:643)
at net.minecraft.entity.EntityAgeable.onLivingUpdate(EntityAgeable.java:178)
at net.minecraft.entity.passive.EntityAnimal.onLivingUpdate(EntityAnimal.java:47)
at net.minecraft.entity.EntityLivingBase.onUpdate(EntityLivingBase.java:2218)
at net.minecraft.entity.EntityLiving.onUpdate(EntityLiving.java:342)
at net.minecraft.world.World.updateEntityWithOptionalForce(World.java:2106)
at net.minecraft.world.WorldServer.updateEntityWithOptionalForce(WorldServer.java:872)
at net.minecraft.world.World.updateEntity(World.java:2073)

-- Entity being ticked --
Details:
Entity Type: rv.voidbeast (com.ravvoid.entity.mob.EntityVoidBeast)
Entity ID: 0
Entity Name: Void Beast
Entity's Exact location: 237.00, 70.25, 303.00
Entity's Block location: World: (237,70,303), Chunk: (at 13,4,15 in 14,18; contains blocks 224,0,288 to 239,255,303), Region: (0,0; contains chunks 0,0 to 31,31, blocks 0,0,0 to 511,255,511)
Entity's Momentum: 0.00, 0.00, 0.00
Entity's Passengers: []
Entity's Vehicle: ~~ERROR~~ NullPointerException: null
Stacktrace:
at net.minecraft.world.World.updateEntities(World.java:1886)
at net.minecraft.world.WorldServer.updateEntities(WorldServer.java:644)

-- Affected level --
Details:
Level name: New World
All players: 1 total; [EntityPlayerMP['Player368'/314, l='New World', x=231.35, y=69.00, z=301.42]]
Chunk stats: ServerChunkCache: 639 Drop: 0
Level seed: 9049979599259575510
Level generator: ID 00 - default, ver 1. Features enabled: true
Level generator options: 
Level spawn location: World: (256,64,256), Chunk: (at 0,4,0 in 16,16; contains blocks 256,0,256 to 271,255,271), Region: (0,0; contains chunks 0,0 to 31,31, blocks 0,0,0 to 511,255,511)
Level time: 12466 game time, 12466 day time
Level dimension: 0
Level storage version: 0x04ABD - Anvil
Level weather: Rain time: 87931 (now: false), thunder time: 115727 (now: false)
Level game mode: Game mode: creative (ID 1). Hardcore: false. Cheats: true
Stacktrace:
at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:783)
at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:687)
at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:156)
at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:536)
at java.lang.Thread.run(Unknown Source)

-- System Details --
Details:
Minecraft Version: 1.10.2
Operating System: Windows 10 (amd64) version 10.0
Java Version: 1.8.0_91, Oracle Corporation
Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation
Memory: 456852240 bytes (435 MB) / 1038876672 bytes (990 MB) up to 1038876672 bytes (990 MB)
JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M
IntCache: cache: 0, tcache: 0, allocated: 12, tallocated: 94
FML: MCP 9.32 Powered by Forge 12.18.1.2011 4 mods loaded, 4 mods active
States: 'U' = Unloaded 'L' = Loaded 'C' = Constructed 'H' = Pre-initialized 'I' = Initialized 'J' = Post-initialized 'A' = Available 'D' = Disabled 'E' = Errored
UCHIJAAAA	mcp{9.19} [Minecraft Coder Pack] (minecraft.jar) 
UCHIJAAAA	FML{8.0.99.99} [Forge Mod Loader] (forgeSrc-1.10.2-12.18.1.2011.jar) 
UCHIJAAAA	Forge{12.18.1.2011} [Minecraft Forge] (forgeSrc-1.10.2-12.18.1.2011.jar) 
UCHIJAAAA	rv{1.10.2} [Ravenous Void] (bin) 
Loaded coremods (and transformers): 
GL info: ~~ERROR~~ RuntimeException: No OpenGL context found in the current thread.
Profiler Position: N/A (disabled)
Player Count: 1 / 8; [EntityPlayerMP['Player368'/314, l='New World', x=231.35, y=69.00, z=301.42]]
Type: Integrated Server (map_client.txt)
Is Modded: Definitely; Client brand changed to 'fml,forge'

 

https://github.com/Zerahi/RavenousVoid/blob/master/src/main/java/com/ravvoid/tileentity/TileEntityAltar.java

Posted

For one you are spawning the entity even if it is null.

 

	                EntityLiving entityliving = spawn instanceof EntityLiving ? (EntityLiving)spawn : null;
                    spawn.setLocationAndAngles(pos.getX(), pos.getY()+1.25f, pos.getZ(), worldObj.rand.nextFloat() * 360.0F, 0.0F);


                        AnvilChunkLoader.spawnEntity(spawn, worldObj);

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.

Posted

its not null ever its only triggered if the Ref.altarlisttier1(this.display) != null;

and mob spawns fine from a spawn egg no crash

 

package com.ravvoid.entity.mob;

import com.google.common.base.Predicate;
import com.ravvoid.Ref;

import javax.annotation.Nullable;
import net.minecraft.block.Block;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityAgeable;
import net.minecraft.entity.EntityCreature;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.IEntityLivingData;
import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.entity.ai.EntityAIAttackMelee;
import net.minecraft.entity.ai.EntityAIFollowParent;
import net.minecraft.entity.ai.EntityAIHurtByTarget;
import net.minecraft.entity.ai.EntityAILookIdle;
import net.minecraft.entity.ai.EntityAINearestAttackableTarget;
import net.minecraft.entity.ai.EntityAIPanic;
import net.minecraft.entity.ai.EntityAISwimming;
import net.minecraft.entity.ai.EntityAIWander;
import net.minecraft.entity.ai.EntityAIWatchClosest;
import net.minecraft.entity.ai.attributes.AttributeModifier;
import net.minecraft.entity.passive.EntityAnimal;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.SoundEvents;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.datasync.DataParameter;
import net.minecraft.network.datasync.DataSerializers;
import net.minecraft.network.datasync.EntityDataManager;
import net.minecraft.util.DamageSource;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.SoundEvent;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.MathHelper;
import net.minecraft.world.DifficultyInstance;
import net.minecraft.world.World;
import net.minecraft.world.storage.loot.LootTableList;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;

public class EntityVoidBeast extends EntityAnimal
{

    public EntityVoidBeast(World world)
    {
        super(world);
        this.setSize(0.9F, 1.1F);
    }

    /**
     * Checks if the parameter is an item which this animal can be fed to breed it (wheat, carrots or seeds depending on
     * the animal type)
     */
    public boolean isBreedingItem(ItemStack stack)
    {
        return false;
    }

    protected void initEntityAI()
    {
        super.initEntityAI();
        this.tasks.addTask(0, new EntityAISwimming(this));
        this.tasks.addTask(1, new EntityAIAttackMelee(this, 1.0D, false));
        this.tasks.addTask(2, new EntityAIWander(this, 1.0D));
        this.tasks.addTask(3, new EntityAIWatchClosest(this, EntityPlayer.class, 6.0F));
        this.tasks.addTask(4, new EntityAILookIdle(this));
        this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityPlayer.class, true));
    }

    protected void applyEntityAttributes()
    {
        super.applyEntityAttributes();
        this.getEntityAttribute(SharedMonsterAttributes.MAX_HEALTH).setBaseValue(15.0D);
        this.getEntityAttribute(SharedMonsterAttributes.FOLLOW_RANGE).setBaseValue(20.0D);
        this.getEntityAttribute(SharedMonsterAttributes.MOVEMENT_SPEED).setBaseValue(0.25D);
        this.getAttributeMap().registerAttribute(SharedMonsterAttributes.ATTACK_DAMAGE);
        this.getEntityAttribute(SharedMonsterAttributes.ATTACK_DAMAGE).setBaseValue(3.0D);
    }

    protected SoundEvent getAmbientSound()
    {
        return SoundEvents.field_190026_er;
    }

    protected SoundEvent getHurtSound()
    {
        return SoundEvents.field_190029_eu;
    }

    protected SoundEvent getDeathSound()
    {
        return SoundEvents.field_190028_et;
    }

    protected void playStepSound(BlockPos pos, Block blockIn)
    {
        this.playSound(SoundEvents.field_190030_ev, 0.15F, 1.0F);
    }


    @Nullable
    protected ResourceLocation getLootTable()
    {
        return Ref.VOIDBEAST;
    }

    /**
     * (abstract) Protected helper method to read subclass entity data from NBT.
     */
    public void readEntityFromNBT(NBTTagCompound compound)
    {
        super.readEntityFromNBT(compound);
    }

    /**
     * (abstract) Protected helper method to write subclass entity data to NBT.
     */
    public void writeEntityToNBT(NBTTagCompound compound)
    {
        super.writeEntityToNBT(compound);
    }


    public boolean attackEntityAsMob(Entity entityIn)
    {
        boolean flag = entityIn.attackEntityFrom(DamageSource.causeMobDamage(this), (float)((int)this.getEntityAttribute(SharedMonsterAttributes.ATTACK_DAMAGE).getAttributeValue()));

        if (flag)
        {
            this.applyEnchantments(this, entityIn);
        }

        return flag;
    }



@Override
public EntityAgeable createChild(EntityAgeable ageable) {
	// TODO Auto-generated method stub
	return null;
}
}

Posted

Entities aren't singletons, you can't just store a single instance and reuse it. You need to create a new instance every time you want to spawn one.

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.

Posted

yeah i see that now, what would be the best way to refer to an entity so i can spawn one of that type later, EntityRegistry? or just store the entity.class

 

Posted

All entities need to be registered with the EntityRegistry, but no instead of

 

public static Entity altarlisttier1(ItemStack item) {

	for (Entry<ItemStack, Entity> entry : altarlisttier1.entrySet())
        {
            if (ItemStack.areItemsEqual(item, (ItemStack)entry.getKey()))
            {
            	return entry.getValue();
            }
            else {
            	return null;
            }
        }
	return null;
}

 

Some thing like

public static Entity getEntityFromItemStackInAltar(World world, ItemStack stack) {
     // Only needs either instanceof or ==
     if (stack != null && (stack.getItem() instanceof ItemClass || stack.getItem() == Items.diamond)) {
          return new Entity(world);
     }
}

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

×   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

    • Reach Out To Rapid Digital: What sapp Info: +1 41 4 80 7 14 85 Email INFO: rap iddi gita lrecov ery @ exe cs. com Hello, my name is Jayson, and I’m 35 years old from the United Kingdom. My family and I recently endured an incredibly challenging experience that I wouldn’t wish on anyone. We became victims of a cryptocurrency investment fraud scheme that saw us lose a staggering $807,000 in USDT and Bitcoins. The fraudsters had created a convincing facade, and we were lured into investing, only to discover later that the platform was a complete scam. We were left devastated, not just financially, but emotionally, as we had trusted these people and believed in the legitimacy of the investment. After the initial shock wore off, we desperately searched for ways to recover the lost funds. It seemed like an impossible task, and we felt as though there was no hope. That’s when, by sheer luck, we stumbled across a post about Rapid Digital Recovery, a cryptocurrency and funds recovery organization with a proven track record in cybersecurity and fraud recovery. We decided to reach out to them, and from the first interaction, we were impressed with their professionalism and transparency. They explained the recovery process in detail and reassured us that they had the skills and expertise to track down the perpetrators and recover our funds. This gave us a renewed sense of hope, something we hadn’t felt in months. What truly stood out during our experience with Rapid Digital Recovery was their dedication to the recovery process. The team went above and beyond, using sophisticated tracking tools and cyber forensics to gather critical information. Within a matter of weeks, they had successfully located the funds and traced the scam back to the fraudsters responsible. They worked with the authorities to ensure the criminals were held accountable for their actions. To our relief, the team at Rapid Digital Recovery was able to recover every single penny we had lost. The funds were returned in full, and the sense of closure we felt was invaluable. We couldn’t have imagined such a positive outcome in the early stages of our recovery journey, and we are deeply grateful for the work they did. If you ever find yourself in a similar situation, I highly recommend contacting Rapid Digital Recovery. Their expertise, transparency, and dedication to their clients make them the go-to choice for anyone seeking to recover lost cryptocurrency or funds. They truly gave us back our financial future.  
    • This is my first time modding anything, so maybe just skill issue. I'm using Forge 54.0.12 and Temurin 21.0.5+11-LTS I wanted to create a custom keybind and to check whether it works I'd like to send a chat message. I tried using Minecraft.getInstance().player.sendSystemMessage(Component.literal("test")); but IntelliJ couldnt resolve sendSystemMessage(...). Since I saw people using it in earlier versions, I tried the same thing with 1.20.6(- 50.1.0), where it works fine, now I can't figure out if this is intentional and whether there are other options for sending chat messages. On that note, is there more documentation than https://docs.minecraftforge.net/en/1.21.x/? It seems very incomplete compared to something like the Oracle Java docs
    • Hi, i'm having this error and I wanna fix it. we try: -Reload drivers -Eliminate .minecraft -Eliminate Java -Restart launcher -Verify if minecraft is using gpu -Mods  in .minecraft is empty -Install the latest and recomended version of forge idk what i have to do, help me pls. the lastest log is: https://mclo.gs/WAMao8x  
    • Read the FAQ, Rule #2. (https://forums.minecraftforge.net/topic/125488-rules-and-frequently-asked-questions-faq/)  
    • The link to your log does not work, it says it is forbidden, Error, this is a private paste or is pending moderation.
  • Topics

×
×
  • Create New...

Important Information

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