-
-
Notifications
You must be signed in to change notification settings - Fork 209
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ensure lists/maps in data components are immutable, add lombok's `@Bu…
…ilder`'s for ease of use (#882) * ensure lists/maps in data components are immutable, add lombok's with and builder's for ease of use * remove with where a builder is already present
- Loading branch information
1 parent
04834f2
commit 5743ca3
Showing
28 changed files
with
146 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 15 additions & 3 deletions
18
.../org/geysermc/mcprotocollib/protocol/data/game/item/component/AdventureModePredicate.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
...src/main/java/org/geysermc/mcprotocollib/protocol/data/game/item/component/ArmorTrim.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,26 @@ | ||
package org.geysermc.mcprotocollib.protocol.data.game.item.component; | ||
|
||
import lombok.Builder; | ||
import net.kyori.adventure.key.Key; | ||
import net.kyori.adventure.text.Component; | ||
import org.geysermc.mcprotocollib.protocol.data.game.Holder; | ||
|
||
import java.util.Map; | ||
|
||
@Builder(toBuilder = true) | ||
public record ArmorTrim(Holder<TrimMaterial> material, Holder<TrimPattern> pattern, boolean showInTooltip) { | ||
|
||
@Builder(toBuilder = true) | ||
public record TrimMaterial(String assetName, int ingredientId, Map<Key, String> overrideArmorAssets, Component description) { | ||
public TrimMaterial(String assetName, int ingredientId, Map<Key, String> overrideArmorAssets, Component description) { | ||
this.assetName = assetName; | ||
this.ingredientId = ingredientId; | ||
this.overrideArmorAssets = Map.copyOf(overrideArmorAssets); | ||
this.description = description; | ||
} | ||
} | ||
|
||
@Builder(toBuilder = true) | ||
public record TrimPattern(Key assetId, int templateItemId, Component description, boolean decal) { | ||
} | ||
} |
3 changes: 3 additions & 0 deletions
3
...java/org/geysermc/mcprotocollib/protocol/data/game/item/component/BannerPatternLayer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
...in/java/org/geysermc/mcprotocollib/protocol/data/game/item/component/BeehiveOccupant.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 4 additions & 2 deletions
6
...va/org/geysermc/mcprotocollib/protocol/data/game/item/component/BlockStateProperties.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,14 @@ | ||
package org.geysermc.mcprotocollib.protocol.data.game.item.component; | ||
|
||
import lombok.AllArgsConstructor; | ||
import lombok.Data; | ||
|
||
import java.util.Map; | ||
|
||
@Data | ||
@AllArgsConstructor | ||
public class BlockStateProperties { | ||
private final Map<String, String> properties; | ||
|
||
public BlockStateProperties(Map<String, String> properties) { | ||
this.properties = Map.copyOf(properties); | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
...rc/main/java/org/geysermc/mcprotocollib/protocol/data/game/item/component/Consumable.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
...main/java/org/geysermc/mcprotocollib/protocol/data/game/item/component/ConsumeEffect.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
...in/java/org/geysermc/mcprotocollib/protocol/data/game/item/component/CustomModelData.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,15 @@ | ||
package org.geysermc.mcprotocollib.protocol.data.game.item.component; | ||
|
||
import lombok.Builder; | ||
|
||
import java.util.List; | ||
|
||
@Builder(toBuilder = true) | ||
public record CustomModelData(List<Float> floats, List<Boolean> flags, List<String> strings, List<Integer> colors) { | ||
public CustomModelData(List<Float> floats, List<Boolean> flags, List<String> strings, List<Integer> colors) { | ||
this.floats = List.copyOf(floats); | ||
this.flags = List.copyOf(flags); | ||
this.strings = List.copyOf(strings); | ||
this.colors = List.copyOf(colors); | ||
} | ||
} |
2 changes: 2 additions & 0 deletions
2
...main/java/org/geysermc/mcprotocollib/protocol/data/game/item/component/DyedItemColor.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
...rc/main/java/org/geysermc/mcprotocollib/protocol/data/game/item/component/Equippable.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,12 @@ | ||
package org.geysermc.mcprotocollib.protocol.data.game.item.component; | ||
|
||
import lombok.Builder; | ||
import net.kyori.adventure.key.Key; | ||
import org.checkerframework.checker.nullness.qual.Nullable; | ||
import org.geysermc.mcprotocollib.protocol.data.game.entity.EquipmentSlot; | ||
import org.geysermc.mcprotocollib.protocol.data.game.level.sound.Sound; | ||
|
||
@Builder(toBuilder = true) | ||
public record Equippable(EquipmentSlot slot, Sound equipSound, @Nullable Key model, @Nullable Key cameraOverlay, | ||
@Nullable HolderSet allowedEntities, boolean dispensable, boolean swappable, boolean damageOnHurt) { | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 9 additions & 1 deletion
10
...src/main/java/org/geysermc/mcprotocollib/protocol/data/game/item/component/Fireworks.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 2 additions & 4 deletions
6
...ain/java/org/geysermc/mcprotocollib/protocol/data/game/item/component/FoodProperties.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
...rc/main/java/org/geysermc/mcprotocollib/protocol/data/game/item/component/Instrument.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 7 additions & 2 deletions
9
...n/java/org/geysermc/mcprotocollib/protocol/data/game/item/component/ItemEnchantments.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,18 @@ | ||
package org.geysermc.mcprotocollib.protocol.data.game.item.component; | ||
|
||
import lombok.AllArgsConstructor; | ||
import lombok.Data; | ||
import lombok.With; | ||
|
||
import java.util.Map; | ||
|
||
@Data | ||
@AllArgsConstructor | ||
@With | ||
public class ItemEnchantments { | ||
private final Map<Integer, Integer> enchantments; | ||
private final boolean showInTooltip; | ||
|
||
public ItemEnchantments(Map<Integer, Integer> enchantments, boolean showInTooltip) { | ||
this.enchantments = Map.copyOf(enchantments); | ||
this.showInTooltip = showInTooltip; | ||
} | ||
} |
4 changes: 4 additions & 0 deletions
4
...in/java/org/geysermc/mcprotocollib/protocol/data/game/item/component/JukeboxPlayable.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,16 @@ | ||
package org.geysermc.mcprotocollib.protocol.data.game.item.component; | ||
|
||
import lombok.Builder; | ||
import net.kyori.adventure.key.Key; | ||
import net.kyori.adventure.text.Component; | ||
import org.geysermc.mcprotocollib.protocol.data.game.Holder; | ||
import org.geysermc.mcprotocollib.protocol.data.game.level.sound.Sound; | ||
import org.jetbrains.annotations.Nullable; | ||
|
||
@Builder(toBuilder = true) | ||
public record JukeboxPlayable(@Nullable Holder<JukeboxSong> songHolder, @Nullable Key songLocation, boolean showInTooltip) { | ||
|
||
@Builder(toBuilder = true) | ||
public record JukeboxSong(Sound soundEvent, Component description, float lengthInSeconds, int comparatorOutput) { | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.