Jump to content

DarkNoobs12

Members
  • Posts

    4
  • Joined

  • Last visited

Everything posted by DarkNoobs12

  1. Yea, I noticed its intended purpose from the behaviour of the outputs. I was talking more about the way it was coded through multiple functions that called each other. Again, my confusion probably came from a lack of Java background. I see, seems to be a useful feature. Thanks for the answer ? It worked, thank you!
  2. On a side note, what is up with this getLightValue() function? My coding background isn't really in Java, so I might be missing something, but I went into the source code for it and it looks useless and kind of a rabbit hole. This is the getLightValue() I called, implemented in net.minecraftforge.common.extensions.IForgeBlockState: default int getLightValue(IBlockReader world, BlockPos pos) { return getBlockState().getBlock().getLightValue(getBlockState(), world, pos); } It calls a different getLightValue(), which is in net.minecraftforge.common.extensions.IForgeBlock: default int getLightValue(BlockState state, IBlockReader world, BlockPos pos) { return state.getLightValue(); } This getLightValue() calls yet another getLightValue(), and it only requires the BlockState to be called. This getLightValue() is in the net.minecraft.block.BlockState: public int getLightValue() { return this.lightLevel; } Is this a java thing, or just the leftovers of previous versions?
  3. Hi, I just started modding and tried to create a simple item that shows the light level the player is in, like in F3, but less debugging mode and more of a real item(for immersion purposes). From all my trials so far it seems the functions for Light level have been changed recently, since all previous posts mention functions I haven't been able to find, or at least IntelliJ hasn't found them. BlockPos pos = player.getPosition(); BlockState feet = world.getBlockState(pos); System.out.println(feet.getLightValue(world,pos)); This is my code, but it outputs the light level the block is emitting, not the light level itself. Meaning I get 0 next to a torch, and 14 when I stand on the torch. What function would give the value I'm looking for?
×
×
  • Create New...

Important Information

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