mirror of
https://github.com/GeyserMC/Geyser.git
synced 2024-08-14 23:57:35 +00:00
Don't hardcode record IDs and fix records for 1.17
This commit is contained in:
parent
aba279fd1a
commit
2c9cd7ed02
3 changed files with 10 additions and 10 deletions
|
@ -127,20 +127,15 @@ public class EffectRegistry {
|
|||
javaEffect = SoundEffect.valueOf(entry.getKey());
|
||||
String name = node.get("name").asText();
|
||||
float volume = node.has("volume") ? node.get("volume").floatValue() : 1.0f;
|
||||
boolean pitchSub = node.has("pitch_sub") ? node.get("pitch_sub").booleanValue() : false;
|
||||
boolean pitchSub = node.has("pitch_sub") && node.get("pitch_sub").booleanValue();
|
||||
float pitchMul = node.has("pitch_mul") ? node.get("pitch_mul").floatValue() : 1.0f;
|
||||
float pitchAdd = node.has("pitch_add") ? node.get("pitch_add").floatValue() : 0.0f;
|
||||
boolean relative = node.has("relative") ? node.get("relative").booleanValue() : true;
|
||||
boolean relative = node.has("relative") && node.get("relative").booleanValue();
|
||||
effect = new PlaySoundEffect(name, volume, pitchSub, pitchMul, pitchAdd, relative);
|
||||
break;
|
||||
}
|
||||
case "record": {
|
||||
JsonNode records = entry.getValue().get("records");
|
||||
Iterator<Map.Entry<String, JsonNode>> recordsIterator = records.fields();
|
||||
while (recordsIterator.hasNext()) {
|
||||
Map.Entry<String, JsonNode> recordEntry = recordsIterator.next();
|
||||
RECORDS.put(Integer.parseInt(recordEntry.getKey()), SoundEvent.valueOf(recordEntry.getValue().asText()));
|
||||
}
|
||||
// Special case handled in ItemRegistry
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -33,6 +33,7 @@ import com.nukkitx.nbt.NbtMap;
|
|||
import com.nukkitx.nbt.NbtMapBuilder;
|
||||
import com.nukkitx.nbt.NbtType;
|
||||
import com.nukkitx.nbt.NbtUtils;
|
||||
import com.nukkitx.protocol.bedrock.data.SoundEvent;
|
||||
import com.nukkitx.protocol.bedrock.data.inventory.ComponentItemData;
|
||||
import com.nukkitx.protocol.bedrock.data.inventory.ItemData;
|
||||
import com.nukkitx.protocol.bedrock.packet.StartGamePacket;
|
||||
|
@ -44,10 +45,10 @@ import it.unimi.dsi.fastutil.objects.Object2IntMap;
|
|||
import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap;
|
||||
import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet;
|
||||
import org.geysermc.connector.GeyserConnector;
|
||||
import org.geysermc.connector.network.translators.effect.EffectRegistry;
|
||||
import org.geysermc.connector.network.translators.world.block.BlockTranslator;
|
||||
import org.geysermc.connector.network.translators.world.block.BlockTranslator1_17_0;
|
||||
import org.geysermc.connector.utils.FileUtils;
|
||||
import org.geysermc.connector.utils.LanguageUtils;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.IOException;
|
||||
|
@ -466,6 +467,10 @@ public class ItemRegistry {
|
|||
.damage(itemEntry.getBedrockData())
|
||||
.count(1)
|
||||
.blockRuntimeId(itemEntry.getBedrockBlockId()).build());
|
||||
} else if (entry.getKey().startsWith("minecraft:music_disc_")) {
|
||||
// The Java record level event uses the item ID as the "key" to play the record
|
||||
EffectRegistry.RECORDS.put(itemIndex, SoundEvent.valueOf("RECORD_" +
|
||||
entry.getKey().replace("minecraft:music_disc_", "").toUpperCase(Locale.ENGLISH)));
|
||||
}
|
||||
|
||||
itemNames.add(entry.getKey());
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 6687e1480c65614e49f313afee81a9eaa39803b7
|
||||
Subproject commit e7c1e32117b8d5011ebe0ba86559285b6d8dfecf
|
Loading…
Reference in a new issue