mirror of
https://github.com/PaperMC/Paper.git
synced 2025-02-13 02:51:37 +01:00
SPIGOT-6249: Add Missing Effect Constants
By: DerFrZocker <derrieple@gmail.com>
This commit is contained in:
parent
4d34ac117b
commit
4495b9ec5b
@ -3,6 +3,7 @@ package org.bukkit.craftbukkit;
|
||||
import net.minecraft.world.item.Item;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import org.apache.commons.lang.Validate;
|
||||
import org.bukkit.Axis;
|
||||
import org.bukkit.Color;
|
||||
import org.bukkit.Effect;
|
||||
import org.bukkit.Material;
|
||||
@ -61,6 +62,31 @@ public class CraftEffect {
|
||||
Validate.isTrue(((Material) data).isBlock(), "Material is not a block!");
|
||||
datavalue = Block.getCombinedId(CraftMagicNumbers.getBlock((Material) data).getBlockData());
|
||||
break;
|
||||
case COMPOSTER_FILL_ATTEMPT:
|
||||
datavalue = ((Boolean) data) ? 1 : 0;
|
||||
break;
|
||||
case BONE_MEAL_USE:
|
||||
datavalue = (Integer) data;
|
||||
break;
|
||||
case ELECTRIC_SPARK:
|
||||
if (data == null) {
|
||||
datavalue = -1;
|
||||
} else {
|
||||
switch ((Axis) data) {
|
||||
case X:
|
||||
datavalue = 0;
|
||||
break;
|
||||
case Y:
|
||||
datavalue = 1;
|
||||
break;
|
||||
case Z:
|
||||
datavalue = 2;
|
||||
break;
|
||||
default:
|
||||
throw new IllegalArgumentException("Bad electric spark axis!");
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
datavalue = 0;
|
||||
}
|
||||
|
@ -1091,10 +1091,11 @@ public class CraftWorld extends CraftRegionAccessor implements World {
|
||||
if (data != null) {
|
||||
Validate.isTrue(effect.getData() != null && effect.getData().isAssignableFrom(data.getClass()), "Wrong kind of data for this effect!");
|
||||
} else {
|
||||
Validate.isTrue(effect.getData() == null, "Wrong kind of data for this effect!");
|
||||
// Special case: the axis is optional for ELECTRIC_SPARK
|
||||
Validate.isTrue(effect.getData() == null || effect == Effect.ELECTRIC_SPARK, "Wrong kind of data for this effect!");
|
||||
}
|
||||
|
||||
int datavalue = data == null ? 0 : CraftEffect.getDataValue(effect, data);
|
||||
int datavalue = CraftEffect.getDataValue(effect, data);
|
||||
playEffect(loc, effect, datavalue, radius);
|
||||
}
|
||||
|
||||
|
@ -527,10 +527,11 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
if (data != null) {
|
||||
Validate.isTrue(effect.getData() != null && effect.getData().isAssignableFrom(data.getClass()), "Wrong kind of data for this effect!");
|
||||
} else {
|
||||
Validate.isTrue(effect.getData() == null, "Wrong kind of data for this effect!");
|
||||
// Special case: the axis is optional for ELECTRIC_SPARK
|
||||
Validate.isTrue(effect.getData() == null || effect == Effect.ELECTRIC_SPARK, "Wrong kind of data for this effect!");
|
||||
}
|
||||
|
||||
int datavalue = data == null ? 0 : CraftEffect.getDataValue(effect, data);
|
||||
int datavalue = CraftEffect.getDataValue(effect, data);
|
||||
playEffect(loc, effect, datavalue);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user