Skip to content

Commit

Permalink
initial wiki
Browse files Browse the repository at this point in the history
  • Loading branch information
darksoulq committed Jan 6, 2025
1 parent 39f49b9 commit a34b15e
Show file tree
Hide file tree
Showing 23 changed files with 162 additions and 264 deletions.
3 changes: 0 additions & 3 deletions .idea/.gitignore

This file was deleted.

8 changes: 8 additions & 0 deletions .idea/WhatIsThat.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 0 additions & 13 deletions .idea/compiler.xml

This file was deleted.

14 changes: 0 additions & 14 deletions .idea/discord.xml

This file was deleted.

7 changes: 0 additions & 7 deletions .idea/encodings.xml

This file was deleted.

55 changes: 0 additions & 55 deletions .idea/jarRepositories.xml

This file was deleted.

12 changes: 0 additions & 12 deletions .idea/material_theme_project_new.xml

This file was deleted.

14 changes: 0 additions & 14 deletions .idea/misc.xml

This file was deleted.

2 changes: 1 addition & 1 deletion .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

124 changes: 0 additions & 124 deletions .idea/uiDesigner.xml

This file was deleted.

2 changes: 1 addition & 1 deletion .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

42 changes: 42 additions & 0 deletions Writerside/topics/Block-Handlers.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Block Handlers

Block Handlers can be used to display info for the blocks that the player is looking at.

<procedure title="Adding a Block Handler" id="adding_a_block_handler">
<step>Make a class which will hold our handler funtion.</step>
<step>Make a function which will be the handler.
<code-block lang="java">
private static boolean handleMyBlock(Block block, Player player) {
// Check if this block belongs to your blocks
if (/* your condition */) {
// Add your logic
WITAPI.updateBar(yourInfo, player);
// `yourInfo` is the string shown on the boss bar.
// `player` is the one received by the handler from the plugin.

return true; // Block successfully handled
}

return false; // Not your block, skip it
}
</code-block>
</step>
<step>Now that you have made a handler, you must register the handler so it's actually used by WIT, this can be done by:
<code-block lang="Java">
WITAPI.addBlockHandler(YourClass::handleMyBlock);
</code-block>
</step>
<step>That's it! you have now successfully made a Block Handler!</step>
<step>A complete example of a block handler (this uses the internal [WAILAManager]):
<code-block lang="Java" src="../../src/main/java/me/darksoul/whatIsThat/compatibility/MinetorioCompat.java">
</code-block>
</step>
</procedure>

<procedure title="Removing a Block Handler" id="removing_a_block_handler">
<step>Removing a block handler is a one-liner!:
<code-block lang="Java">
WITAPI.removeBlockHandler(YourClass::BlockHandlerFunc)
</code-block>
</step>
</procedure>
22 changes: 22 additions & 0 deletions Writerside/topics/Default-Handlers.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Default Handlers

<tabs xmlns="">
<tab title="Block Handlers">
<code-block lang="Java">
LiteFarmCompat::handleLitefarmCrop
MinetorioCompat::handleMTDisplay
ItemsAdderCompat::handleIABlocks
SlimefunCompat::handleSlimefunMachines
NexoCompat::handleNexoBlock
</code-block>
</tab>
<tab title="Entity Handlers">
<code-block lang="Java">
ValhallaMMOCompat::handleVMMOEntity
ItemsAdderCompat::handleIAEntity
EliteMobsCompat::handleEMEntity
AuraMobsCompat::handleAuraMobs
NexoCompat::handleNexoEntity
</code-block>
</tab>
</tabs>
30 changes: 30 additions & 0 deletions Writerside/topics/Entity-Handlers.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Entity Handlers

Entity handlers can be used to display info about the entity the player is looking at.

<procedure title="Adding an Entity Handler" id="adding_an_entity_handler">
<step>Make a class which will hold our Handler.</step>
<step>Make a function which will be our handler.
<code-block lang="Java">
private static boolean handleMyEntity(Entity entity, Player player) {
if (/* your condition */) {
// Your logic here
WITAPI.updateBar(yourInfo, player);
return true; // Successfully handled the entity
}

return false; // Not your entity, skip it
}
</code-block>
</step>
<step>Now that you have made the Handler, you must register it.
<code-block lang="Java">
WITAPI.addEntityHandler(YourClass::handleMyEntity);
</code-block>
</step>
<step>That's it, you have made you entity handler!</step>
<step>A complete example of an entity handler (this uses the internal [WAILAManager]):
<code-block lang="Java" src="../../src/main/java/me/darksoul/whatIsThat/compatibility/EliteMobsCompat.java">
</code-block>
</step>
</procedure>
7 changes: 7 additions & 0 deletions Writerside/topics/api.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# API

## What can you do:

- Inject Handlers for Blocks
- Inject Handlers for Entities
- Remove Handlers (Including Defaults)
Loading

0 comments on commit a34b15e

Please sign in to comment.