Reputation: 21
So i started developing my mod for minectraft. One of the block it adds should be more powerfull version of glowstone. So this is the script:
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
public class FeralFlareBlock extends BlockBase
{
public FeralFlareBlock(String name, Material material)
{
super(name, material);
setSoundType(SoundType.GLASS);
setHardness(0.3F);
setResistance(0.3F);
setHarvestLevel("pickaxe", 1);
setLightLevel(100.0F);
setLightOpacity(1);
}
}
There is the setLightLevel function, i have it set to 100 even tho glowstone is 15 so theoretically this should be more powerfull. It isn't. Don't know what im doing wrong, please help me. Thx
Upvotes: 1
Views: 1014
Reputation: 25903
The setLightLevel
method does take values between 0.0
(darkest) and 1.0
(brightest).
So a value of 100.0F
is invalid.
Also see some thread I found when searching for your issue: [1.11] setLightLevel not producing light when block is placed in world:
Item#setLightLevel
takes a float between 0.0F and 1.0F, instead of going from 0 to 15. If you want to have the max light level, you use 1.0F.
For reference, here is a link to a javadoc: Block#setLightLevel.
I have it set to 100 even tho glowstone is 15 so theoretically this should be more powerfull. It isn't.
The brightest light level in Minecraft is 15
(received by a value of 1.0
with setLightLevel
). You can not make anything brighter than this. Minecraft does not support brighter values.
You can easily convert minecrafts light levels (0 to 15) to this method with simple math:
// Takes values between 0 and 15 (both inclusive) and converts to 0 to 1.0.
private static double translateLightLevelToFloat(int lightLevel) {
if (ligthLevel < 0 || lightLevel > 15) {
throw new IllegalArgumentException("Light level must be between 0 and 15 (both inclusive)");
}
return lightLevel / 15.0;
}
Upvotes: 2
Reputation: 80
The maximum lightlevel is 15. So it cannot get lighter than glowstone.
https://minecraft.gamepedia.com/Light
There are 16 light levels, which are specified by an integer from 0 (the minimum) to 15 (the maximum).
Upvotes: -1