Jump to content

Recommended Posts

Posted

Ohhhhhhhhh.... I get what you mean. Ill try that out.

Apparently I'm addicted to these forums and can't help but read all the posts. So if I somehow help you, please click the "Like This" button, it helps.

Posted (edited)

Stupid me... Apparently changing the 

On 2/25/2017 at 5:25 PM, Leomelonseeds said:

(container, 0);

to 

container, 3(My entity id) fixed the crash... lol.

 

Ok now its giving an error:

[16:45:09] [Client thread/ERROR] [FML]: A severe problem occurred during the spawning of an entity at ( -906.96875,71.5, 151.5)
java.lang.NullPointerException: The validated object is null
	at org.apache.commons.lang3.Validate.notNull(Validate.java:222) ~[commons-lang3-3.3.2.jar:3.3.2]
	at org.apache.commons.lang3.Validate.notNull(Validate.java:203) ~[commons-lang3-3.3.2.jar:3.3.2]
	at net.minecraft.entity.EntityHanging.updateFacingWithBoundingBox(EntityHanging.java:58) ~[EntityHanging.class:?]
	at com.leomelonseeds.moarstuff.entity.EntityCamera.<init>(EntityCamera.java:31) ~[EntityCamera.class:?]
	at com.leomelonseeds.moarstuff.entity.EntityCamera.<init>(EntityCamera.java:37) ~[EntityCamera.class:?]
	at com.leomelonseeds.moarstuff.entity.SomeSpawnCallBack.apply(SomeSpawnCallBack.java:29) ~[SomeSpawnCallBack.class:?]
	at com.leomelonseeds.moarstuff.entity.SomeSpawnCallBack.apply(SomeSpawnCallBack.java:1) ~[SomeSpawnCallBack.class:?]
	at net.minecraftforge.fml.common.registry.EntityRegistry$EntityRegistration.doCustomSpawning(EntityRegistry.java:112) ~[EntityRegistry$EntityRegistration.class:?]
	at net.minecraftforge.fml.common.network.internal.EntitySpawnHandler.spawnEntity(EntitySpawnHandler.java:93) [EntitySpawnHandler.class:?]
	at net.minecraftforge.fml.common.network.internal.EntitySpawnHandler.process(EntitySpawnHandler.java:73) [EntitySpawnHandler.class:?]
	at net.minecraftforge.fml.common.network.internal.EntitySpawnHandler.access$000(EntitySpawnHandler.java:48) [EntitySpawnHandler.class:?]
	at net.minecraftforge.fml.common.network.internal.EntitySpawnHandler$1.run(EntitySpawnHandler.java:63) [EntitySpawnHandler$1.class:?]
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:1.8.0_25]
	at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:1.8.0_25]
	at net.minecraft.util.Util.runTask(Util.java:25) [Util.class:?]
	at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1108) [Minecraft.class:?]
	at net.minecraft.client.Minecraft.run(Minecraft.java:406) [Minecraft.class:?]
	at net.minecraft.client.main.Main.main(Main.java:118) [Main.class:?]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_25]
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_25]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_25]
	at java.lang.reflect.Method.invoke(Method.java:483) ~[?:1.8.0_25]
	at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.12.jar:?]
	at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.12.jar:?]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_25]
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_25]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_25]
	at java.lang.reflect.Method.invoke(Method.java:483) ~[?:1.8.0_25]
	at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97) [start/:?]
	at GradleStart.main(GradleStart.java:26) [start/:?]

Code:

package com.leomelonseeds.moarstuff.entity;

import com.google.common.base.Function;

import net.minecraft.client.multiplayer.WorldClient;
import net.minecraft.entity.Entity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.fml.client.FMLClientHandler;
import net.minecraftforge.fml.common.network.internal.FMLMessage.EntitySpawnMessage;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;


	
	@SideOnly(Side.CLIENT)
	public class SomeSpawnCallBack implements Function<EntitySpawnMessage, Entity> {
	  
	WorldClient wc = FMLClientHandler.instance ().getWorldClient ();
	public BlockPos pos;
	public EnumFacing facing;
	public String title;
	
	  
	  @Override
	  public Entity apply(EntitySpawnMessage m) {
		System.out.println(m);
		EntityCamera entityC = new EntityCamera(wc, pos, facing, title);
	    return entityC;
		  
	  }
	  
	}

For message m, im getting this:

[16:45:09] [Client thread/INFO] [STDOUT]: [com.leomelonseeds.moarstuff.entity.SomeSpawnCallBack:apply:28]: net.minecraftforge.fml.common.network.internal.FMLMessage$EntitySpawnMessage@2e04d682

 

Edited by Leomelonseeds

Apparently I'm addicted to these forums and can't help but read all the posts. So if I somehow help you, please click the "Like This" button, it helps.

Posted

You declared fields (pos, facing & title) in a class and never gave them values. I told you above that you need to get data from the message m. What did you expect would happen when you passed uninitialized arguments to that constructor? Why are you even posting the crash here when it points directly to a face-palm level programming omission?

 

Your effort here is looking more and more like cargo-cult programming, which will leave you wondering why you stop getting help in this forum. You've left the realm of Forge learning and entered the realm of either Java ignorance or just plain laziness. Put some effort into understanding Java, and the plain English meaning of your error message, and the "logic" of your own program sequence before asking for any more help.

The debugger is a powerful and necessary tool in any IDE, so learn how to use it. You'll be able to tell us more and get better help here if you investigate your runtime problems in the debugger before posting.

Posted
3 hours ago, jeffryfisher said:

I told you above that you need to get data from the message m

 

23 hours ago, Leomelonseeds said:

For message m, im getting this:


[16:45:09] [Client thread/INFO] [STDOUT]: [com.leomelonseeds.moarstuff.entity.SomeSpawnCallBack:apply:28]: net.minecraftforge.fml.common.network.internal.FMLMessage$EntitySpawnMessage@2e04d682

 

Apparently I'm addicted to these forums and can't help but read all the posts. So if I somehow help you, please click the "Like This" button, it helps.

Posted (edited)

Congrats, you use system.out and passed in a complex object type which doesn't override ToString to return a meaningful value. You're looking at the string representation of a pointer.  Please stop Cargo Cult-ing.

 

You need to actually do something with the m in order to get any data out of it. Go look at the class (right click -> jump to declaration on the variable's Type).

Edited by Draco18s

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.

  • 2 weeks later...
Posted

Ok I see that it uses toBytes. How would I get any data from toBytes though? (Forgive the stupid questions please I just want help)

Apparently I'm addicted to these forums and can't help but read all the posts. So if I somehow help you, please click the "Like This" button, it helps.

Posted

So that will provide the methods I need for my constructor? Or am I getting this all wrong??

On 2/24/2017 at 0:31 PM, jeffryfisher said:

In 1.10.2, to stop MC from trying to spawn a vanilla painting, I needed to provide a callback class to a custom spawning registration that was called from client proxy init.

Sooo... That?

Apparently I'm addicted to these forums and can't help but read all the posts. So if I somehow help you, please click the "Like This" button, it helps.

Posted

Wait but what data should I put in the methods? (Sorry for more stupid questions) You told me to not use anything suggested above but mabye there is some value in that...?

Apparently I'm addicted to these forums and can't help but read all the posts. So if I somehow help you, please click the "Like This" button, it helps.

Posted

And also how will those two methods help me in making my entity appear?

Apparently I'm addicted to these forums and can't help but read all the posts. So if I somehow help you, please click the "Like This" button, it helps.

Posted

Waitt..... When I spawn the entity, there are no errors in the console tho. Can you please explain in detail why my entity doesn't spawn but a painting does? 

Apparently I'm addicted to these forums and can't help but read all the posts. So if I somehow help you, please click the "Like This" button, it helps.

Posted

well it does spawn i think but it doesnt have a collision box. I think it does spawn cause when i break the block behind it, a few seconds later it drops as an item (the entity)

Apparently I'm addicted to these forums and can't help but read all the posts. So if I somehow help you, please click the "Like This" button, it helps.

Posted

How many times have you stepped through the creation / spawning in the debugger? Does that number bear a remarkable resemblance to your level of understanding? Set breakpoints (in your constructors and in vanilla EntityPainting constructors) and run the debugger.

The debugger is a powerful and necessary tool in any IDE, so learn how to use it. You'll be able to tell us more and get better help here if you investigate your runtime problems in the debugger before posting.

  • 4 weeks later...
Posted

Ok guys can one of you nice people give me a link to a clear tutorial to use the debugger? I think it is pretty important.

Apparently I'm addicted to these forums and can't help but read all the posts. So if I somehow help you, please click the "Like This" button, it helps.

Posted (edited)

"Debugger" depends on what IDE you're using. If Eclipse, then search the web for Eclipse tutorials. Teaching Eclipse (and Java and other tools) is outside the scope of this forum. Come back here when you've narrowed your problem to a specific question about Forge and its decompiled, deobfuscated Minecraft code.

Edited by jeffryfisher

The debugger is a powerful and necessary tool in any IDE, so learn how to use it. You'll be able to tell us more and get better help here if you investigate your runtime problems in the debugger before posting.

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



×
×
  • Create New...

Important Information

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