RhysB / Project-Poseidon

A CraftBukkit CB1060 fork for Beta 1.7.3 fixing bugs and adding basic features
https://discord.gg/FwKg676
GNU General Public License v3.0
85 stars 29 forks source link

Add Block.getDrops() and Block.breakNaturally() #85

Closed Meep3692 closed 4 months ago

Meep3692 commented 5 months ago

Modern versions of Spigot have an api for figuring out what drops a block will provide and for breaking it. This api was understandably absent from Poseidon due to the way old Minecraft handled block drops (blocks would just spawn item entities in their break method). Most of the changed are in NMS so we can query what drops a block will have before breaking it. I don't know how insistent we are about those //Poseidon start and //Poseidon end comments in modified NMS code. If we really want them, we should do it before merging these changes so we can reference the diff to see what's been changed. I also did some refactoring of NMS code to help reverse engineer the block breaking and dropping process. I figure since we don't use the decompile->deobfuscate->patch->recompile method used by modern Spigot and because we don't need to worry about keeping deobfuscation mappings between versions, there's no harm in some manual deobfustation.

notdevcody commented 5 months ago

You see, you need to be very careful about renaming NMS methods. Some plugins (like spout) use reflection to change the NMS code and that could break such (also includes plugins using the nms methods).

Meep3692 commented 5 months ago

I believe I have reverted all the name changes. I see Spout come up a lot in conversations about NMS reflection, does anyone have link to the beta 1.7.3 version of the spout client and plugin? It would be really useful to have something that breaks easily to use for testing in the future.

Moresteck commented 5 months ago

Any plugin that bypasses Bukkit is likely to break. The most notable example I've been using is the Citizens plugin, if you need something easier than Spout

RhysB commented 4 months ago

Apologies for the long delay, this change is approved and merged.

RhysB commented 4 months ago

@Meep3692 RetroMC updated to the latest Poseidon last night and encountered multiple issues as a result of this pull request.

It was observed that breaking tall grass can “chunk ban” the player if it attempts to drop seeds. Potentially this change makes it try to drop an invalid item. The client crashes when rendering the dropped item or it is in the inventory according to my staff.

Still happy for this change once these issues are resolved. If you need additional info happy to discuss it here or on Discord.

Please see the attached screenshots Chunk Ban due to invalid item Error rate on RetroMC Message when kicked