mirror of
https://github.com/DieReicheErethons/Brewery.git
synced 2024-09-26 03:42:38 +02:00
Added open/close sounds to our Barrels
This commit is contained in:
parent
67ab8e7de3
commit
dbe4d4fd93
@ -311,6 +311,10 @@ public class Barrel implements InventoryHolder {
|
|||||||
return inventory;
|
return inventory;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Block getSpigot() {
|
||||||
|
return spigot;
|
||||||
|
}
|
||||||
|
|
||||||
// Returns true if this Block is part of this Barrel
|
// Returns true if this Block is part of this Barrel
|
||||||
public boolean hasBlock(Block block) {
|
public boolean hasBlock(Block block) {
|
||||||
if (block != null) {
|
if (block != null) {
|
||||||
|
@ -9,6 +9,8 @@ import com.dre.brewery.P;
|
|||||||
import com.dre.brewery.integration.LogBlockBarrel;
|
import com.dre.brewery.integration.LogBlockBarrel;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.Sound;
|
||||||
|
import org.bukkit.SoundCategory;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.block.BlockState;
|
import org.bukkit.block.BlockState;
|
||||||
import org.bukkit.block.BrewingStand;
|
import org.bukkit.block.BrewingStand;
|
||||||
@ -390,6 +392,18 @@ public class InventoryListener implements Listener {
|
|||||||
|
|
||||||
if (!P.use1_14) return;
|
if (!P.use1_14) return;
|
||||||
|
|
||||||
|
// Barrel Closing Sound
|
||||||
|
if (event.getInventory().getHolder() instanceof Barrel) {
|
||||||
|
Barrel barrel = ((Barrel) event.getInventory().getHolder());
|
||||||
|
float randPitch = (float) (Math.random() * 0.1);
|
||||||
|
if (barrel.isLarge()) {
|
||||||
|
barrel.getSpigot().getWorld().playSound(barrel.getSpigot().getLocation(), Sound.BLOCK_BARREL_CLOSE, SoundCategory.BLOCKS, 0.5f, 0.5f + randPitch);
|
||||||
|
barrel.getSpigot().getWorld().playSound(barrel.getSpigot().getLocation(), Sound.ITEM_BUCKET_EMPTY, SoundCategory.BLOCKS, 0.2f, 0.6f + randPitch);
|
||||||
|
} else {
|
||||||
|
barrel.getSpigot().getWorld().playSound(barrel.getSpigot().getLocation(), Sound.BLOCK_BARREL_CLOSE, SoundCategory.BLOCKS, 0.5f, 0.8f + randPitch);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Check for MC Barrel
|
// Check for MC Barrel
|
||||||
if (event.getInventory().getType() == InventoryType.BARREL) {
|
if (event.getInventory().getType() == InventoryType.BARREL) {
|
||||||
Inventory inv = event.getInventory();
|
Inventory inv = event.getInventory();
|
||||||
|
@ -4,6 +4,8 @@ import com.dre.brewery.*;
|
|||||||
import com.dre.brewery.filedata.UpdateChecker;
|
import com.dre.brewery.filedata.UpdateChecker;
|
||||||
import org.bukkit.GameMode;
|
import org.bukkit.GameMode;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.Sound;
|
||||||
|
import org.bukkit.SoundCategory;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.block.BlockFace;
|
import org.bukkit.block.BlockFace;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@ -172,6 +174,18 @@ public class PlayerListener implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
barrel.open(player);
|
barrel.open(player);
|
||||||
|
|
||||||
|
if (P.use1_14) {
|
||||||
|
// Barrel opening Sound
|
||||||
|
float randPitch = (float) (Math.random() * 0.1);
|
||||||
|
if (barrel.isLarge()) {
|
||||||
|
barrel.getSpigot().getWorld().playSound(barrel.getSpigot().getLocation(), Sound.BLOCK_CHEST_OPEN, SoundCategory.BLOCKS, 0.4f, 0.55f + randPitch);
|
||||||
|
//barrel.getSpigot().getWorld().playSound(barrel.getSpigot().getLocation(), Sound.ITEM_BUCKET_EMPTY, SoundCategory.BLOCKS, 0.5f, 0.6f + randPitch);
|
||||||
|
barrel.getSpigot().getWorld().playSound(barrel.getSpigot().getLocation(), Sound.BLOCK_BREWING_STAND_BREW, SoundCategory.BLOCKS, 0.4f, 0.45f + randPitch);
|
||||||
|
} else {
|
||||||
|
barrel.getSpigot().getWorld().playSound(barrel.getSpigot().getLocation(), Sound.BLOCK_BARREL_OPEN, SoundCategory.BLOCKS, 0.5f, 0.8f + randPitch);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user