Skip to content

Commit

Permalink
added comments
Browse files Browse the repository at this point in the history
Co-authored-by: Space Toad <spacetoadcraft@gmail.com>
  • Loading branch information
halotroop2288 and SpaceToad committed Aug 18, 2024
1 parent 97b0a3c commit 9b6d8a4
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
// TODO(halotroop2288): Convert this to GSON

/**
* This class offers advanced configurations capabilities,
* allowing to provide various categories for configuration variables.
*
* @author Space Toad
* @since 1.0.0
*/
Expand All @@ -27,6 +30,8 @@ public class Configuration {
public TreeMap<String, Property> generalProperties = new TreeMap<>();

/**
* Create a configuration for the file given.
*
* @author Space Toad
* @since 1.0.0
*/
Expand All @@ -35,6 +40,14 @@ public Configuration(@NotNull File file) {
}

/**
* Gets or create a block id property.<br>
* If the block id property key is already in the configuration, then it will be used.
* Otherwise, {@code defaultID} will be used, except if already taken,
* in which case this will try to determine a free default id.
*
* @param key the key to get or create a property for
* @param defaultID the id to try to use if the property doesn't already exist
*
* @author Space Toad
* @since 1.0.0
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

import net.minecraft.src.*;
import net.minecraftforge.injection.ForgeItemTool;
import org.jetbrains.annotations.ApiStatus;

import java.util.*;

Expand All @@ -18,28 +19,37 @@ public class MinecraftForge {
private static final LinkedList<IHarvestHandler> harvestHandlers = new LinkedList<>();

/**
* This is not supposed to be called outside of Minecraft internals.
*
* @author Space Toad
* @since 1.0.0
*/
@ApiStatus.Internal
public static ItemStack fillCustomBucket(World world, int x, int y, int z) {
return bucketHandlers.stream().map(handler -> handler.fillCustomBucket(world, x, y, z))
.filter(Objects::nonNull).findFirst().orElse(null);
.filter(Objects::nonNull).findFirst().orElse(null);
}

/**
* This is not supposed to be called outside of Minecraft internals.
*
* @author Space Toad
* @since 1.0.0
*/
@ApiStatus.Internal
public static void populateBiome(World world, BiomeGenBase biome, int chunkX, int chunkZ) {
biomePopulators.forEach(populator -> populator.populate(world, biome, chunkX, chunkZ));
}

/**
* This is not supposed to be called outside of Minecraft internals.
*
* @param tool the tool used to harvest the block
* @param block the block to be harvested
* @author Space Toad
* @since 1.0.0
*/
@ApiStatus.Internal
public static boolean canHarvestBlock(ItemTool tool, Block block) {
return harvestHandlers.stream().anyMatch(handler -> handler.canHarvestBlock(tool, block));
}
Expand All @@ -60,6 +70,8 @@ public static void addPickaxeBlockEffectiveAgainst(Block block) {
}

/**
* Registers a new custom bucket handler.
*
* @author Space Toad
* @since 1.0.0
*/
Expand All @@ -68,6 +80,8 @@ public static void registerCustomBucketHandler(IBucketHandler bucketHandler) {
}

/**
* Registers a new biome contributor.
*
* @author Space Toad
* @since 1.0.0
*/
Expand All @@ -76,6 +90,8 @@ public static void registerBiomePopulate(IBiomePopulator biomePopulator) {
}

/**
* Registers a new harvest handler.
*
* @author Space Toad
* @since 1.0.0
*/
Expand Down

0 comments on commit 9b6d8a4

Please sign in to comment.