Skip to content

Commit

Permalink
Missing particle type & small tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
Alemiz112 committed May 16, 2024
1 parent c679da9 commit 0eeb31c
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,7 @@
import org.cloudburstmc.protocol.bedrock.codec.v594.serializer.AvailableCommandsSerializer_v594;
import org.cloudburstmc.protocol.bedrock.codec.v671.Bedrock_v671;
import org.cloudburstmc.protocol.bedrock.codec.v685.serializer.*;
import org.cloudburstmc.protocol.bedrock.data.LevelEvent;
import org.cloudburstmc.protocol.bedrock.data.LevelEventType;
import org.cloudburstmc.protocol.bedrock.data.PacketRecipient;
import org.cloudburstmc.protocol.bedrock.data.SoundEvent;
import org.cloudburstmc.protocol.bedrock.data.*;
import org.cloudburstmc.protocol.bedrock.data.command.CommandParam;
import org.cloudburstmc.protocol.bedrock.data.entity.EntityDataFormat;
import org.cloudburstmc.protocol.bedrock.data.entity.EntityDataTypes;
Expand All @@ -23,6 +20,10 @@

public class Bedrock_v685 extends Bedrock_v671 {

protected static final TypeMap<ParticleType> PARTICLE_TYPES = Bedrock_v671.PARTICLE_TYPES.toBuilder()
.insert(93, ParticleType.OMINOUS_ITEM_SPAWNER)
.build();

protected static final TypeMap<SoundEvent> SOUND_EVENTS = Bedrock_v671.SOUND_EVENTS
.toBuilder()
.insert(516, SoundEvent.TRAIL_SPAWNER_CHARGE_ACTIVATE)
Expand Down Expand Up @@ -54,6 +55,7 @@ public class Bedrock_v685 extends Bedrock_v671 {
.build();

protected static final TypeMap<LevelEventType> LEVEL_EVENTS = Bedrock_v671.LEVEL_EVENTS.toBuilder()
.insert(LEVEL_EVENT_PARTICLE_TYPE, PARTICLE_TYPES)
.replace(LEVEL_EVENT_BLOCK + 115, LevelEvent.PARTICLE_TRIAL_SPAWNER_DETECTION_CHARGED)
.insert(LEVEL_EVENT_BLOCK + 116, LevelEvent.PARTICLE_TRIAL_SPAWNER_BECOME_CHARGED)
.insert(LEVEL_EVENT_BLOCK + 117, LevelEvent.ALL_PLAYERS_SLEEPING)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,20 +89,14 @@ protected void writeShapedRecipe(ByteBuf buffer, BedrockCodecHelper helper, Shap
}

protected RecipeUnlockingRequirement readRequirement(ByteBuf buffer, BedrockCodecHelper helper, CraftingDataType type) {
if (!type.equals(CraftingDataType.SHAPED) && !type.equals(CraftingDataType.SHAPELESS)) {
return RecipeUnlockingRequirement.INVALID;
}
final RecipeUnlockingRequirement requirement = new RecipeUnlockingRequirement(RecipeUnlockingRequirement.UnlockingContext.from(buffer.readByte()));
RecipeUnlockingRequirement requirement = new RecipeUnlockingRequirement(RecipeUnlockingRequirement.UnlockingContext.from(buffer.readByte()));
if (requirement.getContext().equals(RecipeUnlockingRequirement.UnlockingContext.NONE)) {
helper.readArray(buffer, requirement.getIngredients(), (buf, h) -> h.readIngredient(buf));
}
return requirement;
}

protected void writeRequirement(ByteBuf buffer, BedrockCodecHelper helper, CraftingRecipeData data) {
if (!data.getType().equals(CraftingDataType.SHAPED) && !data.getType().equals(CraftingDataType.SHAPELESS)) {
return;
}
buffer.writeByte(data.getRequirement().getContext().ordinal());
if (data.getRequirement().getContext().equals(RecipeUnlockingRequirement.UnlockingContext.NONE)) {
helper.writeArray(buffer, data.getRequirement().getIngredients(), (buf, h, ingredient) -> h.writeIngredient(buf, ingredient));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,5 +117,9 @@ public enum ParticleType implements LevelEventType {
/**
* @since v671
*/
WOLF_ARMOR_BREAK
WOLF_ARMOR_BREAK,
/**
* @since 685
*/
OMINOUS_ITEM_SPAWNER,
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public class TextPacket implements BedrockPacket {
/**
* @since v685
*/
private String filteredMessage;
private String filteredMessage = "";

@Override
public final PacketSignal handle(BedrockPacketHandler handler) {
Expand Down

0 comments on commit 0eeb31c

Please sign in to comment.