Jump to content

hydroflame

Members
  • Posts

    1511
  • Joined

  • Last visited

Posts posted by hydroflame

  1. no you got it right in my case i want to have access to the Timer reference in Minecraft (for rendering). so i only need to copy the reference once since it will be the exact same timer during your whole session. but in the case of redstone theres redstone all over the world so you dont want to have reference to everything. what you would do is use reflection every time you need to access it but that slow

     

    btw when we say slow we mean "slower then strong reference" in some case reflection will be "slow" but still fast enough so that your fps wont drop

  2. well example in one of my mod i need to read value from a private field in some class, using reflection i am able to get a reference to that object, save it elsewhere and read the value i need from that reference. so i technicly use reflection only 1 time, to get the reference and after i dont need it. basicly its slow while im getting the reference for the first time and after that everythign is smooth.

     

    on the other side sometimes youll need to constantly use reflection so that not super efficient

  3. And then maybe release 2 versions 1 API compat and one not?

    your choice really, if you use strong reference it will generally be faster. but you if the mod is not installed then it wont work (like gotolink said)

     

    if you need to reflect all the time (like every milisecond) then reflection might not be such a good idea but if its only for setup then reflection is awesome!

  4. I just have a preference towards command driven interfaces since they're most efficient.

    you must be kidding me... yes ok it works well on linux because you have auto complete and drawing all the icons take a butload of time, but for a game ????!?!

     

    sign-shop is the worst system in the world

     

    and really ? efficient?

     

    please tell me how typing "/gold" is faster then opening your eyes:

    8DUbIyH.png

  5. yes and no, im my case i need mana to be sent to the players (and i want the amount of mana to affect how players are rendered, so every client must know about the mana stats of every player)

     

    so in my case i have to take one of the 22 free id and use one to store the mana level

     

    but generally speaking yes people could probably use the datawatcher for their custom mobs without screwing up everything

  6. well with 1.6 its actually very easy to change between profile, so in the worst case you could specificly tell that you cannot use this on a vanilla server

     

    but i think you're right and it's not worth it, there's probably only a very small amount of mods that will need to use those and for now we probably wont be running out of id

     

    the minimum that we should do (those who want to use datawatchers) is to get the id from a config file, so that if 2 mods come in conflict the player can always change them

  7. hmm...

     

    well... gotolink is rarely wrong so maybe i just read the code wrong

     

    but it seems to me like:

    public static final int[] lightValue = new int[4096];
    
    public Block setLightValue(float par1)
        {
            lightValue[this.blockID] = (int)(15.0F * par1);
            return this;
        }

    it will be the same for every block... but considering gotolink post... i would try it just in case

  8. good point... i did not think of that, do you remember if the Datawatcher class is loaded when you connect to the server or before that ? (in one case you could simply omit to change the class, in the other you would have to launch the game in "normal datawatcher mode")

     

  9. actually...

    /**

        * How bright to render this block based on the light its receiving. Args: iBlockAccess, x, y, z

        */

        public float getBlockBrightness(IBlockAccess par1IBlockAccess, int par2, int par3, int par4)

        {

            return par1IBlockAccess.getBrightness(par2, par3, par4, getLightValue(par1IBlockAccess, par2, par3, par4));

        }

     

    /**

        * Get a light value for the block at the specified coordinates, normal ranges are between 0 and 15

        *

        * @param world The current world

        * @param x X Position

        * @param y Y position

        * @param z Z position

        * @return The light value

        */

        public int getLightValue(IBlockAccess world, int x, int y, int z)

        {

            Block block = blocksList[world.getBlockId(x, y, z)];

            if (block != null && block != this)

            {

                return block.getLightValue(world, x, y, z);

            }

            return lightValue[blockID];

        }

     

    this seems to be the same for every block in the world

     

    using thsi method you could make the block look bright, but not emit light

  10. hmmm, are you usign 162 ? my Block.java only has

    /**
         * Sets the amount of light emitted by a block from 0.0f to 1.0f (converts internally to 0-15). Returns the object
         * for convenience in constructing.
         */
        public Block setLightValue(float par1)
        {
            lightValue[this.blockID] = (int)(15.0F * par1);
            return this;
        }

    which obviously will be the same for every block in the world (which you dont want xD)

  11. I have a weird system for texturing in my mod and I'd like to make it so that if texture packers include a png file with a certain name it will override my weird texturing system. I know in java there's a file.exists() function but that doesn't seem to work in a compiled jar.

    yeah ok, sooo .. whats the problem now xD ?

  12. after more research in the issue i have discovered that there is actually a very low amount of values that are actually used

     

    result:

     

     

    2013-08-12 10:55:02 [iNFO] [sTDOUT] class net.minecraft.entity.player.EntityPlayerMP

    2013-08-12 10:55:02 [iNFO] [sTDOUT] key: 17 value: 0.0 value of type: Float

    2013-08-12 10:55:02 [iNFO] [sTDOUT] key: 0 value: 0 value of type: Byte

    2013-08-12 10:55:02 [iNFO] [sTDOUT] key: 16 value: 0 value of type: Byte

    2013-08-12 10:55:02 [iNFO] [sTDOUT] key: 1 value: 300 value of type: Short

    2013-08-12 10:55:02 [iNFO] [sTDOUT] key: 18 value: 0 value of type: Integer

    2013-08-12 10:55:02 [iNFO] [sTDOUT] key: 6 value: 1.0 value of type: Float

    2013-08-12 10:55:02 [iNFO] [sTDOUT] key: 7 value: 0 value of type: Integer

    2013-08-12 10:55:02 [iNFO] [sTDOUT] key: 8 value: 0 value of type: Byte

    2013-08-12 10:55:02 [iNFO] [sTDOUT] key: 9 value: 0 value of type: Byte

    2013-08-12 10:55:02 [iNFO] [sTDOUT] we are using 9/31 meaning we have 22 free

    2013-08-12 10:55:03 [iNFO] [sTDOUT]

    2013-08-12 10:55:03 [iNFO] [sTDOUT] class net.minecraft.client.entity.EntityClientPlayerMP

    2013-08-12 10:55:03 [iNFO] [sTDOUT] key: 17 value: 0.0 value of type: Float

    2013-08-12 10:55:03 [iNFO] [sTDOUT] key: 0 value: 0 value of type: Byte

    2013-08-12 10:55:03 [iNFO] [sTDOUT] key: 16 value: 0 value of type: Byte

    2013-08-12 10:55:03 [iNFO] [sTDOUT] key: 1 value: 300 value of type: Short

    2013-08-12 10:55:03 [iNFO] [sTDOUT] key: 18 value: 0 value of type: Integer

    2013-08-12 10:55:03 [iNFO] [sTDOUT] key: 6 value: 1.0 value of type: Float

    2013-08-12 10:55:03 [iNFO] [sTDOUT] key: 7 value: 0 value of type: Integer

    2013-08-12 10:55:03 [iNFO] [sTDOUT] key: 8 value: 0 value of type: Byte

    2013-08-12 10:55:03 [iNFO] [sTDOUT] key: 9 value: 0 value of type: Byte

    2013-08-12 10:55:03 [iNFO] [sTDOUT] we are using 9/31 meaning we have 22 free

    2013-08-12 10:55:22 [iNFO] [sTDOUT]

    2013-08-12 10:55:22 [iNFO] [sTDOUT] class net.minecraft.entity.monster.EntitySlime

    2013-08-12 10:55:22 [iNFO] [sTDOUT] key: 0 value: 0 value of type: Byte

    2013-08-12 10:55:22 [iNFO] [sTDOUT] key: 16 value: 1 value of type: Byte

    2013-08-12 10:55:22 [iNFO] [sTDOUT] key: 1 value: 300 value of type: Short

    2013-08-12 10:55:22 [iNFO] [sTDOUT] key: 6 value: 1.0 value of type: Float

    2013-08-12 10:55:22 [iNFO] [sTDOUT] key: 7 value: 0 value of type: Integer

    2013-08-12 10:55:22 [iNFO] [sTDOUT] key: 8 value: 0 value of type: Byte

    2013-08-12 10:55:22 [iNFO] [sTDOUT] key: 9 value: 0 value of type: Byte

    2013-08-12 10:55:22 [iNFO] [sTDOUT] key: 10 value:  value of type: String

    2013-08-12 10:55:22 [iNFO] [sTDOUT] key: 11 value: 0 value of type: Byte

    2013-08-12 10:55:22 [iNFO] [sTDOUT] we are using 9/31 meaning we have 22 free

    2013-08-12 10:55:22 [iNFO] [sTDOUT]

    2013-08-12 10:55:22 [iNFO] [sTDOUT] class net.minecraft.entity.monster.EntitySkeleton

    2013-08-12 10:55:22 [iNFO] [sTDOUT] key: 0 value: 0 value of type: Byte

    2013-08-12 10:55:22 [iNFO] [sTDOUT] key: 1 value: 300 value of type: Short

    2013-08-12 10:55:22 [iNFO] [sTDOUT] key: 6 value: 1.0 value of type: Float

    2013-08-12 10:55:22 [iNFO] [sTDOUT] key: 7 value: 0 value of type: Integer

    2013-08-12 10:55:22 [iNFO] [sTDOUT] key: 8 value: 0 value of type: Byte

    2013-08-12 10:55:22 [iNFO] [sTDOUT] key: 9 value: 0 value of type: Byte

    2013-08-12 10:55:22 [iNFO] [sTDOUT] key: 10 value:  value of type: String

    2013-08-12 10:55:22 [iNFO] [sTDOUT] key: 11 value: 0 value of type: Byte

    2013-08-12 10:55:22 [iNFO] [sTDOUT] key: 13 value: 0 value of type: Byte

    2013-08-12 10:55:22 [iNFO] [sTDOUT] we are using 9/31 meaning we have 22 free

    2013-08-12 10:55:22 [iNFO] [sTDOUT]

    2013-08-12 10:55:22 [iNFO] [sTDOUT] class net.minecraft.entity.monster.EntityCreeper

    2013-08-12 10:55:22 [iNFO] [sTDOUT] key: 17 value: 0 value of type: Byte

    2013-08-12 10:55:22 [iNFO] [sTDOUT] key: 0 value: 0 value of type: Byte

    2013-08-12 10:55:22 [iNFO] [sTDOUT] key: 16 value: -1 value of type: Byte

    2013-08-12 10:55:22 [iNFO] [sTDOUT] key: 1 value: 300 value of type: Short

    2013-08-12 10:55:22 [iNFO] [sTDOUT] key: 6 value: 1.0 value of type: Float

    2013-08-12 10:55:22 [iNFO] [sTDOUT] key: 7 value: 0 value of type: Integer

    2013-08-12 10:55:22 [iNFO] [sTDOUT] key: 8 value: 0 value of type: Byte

    2013-08-12 10:55:22 [iNFO] [sTDOUT] key: 9 value: 0 value of type: Byte

    2013-08-12 10:55:22 [iNFO] [sTDOUT] key: 10 value:  value of type: String

    2013-08-12 10:55:22 [iNFO] [sTDOUT] key: 11 value: 0 value of type: Byte

    2013-08-12 10:55:22 [iNFO] [sTDOUT] we are using 10/31 meaning we have 21 free

    2013-08-12 10:55:22 [iNFO] [sTDOUT]

    2013-08-12 10:55:22 [iNFO] [sTDOUT] class net.minecraft.entity.monster.EntityZombie

    2013-08-12 10:55:22 [iNFO] [sTDOUT] key: 0 value: 0 value of type: Byte

    2013-08-12 10:55:22 [iNFO] [sTDOUT] key: 1 value: 300 value of type: Short

    2013-08-12 10:55:22 [iNFO] [sTDOUT] key: 6 value: 1.0 value of type: Float

    2013-08-12 10:55:22 [iNFO] [sTDOUT] key: 7 value: 0 value of type: Integer

    2013-08-12 10:55:22 [iNFO] [sTDOUT] key: 8 value: 0 value of type: Byte

    2013-08-12 10:55:22 [iNFO] [sTDOUT] key: 9 value: 0 value of type: Byte

    2013-08-12 10:55:22 [iNFO] [sTDOUT] key: 10 value:  value of type: String

    2013-08-12 10:55:22 [iNFO] [sTDOUT] key: 11 value: 0 value of type: Byte

    2013-08-12 10:55:22 [iNFO] [sTDOUT] key: 12 value: 0 value of type: Byte

    2013-08-12 10:55:22 [iNFO] [sTDOUT] key: 13 value: 0 value of type: Byte

    2013-08-12 10:55:22 [iNFO] [sTDOUT] key: 14 value: 0 value of type: Byte

    2013-08-12 10:55:22 [iNFO] [sTDOUT] we are using 11/31 meaning we have 20 free

    2013-08-12 10:55:22 [iNFO] [sTDOUT]

    2013-08-12 10:55:22 [iNFO] [sTDOUT] class net.minecraft.entity.monster.EntitySpider

    2013-08-12 10:55:22 [iNFO] [sTDOUT] key: 0 value: 0 value of type: Byte

    2013-08-12 10:55:22 [iNFO] [sTDOUT] key: 16 value: 0 value of type: Byte

    2013-08-12 10:55:23 [iNFO] [sTDOUT] key: 1 value: 300 value of type: Short

    2013-08-12 10:55:23 [iNFO] [sTDOUT] key: 6 value: 1.0 value of type: Float

    2013-08-12 10:55:23 [iNFO] [sTDOUT] key: 7 value: 0 value of type: Integer

    2013-08-12 10:55:23 [iNFO] [sTDOUT] key: 8 value: 0 value of type: Byte

    2013-08-12 10:55:23 [iNFO] [sTDOUT] key: 9 value: 0 value of type: Byte

    2013-08-12 10:55:23 [iNFO] [sTDOUT] key: 10 value:  value of type: String

    2013-08-12 10:55:23 [iNFO] [sTDOUT] key: 11 value: 0 value of type: Byte

    2013-08-12 10:55:23 [iNFO] [sTDOUT] we are using 9/31 meaning we have 22 free

    2013-08-12 10:55:33 [iNFO] [sTDOUT]

    2013-08-12 10:55:33 [iNFO] [sTDOUT] class net.minecraft.entity.passive.EntitySquid

    2013-08-12 10:55:33 [iNFO] [sTDOUT] key: 0 value: 0 value of type: Byte

    2013-08-12 10:55:33 [iNFO] [sTDOUT] key: 1 value: 300 value of type: Short

    2013-08-12 10:55:33 [iNFO] [sTDOUT] key: 6 value: 1.0 value of type: Float

    2013-08-12 10:55:33 [iNFO] [sTDOUT] key: 7 value: 0 value of type: Integer

    2013-08-12 10:55:33 [iNFO] [sTDOUT] key: 8 value: 0 value of type: Byte

    2013-08-12 10:55:33 [iNFO] [sTDOUT] key: 9 value: 0 value of type: Byte

    2013-08-12 10:55:33 [iNFO] [sTDOUT] key: 10 value:  value of type: String

    2013-08-12 10:55:33 [iNFO] [sTDOUT] key: 11 value: 0 value of type: Byte

    2013-08-12 10:55:33 [iNFO] [sTDOUT] we are using 8/31 meaning we have 23 free

    2013-08-12 10:55:34 [iNFO] [sTDOUT]

    2013-08-12 10:55:34 [iNFO] [sTDOUT] class net.minecraft.entity.monster.EntityEnderman

    2013-08-12 10:55:34 [iNFO] [sTDOUT] key: 17 value: 0 value of type: Byte

    2013-08-12 10:55:34 [iNFO] [sTDOUT] key: 0 value: 0 value of type: Byte

    2013-08-12 10:55:34 [iNFO] [sTDOUT] key: 16 value: 0 value of type: Byte

    2013-08-12 10:55:34 [iNFO] [sTDOUT] key: 1 value: 300 value of type: Short

    2013-08-12 10:55:34 [iNFO] [sTDOUT] key: 18 value: 0 value of type: Byte

    2013-08-12 10:55:34 [iNFO] [sTDOUT] key: 6 value: 1.0 value of type: Float

    2013-08-12 10:55:34 [iNFO] [sTDOUT] key: 7 value: 0 value of type: Integer

    2013-08-12 10:55:34 [iNFO] [sTDOUT] key: 8 value: 0 value of type: Byte

    2013-08-12 10:55:34 [iNFO] [sTDOUT] key: 9 value: 0 value of type: Byte

    2013-08-12 10:55:34 [iNFO] [sTDOUT] key: 10 value:  value of type: String

    2013-08-12 10:55:34 [iNFO] [sTDOUT] key: 11 value: 0 value of type: Byte

    2013-08-12 10:55:34 [iNFO] [sTDOUT] we are using 11/31 meaning we have 20 free

    2013-08-12 10:55:37 [iNFO] [sTDOUT]

    2013-08-12 10:55:37 [iNFO] [sTDOUT] class net.minecraft.entity.passive.EntityBat

    2013-08-12 10:55:37 [iNFO] [sTDOUT] key: 0 value: 0 value of type: Byte

    2013-08-12 10:55:37 [iNFO] [sTDOUT] key: 16 value: 0 value of type: Byte

    2013-08-12 10:55:37 [iNFO] [sTDOUT] key: 1 value: 300 value of type: Short

    2013-08-12 10:55:37 [iNFO] [sTDOUT] key: 6 value: 1.0 value of type: Float

    2013-08-12 10:55:37 [iNFO] [sTDOUT] key: 7 value: 0 value of type: Integer

    2013-08-12 10:55:37 [iNFO] [sTDOUT] key: 8 value: 0 value of type: Byte

    2013-08-12 10:55:37 [iNFO] [sTDOUT] key: 9 value: 0 value of type: Byte

    2013-08-12 10:55:37 [iNFO] [sTDOUT] key: 10 value:  value of type: String

    2013-08-12 10:55:37 [iNFO] [sTDOUT] key: 11 value: 0 value of type: Byte

    2013-08-12 10:55:37 [iNFO] [sTDOUT] we are using 9/31 meaning we have 22 free

     

     

     

     

    meaning we actually have more values to play with then we tought we would :D (average of 22 free id)

    considering the proper usage of these (like i said earlier, values changing a lot like mana or energy) we probably don't need to expand it further then 31 for now

     

    values worth interrest:

    Entity uses 0, 1 meaning 29 free id

    EntityLivingBase use 0, 1, 6, 7, 8, 9 meaning every single of your mobs has 25 id free!

    EntityAnimal uses 12 (as well as every other before) for age. 24 free for your passif mobs

    EntityPlayer uses 16, 17, 18 as well as EntityLivingBase so you still have 22 free id! (should be enough for our small needs)

     

    so considering the free space, its probably not a big deal to expand the watch list size, but for the sake of it i did it anyway

     

    all you have to do is remove the check for id>31, change the "writeWatchableObject" method to write [int][byte] (id, type) instead of [byte] (which was 3 bit for type 5 for id) and finally change the "readWatchableObjects" so that it reads [int][byte] instead

     

    @Mazetar, the goal was to use the already implemented system to pack all values in 1 packet and prevent overhead caused by sending multiple packet. but it might be possible to simply add more information after the end byte that vanilla puts in the packet and retreive that information later

     

    @gotoLink, same as maz

  13. hmmm well redstone simply change the block when you click it :\ which isnt really what you want but it could work anyway

     

    /**
         * The redstone ore glows.
         */
        private void glow(World par1World, int par2, int par3, int par4)
        {
            this.sparkle(par1World, par2, par3, par4);
    
            if (this.blockID == Block.oreRedstone.blockID)
            {
                par1World.setBlock(par2, par3, par4, Block.oreRedstoneGlowing.blockID);
            }
        }

     

    i looked quickyl through Block.java and there doesnt seem to be anything but maybe im wrong

×
×
  • Create New...

Important Information

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