Skip to content

Commit

Permalink
[CI skip] Add simple BlockPosition based BlockStorage helpers. (#4244)
Browse files Browse the repository at this point in the history
* Add simple `BlockPosition` based helpers for BlockStorage to help ease the transition between `Location` and `BlockStorage`

* Fix build.
  • Loading branch information
ProfElements authored Jan 11, 2025
1 parent d12ae85 commit 9ce8955
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/main/java/me/mrCookieSlime/Slimefun/api/BlockStorage.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
import com.google.gson.JsonParser;
import com.google.gson.stream.JsonWriter;

import io.github.bakedlibs.dough.blocks.BlockPosition;
import io.github.bakedlibs.dough.common.CommonPatterns;
import io.github.thebusybiscuit.slimefun4.api.items.SlimefunItem;
import io.github.thebusybiscuit.slimefun4.implementation.Slimefun;
Expand Down Expand Up @@ -513,10 +514,18 @@ public static String getLocationInfo(Location l, String key) {
return getLocationInfo(l).getString(key);
}

public static String getLocationInfo(BlockPosition l, String key) {
return getLocationInfo(l.toLocation()).getString(key);
}

public static void addBlockInfo(Location l, String key, String value) {
addBlockInfo(l, key, value, false);
}

public static void addBlockInfo(BlockPosition l, String key, String value) {
addBlockInfo(l.toLocation(), key, value, false);
}

public static void addBlockInfo(Block block, String key, String value) {
addBlockInfo(block.getLocation(), key, value);
}
Expand All @@ -525,6 +534,10 @@ public static void addBlockInfo(Block block, String key, String value, boolean u
addBlockInfo(block.getLocation(), key, value, updateTicker);
}

public static void addBlockInfo(BlockPosition l, String key, String value, boolean updateTicker) {
addBlockInfo(l.toLocation(), key, value, updateTicker);
}

public static void addBlockInfo(Location l, String key, String value, boolean updateTicker) {
Config cfg = getLocationInfo(l);

Expand Down

0 comments on commit 9ce8955

Please sign in to comment.