{"id":15281426,"url":"https://github.com/skytasul/guardianbeam","last_synced_at":"2025-04-06T13:12:07.173Z","repository":{"id":39669785,"uuid":"141582597","full_name":"SkytAsul/GuardianBeam","owner":"SkytAsul","description":"An util to create easily Guardian Lasers via Packets and Reflection. No dependencies, compatible 1.9 -\u003e 1.21","archived":false,"fork":false,"pushed_at":"2024-12-23T22:55:52.000Z","size":33247,"stargazers_count":97,"open_issues_count":2,"forks_count":7,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-03-30T12:08:42.041Z","etag":null,"topics":["beam","bukkit","class","guardian","java","laser","minecraft","nms","packet","packets","reflection","spigot","util"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/SkytAsul.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":null,"patreon":null,"open_collective":null,"ko_fi":"skytasul","tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"lfx_crowdfunding":null,"custom":null}},"created_at":"2018-07-19T13:20:29.000Z","updated_at":"2025-02-26T15:26:37.000Z","dependencies_parsed_at":"2023-01-26T07:46:09.435Z","dependency_job_id":"63ac4025-327f-4919-b2cd-cefea6c1d3b9","html_url":"https://github.com/SkytAsul/GuardianBeam","commit_stats":{"total_commits":64,"total_committers":3,"mean_commits":"21.333333333333332","dds":0.078125,"last_synced_commit":"3df190a978182ef77303f8eb1ff2d7676a40090a"},"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SkytAsul%2FGuardianBeam","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SkytAsul%2FGuardianBeam/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SkytAsul%2FGuardianBeam/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SkytAsul%2FGuardianBeam/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SkytAsul","download_url":"https://codeload.github.com/SkytAsul/GuardianBeam/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247485290,"owners_count":20946398,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["beam","bukkit","class","guardian","java","laser","minecraft","nms","packet","packets","reflection","spigot","util"],"created_at":"2024-09-30T13:07:45.410Z","updated_at":"2025-04-06T13:12:07.140Z","avatar_url":"https://github.com/SkytAsul.png","language":"Java","funding_links":["https://ko-fi.com/skytasul"],"categories":[],"sub_categories":[],"readme":"# GuardianBeam\n![Maven Central](https://img.shields.io/maven-central/v/fr.skytasul/guardianbeam)\n\nAn util to create easily Guardians and Ender Crystal Lasers via Packets and Reflection. No ProtocolLib, no dependency, compatible from Minecraft 1.9 to Minecraft 1.21!\n\nInspired by the plugin [GuardianBeamAPI by Jaxon A Brown](https://www.spigotmc.org/resources/18329), which uses ProtocolLib.\n\nThere is a [page on SpigotMC](https://www.spigotmc.org/threads/tutorial-laser-guardian-beam.348901/).\n\n![Static laser gif](Beam.gif)\n\n## How to install using maven\nAdd this requirement to your maven `pom.xml` file:\n\n```xml\n\u003cdependency\u003e\n  \u003cgroupId\u003efr.skytasul\u003c/groupId\u003e\n  \u003cartifactId\u003eguardianbeam\u003c/artifactId\u003e\n  \u003cversion\u003e{VERSION}\u003c/version\u003e\n  \u003cscope\u003ecompile\u003c/scope\u003e\n\u003c/dependency\u003e\n```\nYou need to set up the maven shade plugin to relocate the classes.\n\n\u003e [!IMPORTANT]\n\u003e Replace {VERSION} by the version of the util you want to use (see at the top).  \n\u003e Versions 1.9 to 1.16.5 are only supported up to the version 2.3.6.\n\n## How to use\n1. Create Location objects of where do you want your laser starts and ends.\n2. Create a Laser instance: `new GuardianLaser(locationStart, locationEnd, duration, visibleDistance)` - duration is the time (in seconds) when laser will be visible (if you set it to -1, the laser will exist infinitely), and visibleDistance is the amount of blocks where your laser will be visible. You can also use `new CrystalLaser(...)` to create an Ender Crystal laser.\n3. After this, call the method `laser.start(plugin);` (where \"plugin\" parameter is the instance of your JavaPlugin class).\n4. Ta-daaa! Your laser is created and shown to nearby players!\n5. You can move the laser with the methods `laser.moveStart(newLocation);` and `laser.moveEnd(newLocation);`\n6. To remove your laser before his end duration, just call `laser.stop();`\n\n## Demo\nHere is something I quickly made to show what you can do with this API: a ray-gun.\n\n![Moving laser animation](Moving%20Beam.gif)\n\nYou can see the system in action [on this video](https://youtu.be/NSYMKsPBdMM), and the class is available [here](LaserDemo.java).\n\n## Advanced usage\n### Animations\nThe `Laser#moveStart(Location location, int ticks, Runnable callback` and `Laser#moveEnd(Location location, int ticks, Runnable callback)` methods can be used to make the laser move smoothly from one point to another.\n\nQuick preview of the smooth movement:\n\n![Smooth laser animation](Smooth%20Moving%20Beam.gif)\n\n### End runnable\nIf you want to execute some actions when the laser comes to its end, use the `Laser#executeEnd(Runnable runnable)` method.\n\nIn example:\n\n```java\nnew GuardianLaser(start, end, duration, distance).executeEnd(() -\u003e Bukkit.broadcastMessage(\"Laser ended!\")).start(plugin);\n```\nThis will start a laser for 10 seconds, after that the message \"Laser ended!\" will be broadcasted to users.\n\n### Duration in ticks\nThe duration passed into the `new GuardianLaser(Location start, Location end, int duration, int distance)` constructor is in seconds. If you want it to be in ticks, call `Laser#durationInTicks()`.\n\nIn example:\n\n```java\nnew GuardianLaser(start, end, durationInTicks, distance).durationInTicks().start(plugin);\n```\nThis will start a laser for 10 ticks.\n\n### Make guardian laser follow entity smoothly\nAs the laser is made out of a guardian entity shooting a laser at an entity, it is possible to make the laser follow\nan existing entity of the world, without having to create a runnable which updates the laser position every tick.\n\nTo achieve this, you can either spawn the laser directly using this code:\n\n```java\nnew GuardianLaser(start, endEntity, duration, distance).start(plugin);\n```\n\nOr, after spawning a laser with a custom end location, use `GuardianLaser#attachEndEntity(LivingEntity endEntity)` to track the entity.\n\nYou can also use a combination of `GuardianLaser#moveEnd(Location endLocation)` and `GuardianLaser#attachEndEntity(LivingEntity endEntity)` as many times and in the order you want.\n\nQuick preview:\n\n![Smooth entity follow](Target%20Beam.gif)\n\n## Troubleshooting\nSometimes, Guardian beams only renders as bubbles, the moving color part is invisible.\nIt is not caused by this util but by a [Minecraft bug](https://bugs.mojang.com/browse/MC-165595).\n\nIt happens when your world gets too old (when its game time value reaches 2800000).\nThe only way to fix it is to open the `level.dat` file with a [NBT editor](https://github.com/jaquadro/NBTExplorer), and edit manually the `Data.Time` field to a lower value. Save the file, and start your server.\n\nThere is also a client bug which makes the Guardian beams completely invisible when too vertical. Adding a small offset to the top location when this issue occurs should fix it.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fskytasul%2Fguardianbeam","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fskytasul%2Fguardianbeam","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fskytasul%2Fguardianbeam/lists"}