diff options
author | Travis Watkins <amaranth@ubuntu.com> | 2012-12-22 13:05:55 -0600 |
---|---|---|
committer | Travis Watkins <amaranth@ubuntu.com> | 2012-12-22 13:07:18 -0600 |
commit | 717fbbeffa8fe8eae00026ca06f95ebc5c3c00cf (patch) | |
tree | c08be2b06f3bdc42ccdc0848b22bc94b50403557 /src/main | |
parent | f72a08c22e4c499ab22a42d5c2d6a0e512823bdb (diff) | |
download | craftbukkit-717fbbeffa8fe8eae00026ca06f95ebc5c3c00cf.tar craftbukkit-717fbbeffa8fe8eae00026ca06f95ebc5c3c00cf.tar.gz craftbukkit-717fbbeffa8fe8eae00026ca06f95ebc5c3c00cf.tar.lz craftbukkit-717fbbeffa8fe8eae00026ca06f95ebc5c3c00cf.tar.xz craftbukkit-717fbbeffa8fe8eae00026ca06f95ebc5c3c00cf.zip |
Update firework power when modifying meta. Fixes BUKKIT-3272
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/java/net/minecraft/server/EntityFireworks.java | 2 | ||||
-rw-r--r-- | src/main/java/org/bukkit/craftbukkit/entity/CraftFirework.java | 6 |
2 files changed, 7 insertions, 1 deletions
diff --git a/src/main/java/net/minecraft/server/EntityFireworks.java b/src/main/java/net/minecraft/server/EntityFireworks.java index 0553ec8d..65b8714c 100644 --- a/src/main/java/net/minecraft/server/EntityFireworks.java +++ b/src/main/java/net/minecraft/server/EntityFireworks.java @@ -3,7 +3,7 @@ package net.minecraft.server; public class EntityFireworks extends Entity { private int a; - private int b; + public int b; // CraftBukkit - private -> public public EntityFireworks(World world) { super(world); diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftFirework.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftFirework.java index 6bc22e4c..5c89ce7d 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftFirework.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftFirework.java @@ -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); } } |