Skip to content

Commit

Permalink
Update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
codetaylor committed Dec 6, 2018
1 parent ef9e82a commit fba650c
Show file tree
Hide file tree
Showing 8 changed files with 100 additions and 19 deletions.
2 changes: 1 addition & 1 deletion docs/examples/_template.md
@@ -1,6 +1,6 @@

!!! note
If you find any issues with the examples, please [report them here](https://github.com/codetaylor/dropt/issues).
To report an issue, or to request a new example, please use the [issue tracker](https://github.com/codetaylor/dropt/issues).

---

Expand Down
4 changes: 2 additions & 2 deletions docs/examples/advanced_fortune.md
@@ -1,6 +1,6 @@

!!! note
If you find any issues with the examples, please [report them here](https://github.com/codetaylor/dropt/issues).
To report an issue, or to request a new example, please use the [issue tracker](https://github.com/codetaylor/dropt/issues).

---

Expand Down Expand Up @@ -59,7 +59,7 @@ Dropt.list("list_name")

### JSON

```js
```json
{
"rules": [
{
Expand Down
10 changes: 2 additions & 8 deletions docs/examples/basic_replacement.md
@@ -1,6 +1,6 @@

!!! note
If you find any issues with the examples, please [report them here](https://github.com/codetaylor/dropt/issues).
To report an issue, or to request a new example, please use the [issue tracker](https://github.com/codetaylor/dropt/issues).

---

Expand All @@ -16,9 +16,7 @@ import mods.dropt.Dropt;
Dropt.list("list_name")

.add(Dropt.rule()
// whitelist match against these blocks
.matchBlocks(["minecraft:stone"])
// drop these items
.addDrop(Dropt.drop()
.items([<minecraft:string>])
)
Expand All @@ -27,19 +25,17 @@ Dropt.list("list_name")

### JSON

```js
```json
{
"rules": [
{
"match": {
// whitelist match against these blocks
"blocks": {
"blocks": [
"minecraft:stone:0"
]
}
},
// drop these items
"drops": [
{
"item": {
Expand All @@ -63,11 +59,9 @@ public void on(DroptLoadRulesEvent event) {
List<IDroptRuleBuilder> list = new ArrayList<>();

list.add(DroptAPI.rule()
// whitelist match against these blocks
.matchBlocks(new String[]{
"minecraft:stone"
})
// drop these items
.addDrops(new IDroptDropBuilder[]{
DroptAPI.drop().items(new String[]{
DroptAPI.itemString(Items.STRING)
Expand Down
4 changes: 2 additions & 2 deletions docs/examples/grass_drops.md
@@ -1,6 +1,6 @@

!!! note
If you find any issues with the examples, please [report them here](https://github.com/codetaylor/dropt/issues).
To report an issue, or to request a new example, please use the [issue tracker](https://github.com/codetaylor/dropt/issues).

---

Expand Down Expand Up @@ -34,7 +34,7 @@ Dropt.list("list_name")

### JSON

```js
```json
{
"rules": [
{
Expand Down
86 changes: 86 additions & 0 deletions docs/examples/leaf_drops.md
@@ -0,0 +1,86 @@

!!! note
To report an issue, or to request a new example, please use the [issue tracker](https://github.com/codetaylor/dropt/issues).

---

Goal: Add `<minecraft:stick>` to leaf drops.

---

Leaf blocks have a different block state depending on whether or not they should check for decay. This makes it hard to know what metadata needs to be supplied to the matcher.

Fortunately, Dropt has a command to assist: `/dropt verbose`.

The command can be toggled on and off, and while on, will log the info of all broken blocks. So run the command, break some blocks, and inspect the results to extract the info you need.

---

### ZenScript

```js
import mods.dropt.Dropt;

Dropt.list("list_name")

.add(Dropt.rule()
.matchBlocks(["minecraft:leaves:*"])
.addDrop(Dropt.drop()
.items([<minecraft:stick>])
)
);
```

### JSON

```json
{
"rules": [
{
"match": {
"blocks": {
"blocks": [
"minecraft:leaves:*"
]
}
},
"replaceStrategy": "ADD",
"drops": [
{
"item": {
"items": [
"minecraft:stick"
]
}
}
]
}
]
}
```

### DroptAPI

```java
@SubscribeEvent
public void on(DroptLoadRulesEvent event) {

List<IDroptRuleBuilder> list = new ArrayList<>();

list.add(DroptAPI.rule()
.matchBlocks(new String[]{
"minecraft:leaves:*"
})
.replaceStrategy(EnumReplaceStrategy.ADD)
.addDrops(new IDroptDropBuilder[]{
DroptAPI.drop().items(new String[]{
DroptAPI.itemString(Items.STICK)
})
})
);

ResourceLocation resourceLocation = new ResourceLocation("my_mod_id", "rule_list_name");
int priority = 0;
DroptAPI.registerRuleList(resourceLocation, priority, list);
}
```
@@ -1,6 +1,6 @@

!!! note
If you find any issues with the examples, please [report them here](https://github.com/codetaylor/dropt/issues).
To report an issue, or to request a new example, please use the [issue tracker](https://github.com/codetaylor/dropt/issues).

---

Expand Down Expand Up @@ -29,7 +29,7 @@ Dropt.list("list_name")

### JSON

```js
```json
{
"rules": [
{
Expand All @@ -46,7 +46,7 @@ Dropt.list("list_name")
]
}
},
"replaceStrategy": "REPLACE_ITEMS"
"replaceStrategy": "REPLACE_ITEMS",
"drops": [{}]
}
]
Expand Down
4 changes: 2 additions & 2 deletions docs/examples/tool_restriction.md
@@ -1,6 +1,6 @@

!!! note
If you find any issues with the examples, please [report them here](https://github.com/codetaylor/dropt/issues).
To report an issue, or to request a new example, please use the [issue tracker](https://github.com/codetaylor/dropt/issues).

---

Expand Down Expand Up @@ -39,7 +39,7 @@ Dropt.list("list_name")

### JSON

```js
```json
{
"rules": [
{
Expand Down
3 changes: 2 additions & 1 deletion mkdocs.yml
Expand Up @@ -10,8 +10,9 @@ pages:
- Debugging: debugging.md
- Examples:
- Basic Replacement: examples/basic_replacement.md
- Basic Removal: examples/basic_removal.md
- Selective Removal: examples/selective_removal.md
- Grass Drops: examples/grass_drops.md
- Leaf Drops: examples/leaf_drops.md
- Tool Restriction: examples/tool_restriction.md
- Advanced Fortune: examples/advanced_fortune.md
- ZenScript:
Expand Down

0 comments on commit fba650c

Please sign in to comment.