{"id":16960986,"url":"https://github.com/cubbossa/cliententities","last_synced_at":"2025-03-22T14:30:53.789Z","repository":{"id":190939987,"uuid":"682417951","full_name":"CubBossa/ClientEntities","owner":"CubBossa","description":"A wrapper for PacketEvents library to easily create client side entities.","archived":false,"fork":false,"pushed_at":"2024-10-27T08:18:43.000Z","size":276,"stargazers_count":12,"open_issues_count":2,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-18T11:51:59.656Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/CubBossa.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"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}},"created_at":"2023-08-24T06:09:45.000Z","updated_at":"2025-03-17T23:01:37.000Z","dependencies_parsed_at":"2023-10-21T10:21:59.746Z","dependency_job_id":"55836d66-2ff6-4062-8a65-7459222cf901","html_url":"https://github.com/CubBossa/ClientEntities","commit_stats":null,"previous_names":["cubbossa/cliententities"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CubBossa%2FClientEntities","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CubBossa%2FClientEntities/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CubBossa%2FClientEntities/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CubBossa%2FClientEntities/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/CubBossa","download_url":"https://codeload.github.com/CubBossa/ClientEntities/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244971706,"owners_count":20540835,"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":[],"created_at":"2024-10-13T22:50:43.505Z","updated_at":"2025-03-22T14:30:53.372Z","avatar_url":"https://github.com/CubBossa.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ClientEntities\n\nA wrapper for the PacketEvents library to easily create client side entities.\nIt uses the Spigot API entity classes, so that the general usage is familiar.\n\n## Maven\n\n```xml\n\u003crepository\u003e\n    \u003cid\u003ecubbossa_repository\u003c/id\u003e\n    \u003curl\u003ehttps://nexus.leonardbausenwein.de/repository/maven-releases/\u003c/url\u003e\n\u003c/repository\u003e\n\n\u003cdependency\u003e\n    \u003cgroupId\u003ede.cubbossa\u003c/groupId\u003e\n    \u003cartifactId\u003eClientEntities\u003c/artifactId\u003e\n    \u003cversion\u003e1.3.1\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\n## How to use\n\n### PacketEvents\n\nClientEntities works on top of [packetevents](https://github.com/retrooper/packetevents/),\nmake sure to set it up correctly.\n\n### ClientEntities\n\nMain part of the library is the PlayerSpace class. It resembles a group of players that are supposed to see some client\nside entity action. It is comparable to Adventure audiences.\n\nIf you want two players to see a client item stack hovering above a chest shop, create a PlayerSpace instance for these\ntwo players with\n```Java\nPlayerSpace playerSpace = PlayerSpace.create().withPlayers(playerA, playerB).build();\n```\n\nYou should keep the reference to later remove the client entities. Also, whenever you used your PlayerSpace and don't need\nit anymore, call `playerSpace.close()` to unregister its listeners.\n\n### Summoning\n\nEntities can be spawned similar to the Spigot API. Some entity methods will throw an exception `ClientEntityMethodNotSupportedException`,\nwhich basically means that the method would not have any influence on the client entity and should therefore not be used. These\nare server-side methods.\n\n```Java \nDisplayText x = playerSpace.spawn(myLocation, DisplayText.class);\n```\n\n**Valid entities for now are:**\n- Armor Stand\n- Block Display\n- Thrown Egg\n- Ender Crystal\n- Thrown Ender Pearl\n- Experience Orb\n- Thrown Eye of Ender\n- Falling Block\n- Firework Rocket\n- Guardian\n- Guardian Beam\n- Interaction\n- Dropped Item\n- Item Display\n- Leash Knot\n- Snowball\n- Squid\n- Text Display\n- Thrown Experience Bottle\n- Thrown Item (any Texture)\n- Thrown Potion\n- Villager\n\nMore will come. If you require one entity in particular, just make an issue and I will add it first.\n\n### Listeners \n\nThere are wrappings for the entity interaction events.\nYou can therefore use\n\n```Java\n\nPlayerSpace.Listener\u003c?\u003e listener = playerSpace.registerListener(PlayerInteractEntityEvent.class, e -\u003e {\n  // do something with the event like with Spigot API\n});\nplayerSpace.unregisterListener(listener);\n```\n\n**Valid events for now are:**\n- PlayerInteractEntityEvent\n- PlayerInteractAtEntityEvent\n- EntityDamageByEntityEvent\n\n\n### Comparison\n#### ClientEntities\n\n````Java\nimport de.cubbossa.cliententities.PlayerSpaceImpl;\nimport org.bukkit.Location;\nimport org.bukkit.entity.FallingBlock;\nimport org.bukkit.util.Vector;\n\nimport java.util.UUID;\n\nclass Fountain {\n  PlayerSpace playerSpace;\n  Location location;\n  Vector direction;\n\n  public Fountain(UUID... players) {\n    playerSpace = PlayerSpace.create().withPlayersById(players).build();\n  }\n\n  void play() {\n    FallingBlock fountain = playerSpace.spawnFallingBlock(location, Material.WATER.createBlockData());\n    fountain.setVelocity(direction);\n    playerSpace.announce(fountain);\n  }\n}\n````\n\n**Advantages**\n- Custom update interval, not tick bound\n- Close to identical syntax to Spigot API, no learning of new API\n- Client-side only, only chosen players see the entity\n- No game state changes - the entity cannot change anything about the world\n- No server side lag\n\n**Disadvantages**\n- Every effect of the entity must be implemented by yourself (A falling block will e.g. not turn into a solid block when landing)\n- Bound to PacketEntities library\n\n#### Spigot\n\n````Java\n\nimport org.bukkit.Bukkit;\nimport org.bukkit.Location;\nimport org.bukkit.Material;\nimport org.bukkit.entity.FallingBlock;\nimport org.bukkit.entity.Player;\nimport org.bukkit.plugin.Plugin;\nimport org.bukkit.util.Vector;\n\nimport java.util.Arrays;\nimport java.util.Collection;\nimport java.util.UUID;\n\nclass Fountain {\n  final Plugin plugin;\n  final Collection\u003cUUID\u003e players;\n  Location location;\n  Vector direction;\n\n  public Fountain(Plugin plugin, UUID... players) {\n    this.plugin = plugin;\n    this.players = Arrays.asList(players);\n  }\n\n  void play() {\n    FallingBlock fountain = location.getWorld().spawnFallingBlock(location, Material.WATER.createBlockData());\n    fountain.setPersistent(false);\n    fountain.setVisibleByDefault(false);\n    fountain.setVelocity(direction);\n    fountain.setCancelDrop(true);\n    for (Player online : Bukkit.getOnlinePlayers()) {\n      if (!players.contains(online.getUniqueId())) {\n        continue;\n      }\n      online.showEntity(fountain, plugin);\n    }\n  }\n}\n````\n\n**Advantages**\n- No additional libraries required\n\n**Disadvantages**\n- Errors in code might change the actual world\n- Bound to main thread\n- Tons of entities can influence the TPS drastically\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcubbossa%2Fcliententities","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcubbossa%2Fcliententities","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcubbossa%2Fcliententities/lists"}