Skip to content

Commit 275ad80

Browse files
committed
Add missing Effects from Paper
1 parent 3130e87 commit 275ad80

File tree

3 files changed

+53
-9
lines changed

3 files changed

+53
-9
lines changed

src/main/java/com/laytonsmith/abstraction/bukkit/BukkitMCWorld.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,14 +298,18 @@ public void playEffect(MCLocation l, MCEffect mCEffect, int data, int radius) {
298298
@Override
299299
public void playEffect(MCLocation l, MCEffect mcEffect, Object data, int radius) {
300300
Effect effect = Effect.valueOf(mcEffect.name());
301-
switch(effect) {
301+
switch(mcEffect) {
302302
case RECORD_PLAY:
303303
case STEP_SOUND:
304304
w.playEffect((Location) l.getHandle(), effect, ((MCMaterial) data).getHandle(), radius);
305305
return;
306306
case SMOKE:
307+
case SHOOT_WHITE_SMOKE:
307308
w.playEffect((Location) l.getHandle(), effect, BlockFace.valueOf(((MCBlockFace) data).name()), radius);
308309
return;
310+
case PARTICLES_AND_SOUND_BRUSH_BLOCK_COMPLETE:
311+
w.playEffect((Location) l.getHandle(), effect, ((MCBlockData) data).getHandle(), radius);
312+
return;
309313
}
310314
w.playEffect((Location) l.getHandle(), effect, data, radius);
311315
}

src/main/java/com/laytonsmith/abstraction/enums/MCEffect.java

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ public enum MCEffect {
77
/**
88
* VISUAL
99
*/
10-
BONE_MEAL_USE, // integer for number of particles
10+
BEE_GROWTH, // integer, Paper, added in 1.20.6, partially replaces VILLAGER_PLANT_GROW
11+
BONE_MEAL_USE, // integer
1112
COMPOSTER_FILL_ATTEMPT, // boolean for success
1213
COPPER_WAX_OFF,
1314
COPPER_WAX_ON,
@@ -22,11 +23,28 @@ public enum MCEffect {
2223
LAVA_INTERACT,
2324
MOBSPAWNER_FLAMES,
2425
OXIDISED_COPPER_SCRAPE,
26+
PARTICLES_EGG_CRACK, // Paper, added 1.20 - 1.20.4
27+
PARTICLES_AND_SOUND_BRUSH_BLOCK_COMPLETE, // BlockData, Paper, added 1.20 - 1.20.4
28+
PARTICLES_SCULK_CHARGE, // integer, Paper, added 1.20 - 1.20.4
2529
POTION_BREAK, // Color
2630
REDSTONE_TORCH_BURNOUT,
31+
SHOOT_WHITE_SMOKE, // BlockFace for the direction, Paper, added 1.20 - 1.20.4
32+
SMASH_ATTACK, // integer, Paper, added in 1.20.5
2733
SMOKE, // BlockFace for the direction of the smoke particles
34+
SPAWN_COBWEB, // Paper, added in 1.20.6
2835
SPONGE_DRY,
29-
VILLAGER_PLANT_GROW, // integer for number of particles
36+
TRIAL_SPAWNER_BECOME_OMINOUS, // boolean, Paper, added 1.20.6
37+
TRIAL_SPAWNER_DETECT_PLAYER, // integer, Paper, added 1.20.4
38+
TRIAL_SPAWNER_DETECT_PLAYER_OMINOUS, // integer, Paper, added 1.20.6
39+
TRIAL_SPAWNER_EJECT_ITEM, // Paper, added 1.20.4
40+
TRIAL_SPAWNER_SPAWN, // boolean, Paper, added 1.20.4
41+
TRIAL_SPAWNER_SPAWN_ITEM, // boolean, Paper, added 1.20.6
42+
TRIAL_SPAWNER_SPAWN_MOB_AT, // boolean, Paper, added 1.20.4
43+
TURTLE_EGG_PLACEMENT, // integer, Paper, added in 1.20.6
44+
VAULT_ACTIVATE, // boolean, Paper, added in 1.20.6
45+
VAULT_DEACTIVATE, // boolean, Paper, added in 1.20.6
46+
VAULT_EJECT_ITEM, // Paper, added in 1.20.6
47+
VILLAGER_PLANT_GROW, // integer, deprecated in 1.20.6, partially replaced by BEE_GROWTH
3048
/**
3149
* SOUND
3250
*/
@@ -42,11 +60,13 @@ public enum MCEffect {
4260
CHORUS_FLOWER_GROW,
4361
CLICK1,
4462
CLICK2,
63+
CRAFTER_CRAFT, // Paper, added 1.20.4
64+
CRAFTER_FAIL, // Paper, added 1.20.4
4565
DOOR_CLOSE, // deprecated in 1.19.3
4666
DOOR_TOGGLE, // deprecated in 1.19.3
4767
ENDERDRAGON_GROWL,
4868
ENDERDRAGON_SHOOT,
49-
ENDEREYE_LAUNCH,
69+
ENDEREYE_LAUNCH, // deprecated in 1.21
5070
EXTINGUISH,
5171
FENCE_GATE_CLOSE, // deprecated in 1.19.3
5272
FENCE_GATE_TOGGLE, // deprecated in 1.19.3
@@ -59,6 +79,7 @@ public enum MCEffect {
5979
IRON_DOOR_TOGGLE, // deprecated in 1.19.3
6080
IRON_TRAPDOOR_CLOSE, // deprecated in 1.19.3
6181
IRON_TRAPDOOR_TOGGLE, // deprecated in 1.19.3
82+
PARTICLES_SCULK_SHRIEK, // Paper, added 1.20 - 1.20.4
6283
PHANTOM_BITE,
6384
POINTED_DRIPSTONE_DRIP_LAVA_INTO_CAULDRON,
6485
POINTED_DRIPSTONE_DRIP_WATER_INTO_CAULDRON,
@@ -67,6 +88,8 @@ public enum MCEffect {
6788
RECORD_PLAY, // Material for record item
6889
SKELETON_CONVERTED_TO_STRAY,
6990
SMITHING_TABLE_USE,
91+
SOUND_STOP_JUKEBOX_SONG, // Paper, added 1.20 - 1.20.4
92+
SOUND_WITH_CHARGE_SHOT, // Paper, added 1.21
7093
STEP_SOUND, // Material for block type stepped on
7194
TRAPDOOR_CLOSE, // deprecated in 1.19.3
7295
TRAPDOOR_TOGGLE, // deprecated in 1.19.3

src/main/java/com/laytonsmith/core/functions/Minecraft.java

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
import com.laytonsmith.abstraction.MCServer;
1414
import com.laytonsmith.abstraction.MCWorld;
1515
import com.laytonsmith.abstraction.StaticLayer;
16+
import com.laytonsmith.abstraction.blocks.MCBlockData;
1617
import com.laytonsmith.abstraction.blocks.MCBlockFace;
1718
import com.laytonsmith.abstraction.blocks.MCMaterial;
1819
import com.laytonsmith.abstraction.enums.MCEffect;
@@ -62,6 +63,7 @@
6263
import java.util.Enumeration;
6364
import java.util.HashMap;
6465
import java.util.List;
66+
import java.util.Locale;
6567
import java.util.Map;
6668
import java.util.Properties;
6769
import java.util.Set;
@@ -427,12 +429,13 @@ public String docs() {
427429
+ " for all players within the radius (or 64 by default). The effect can be one of the following: "
428430
+ StringUtils.Join(MCEffect.values(), ", ", ", or ", " or ")
429431
+ ". ---- Some effects may require an applicable block at the specified location."
430-
+ " Additional data can be supplied with the syntax EFFECT:DATA."
431-
+ "<br>The STEP_SOUND takes a block material name."
432+
+ " Additional data can be supplied with the syntax EFFECT:DATA.<br>"
433+
+ "<br>STEP_SOUND and PARTICLES_AND_SOUND_BRUSH_BLOCK_COMPLETE (Paper) take a block material name."
432434
+ "<br>RECORD_PLAY takes a record material name."
433-
+ "<br>SMOKE takes a facing, one of " + StringUtils.Join(MCBlockFace.values(), ", ", ", or ", " or ")
435+
+ "<br>SHOOT_WHITE_SMOKE (Paper) and SMOKE take a facing, one of " + StringUtils.Join(MCBlockFace.values(), ", ", ", or ", " or ")
434436
+ "<br>POTION_BREAK takes an int (represents color)."
435-
+ "<br>VILLAGER_PLANT_GROW and BONE_MEAL_USE take an int for the number of particles.";
437+
+ "<br>BONE_MEAL_USE, BEE_GROWTH (Paper), SMASH_ATTACK (Paper) and"
438+
+ " TURTLE_EGG_PLACEMENT (Paper) take an int for the number of particles.";
436439
}
437440

438441
@Override
@@ -478,7 +481,7 @@ public Mixed exec(Target t, Environment env, Mixed... args) throws ConfigRuntime
478481
if(args.length > 2) {
479482
radius = ArgumentValidation.getInt32(args[args.length - 1], t);
480483
}
481-
if(!dataString.equals("")) {
484+
if(!dataString.isEmpty()) {
482485
switch(effect) {
483486
case RECORD_PLAY:
484487
case STEP_SOUND:
@@ -494,6 +497,7 @@ public Mixed exec(Target t, Environment env, Mixed... args) throws ConfigRuntime
494497
// Fall back to integer
495498
break;
496499
case SMOKE:
500+
case SHOOT_WHITE_SMOKE:
497501
try {
498502
MCBlockFace facing = MCBlockFace.valueOf(dataString.toUpperCase());
499503
try {
@@ -506,6 +510,19 @@ public Mixed exec(Target t, Environment env, Mixed... args) throws ConfigRuntime
506510
// Fall back to integer
507511
}
508512
break;
513+
case PARTICLES_AND_SOUND_BRUSH_BLOCK_COMPLETE:
514+
try {
515+
MCBlockData blockData = Static.getServer().createBlockData(dataString.toLowerCase(Locale.ROOT));
516+
try {
517+
l.getWorld().playEffect(l, effect, blockData, radius);
518+
} catch (IllegalArgumentException ex) {
519+
throw new CREIllegalArgumentException(ex.getMessage(), t);
520+
}
521+
return CVoid.VOID;
522+
} catch (IllegalArgumentException ex) {
523+
// Fall back to integer
524+
}
525+
break;
509526
}
510527
try {
511528
data = Integer.parseInt(dataString);

0 commit comments

Comments
 (0)