Vswe's Summer Courses | You're not logged in. Sign up or log in | Server time: | Donate
One can now see other persons' badge hunts. Simply head over to their profiles to access them.

Go back to course page

Forging a Minecraft mod

Basic Minecraft modding with Minecraft Forge

Double Entity Creation (Assignment Question)

  • 2014-02-04 01:26:47
    EntityFirework: http://pastebin.com/zc6FXisA
    TileEntityFirework: http://pastebin.com/UEuBmQsV

    Here's how my code works:
    When the TileEntity's timer runs down, a new firework entity is created. A variable called "type" in the entity is set to the block that spawned it's metadata (0, 1, or 2, corresponding to red, green, or blue). The render class just calls the getType method to pick a texture to use.

    So I've got a bug where the firework block creates the entity, but doesn't change the texture of the entity. Actually, it seems to create two entities, one with the correct type, and one with a type 0, as if the setType method doesn't get called at all. Even thought two entities seem to get created, I can only see the default one rendered (maybe because one is on top of the other?).

    Does this have something to do with a server/client issue? Or is it something really obvious that I missed?

    Thanks,
    Tardisfan
  • 2014-02-04 09:53:52
    yup. It is the old client-server problem :D
    when you set the type you are on the server side (you are checking for !world.isRemote) but when you render the entity you read the client side variable type that you never changed. Watch again lecture 5, the answer is there! (I can't tell you because it is an assignment)
  • 2014-02-04 22:50:27
    Yes, that was the problem. Re-watching the video gave me the answer. Thanks!
  • Log in or sign up to reply to this thread