Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add simple BlockPosition based BlockStorage helpers. #4244

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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