Jump to content

sequituri

Forge Modder
  • Posts

    669
  • Joined

  • Last visited

Posts posted by sequituri

  1. i would say take the blocks xyz pos, and see if there are any blocks on above the block on the y axis, from the blocks y pos to 256, i would also reccomend passing through glass and other transparent blocks. For example.

    while(int y = yPos; y <=256; y++)
    {
        if((world.getBlockatCoords(xPos,y,zPos) != null) || (world.getBlockatCoords(xPos,y,zPos) != Blocks.glass))
        {
             skyVisible = false;
        }
    }
    

     

    The method is getBlock(x, y, z) and the null check is useless. Blocks.air is returned in any case other than a regular block.

  2. Any object that implements IExtendedEntityProperties should exist on client and server both, and the methods (unless that effect the client only) should be executed on both sides. This is normally true, unless the calls to change its values originates from client-only code. So, if you want to change it from clientside-only code, schedule a server update with your own packet handler and pass in any changed data keys and values. You have to handle the update in your own handler.

     

    Check this tutorial http://www.minecraftforum.net/topic/1952901-172164-eventhandler-and-iextendedentityproperties/

  3. Your code assumes that your statically initialized final references will be set after the Blocks class static final initializers have been set. There is no way to guarantee this is true. So, you'd best not use them that way. In the proper event handler, grab the values you need and assign them That way, you will know they already have their proper values from the registry.

  4. I dont get how come if a player remove an item like this with metadata removes the same as others. I mean i only use a custom item which is useless for my practice and i use only int so they will become unique

     

    i have blue ingot , yellow ingot <-- wth wrong?

     

    The proper way to do what you seem to want (see ItemDye class) is to assign subtypes via Item#hasSubtypes and getIconFromDamage() as well as getSubItems(). The itemStack contains the damage value from which the subItem is determined, not some added field that has no meaning to minecraft.

  5. Just so you understand the bug you are creating... the Item class creates any number of items (all completely different even if given the same name) and each Item (instancde) created is only a prototype of all such items. Therefore, any fields created in the Item class are shared with every item in the game. That includes yours and every other player who has on in their inventory. So, if you create an ItemX (and assign any 'metadata' to that object) then every itemX in the game will have the same metadata.  In other words, every player and every ItemX-based item anywhere in the world will be changed when you change yours. Even the ones in players inventories and chests.

    I don't think that is what you want.

  6. Try adding @Override annotations to all your methods that should be overriding methods in the superclass, you don't need this; but it won't hurt and it will give your errors when method names/args are wrong, helping you out.

     

    Indeed, as I've tried to get across many times: if you think you are overriding a method - you NEED to put an @override annotation for sanity's sake.

  7. How exactly do I change and read the values from outside my IExtendedEntityProps though?

    Not advised: Just add instance fields to your entity for each property and maybe getter/setter methods to read and change them.

     

    Advised: Use Entity#getExtendedProperties(String propname) to read them...

                    Entity#registerExtendedEntityProperties(String propname, IExtendedEntityProperties object) to set them up.

     

×
×
  • Create New...

Important Information

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