-
Notifications
You must be signed in to change notification settings - Fork 2
(1.16 ) Pebble
That was a Wall of Text huh?
Glad we skipped all of it and entered this Page.
If you don't understand what's going on, don't blame me :)
So, a Pebble huh?
Kinda generic, but iconic.
But let's get going.
This Page will contain, different versions of the classic "pebble" feature, introduced with Botania:GardenOfGlass.
Going with the generic one, that kind that will be sufficient for 80% of cases.
Let's break down the Feature, what we want, what we maybe don't want.
We don't want it to be triggered with anything else than the bare fist.
Also only want it, with only the main hand empty, the off-hand should not impact it, in any way.
Also digging this long, sure exhausts you...
There is 1 last thing we need... Did you get what it is?
The loot... we'll need a custom Loot Table...
Yet again I recommend the Loot Table Generator linked on (1.16+) Getting Started.
Getting everything ready, we now have within our properties:
- scavenge_player:is_hand_empty
- scavenge_player:is_hand
- scavenge_player:add_exhaustion
In our loot we want to specify the path, including a Condition of 85% to spawn the Loot.
Finally we want to specify which block should be affected. In this case we want 2 Blocks: Grass and Dirt.
"is_hand_empty" checks if our hands are empty, if true it continues to the next property.
our next property "is_hand" checks if it should check main-hand or off-hand. as we didnt change anything, it is by default on main-hand = true.
Both combined will now simply check if the Players main-hand is empty.
If our main hand is empty, it will now add Exhaustion to the Player, if there are no further Conditions or Effects, it will now try to generate our loot.
Your Script should now like similar or equal to this:
Script
{
"scripts": {
"id": "test:pebble",
"swing": true,
"drop_rule": "block",
"properties": [
{
"property": "scavenge_player:is_hand_empty"
},
{
"property": "scavenge_player:is_hand"
},
{
"property": "scavenge_utils:conditional_effect",
"test": {
"property": "scavenge_player:real_player"
},
"true": {
"property": "scavenge_player:add_exhaustion",
"exhaustion": 0.1
},
"false": {
"property": "scavenge_utils:default_effect"
}
}
],
"loot": [
{
"lootPool": "minecraft:pebble",
"conditions": [
{
"property": "scavenge_utils:random",
"chance": 85.0
}
]
}
],
"type": {
"type": "right_click",
"consume": true,
"show": true
},
"targets": [
{
"type": "blocks",
"id": [
"minecraft:grass_block",
"minecraft:dirt"
]
}
]
}
}
Loot Pool JSON
{
"pools": [
{
"rolls": 1,
"entries": [
{
"type": "minecraft:item",
"name": "minecraft:cobblestone"
}
]
}
]
}
As supposed to, Variant 1 was very simple, besides maybe the Conditional Effect. How about we add a little bit to it, to make it more satisfying for the Player, shall we?
So how can the Player Experience be improved?
2 very Common things in ALMOST every game!!!
Eh? You got? So, if you thought about sfx and gfx you're right :)
Scavenge allows us to add Sound Effects on execution, such as spawning Particles!
Why would you need that? Try playing this game without any Sound or Effects... It would get pretty stale doesn't it?
So here we go:
Script
{
"scripts": {
"id": "test:pebble",
"swing": true,
"drop_rule": "block",
"properties": [
{
"property": "scavenge_player:is_hand_empty"
},
{
"property": "scavenge_player:is_hand"
},
{
"property": "scavenge_utils:conditional_effect",
"test": {
"property": "scavenge_player:real_player"
},
"true": {
"property": "scavenge_player:add_exhaustion",
"exhaustion": 0.1
},
"false": {
"property": "scavenge_utils:default_effect"
}
},
{
"property": "scavenge_utils:conditional_effect",
"test": {
"property": "scavenge_player:limit_action",
"id": "soundlimit",
"delay": 10,
"limit": [
{
"condition": "scavenge:smaller",
"value": 1
}
],
"change": {
"operation": "scavenge:add",
"value": 1
}
},
"true": {
"property": "scavenge_utils:array_effect",
"effects": [
{
"property": "scavenge_world:play_sound",
"category": "block",
"sound": "minecraft:block.grass.hit",
"pitch": {
"operation": "scavenge:const",
"value": 100
}
},
{
"property": "scavenge_player:limit_action",
"id": "soundlimit",
"delay": 10,
"limit": [
{
"condition": "scavenge:smaller",
"value": 1
}
],
"change": {
"operation": "scavenge:add",
"value": 1
}
}
]
},
"false": {
"property": "scavenge_utils:default_effect"
}
},
{
"property": "scavenge_world:spawn_particles",
"particle": "minecraft:crit",
"count": {
"operation": "scavenge:const",
"value": 3
}
}
],
"loot": [
{
"lootPool": "minecraft:pebble",
"conditions": [
{
"property": "scavenge_utils:random",
"chance": 85.0
}
]
}
],
"type": {
"type": "right_click",
"consume": true,
"show": true
},
"targets": [
{
"type": "blocks",
"id": [
"minecraft:grass_block",
"minecraft:dirt"
]
}
]
}
}
The Script is already getting tough huh?
So let's take some steps back and explain what is going on here.
The first thing you might notice, there is a new Conditional Effect. Why?
Within that Conditional Effect we have our sfx, our Sound. Don't we all know how annoying it can be when Sound is just being spammed or overlapped into Oblivion.
That can be solved with "Limit Action", one of few Conditional Effects. It has quite a few Variables but don't be afraid!
"Limit Action" for one, needs an ID, this one yet again has to be unique, you'll see in a Minute why.
It then has the "delay", it's the time(in ticks) specified when it should reset the ID's value to 0.
Now following are the Condition "limit" and the Effect "change". Those should be self-explanatory at this point.
Important is now, how I have used them. As you might have noticed the Conditional Effect, has 2 Limit Actions inside, but both use the same ID.
This is where its being as "Conditional Effect" comes into play.
The first Limit Action is within the "test" of "Conditional Effect"(aka. the Condition), and will check if the "limit" value of "Limit Action" is below 1, as we only want to play the Sound once within the specified Delay. Note that this one cannot modify the "change" value, as it is within the Condition Section.
The second Limit Action is within the "true" of "Conditional Effect"(aka. the Effect), and will use the math operations on the "change" value, in this case it increases it by 1 each time it gets executed. Note that this one cannot modify the "limit" value, as it is within the Effect Section.
Using this nifty method we have now successfully limited the sounds played. But the problem doesn't end there. At this point we have 2 Properties we want to be executed if it's true... but "true" can only execute 1... For this problem we have a solution, "scavenge_utils:array_effect".
What it does? Pretty simple, it can take multiple Properties, and will execute them in order, considering they return true.
So we simply add the Array Effect, and add the Sound Property, such as the Limit Action into the Array Effect.
Voilà, we're done, "false" yet again receives a "scavenge_utils:default_effect", as we don't want to execute anything if we already played the Sound.
Now we can simply add the gfx, "scavenge_world:spawn_particles" at the end. With this one we don't have to make anything bulletproof, as we have almost full control over them, but for this we keep them default, but as "minecraft:crit" particles.