mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-24 01:06:01 +01:00
Update firework power when modifying meta. Fixes BUKKIT-3272
By: Travis Watkins <amaranth@ubuntu.com>
This commit is contained in:
parent
2c5dd716bb
commit
ce8e581ffc
1 changed files with 6 additions and 0 deletions
|
@ -11,6 +11,8 @@ import org.bukkit.entity.EntityType;
|
|||
import org.bukkit.entity.Firework;
|
||||
import org.bukkit.inventory.meta.FireworkMeta;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class CraftFirework extends CraftEntity implements Firework {
|
||||
private static final int FIREWORK_ITEM_INDEX = 8;
|
||||
|
||||
|
@ -54,5 +56,9 @@ public class CraftFirework extends CraftEntity implements Firework {
|
|||
|
||||
public void setFireworkMeta(FireworkMeta meta) {
|
||||
item.setItemMeta(meta);
|
||||
|
||||
// Copied from EntityFireworks constructor, update firework lifetime/power
|
||||
Random random = new Random();
|
||||
getHandle().b = 10 * meta.getPower() + random.nextInt(6) + random.nextInt(7);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue