Skip to content

Commit 4ff21f8

Browse files
committed
Add overload and javadocs for aforementioned extracted method
1 parent d9ad9d8 commit 4ff21f8

File tree

1 file changed

+22
-1
lines changed

1 file changed

+22
-1
lines changed

src/main/java/gregtech/api/util/FTBChunksUtil.java

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,37 @@
1111
import com.feed_the_beast.ftbutilities.data.ClaimedChunks;
1212
import org.jetbrains.annotations.NotNull;
1313

14+
import java.util.UUID;
15+
1416
public class FTBChunksUtil {
1517

18+
/**
19+
* Check if a {@link BlockPos} is modifiable by a player abiding by FTB chunk rules, if this block is in a claimed
20+
* chunk. <br/>
21+
* Will always return {@code true} if
22+
* <a href="https://www.curseforge.com/minecraft/mc-mods/ftb-utilities-forge">FTBUtilities</a> isn't present or the
23+
* {@link BlockPos} isn't in a claimed chunk.
24+
*/
1625
public static boolean isBlockModifiableByPlayer(@NotNull World world, @NotNull BlockPos blockPos,
1726
@NotNull EntityPlayer player) {
27+
return isBlockModifiableByPlayer(world, blockPos, player.getUniqueID());
28+
}
29+
30+
/**
31+
* Check if a {@link BlockPos} is modifiable by a player abiding by FTB chunk rules, if this block is in a claimed
32+
* chunk. <br/>
33+
* Will always return {@code true} if
34+
* <a href="https://www.curseforge.com/minecraft/mc-mods/ftb-utilities-forge">FTBUtilities</a> isn't present or the
35+
* {@link BlockPos} isn't in a claimed chunk.
36+
*/
37+
public static boolean isBlockModifiableByPlayer(@NotNull World world, @NotNull BlockPos blockPos,
38+
@NotNull UUID playerID) {
1839
if (!Mods.FTB_UTILITIES.isModLoaded()) return true;
1940

2041
ClaimedChunks instance = ClaimedChunks.instance;
2142
ClaimedChunk claimedChunk = instance.getChunk(new ChunkDimPos(blockPos, world.provider.getDimension()));
2243
if (claimedChunk != null) {
23-
ForgePlayer forgePlayer = instance.universe.getPlayer(player.getUniqueID());
44+
ForgePlayer forgePlayer = instance.universe.getPlayer(playerID);
2445
EnumTeamStatus status = claimedChunk.getData().getEditBlocksStatus();
2546
return !claimedChunk.getTeam().hasStatus(forgePlayer, status);
2647
}

0 commit comments

Comments
 (0)