Skip to content

Commit

Permalink
Updated to 1.12.
Browse files Browse the repository at this point in the history
Updated Jinglenote, and removed Chair hack-fix
  • Loading branch information
me4502 committed Jun 11, 2017
1 parent 62d9553 commit 0fe5cdc
Show file tree
Hide file tree
Showing 6 changed files with 64 additions and 35 deletions.
4 changes: 2 additions & 2 deletions build.gradle
Expand Up @@ -21,7 +21,7 @@ buildscript {

configurations.all {
resolutionStrategy {
force 'com.google.guava:guava:17.0'
force 'com.google.guava:guava:21.0'
}
}

Expand Down Expand Up @@ -109,7 +109,7 @@ subprojects {
}

dependencies {
compile 'com.google.guava:guava:17.0'
compile 'com.google.guava:guava:21.0'
compile 'com.google.code.gson:gson:2.2.4'
compile 'org.apache.commons:commons-lang3:3.3.2'

Expand Down
Expand Up @@ -17,12 +17,30 @@
package com.sk89q.craftbook.core.util.jinglenote;

public enum Instrument {
GUITAR, PIANO, BASS, BASS_GUITAR, STICKS, BASS_DRUM, SNARE_DRUM;

/*
0 = BLOCK_NOTE_HARP = PIANO
1 = BLOCK_NOTE_BASS = BASS
2 = BLOCK_NOTE_SNARE = SNARE_DRUM
3 = BLOCK_NOTE_HAT = STICKS
4 = BLOCK_NOTE_BASEDRUM = BASS_DRUM
5 = BLOCK_NOTE_GUITAR = GUITAR
6 = BLOCK_NOTE_BELL = BELL
7 = BLOCK_NOTE_CHIME = CHIME
8 = BLOCK_NOTE_FLUTE = FLUTE
9 = BLOCK_NOTE_XYLOPHONE = XYLOPHONE
10 = BLOCK_NOTE_PLING = PLING
*/

PIANO, BASS, SNARE_DRUM, STICKS, BASS_DRUM, GUITAR,
BELL, CHIME, FLUTE, XYLOPHONE, PLING;

public static Instrument toMCSound(byte instrument) {
switch (instrument) {
case 0:
return Instrument.PIANO;
case 1:
return Instrument.BASS_GUITAR;
return Instrument.BASS;
case 2:
return Instrument.SNARE_DRUM;
case 3:
Expand All @@ -32,7 +50,15 @@ public static Instrument toMCSound(byte instrument) {
case 5:
return Instrument.GUITAR;
case 6:
return Instrument.BASS;
return Instrument.BELL;
case 7:
return Instrument.CHIME;
case 8:
return Instrument.FLUTE;
case 9:
return Instrument.XYLOPHONE;
case 10:
return Instrument.PLING;
default:
return Instrument.PIANO;
}
Expand Down
Expand Up @@ -36,32 +36,32 @@ public final class MidiJingleSequencer implements JingleSequencer {

private static final int[] instruments = {
0, 0, 0, 0, 0, 0, 0, 5, // 8
6, 0, 0, 0, 0, 0, 0, 0, // 16
0, 0, 0, 0, 0, 0, 0, 5, // 24
5, 5, 5, 5, 5, 5, 5, 5, // 32
6, 6, 6, 6, 6, 6, 6, 6, // 40
5, 5, 5, 5, 5, 5, 5, 2, // 48
5, 5, 5, 5, 0, 0, 0, 0, // 56
0, 0, 0, 0, 0, 0, 0, 0, // 64
0, 0, 0, 0, 0, 0, 0, 0, // 72
0, 0, 0, 0, 0, 0, 0, 0, // 80
9, 9, 9, 9, 9, 6, 0, 9, // 16
9, 0, 0, 0, 0, 0, 0, 5, // 24
5, 5, 5, 5, 5, 5, 5, 1, // 32
1, 1, 1, 1, 1, 1, 1, 5, // 40
1, 5, 5, 5, 5, 5, 5, 5, // 48
5, 5, 5, 8, 8, 8, 8, 8, // 56
8, 8, 8, 8, 8, 8, 8, 8, // 64
8, 8, 8, 8, 8, 8, 8, 8, // 72
8, 8, 8, 8, 8, 8, 8, 8, // 80
0, 0, 0, 0, 0, 0, 0, 0, // 88
0, 0, 0, 0, 0, 0, 0, 0, // 96
0, 0, 0, 0, 0, 0, 0, 0, // 104
0, 0, 0, 0, 0, 0, 0, 0, // 112
1, 1, 1, 3, 1, 1, 1, 5, // 120
1, 1, 1, 1, 1, 2, 4, 3, // 128
0, 0, 0, 0, 0, 0, 0, 5, // 104
5, 5, 5, 9, 8, 5, 8, 6, // 112
6, 3, 3, 2, 2, 2, 6, 5, // 120
1, 1, 1, 6, 1, 2, 4, 7, // 128
};


private static final int[] percussion = {
3, 3, 4, 4, 3, 2, 3, 2, //8 - Electric Snare
2, 2, 2, 2, 2, 2, 2, 2, //16 - Hi Mid Tom
3, 2, 3, 3, 3, 0, 3, 3, //24 - Cowbell
3, 3, 3, 2, 2, 3, 3, 3, //32 - Low Conga
2, 2, 0, 0, 2, 2, 0, 0, //40 - Long Whistle
3, 3, 3, 3, 3, 3, 5, 5, //48 - Open Cuica
3, 3, //50 - Open Triangle
9, 6, 4, 4, 3, 2, 3, 2, //40 - Electric Snare
2, 2, 2, 2, 2, 2, 2, 2, //48 - Hi Mid Tom
7, 2, 7, 7, 6, 3, 7, 6, //56 - Cowbell
7, 3, 7, 2, 2, 3, 3, 3, //64 - Low Conga
2, 2, 6, 6, 2, 2, 0, 0, //72 - Long Whistle
3, 3, 3, 3, 3, 3, 5, 5, //80 - Open Cuica
10, 10, //82 - Open Triangle
};

private Sequencer sequencer = null;
Expand Down
2 changes: 1 addition & 1 deletion craftbook-sponge/build.gradle
Expand Up @@ -11,7 +11,7 @@ plugins {
id 'org.spongepowered.plugin' version '0.8.1'
}

def spongeVersion = "6.1"
def spongeVersion = "7.0"
def spongeFullVersion = spongeVersion + ".0-SNAPSHOT"

dependencies {
Expand Down
Expand Up @@ -119,8 +119,6 @@ public void onInitialize() throws CraftBookException {
if (player.get(Keys.EXHAUSTION).orElse(-20d) > -20d) {
player.offer(Keys.EXHAUSTION, player.get(Keys.EXHAUSTION).orElse(-20d) - 0.1d);
}

chair.getValue().chairEntity.setRotation(new Vector3d(0, player.getRotation().getY(), 0));
}
}).submit(CraftBookPlugin.inst());
}
Expand Down Expand Up @@ -168,7 +166,6 @@ private void addChair(Player player, Location<World> location) {
Entity entity = location.getExtent().createEntity(EntityTypes.ARMOR_STAND, location.getBlockPosition().toDouble().sub(-0.5, 1, -0.5));
entity.offer(Keys.INVISIBLE, true);
entity.offer(Keys.HAS_GRAVITY, false);
entity.setRotation(new Vector3d(0, player.getRotation().getY(), 0));

location.getExtent().spawnEntity(entity, Cause.of(NamedCause.of("root", SpawnCause.builder().type(SpawnTypes.CUSTOM).build()), NamedCause.source(player)));

Expand Down
Expand Up @@ -43,18 +43,24 @@ private static SoundType toSound(Instrument instrument) {
switch(instrument) {
case PIANO:
return SoundTypes.BLOCK_NOTE_HARP;
case GUITAR:
return SoundTypes.BLOCK_NOTE_PLING;
case BASS:
return SoundTypes.BLOCK_NOTE_BASS;
case BASS_GUITAR:
return SoundTypes.BLOCK_NOTE_BASS;
case SNARE_DRUM:
return SoundTypes.BLOCK_NOTE_SNARE;
case STICKS:
return SoundTypes.BLOCK_NOTE_HAT;
case BASS_DRUM:
return SoundTypes.BLOCK_NOTE_BASEDRUM;
case SNARE_DRUM:
return SoundTypes.BLOCK_NOTE_SNARE;
case BELL:
return SoundTypes.BLOCK_NOTE_BELL;
case CHIME:
return SoundTypes.BLOCK_NOTE_CHIME;
case FLUTE:
return SoundTypes.BLOCK_NOTE_FLUTE;
case XYLOPHONE:
return SoundTypes.BLOCK_NOTE_XYLOPHONE;
case PLING:
return SoundTypes.BLOCK_NOTE_PLING;
default:
return SoundTypes.BLOCK_NOTE_HARP;
}
Expand Down

0 comments on commit 0fe5cdc

Please sign in to comment.