Created
September 6, 2024 15:42
-
-
Save Densamisten/3cedb0fe262980ab6ce76d6dc2ec92cd to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package exonihility.client.mixin; | |
| import exonihility.client.module.ModuleManager; | |
| import net.minecraft.client.world.ClientWorld; | |
| import net.minecraft.entity.Entity; | |
| import org.spongepowered.asm.mixin.Mixin; | |
| import org.spongepowered.asm.mixin.injection.At; | |
| import org.spongepowered.asm.mixin.injection.Inject; | |
| import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; | |
| @Mixin(ClientWorld.class) | |
| public class ClientWorldMixin { | |
| @Inject(at = @At("RETURN"), method = "getEntities", cancellable = true) | |
| private void getEntities(CallbackInfoReturnable<Iterable<Entity>> cir) { | |
| if (ModuleManager.getInstance.getModuleByName("lookout").isEnabled()) { | |
| Iterable<Entity> entities = cir.getReturnValue(); // Get the returned iterable of entities | |
| for (Entity entity : entities) { | |
| String entityName = entity.getDisplayName().getString(); | |
| System.out.println("Entity Name: " + entityName); | |
| } | |
| cir.setReturnValue(entities); | |
| cir.cancel(); // Cancel to prevent further handling of this method | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment