Posted July 27, 20223 yr Hello, I have an entity and I want to make it unable to trigger sculk sensors like Warden. I looked the Warden's code but I couldn't find anything that I can use. How I can implement that feature? Edited July 27, 20223 yr by FantaLaTone solved
July 27, 20223 yr This is not something I have ever looked at before, but; Both Wardens and Sculk Sensors implement VibrationListener.VibrationListenerConfig. This class by default listens for GameEvents with the tag GameEventTags.VIBRATIONS. Entities emit vibrations in that tag, see callers of Entity.gameEvent() so you can always override that method to suppress events you don't want to emit. This may have unwanted side-effects if the event is used for other behaviours, e.g. playing sounds However, if you look at VibrationListenerConfig.isValidVibration(), it checks Entity.dampensVibrations() so I guess you can override that method in your entity to return true? Boilerplate: If you don't post your logs/debug.log we can't help you. For curseforge you need to enable the forge debug.log in its minecraft settings. You should also post your crash report if you have one. If there is no error in the log file and you don't have a crash report then post the launcher_log.txt from the minecraft folder. Again for curseforge this will be in your curseforge/minecraft/Install Large files should be posted to a file sharing site like https://gist.github.com You should also read the support forum sticky post.
July 27, 20223 yr Author 1 hour ago, warjort said: This is not something I have ever looked at before, but; Both Wardens and Sculk Sensors implement VibrationListener.VibrationListenerConfig. This class by default listens for GameEvents with the tag GameEventTags.VIBRATIONS. Entities emit vibrations in that tag, see callers of Entity.gameEvent() so you can always override that method to suppress events you don't want to emit. This may have unwanted side-effects if the event is used for other behaviours, e.g. playing sounds However, if you look at VibrationListenerConfig.isValidVibration(), it checks Entity.dampensVibrations() so I guess you can override that method in your entity to return true? Yeah, you were right. Making mobs silent for sculk sensors is really easy. Make sure your mob is implementing these: implements VibrationListener.VibrationListenerConfig And then override these methods: @Override public boolean canTriggerAvoidVibration() { return true; // Actions will not cause vibration } @Override public boolean shouldListen(ServerLevel p_223872_, GameEventListener p_223873_, BlockPos p_223874_, GameEvent p_223875_, GameEvent.Context p_223876_) { return false; // Do not listen vibrations } @Override public void onSignalReceive(ServerLevel p_223865_, GameEventListener p_223866_, BlockPos p_223867_, GameEvent p_223868_, @Nullable Entity p_223869_, @Nullable Entity p_223870_, float p_223871_) { } @Override // I DON'T KNOW WHAT THIS ONE DO :( public boolean alwaysAccepts() { return false; }
July 27, 20223 yr Author 4 minutes ago, FantaLaTone said: Yeah, you were right. Making mobs silent for sculk sensors is really easy. Make sure your mob is implementing these: implements VibrationListener.VibrationListenerConfig And then override these methods: @Override public boolean canTriggerAvoidVibration() { return true; // Actions will not cause vibration } @Override public boolean shouldListen(ServerLevel p_223872_, GameEventListener p_223873_, BlockPos p_223874_, GameEvent p_223875_, GameEvent.Context p_223876_) { return false; // Do not listen vibrations } @Override public void onSignalReceive(ServerLevel p_223865_, GameEventListener p_223866_, BlockPos p_223867_, GameEvent p_223868_, @Nullable Entity p_223869_, @Nullable Entity p_223870_, float p_223871_) { } @Override // I DON'T KNOW WHAT THIS ONE DO :( public boolean alwaysAccepts() { return false; } You don't need last method my bad!
July 27, 20223 yr You seem to have a habit of asking questions then doing something completely different to what we tell you. 🙂 I don't understand why doing the above would solve your requirement? I don't see why it would do anything at all, since all you have done is implement the configuration policy, but you don't have a listener to configure? Boilerplate: If you don't post your logs/debug.log we can't help you. For curseforge you need to enable the forge debug.log in its minecraft settings. You should also post your crash report if you have one. If there is no error in the log file and you don't have a crash report then post the launcher_log.txt from the minecraft folder. Again for curseforge this will be in your curseforge/minecraft/Install Large files should be posted to a file sharing site like https://gist.github.com You should also read the support forum sticky post.
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.