1
0
Fork 0

Add additional portal materials and quiet down sounds a lot

main
Mari 4 years ago
parent 46e2f8646b
commit 04cfeda1b2
  1. 8
      src/main/kotlin/net/deliciousreya/minecraftportal/extensions/Material.kt
  2. 26
      src/main/kotlin/net/deliciousreya/minecraftportal/model/PortalFrame.kt
  3. 8
      src/main/proto/portal-save-data.proto

@ -53,6 +53,14 @@ val MINERAL_MAPPING: ImmutableBiMap<Material, PortalSaveDataProtos.Portal.Minera
.put(Material.EMERALD_BLOCK, PortalSaveDataProtos.Portal.Mineral.EMERALD) .put(Material.EMERALD_BLOCK, PortalSaveDataProtos.Portal.Mineral.EMERALD)
.put(Material.IRON_BLOCK, PortalSaveDataProtos.Portal.Mineral.IRON) .put(Material.IRON_BLOCK, PortalSaveDataProtos.Portal.Mineral.IRON)
.put(Material.QUARTZ_BLOCK, PortalSaveDataProtos.Portal.Mineral.QUARTZ) .put(Material.QUARTZ_BLOCK, PortalSaveDataProtos.Portal.Mineral.QUARTZ)
.put(Material.TERRACOTTA, PortalSaveDataProtos.Portal.Mineral.TERRACOTTA)
.put(Material.SMOOTH_RED_SANDSTONE, PortalSaveDataProtos.Portal.Mineral.RED_SANDSTONE)
.put(Material.END_STONE_BRICKS, PortalSaveDataProtos.Portal.Mineral.END_STONE)
.put(Material.PRISMARINE, PortalSaveDataProtos.Portal.Mineral.PRISMARINE)
.put(Material.BRICKS, PortalSaveDataProtos.Portal.Mineral.BRICKS)
.put(Material.PURPUR_BLOCK, PortalSaveDataProtos.Portal.Mineral.PURPUR)
.put(Material.POLISHED_GRANITE, PortalSaveDataProtos.Portal.Mineral.GRANITE)
.put(Material.POLISHED_ANDESITE, PortalSaveDataProtos.Portal.Mineral.ANDESITE)
.build() .build()
fun Material.toMineralProto(): PortalSaveDataProtos.Portal.Mineral { fun Material.toMineralProto(): PortalSaveDataProtos.Portal.Mineral {

@ -28,6 +28,14 @@ val MINERAL_TYPES: ImmutableMap<Material, Material> = ImmutableMap.Builder<Mater
.put(EMERALD_BLOCK, GREEN_STAINED_GLASS) .put(EMERALD_BLOCK, GREEN_STAINED_GLASS)
.put(IRON_BLOCK, GRAY_STAINED_GLASS) .put(IRON_BLOCK, GRAY_STAINED_GLASS)
.put(QUARTZ_BLOCK, WHITE_STAINED_GLASS) .put(QUARTZ_BLOCK, WHITE_STAINED_GLASS)
.put(TERRACOTTA, ORANGE_STAINED_GLASS)
.put(SMOOTH_RED_SANDSTONE, PINK_STAINED_GLASS)
.put(END_STONE_BRICKS, LIME_STAINED_GLASS)
.put(PRISMARINE, LIGHT_BLUE_STAINED_GLASS)
.put(BRICKS, MAGENTA_STAINED_GLASS)
.put(PURPUR_BLOCK, PURPLE_STAINED_GLASS)
.put(POLISHED_GRANITE, BROWN_STAINED_GLASS)
.put(POLISHED_ANDESITE, LIGHT_GRAY_STAINED_GLASS)
.build() .build()
val DOOR_TYPES: ImmutableSet<Material> = ImmutableSet.of(ACACIA_DOOR, BIRCH_DOOR, DARK_OAK_DOOR, IRON_DOOR, JUNGLE_DOOR, OAK_DOOR, SPRUCE_DOOR) val DOOR_TYPES: ImmutableSet<Material> = ImmutableSet.of(ACACIA_DOOR, BIRCH_DOOR, DARK_OAK_DOOR, IRON_DOOR, JUNGLE_DOOR, OAK_DOOR, SPRUCE_DOOR)
@ -233,9 +241,9 @@ data class PortalFrame(val lowerLeftFrontCorner: Location, val direction: ExitDi
fun activate() { fun activate() {
val mineral = (lowerLeftFrontCorner + direction.mineralOffset).block val mineral = (lowerLeftFrontCorner + direction.mineralOffset).block
for (offset in direction.glassOffsets) { for (offset in direction.glassOffsets) {
(lowerLeftFrontCorner + offset).block.type = MINERAL_TYPES.getOrDefault(mineral.type, BROWN_STAINED_GLASS) (lowerLeftFrontCorner + offset).block.type = MINERAL_TYPES.getOrDefault(mineral.type, GLASS)
} }
portalCenter.world?.playSound(midCenter, Sound.ENTITY_EVOKER_CAST_SPELL, 20f, 1f) portalCenter.world?.playSound(midCenter, Sound.ENTITY_EVOKER_CAST_SPELL, 1f, 1f)
portalCenter.world?.spawnParticle(Particle.SPELL, midCenter, 75) portalCenter.world?.spawnParticle(Particle.SPELL, midCenter, 75)
open() open()
} }
@ -244,7 +252,7 @@ data class PortalFrame(val lowerLeftFrontCorner: Location, val direction: ExitDi
for (offset in direction.glassOffsets) { for (offset in direction.glassOffsets) {
(lowerLeftFrontCorner + offset).block.type = GLASS (lowerLeftFrontCorner + offset).block.type = GLASS
} }
portalCenter.world?.playSound(midCenter, Sound.ENTITY_ILLUSIONER_CAST_SPELL, 20f, 1f) portalCenter.world?.playSound(midCenter, Sound.ENTITY_ILLUSIONER_CAST_SPELL, 1f, 1f)
portalCenter.world?.spawnParticle(Particle.SMOKE_NORMAL, midCenter, 75) portalCenter.world?.spawnParticle(Particle.SMOKE_NORMAL, midCenter, 75)
} }
@ -253,21 +261,21 @@ data class PortalFrame(val lowerLeftFrontCorner: Location, val direction: ExitDi
} }
fun playPortalsLinkedEffect() { fun playPortalsLinkedEffect() {
portalCenter.world?.playSound(midCenter, Sound.BLOCK_BEACON_ACTIVATE, 20f, 1f) portalCenter.world?.playSound(midCenter, Sound.BLOCK_BEACON_ACTIVATE, 1f, 1f)
portalCenter.world?.spawnParticle(Particle.SPELL, midCenter, 30) portalCenter.world?.spawnParticle(Particle.SPELL, midCenter, 30)
} }
fun playPortalsUnlinkedEffect() { fun playPortalsUnlinkedEffect() {
portalCenter.world?.playSound(midCenter, Sound.BLOCK_BEACON_DEACTIVATE, 20f, 1f) portalCenter.world?.playSound(midCenter, Sound.BLOCK_BEACON_DEACTIVATE, 1f, 1f)
portalCenter.world?.spawnParticle(Particle.SMOKE_NORMAL, midCenter, 30) portalCenter.world?.spawnParticle(Particle.SMOKE_NORMAL, midCenter, 30)
} }
fun playTeleporterActivatedEffect() { fun playTeleporterActivatedEffect() {
portalCenter.world?.playSound(midCenter, Sound.BLOCK_PORTAL_TRIGGER, 20f, 1f) portalCenter.world?.playSound(midCenter, Sound.BLOCK_PORTAL_TRIGGER, 1f, 1f)
} }
fun playTeleportTravelEffect() { fun playTeleportTravelEffect() {
portalCenter.world?.playSound(midCenter, Sound.BLOCK_PORTAL_TRAVEL, 20f, 1f) portalCenter.world?.playSound(midCenter, Sound.BLOCK_PORTAL_TRAVEL, 1f, 1f)
portalCenter.world?.spawnParticle(Particle.FIREWORKS_SPARK, midCenter, 75) portalCenter.world?.spawnParticle(Particle.FIREWORKS_SPARK, midCenter, 75)
} }
@ -280,13 +288,13 @@ data class PortalFrame(val lowerLeftFrontCorner: Location, val direction: ExitDi
} }
fun playTeleportCanceledEffect() { fun playTeleportCanceledEffect() {
portalCenter.world?.playSound(midCenter, Sound.BLOCK_LAVA_EXTINGUISH, 20f, 1f) portalCenter.world?.playSound(midCenter, Sound.BLOCK_LAVA_EXTINGUISH, 1f, 1f)
portalCenter.world?.spawnParticle(Particle.SMOKE_NORMAL, midCenter, 30) portalCenter.world?.spawnParticle(Particle.SMOKE_NORMAL, midCenter, 30)
} }
inner class MakePortalSound : BukkitRunnable() { inner class MakePortalSound : BukkitRunnable() {
override fun run() { override fun run() {
portalCenter.world?.playSound(portalCenter + MID_BLOCK, Sound.BLOCK_PORTAL_AMBIENT, 3f, 0f) portalCenter.world?.playSound(portalCenter + MID_BLOCK, Sound.BLOCK_PORTAL_AMBIENT, 0.1f, 0f)
} }
} }
inner class MakePortalSparkles : BukkitRunnable() { inner class MakePortalSparkles : BukkitRunnable() {

@ -30,6 +30,14 @@ message Portal {
EMERALD = 6; EMERALD = 6;
IRON = 7; IRON = 7;
QUARTZ = 8; QUARTZ = 8;
TERRACOTTA = 9;
RED_SANDSTONE = 10;
END_STONE = 11;
PRISMARINE = 12;
BRICKS = 13;
PURPUR = 14;
GRANITE = 15;
ANDESITE = 16;
} }
enum Color { enum Color {
UNKNOWN_COLOR = 0; UNKNOWN_COLOR = 0;

Loading…
Cancel
Save