Skip to content

Commit

Permalink
EVEN MORE JAVADOC
Browse files Browse the repository at this point in the history
  • Loading branch information
strubium committed Jul 11, 2024
1 parent 4d6c035 commit 6bafaaf
Show file tree
Hide file tree
Showing 14 changed files with 87 additions and 33 deletions.
10 changes: 5 additions & 5 deletions src/main/java/mcjty/theoneprobe/Utilities.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ public static String getProviderId(@Nonnull String name) {
/**
* Adds an ItemStack to a list, merging it with existing stacks if possible.
*
* @param stacks The list of ItemStacks to add to.
* @param foundItems A set of items already present in the stacks list.
* @param stack The ItemStack to add.
* @param stacks The list of {@link ItemStack}s to add to.
* @param foundItems A set of {@link Item}s already present in the stacks list.
* @param stack The {@link ItemStack} to add.
*/
public static void addItemStack(@Nonnull List<ItemStack> stacks, @Nonnull Set<Item> foundItems, @Nonnull ItemStack stack) {
if (stack.isEmpty()) return;
Expand All @@ -64,9 +64,9 @@ public static void addItemStack(@Nonnull List<ItemStack> stacks, @Nonnull Set<It
/**
* Displays the contents of a chest in the IProbeInfo.
*
* @param probeInfo The IProbeInfo to display the chest contents in.
* @param probeInfo The {@link IProbeInfo} to display the chest contents in.
* @param stacks The list of ItemStacks representing the chest contents.
* @param mode The mode of the probe.
* @param mode The current {@link ProbeMode}.
*/
public static void showChestContents(@Nonnull IProbeInfo probeInfo, @Nonnull List<ItemStack> stacks, @Nonnull ProbeMode mode) {
IProbeInfo vertical = probeInfo.vertical(probeInfo.defaultLayoutStyle().borderColor(ConfigSetup.chestContentsBorderColor).spacing(0));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
/**
* Implement this interface if you want a custom display for your own blocks instead of the standard
* display. This can be useful if you (for example) have a multiblock and want to show a picture of the
* entire multiblock instead of the itemstack that getPickBlock() would return.
* entire multiblock instead of just the itemstack that getPickBlock() would return.
*/
public interface IBlockDisplayOverride {

Expand Down
4 changes: 2 additions & 2 deletions src/main/java/mcjty/theoneprobe/api/IElement.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ public interface IElement {

/**
* Persist this element to the given network buffer. This should be symmetrical to
* what IElementFactory.createElement() expects.
* what {@link IElementFactory}.createElement() expects.
*/
void toBytes(ByteBuf buf);

/**
* Get the identifier for this element (as returned by ITheOneProbe.registerElementFactory()
* Get the identifier for this element as returned by {@link ITheOneProbe}.registerElementFactory()
*/
int getID();
}
2 changes: 1 addition & 1 deletion src/main/java/mcjty/theoneprobe/api/IElementFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ public interface IElementFactory {

/**
* Create an element from a network buffer. This should be
* symmetrical to what IElement.toBytes() creates.
* symmetrical to what {@link IElement}.toBytes() creates.
*/
IElement createElement(ByteBuf buf);
}
2 changes: 1 addition & 1 deletion src/main/java/mcjty/theoneprobe/api/IOverlayRenderer.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public interface IOverlayRenderer {
* This has to be called client side and you have to call it every
* frame for as long as you want this overlay to be visible.
*
* Typically you might want to call this in a RenderGameOverlayEvent.
* Typically, you might want to call this in a RenderGameOverlayEvent.
*
* Note that calling this does not prevent the normal overlay from
* rendering.
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/mcjty/theoneprobe/api/IProbeConfig.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package mcjty.theoneprobe.api;

/**
* This inerface represents the default config for The One Probe.
* This interface represents the default config for The One Probe.
*/
public interface IProbeConfig {

Expand Down
1 change: 1 addition & 0 deletions src/main/java/mcjty/theoneprobe/api/IProbeHitData.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ public interface IProbeHitData {
* Access the client-side result of getPickBlock() for the given block. That way
* you don't have to call this server side because that can sometimes be
* problematic
*
* @return the picked block or null
*/
@Nullable
Expand Down
14 changes: 11 additions & 3 deletions src/main/java/mcjty/theoneprobe/api/IProbeInfoAccessor.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,18 @@
public interface IProbeInfoAccessor {

/**
* Add information for the probe info for the given block. This is always
* called server side.
* The given <code>probeInfo</code> object represents a vertical layout. So adding elements to that
* Adds information for the probe info for the given block. This method is always
* called server-side.
*
* <p>The {@code probeInfo} object represents a vertical layout, so adding elements to it
* will cause them to be grouped vertically.
*
* @param mode The {@link ProbeMode} (e.g., NORMAL, EXTENDED).
* @param probeInfo The {@link IProbeInfo} object to which information should be added.
* @param player The player interacting with the probe.
* @param world The world in which the block exists.
* @param blockState The state of the block for which probe information is being added.
* @param data Additional hit data related to the probe interaction (e.g., hit position, side hit).
*/
void addProbeInfo(ProbeMode mode, IProbeInfo probeInfo, EntityPlayer player, World world, IBlockState blockState, IProbeHitData data);
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

/**
* You can implement this in your entity implementation if you want to support
* the probe. An alternative to this is to make an IProveInfoProvider.
* the probe. An alternative to this is to make an {@link IProbeInfoProvider}.
* Note that if you implement this then it will be called last (after all the providers)
*/
public interface IProbeInfoEntityAccessor {
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/mcjty/theoneprobe/api/ITheOneProbe.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ public interface ITheOneProbe {

/**
* Optionally: register a provider for your probe information. You don't have to do this, as you
* can also implement IProbeInfoAccessor in your block instead. If you register a provider
* can also implement {@link IProbeInfoAccessor} in your block instead. If you register a provider
* with the same string ID as one that already exists, it will replace that provider. This
* is one way to replace the standard providers. TheOneProbe has the following standard
* providers (registered in the given order):
Expand All @@ -29,7 +29,7 @@ public interface ITheOneProbe {

/**
* Optionally: register a provider for your probe information. You don't have to do this, as you
* can also implement IProbeInfoAccessor in your block instead. If you register a provider
* can also implement {@link IProbeInfoAccessor} in your block instead. If you register a provider
* with the same string ID as one that already exists it will replace that provider. This
* is one way to replace the standard providers. TheOneProbe has the following standard
* providers (registered in the given order):
Expand All @@ -47,7 +47,7 @@ public interface ITheOneProbe {
void registerEntityProvider(IProbeInfoEntityProvider provider);

/**
* Register an element factory.
* Register an {@link IElementFactory}.
* @return an id to use when defining elements using this factory
*/
int registerElementFactory(IElementFactory factory);
Expand Down
9 changes: 6 additions & 3 deletions src/main/java/mcjty/theoneprobe/api/ProbeMode.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@
* to show different information.
*/
public enum ProbeMode {
NORMAL, // Normal display. What a user expects to see
EXTENDED, // Extended. This is used when the player is sneaking
DEBUG // Creative only. This is used when the player holds a creative probe
/**Normal display. What a user probably expects to see*/
NORMAL,
/**Extended. This is shown when the player is sneaking*/
EXTENDED,
/**Creative only. This is shown when the player holds a creative probe*/
DEBUG
}
5 changes: 5 additions & 0 deletions src/main/java/mcjty/theoneprobe/api/TextStyleClass.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,11 @@ public String getReadableName() {
return readableName;
}

/**
* Returns a string representation of the enum constant,
* formatted as "{=code=}".
* @return String representation of the enum constant.
*/
@Override
public String toString() {
return "{=" + code + "=}";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,18 @@ private void showBrewingStandInfo(IProbeInfo probeInfo, World world, IProbeHitDa
}
}

/**
* Shows information specific to a mob spawner block in the probe info.
* This method checks if the block is a mob spawner and retrieves relevant information
* about the spawner's configured mob.
*
* @author Artemish
*
* @param probeInfo The {@link IProbeInfo} object where information about the mob spawner is added.
* @param world The {@link World} instance where the mob spawner exists.
* @param data Additional hit data related to the mob spawner probe.
* @param block The {@link Block} instance being probed, expected to be a mob spawner.
*/
private void showMobSpawnerInfo(IProbeInfo probeInfo, World world, IProbeHitData data, Block block) {
if (block instanceof BlockMobSpawner) {
TileEntity te = world.getTileEntity(data.getPos());
Expand Down Expand Up @@ -220,6 +232,18 @@ private void showRF(IProbeInfo probeInfo, World world, BlockPos pos) {
}
}

/**
* Adds information about Redstone Flux energy based on the given configuration.
* If the RF mode in the configuration is set to 1, a progress bar is displayed with specific styling.
* Otherwise, a text representation of the RF energy is shown.
*
* @author McJty
*
* @param probeInfo The {@link IProbeInfo} object to which the RF information will be added.
* @param config The {@link ProbeConfig} containing settings for displaying RF information.
* @param energy The current amount of RF energy.
* @param maxEnergy The maximum capacity of RF energy.
*/
private void addRFInfo(IProbeInfo probeInfo, ProbeConfig config, long energy, long maxEnergy) {
if (config.getRFMode() == 1) {
probeInfo.progress(energy, maxEnergy,
Expand Down Expand Up @@ -251,6 +275,19 @@ private void showGrowthLevel(IProbeInfo probeInfo, IBlockState blockState) {
}
}

/**
* Shows standard information about a block based on the probe configuration and mode.
* This method handles different types of blocks and their display in the probe info.
*
* @author McJty, Joseph C. Sible
*
* @param config The {@link IProbeConfig}.
* @param mode The {@link ProbeMode} determining the level of detail to show.
* @param probeInfo The {@link IProbeInfo} object where block information is added.
* @param blockState The {@link IBlockState} of the block being probed.
* @param block The {@link Block} being probed.
* @param data Additional hit data related to the block probe.
*/
public static void showStandardBlockInfo(IProbeConfig config, ProbeMode mode, IProbeInfo probeInfo, IBlockState blockState, Block block,
IProbeHitData data) {
String modid = Tools.getModName(block);
Expand Down Expand Up @@ -301,6 +338,6 @@ public static void showStandardBlockInfo(IProbeConfig config, ProbeMode mode, IP
probeInfo.vertical()
.text(MODNAME + modid);
}
}
}
}
}
22 changes: 11 additions & 11 deletions src/main/java/mcjty/theoneprobe/rendering/RenderHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,9 @@ public static boolean renderIcon(Minecraft mc, RenderItem itemRender, TextureAtl
* This method checks the count of the item stack and, based on the count, calls {@link #renderItemStack(Minecraft, RenderItem, ItemStack, int, int, String, boolean)}
* with the appropriate text to display.
*
* @param mc The Minecraft instance.
* @param itemRender The RenderItem instance used to render the item.
* @param itm The ItemStack to be rendered.
* @param mc The {@link Minecraft} instance.
* @param itemRender The {@link RenderItem} instance used to render the item.
* @param itm The {@link ItemStack} to be rendered.
* @param xo The x-coordinate where the item stack should be rendered.
* @param yo The y-coordinate where the item stack should be rendered.
* @param highlight A boolean indicating whether to highlight the item stack.
Expand Down Expand Up @@ -554,7 +554,7 @@ public static void drawBeam(Vector S, Vector E, Vector P, float width) {
/**
* Draws a quadrilateral using the specified Tessellator and four corner points.
*
* @param tessellator The Tessellator instance used for drawing.
* @param tessellator The {@link Tessellator} instance used for drawing.
* @param p1 The first vertex of the quadrilateral.
* @param p2 The second vertex of the quadrilateral.
* @param p3 The third vertex of the quadrilateral.
Expand All @@ -575,9 +575,9 @@ private static void drawQuad(Tessellator tessellator, Vector p1, Vector p2, Vect
/**
* Renders an ItemStack at a specified position with an optional overlay text.
*
* @param mc The Minecraft instance.
* @param itemRender The RenderItem instance to be used to render the item.
* @param itm The ItemStack to be rendered.
* @param mc The {@link Minecraft} instance.
* @param itemRender The {@link RenderItem} instance to be used to render the item.
* @param itm The {@link ItemStack} to be rendered.
* @param x The x-coordinate at which to render the item.
* @param y The y-coordinate at which to render the item.
* @param txt The overlay text to render on the item, can be null.
Expand Down Expand Up @@ -615,8 +615,8 @@ public static boolean renderItemStack(Minecraft mc, RenderItem itemRender, ItemS
/**
* Renders the stack size and/or damage bar for the given ItemStack in the GUI.
*
* @param fr The FontRenderer instance to be used to render text.
* @param stack The ItemStack for which the overlay is being rendered.
* @param fr The {@link FontRenderer} instance to be used to render text.
* @param stack The {@link ItemStack} for which the overlay is being rendered.
* @param xPosition The x-coordinate of the item position in the GUI.
* @param yPosition The y-coordinate of the item position in the GUI.
* @param text An optional text to display instead of the item count.
Expand Down Expand Up @@ -695,7 +695,7 @@ public static void renderItemOverlayIntoGUI(FontRenderer fr, ItemStack stack, in
/**
* Draws a colored rectangle using the provided BufferBuilder.
*
* @param renderer The BufferBuilder instance used to draw the rectangle.
* @param renderer The {@link BufferBuilder} instance used to draw the rectangle.
* @param x The x-coordinate of the top-left corner of the rectangle.
* @param y The y-coordinate of the top-left corner of the rectangle.
* @param width The width of the rectangle.
Expand All @@ -718,7 +718,7 @@ private static void draw(BufferBuilder renderer, int x, int y, int width, int he
/**
* Renders a text string on the screen at the specified coordinates.
*
* @param mc The Minecraft instance.
* @param mc The {@link Minecraft} instance.
* @param x The x-coordinate where the text will be rendered.
* @param y The y-coordinate where the text will be rendered.
* @param txt The text string to be rendered.
Expand Down

0 comments on commit 6bafaaf

Please sign in to comment.