Posted August 20, 20205 yr 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, 20205 yr by _HungTeen_
August 20, 20205 yr Author Ok,my bad . Its still a small mistake like last time. I forgot to break in switch 😅 Can I delete this topic?
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.