_HungTeen_ Posted August 20, 2020 Share Posted August 20, 2020 (edited) I am making a WorldEventData class to save my world event set. private HashSet<Events> events = new HashSet<>(Events.values().length); When I add event to the set ,it seems ok. public void addEvent(Events ev) { events.add(ev); // System.out.println(events.contains(ev)); this.markDirty(); } If I use code below to check wheather it add correctly,it output nothing (means the event did't add correctly) @SuppressWarnings("resource") @SubscribeEvent public static void onPlayerRightClick(RightClickItem ev){ // System.out.println(ev.getWorld().getDayTime()); if(!ev.getWorld().isRemote) { WorldEventData data = WorldEventData.getOverWorldEventData(ev.getWorld()); for(Events event:Events.values()) { System.out.println(data.hasEvent(event)); } } } Codes which maybe related. WorldEventData : https://github.com/HungTeen/pvzmod/blob/dev/src/main/java/com/hungteen/pvz/world/data/WorldEventData.java RightClickEvent : https://github.com/HungTeen/pvzmod/blob/dev/src/main/java/com/hungteen/pvz/event/PVZPlayerEvent.java#L83 The place I add event : https://github.com/HungTeen/pvzmod/blob/dev/src/main/java/com/hungteen/pvz/event/OverWorldEvent.java#L64 Edited August 20, 2020 by _HungTeen_ Quote Link to comment Share on other sites More sharing options...
_HungTeen_ Posted August 20, 2020 Author Share Posted August 20, 2020 Ok,my bad . Its still a small mistake like last time. I forgot to break in switch 😅 Can I delete this topic? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.