1414import teamport .aether .block .AetherBlocks ;
1515import teamport .aether .compat .AetherPlugin ;
1616import teamport .aether .entity .AetherMobFallingToOverworld ;
17+ import teamport .aether .entity .animal .aerbunny .MobAerbunny ;
1718import teamport .aether .helper .unboxed .IntPair ;
1819import teamport .aether .net .message .SunspiritDeathNetworkMessage ;
1920import teamport .aether .world .biome .AetherBiomes ;
2728
2829public class AetherDimension {
2930
30- private static final int SCHEMA_VERSION = 2 ;
31+ private static final int SCHEMA_VERSION = 3 ;
3132
3233 public static final int OVERWORLD_RETURN_HEIGHT = 270 ;
3334 public static final int DUNGEON_GENERATION_RADIUS = 16 ;
@@ -38,6 +39,8 @@ public class AetherDimension {
3839 private static final HashMap <Integer , List <Integer >> DIMENSION_PLACEMENT_BLACKLIST = new HashMap <>();
3940
4041 private static final HashMap <UUID , Boolean > HAS_RECEIVED_PARACHUTE_MAP = new HashMap <>();
42+ private static final HashMap <UUID , CompoundTag > HAS_BUNNY_MAP = new HashMap <>();
43+
4144
4245 public static List <Integer > getDimensionBlacklist (Dimension dimension ) {
4346 return getDimensionBlacklist (dimension .id );
@@ -132,6 +135,21 @@ public static void unlockDaylightCycle(World world) {
132135 }
133136 }
134137
138+ public static MobAerbunny popBunnyFromPlayer (UUID uuidPlayer , World world ) {
139+ CompoundTag tag = HAS_BUNNY_MAP .remove (uuidPlayer );
140+ if (tag == null ) return null ;
141+ MobAerbunny mobAerbunny = (MobAerbunny ) EntityDispatcher .createEntityFromNBT (tag , world );
142+ world .entityJoinedWorld (mobAerbunny );
143+ return mobAerbunny ;
144+ }
145+
146+ public static void addBunnyToPlayer (UUID uuidPlayer , MobAerbunny mobAerbunny ) {
147+ CompoundTag tag = new CompoundTag ();
148+ mobAerbunny .save (tag );
149+ mobAerbunny .remove ();
150+ HAS_BUNNY_MAP .put (uuidPlayer , tag );
151+ }
152+
135153 public static boolean canGetParachute (UUID uuid ) {
136154 boolean result = !HAS_RECEIVED_PARACHUTE_MAP .computeIfAbsent (uuid , it -> false );
137155 return result ;
@@ -235,6 +253,13 @@ public static void saveWorldData(CompoundTag aetherWorldData) {
235253 entitiesToMoveMap .addTag (entryCompound );
236254 }
237255
256+ CompoundTag bunnyMap = new CompoundTag ();
257+ for (Map .Entry <UUID , CompoundTag > entry : HAS_BUNNY_MAP .entrySet ()) {
258+ bunnyMap .put (entry .getKey ().toString (), entry .getValue ());
259+ }
260+
261+ aetherWorldData .putInt (AetherMod .MOD_ID + ".bunnyMap" , SCHEMA_VERSION );
262+
238263 aetherWorldData .putInt (AetherMod .MOD_ID + ".__SCHEMA_VERSION__" , SCHEMA_VERSION );
239264 aetherWorldData .put (AetherMod .MOD_ID + ".overworldFallen" , entitiesToMoveMap );
240265 DungeonMap .save (aetherWorldData );
@@ -253,6 +278,10 @@ public static void loadWorldData(CompoundTag aetherWorldData) {
253278 HAS_RECEIVED_PARACHUTE_MAP .clear ();
254279 CompoundTag canReceiveParachuteCompound = aetherWorldData .getCompound (AetherMod .MOD_ID + ".canReceiveParachute" );
255280 canReceiveParachuteCompound .getValues ().forEach (it -> HAS_RECEIVED_PARACHUTE_MAP .put (UUID .fromString (it .getTagName ()), ((Byte ) it .getValue ()) > 0 ));
281+
282+ HAS_BUNNY_MAP .clear ();
283+ CompoundTag bunnyCompound = aetherWorldData .getCompound (AetherMod .MOD_ID + ".bunnyMap" );
284+ bunnyCompound .getValues ().forEach (it -> HAS_BUNNY_MAP .put (UUID .fromString (it .getTagName ()), (CompoundTag ) it ));
256285 }
257286
258287 public static void loadDimensionData (CompoundTag dimensionData ) {
0 commit comments