Everything posted by Suleiman700
-
[1.19.2] Help with player glow
Update #2: Tried to use PlayerTickEvent to set the glow effect to the player, And it only works in single player, Even though it detects all server players. @SubscribeEvent public void playerTick(TickEvent.PlayerTickEvent event) { event.player.setGlowingTag(true); // Only for player Minecraft.getInstance().player.setGlowingTag(true); // Only for player }
-
[1.19.2] Help with player glow
Update #1: addEffect() does not help with this situation, It can be useful to add night vision effect event.getEntity().addEffect(new MobEffectInstance(MobEffects.NIGHT_VISION, 1000));
-
[1.19.2] Help with player glow
Hi. I am trying to add glow effect to players using playerRendering(RenderPlayerEvent.Post event). @SubscribeEvent public void playerRendering(RenderPlayerEvent.Post event) { if (event.getEntity() instanceof Player) { event.getEntity().setGlowingTag(true); // Only works in singleplayer event.getEntity().setCustomNameVisible(true); System.out.println(event.getEntity().hasGlowingTag()); // true for singleplayer, multiplayer & realms // event.getEntity().addEffect(); Should I use this ? double posX = event.getEntity().position().x; double posY = event.getEntity().position().y; double posZ = event.getEntity().position().z; event.getEntity().level.addParticle(ParticleTypes.FIREWORK, posX, posY, posZ, 0.0D, 0.0D, 0.0D); // Works in singleplayer, multiplayer & realms } } The particle effect tested and works fine in singleplayer, multiplayer & realms. But my problem is with setGlowTag() method, It only works in singleplayer, Even though I tired to log hasGlowingTag() and prints true into the console but it does not add the glowing effect. Should I add glow effect using addEffect() ? If yes how to do it ? Any help ? Thanks
-
[1.19.2] Error With GL11
I am really having a serious problem doing that. Can you please share a demo code that renders line behind player when he moves ? I've checked tutorials and many sites and still no success
-
[1.19.2] Error With GL11
Hello, I am trying to draw line between two points using GL11, But I get this error message FATAL ERROR in native method: Thread[Render thread,10,main]: No context is current or a function that is not available in the current context was called. The JVM will abort execution. at org.lwjgl.opengl.GL11.glPushMatrix([email protected]+7/Native Method) My Code: @SubscribeEvent public void playerTick(TickEvent.PlayerTickEvent event) { double posX = event.player.position().x; double posY = event.player.position().y; double posZ = event.player.position().z; event.player.level.addParticle(ParticleTypes.SMOKE, posX, posY, posZ, 0.0D, 0.0D, 0.0D); event.player.setGlowingTag(true); Vec3 pos1= new Vec3 (0,5,0); // [b]Vector from 0,0,0 to 0,5,0 -> Blockcoords[/b] Vec3 pos2= new Vec3 (5,5,0); // [b]Vector from 0,0,0 to 5,5,0 -> Blockcoords[/b] // Draw line drawLineWithGL(pos1, pos2); } private void drawLineWithGL(Vec3 blockA, Vec3 blockB) { System.out.println("REACHED HERE"); // Here it returns error and crash GL11.glPushMatrix(); GL11.glPushAttrib(GL11.GL_ENABLE_BIT); GL11.glDisable(GL11.GL_LIGHTING); GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glDisable(GL11.GL_DEPTH_TEST); GL11.glDisable(GL11.GL_CULL_FACE); GL11.glDisable(GL11.GL_LIGHTING); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glColor3f(0F, 1F, 0F); GL11.glBegin(GL11.GL_LINE_STRIP); //you will want to modify these offsets. GL11.glVertex3d(blockA.x + 0.5,blockA.y - 0.01,blockA.z + 0.5); GL11.glVertex3d(blockB.x + 0.5,blockB.y - 0.01,blockB.z + 0.5); GL11.glEnd(); }
-
[1.19.2] Trying To Draw A Line Behind Player
Thanks, I've managed to add particles Have a great day
-
[1.19.2] Trying To Draw A Line Behind Player
I am trying to do that but did not find any clue how! I tried but the classes names & methods names are not found at all (World, Level, spawnParticle, addFreshEntity) World.spawnParticle("reddust", par3EntityPlayer.posX, par3EntityPlayer.posY, par3EntityPlayer.posZ, 0.0D, 0.0D, 0.0D); Level.spawnParticle("reddust", par3EntityPlayer.posX, par3EntityPlayer.posY, par3EntityPlayer.posZ, 0.0D, 0.0D, 0.0D); Level.addFreshEntity("reddust", par3EntityPlayer.posX, par3EntityPlayer.posY, par3EntityPlayer.posZ, 0.0D, 0.0D, 0.0D); + Do you know how to get the correct classes names in 1.19.2 ?
-
[1.19.2] Trying To Draw A Line Behind Player
Hello. I am trying to draw a line behind player when he moves. The idea behind this mod is to help players when they go mining, It will help them follow the walk path using this mod. The problem is that in 1.19.2 I cannot find the render event & player movement event (maybe these events are not need, I dunno) - I used to create mods for 1.12.2 Like when a player moves it will call a render method that draws line at player pos xyz. Thanks in advance!
-
onLivingHurt cause lag in multiplayer
Then what event i should use ? I want event that gets target name and health (that has been shot by player projectile/arrow
-
onLivingHurt cause lag in multiplayer
Hello. I am trying to build a mod that shows target health when shooting it with arrow. And it works fine in singleplayer but very laggy in multiplayer (Even if I join a small server). Events I used: onLivingHurt, LivingAttackEvent, LivingDamageEvent (There are all lagging in multiplayer) NOTE: even if I delete all the code inside the function it will also still laggy @SubscribeEvent public void onLivingHurt(LivingHurtEvent event){ if (event.getSource().isProjectile()) { // Get attacker name EntityPlayerMP attacker = (EntityPlayerMP) event.getSource().getTrueSource(); String attackerName = attacker.getDisplayNameString(); // Damage dealt float damage = event.getAmount(); // Get target info String targetName = event.getEntity().getName(); float targetHealth = event.getEntityLiving().getHealth(); Chat.SendMessage("Shot: " + targetName + " | Damage: " + damage + " | HealthB4: " + targetHealth + " | HealthAFTR: " + (targetHealth - damage), "green"); } } @SubscribeEvent public void LivingAttackEvent(LivingEvent event) { // Will also lag in multiplayer even if its an empty function }
IPS spam blocked by CleanTalk.