Jump to content

Sinu

Members
  • Posts

    29
  • Joined

  • Last visited

Sinu's Achievements

Tree Puncher

Tree Puncher (2/8)

0

Reputation

  1. Sweet, that seems to have worked! The one issue is that, I had to check if the instance was client or server because for some reason the server kept thinking the light level of the player is always 0 (is it client-side only?). So my code looks like this now: PlayerEntity player = event.player; World world = event.player.level; BlockPos blockpos = player.blockPosition(); BlockState block = world.getBlockState(blockpos); if (world.isClientSide) { System.out.print(world.getMaxLocalRawBrightness(blockpos) + System.lineSeparator()); if (world.getMaxLocalRawBrightness(blockpos) == 0) { ((LivingEntity)event.player).addEffect(new EffectInstance(Effects.BLINDNESS, 20, 3)); } } But now once I walk out of the light level of 0, it still says that I have the Blindness effect even though I can see clearly. I am assuming that since I checked if the instance is client-side or not, it didn't actually give the potion effect according to the server (which makes sense) but I don't understand why Blindness goes away even after I walk into the light?
  2. I see. What is the second int parameter in World#getRawBrightness for? I looked at the reference and it just seems to subtract it? Not sure why.. Also I believe I tried using World#getBrightness with LightType.BLOCK but I don't think it detected the light level properly. I am trying to give the Blindness effect to players who walk into caves with light levels of 0.
  3. Will this also work if I put this in BlockEvent.BreakEvent? Let's say I check if the player is breaking a Stone block and trying to replace that with something else.
  4. I am trying to give a blinding effect to players who are in light level of 0 but I can't seem to get it to work. @SubscribeEvent public static void onPlayerTick(TickEvent.PlayerTickEvent event) { PlayerEntity player = event.player; World world = event.player.level; BlockPos blockpos = player.blockPosition(); BlockState block = world.getBlockState(blockpos); if (block.getLightValue(world, blockpos) == 0 && block != null) { ((LivingEntity)event.player).addEffect(new EffectInstance(Effects.BLINDNESS, 20, 3)); } } Am I using getLightValue correctly? Also I am correctly feeding in the correct block position?
  5. So you just downloaded my source code and loaded it up and it doesn't allow you to create the Fishing Rod? I can still craft it and I uploaded exactly as is and I haven't touched it.
  6. How will that fix my crafting issues with fishing_rod.json file when it doesn't even use/reference any tags I added in that folder?
  7. I have no idea what you mean either. Can you be more specific? Which json file are you talking about?
  8. Well I can still craft the Fishing Rod even after I changed it.
  9. Right. I get that. But what is my "dependencies"? [[dependencies.???]] my own mod ID?? I know its definitely not examplemod. I did: [[dependencies.brimheim]] modId="forge" mandatory=true versionRange="[36,)" ordering="AFTER" side="BOTH" Is that correct?
  10. So we are talking about the mods.toml inside META-INF folder? Ex: Projects\Minecraft\Brimheim\src\main\resources\META-INF. This is the only mods.toml I can find inside my MDK. But what am I adding dependency of? I get that I need to set the "ordering" to AFTER but what am I setting the "ordering" of? Forge??
×
×
  • Create New...

Important Information

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