Jump to content

New Picture Object


ShetiPhian

Recommended Posts

Well I'm now just getting into entities I've prolonged it as far as possible but to continue development on my mod I need to learn how to use them.

 

The first thing I started with is a new picture entity,

I copied EnumArt, ItemPainting, and  EntityPainting into my common package, then RenderPainting into my client package.

Set up all the imports, and added these two line into my @Init

EntityRegistry.registerModEntity(EntityPainting.class, "Picture", EntityRegistry.findGlobalUniqueEntityId(), this, 160, 100, false);

Item painting = (new ItemPainting(6500)).setIconCoord(10, 1).setItemName("picture");

 

and through my proxy this line on the client side

RenderingRegistry.registerEntityRenderingHandler(EntityPainting.class, new RenderPainting());

 

 

The first problem I had was a null pointer in the renderer, turns out the server wasn't telling the client what the value of art was.

That was a simple fix, I first check to make sure art wasn't null to prevent any future crashes, then setup a packet to update the client.

 

At first this looked to work perfectly, then my picture jumped up a block  ???

For some reason, in around the 15 second mark, the client decides to change the y value, then it never does it again.

The value is still correct on the server side, re-entering the world places the pictures in the correct spot. (for 15sec at least)

If I send the x,y,z to the client, every 15seconds it jumps up and gets corrected into the proper spot.

 

I don't know why it is behaving like this, the java files are copies of the originals.

The other issue I have is the painting disappear if you turn your camera enough to only have them partly on screen.

 

I'm having so much fun with this entity I cant wait to add mobs, chest, furnace, sign  :o

 

EDIT:

Wow you guys are good!

I changed nothing in my code between posting here, and pressing the debug button again and everything worked.

I'm now more confused and very glad its working.

Link to comment
Share on other sites

It's called a physic bugfix.

You posted, someone saw it, and used their mind to fix your client.

 

If only, I was back fighting with it again.

After I switched over to my textures I noticed I had grabbed the wrong painting from creative mode  ::) no wonder it worked :-[

 

Using the correct item mine once again moves up after 15seconds, and vanishes when its at the edge of my screen  :-\

 

 

EDIT:

Well I thing I finally got it working.

To solve the disappearing at the edges problem, I just sent the bounding box info.

 

Now for moving up after 15sec.

The default paintings extend Entity, but if I extend EntityLiving instead my painting stay put.

This cause a few problems with simple solutions.

Walking into the paintings pushed them off the wall, dropping the item. canBePushed() returning false solved this.

If you got too far away the paintings would completely vanish , canDespawn() returning false fixed that.

 

So now my painting are "Alive" but they seem to work.

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



×
×
  • Create New...

Important Information

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