Skip to content

Commit

Permalink
Fixed beacon effect rewriting
Browse files Browse the repository at this point in the history
  • Loading branch information
RaphiMC committed Nov 6, 2023
1 parent fa98398 commit 4891075
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -496,13 +496,13 @@ public void load() {
final JsonArray javaEffectsJson = this.readJson("java/effects.json", JsonArray.class);
this.javaEffects = HashBiMap.create(javaEffectsJson.size());
for (int i = 0; i < javaEffectsJson.size(); i++) {
this.javaEffects.put(javaEffectsJson.get(i).getAsString(), i);
this.javaEffects.put(javaEffectsJson.get(i).getAsString(), i + 1);
}

final JsonArray bedrockEffectsJson = this.readJson("bedrock/effects.json", JsonArray.class);
this.bedrockEffects = HashBiMap.create(bedrockEffectsJson.size());
for (int i = 0; i < bedrockEffectsJson.size(); i++) {
this.bedrockEffects.put(bedrockEffectsJson.get(i).getAsString(), i);
this.bedrockEffects.put(bedrockEffectsJson.get(i).getAsString(), i + 1);
}

this.bedrockToJavaEffects = new HashMap<>(this.bedrockEffects.size());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ public BlockEntity toJava(UserConnection user, BedrockBlockEntity bedrockBlockEn
private void mapEffect(final CompoundTag oldTag, final CompoundTag newTag, final String oldName, final String newName) {
if (oldTag.get(oldName) instanceof IntTag) {
final int bedrockId = oldTag.<IntTag>get(oldName).asInt();
if (bedrockId == 0) {
return;
}

final String bedrockIdentifier = BedrockProtocol.MAPPINGS.getBedrockEffects().inverse().get(bedrockId);
if (bedrockIdentifier == null) {
ViaBedrock.getPlatform().getLogger().log(Level.WARNING, "Unknown beacon effect: " + bedrockId);
Expand Down

0 comments on commit 4891075

Please sign in to comment.