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.

Featured Replies

Posted

I am trying to make so when a MagmaBlock hits water it will turn into MagmaIngot (Selfmade) but when i try to spawn it i get an error.

 

EntityJoinWorldEventHandler Class:

 

[embed=425,349]package thaun.thaunsmod.handler;

 

import net.minecraft.entity.item.EntityItem;

import net.minecraft.init.Blocks;

import net.minecraft.item.Item;

import net.minecraftforge.event.entity.EntityJoinWorldEvent;

import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;

import thaun.thaunsmod.Blocks.MagmaEntity;

 

public class EntityJoinWorldEventHandler {

 

@SubscribeEvent

    public void onEntityJoinWorld(EntityJoinWorldEvent event)

    {

        if(event.getEntity() instanceof EntityItem)

        {

            if(((EntityItem)event.getEntity()).getEntityItem().getItem() == Item.getItemFromBlock(Blocks.MAGMA))

            {

                event.setCanceled(true);

                MagmaEntity entityItem = new MagmaEntity(event.getEntity().worldObj, event.getEntity().posX, event.getEntity().posY, event.getEntity().posZ, ((EntityItem)event.getEntity()).getEntityItem());

                if (!event.getWorld().isRemote) {

                System.out.println("Sending out signal: 1");

                event.getEntity().getEntityWorld().spawnEntityInWorld(entityItem);

                }

             

            }

        }

    }

}

[/embed]

 

 

MagmaBlock class:

 

[embed=425,349]package thaun.thaunsmod.Blocks;

 

import net.minecraft.entity.item.EntityItem;

import net.minecraft.item.ItemStack;

import net.minecraft.nbt.NBTTagCompound;

import net.minecraft.world.World;

import thaun.thaunsmod.Items.ItemInit;

 

public class MagmaEntity extends EntityItem{

 

public MagmaEntity(World worldIn, double x, double y, double z, ItemStack stack) {

        super(worldIn, x, y, z, stack);

    }

 

    @Override

    public void onUpdate()

    {

   

        if(this.isWet())

        {

            EntityItem entity = new EntityItem(worldObj, this.posX, this.posY, this.posZ, new ItemStack(ItemInit.magmaIngot));

            worldObj.spawnEntityInWorld(entity);

        System.out.println("Sending out signal: 2");

         

        }

    }

 

}[/embed]

 

 

I have

[embed=425,349]MinecraftForge.EVENT_BUS.register(new EntityJoinWorldEventHandler());[/embed]

in Post-Init

 

What i get as output is alot of "Sending out signal: 1" and this error that is huge...

http://pastebin.com/dWQcyCqe

My guess is that you haven't registered your entity.

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.

  • Author

I looked thru some Entity Registering and i cant understand them. That means i do not know how to register the entity.

  • Author

Did this:

 

[embed=425,349]

EntityRegistry.registerModEntity(Blocks.MAGMA.getRegistryName(), MagmaEntity.class, "magma", 1899, this, 1, 1, false);[/embed]

 

Seems i get the same error... I dont really know how to use this stuff really well...

  • Author

Well, lets say i dont know what i am doing. When it comes to forge modding, im kinda a novice at this.

What i want it to do is:

When a Magma Block ENTITY  iswet or is in water i want it to turn itself into another item that i created.

 

Yes, we know. Diesieben07 has pointed out the problems with your current code. You need to fix those.

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.

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.