Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Geysermetica #2

Open
wants to merge 1,368 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
1368 commits
Select commit Hold shift + click to select a range
9091393
Keep chugging away
Camotoy Apr 20, 2024
6d8021f
Update the non-item parts (#4586)
basaigh Apr 20, 2024
aed7f1b
Update the item parts
Camotoy Apr 20, 2024
94e533e
Fix tags and attributes
basaigh Apr 21, 2024
8bd2df0
Trying to get more compiled but brain is officially fried for the day!
Camotoy Apr 21, 2024
ab8832b
Compiles
AJ-Ferguson Apr 21, 2024
687ddbb
Tiny fixes
Camotoy Apr 21, 2024
61907b1
Little more work
Camotoy Apr 21, 2024
57ce570
Update mappings submodule
basaigh Apr 21, 2024
b73f23d
remove global palette bits, fix nullable block entity tags
onebeastchris Apr 21, 2024
48164e9
Bump mcpl to fix item deserialization
basaigh Apr 21, 2024
c5e02d2
ensure geyser builds
onebeastchris Apr 21, 2024
8381a14
Fix book signing
AJ-Ferguson Apr 21, 2024
dac5f69
Bump mcpl
basaigh Apr 22, 2024
c34f0f2
Update for latest MCProtocolLib
Camotoy Apr 22, 2024
6a5efa3
Start on 1.20.5 mod platform support - NeoForge (temporarily) excluded
onebeastchris Apr 22, 2024
11f79d4
Refactor Java registry storage; implement trim support
Camotoy Apr 22, 2024
d3f902a
Banners
AJ-Ferguson Apr 23, 2024
1bdbcab
Wolf variants
AJ-Ferguson Apr 23, 2024
3f499e3
Start on custom skulls
Kas-tle Apr 23, 2024
9d8edad
Fix horse inventory
AJ-Ferguson Apr 23, 2024
c48428d
init: pick item component change
onebeastchris Apr 23, 2024
b814088
Refactor TagCache to be extensible
Camotoy Apr 23, 2024
d105dad
Update for release. STILL NOT READY YET THOUGH
Camotoy Apr 23, 2024
abea013
Fix llama carpets
Camotoy Apr 23, 2024
c54624f
Fix some cases of empty tags being needed
Camotoy Apr 23, 2024
687d299
target 1.20.5 release, build neoforge again
onebeastchris Apr 23, 2024
bbaffb2
Wolf interactions
AJ-Ferguson Apr 23, 2024
a1534e4
Basic Armadillo structure
Camotoy Apr 24, 2024
9490a09
Calculate horse inventory size
AJ-Ferguson Apr 24, 2024
b29e0d9
Move MCProtocolLib to dev - package ID change
Camotoy Apr 24, 2024
9d540fe
Shulker box NPE fix
Camotoy Apr 24, 2024
652f6af
Fix custom skulls 1.20.5
Kas-tle Apr 25, 2024
99e6a29
Entity properties
Kas-tle Apr 25, 2024
16cb76f
neoforge 1.20.5 boots
onebeastchris Apr 25, 2024
8e3a3ea
implement curse of binding check for wolf armor removal
onebeastchris Apr 25, 2024
3656395
Armadillo states
AJ-Ferguson Apr 26, 2024
91a7460
idea: deal with cookies and transfer
onebeastchris Apr 26, 2024
f67c131
Forcibly disconnect players even if no server target was set in the J…
onebeastchris Apr 26, 2024
68534f3
Merge remote-tracking branch 'upstream/feature/1.20.5' into feature/1…
onebeastchris Apr 26, 2024
5015a2e
bump project version to 2.3.0
onebeastchris Apr 26, 2024
a57e7b5
Update ViaVersion api usage to be compatible with ViaVersion 4.10 (#4…
onebeastchris Apr 26, 2024
42a9ba6
Update ViaProxy platform (#4607)
RaphiMC Apr 26, 2024
2fa7585
Switch to Cloudburst NBT only
Camotoy Apr 27, 2024
9217414
Merge remote-tracking branch 'origin/feature/1.20.5' into feature/1.20.5
Camotoy Apr 27, 2024
f47754b
Goat horns
Camotoy Apr 27, 2024
6d5ac23
Dyeable items work.
Camotoy Apr 28, 2024
e97bbcc
Potion effect colors
AJ-Ferguson Apr 28, 2024
9cb9a14
Don't use tee to write metadata.json to downloads API (#4612)
Kas-tle Apr 28, 2024
420f677
Fix suspicious stew NPEs
basaigh Apr 28, 2024
9b1e450
Fix injectors, should work with Spigot/Paper 1.20.5 now
onebeastchris Apr 28, 2024
8ab0921
Merge remote-tracking branch 'upstream/feature/1.20.5' into feature/1…
onebeastchris Apr 28, 2024
82123ae
Fix: Modded platform injector not being used
onebeastchris Apr 28, 2024
e8c1c22
Fix banners on shields
Camotoy Apr 29, 2024
88ae447
Fix banner block entity base colors with no patterns
Camotoy Apr 29, 2024
a82a156
Firework shapes
Camotoy Apr 29, 2024
4ff746e
Fix translateTag NPE
AJ-Ferguson Apr 29, 2024
8b7b8cd
Properly shutdown LocalSession's, ensure transferring works properly …
onebeastchris Apr 29, 2024
5d3630c
ominous banners - this really isn't ideal
onebeastchris Apr 29, 2024
28d5db6
revert bad change
onebeastchris Apr 29, 2024
c963503
Entity scale attribute is now applied
Camotoy Apr 30, 2024
dacacc6
Anvil renaming
AJ-Ferguson Apr 30, 2024
74d6a37
Fix bug when adding enchantments in anvil
AJ-Ferguson Apr 30, 2024
ff9965f
Translate item repair cost component
AJ-Ferguson Apr 30, 2024
dd745b9
move to paper-adapters
onebeastchris Apr 30, 2024
d99f498
translate ominous banners
onebeastchris Apr 30, 2024
4a0a694
revert bad diff
onebeastchris Apr 30, 2024
51cbbba
Merge remote-tracking branch 'upstream/feature/1.20.5' into feature/1…
onebeastchris Apr 30, 2024
2558354
viaversion 4.10.0 compat, indicate 1.20.6 support on modrinth
onebeastchris Apr 30, 2024
aff7d2c
Fix potential NPE
AJ-Ferguson Apr 30, 2024
59a2c0d
Use item tags for all animal loved food
Camotoy Apr 30, 2024
abb1d7d
Indicate Java 1.20.6 support
Camotoy Apr 30, 2024
1e8d6b2
Different registry implementation; fix banner blocks with ViaVersion
Camotoy May 1, 2024
cc635d4
This would probably end up being an issue...
Camotoy May 1, 2024
1291b89
Ensure proper Geyser starting/disabling when Geyser is used on a clie…
onebeastchris May 1, 2024
fdae333
Add data components hash code to translated NBT
AJ-Ferguson May 1, 2024
d003818
Potion fixes
AJ-Ferguson May 2, 2024
29a613b
Use java default area effect cloud radius
AJ-Ferguson May 2, 2024
60f8532
Fix attribute display text
AJ-Ferguson May 2, 2024
f7c65f3
properly annotate methods in the ServerTransferEvent
onebeastchris May 2, 2024
efda134
Merge branch 'master' into feature/1.20.5
Camotoy May 2, 2024
6a214f2
Remove duplicate method
Camotoy May 2, 2024
cab1a20
Set mappings commit to master
Camotoy May 2, 2024
b39ed5d
Panda eating particles are not necessarily bamboo
Camotoy May 3, 2024
a39cd65
Fix velocity ping passthrough (#4626)
basaigh May 3, 2024
9d299ee
Fix particle reading issues (#4631)
basaigh May 3, 2024
b8fe71a
Bump MCPL to fix ClientboundExplodePacket (#4635)
AJ-Ferguson May 4, 2024
5770c96
Indicate support for 1.20.81
Camotoy May 5, 2024
8addcad
Bump MCPL to increase NBT max depth (#4639)
AJ-Ferguson May 5, 2024
0a261f1
Update MCPL and MCAuthLib (#4645)
AJ-Ferguson May 7, 2024
cda7a19
Fix discarding of custom trim patterns/materials (#4642)
eclipseisoffline May 7, 2024
627c2ba
Fix various mob attack animations (#4627)
AJ-Ferguson May 7, 2024
e697eb3
Feat: Make connection data exposed in api less prone to throw errors …
onebeastchris May 10, 2024
7801e35
Map new Mace enchantments for Bedrock clients (#4653)
Teelair May 10, 2024
86dafbc
Ensure we load mod resources correctly on Geyser-NeoForge (#4651)
onebeastchris May 12, 2024
b11a6d7
Remove unofficial skin sources and add skin event for extensions (#4507)
rtm516 May 14, 2024
4d61766
Fix SessionSkinApplyEvent not keeping altered skin data (#4663)
rtm516 May 14, 2024
6c4b2cb
Don't create a property manager if an entity has no properties
Camotoy May 15, 2024
423d2e3
Emulate vanilla behavior with existing registries
Camotoy May 15, 2024
9bca012
Bump Erosion
Camotoy May 15, 2024
cbaa9cd
Block refactory
Camotoy May 17, 2024
a46332a
Move block breaking to new system
Camotoy May 17, 2024
1cd0aad
Comment out snow collision
Camotoy May 17, 2024
b010c50
Various entity fixes: Ensure TNT doesn't bug into the ground, reset p…
onebeastchris May 17, 2024
5ebb6ef
Fix: using curly brackets in custom Minecraft locale overrides
onebeastchris May 17, 2024
06dc0d1
Collisions without BlockMapping
Camotoy May 17, 2024
beef01f
Pistons now use the new block stuff
Camotoy May 18, 2024
a439f3e
Fix compilation for Spigot
Camotoy May 18, 2024
8b77031
Resolve issue when trying to transfer a Geyser player (#4673)
onebeastchris May 18, 2024
6c904b2
It's almost done.
Camotoy May 18, 2024
1e9dbaf
Here is the Spigot change
Camotoy May 18, 2024
d85549c
BlockMapping is removed
Camotoy May 20, 2024
1b075ba
Actually implement adventure mode predicates, kind of.
Camotoy May 20, 2024
f489fd3
Add TrapDoorBlock
AJ-Ferguson May 20, 2024
a780eea
Open advancement tab regardless of currently open tab (#4665)
gecko10000 May 20, 2024
db166ad
Small optimizations and BlockStateValues reduction
Camotoy May 21, 2024
0094fa1
BlockState values can now be switched at runtime
Camotoy May 21, 2024
96bfda2
Fix #4683
Camotoy May 22, 2024
f7b026d
Remove old sneaking/crawling workarounds
Camotoy May 22, 2024
6f4c29c
Match Advancement Packet Behavior Towards Java (#4684)
gecko10000 May 22, 2024
377eb07
Merge remote-tracking branch 'origin/master' into dev
Kas-tle May 23, 2024
ec3327e
Minor minor changes
Camotoy May 23, 2024
d5fdbeb
Make allow-third-party-capes default to false (#4690)
rtm516 May 25, 2024
0ea01bf
Allow skull pick item NBT
Camotoy May 25, 2024
5f7a31a
Fix #4688
Camotoy May 26, 2024
fa6808a
Bedrock 1.21.0 Support (#4687)
Kas-tle May 27, 2024
cb0488a
Fix NPE in TippedArrow when it has no components (#4694)
valaphee May 27, 2024
3570caa
Fix crafting output not updating sometimes (#4692)
valaphee May 27, 2024
cf27b88
Switch to centralized GitHub actions (#4693)
Kas-tle May 27, 2024
444b5ec
Remove BlockStateUpdater dependency
Camotoy May 27, 2024
675faf6
Remove unused chat class
Camotoy May 27, 2024
6c88cc5
Merge branch 'master' of https://github.com/GeyserMC/Geyser into dev
Camotoy May 27, 2024
fe63665
Composite gradle setup and artifact archival (#4696)
Kas-tle May 28, 2024
0fcf0f9
Update Bungee version check, create logger earlier (#4697)
onebeastchris May 28, 2024
63c84bc
Yeet lectern cache (#4695)
onebeastchris May 29, 2024
97d9207
Merge branch 'dev' of https://github.com/GeyserMC/Geyser into dev
Camotoy May 29, 2024
7ba95f1
Composite gradle setup and artifact archival (#4696)
Kas-tle May 28, 2024
dc15491
Only include downloads on master
Kas-tle May 29, 2024
8be60b4
Remove lectern/item frame dropping handling for pre 1.20.60
onebeastchris May 29, 2024
66f30a2
Ensure we send commands/chat the same way a Java client would (#4703)
onebeastchris May 29, 2024
c8fbffb
Piston head correct pick block behavior
Camotoy May 30, 2024
da5d800
Add native offhand support for *some* items
Camotoy May 31, 2024
214cc5a
Initial changes for Java 1.21
Camotoy Jun 1, 2024
65fd409
Painting re-implemented. Started on enchantments
Camotoy Jun 3, 2024
8ad10f8
Boats are leashable
Camotoy Jun 3, 2024
aaad10b
Merge remote-tracking branch 'upstream/master' into dev
onebeastchris Jun 3, 2024
0ca4230
Feature: Add API to show/hide GUI elements (#4705)
onebeastchris Jun 3, 2024
6c245a6
Adapt for new enchantment changes
Camotoy Jun 4, 2024
3ead9e9
More unneeded classes
Camotoy Jun 4, 2024
087322f
Small set optimization
Camotoy Jun 4, 2024
688b642
Ignore PurchaseReceiptPacket (#4719)
onebeastchris Jun 4, 2024
42ae9eb
Fix air bubbles for Bedrock 1.21
Camotoy Jun 4, 2024
e2a61d4
Merge branch 'dev' into feature/1.21
Camotoy Jun 5, 2024
fcdd1b9
New banner patterns
Camotoy Jun 5, 2024
4ee9dd5
New potions and merge potion enums
Camotoy Jun 5, 2024
3f8739a
New effects
Camotoy Jun 5, 2024
8f5d156
Implement Bogged entity
Camotoy Jun 6, 2024
c3994a6
Override forward-hostname setting if ViaProxy wildcard domain handlin…
RaphiMC Jun 6, 2024
29c9515
Re-implement jukebox songs
Camotoy Jun 7, 2024
79bcc79
Remove Registries.RECORDS
Camotoy Jun 7, 2024
b7931f8
Update protocol to suppress packet warnings
onebeastchris Jun 6, 2024
9b776b5
Fixed remote config being reset everytime when accessed on Geyser-Via…
RaphiMC Jun 7, 2024
8ae1150
Remove unused lectern code in ModWorldManager, fix spelling error in …
onebeastchris Jun 7, 2024
007ecb4
Ensure custom blocks can be represented at any index
Camotoy Jun 9, 2024
c136bcb
Merge remote-tracking branch 'origin/dev' into feature/1.21
Camotoy Jun 9, 2024
e9e3646
New potion effects
Camotoy Jun 9, 2024
ae6059b
Implement wind charges
Camotoy Jun 9, 2024
f954dd9
oooops
Camotoy Jun 9, 2024
edee5e7
Add builtin server transfer support for ViaProxy (#4723)
RaphiMC Jun 9, 2024
02179a7
You shall compile!
Camotoy Jun 10, 2024
18ad652
Merge branch 'master' of https://github.com/GeyserMC/Geyser
Camotoy Jun 10, 2024
538e9f4
Properly remove SnowCollision
Camotoy Jun 10, 2024
9a310f2
1.21-pre4 updated block tags
Camotoy Jun 11, 2024
7fc370c
Merge remote-tracking branch 'origin/master' into feature/1.21
Camotoy Jun 11, 2024
d198071
Properly show dyed wolf armor
Camotoy Jun 11, 2024
956a84a
Enchantment tag can be null
Camotoy Jun 11, 2024
b78c7b2
Fix #4729
Camotoy Jun 11, 2024
29dacd2
Properly remap coral blocks on 1.20.80
Camotoy Jun 11, 2024
a42c979
This variant of tag loading should be slightly more efficient
Camotoy Jun 12, 2024
82d68bf
Bump fabric/neoforge dependencies to 1.21, update README.md, bump Gey…
onebeastchris Jun 12, 2024
ecffb56
Refactor static recipe loading
Camotoy Jun 13, 2024
7314571
Merge branch 'feature/1.21' of https://github.com/GeyserMC/Geyser int…
Camotoy Jun 13, 2024
2ecc4cd
Point to right mappings
Camotoy Jun 13, 2024
82d0a87
Remove debug code
Camotoy Jun 13, 2024
9db1dd1
Fix some water plants not being waterlogged
Camotoy Jun 13, 2024
52a93ec
Implement breeze
Camotoy Jun 13, 2024
3528b1d
Allow recipes to default count as 1
Camotoy Jun 13, 2024
be04ff2
Update to latest MCProtocolLib
Camotoy Jun 13, 2024
026e6fc
Merge remote-tracking branch 'origin/master' into feature/1.21
Camotoy Jun 13, 2024
73d5f24
Fix compilation for modded
Camotoy Jun 13, 2024
d00cab1
Only translate double chest tags if we are dealing with a double ches…
onebeastchris Jun 13, 2024
db5a528
Fix: Improper detection of virtual double chests (#4738)
onebeastchris Jun 13, 2024
842e1b4
Merge branch 'master' of https://github.com/GeyserMC/Geyser into feat…
Camotoy Jun 13, 2024
ce3083b
Fix key regression with pre-built registries
Camotoy Jun 13, 2024
746be56
Sanity check for BlockState being chest
Camotoy Jun 13, 2024
b6653ac
Catch Throwable when trying to load world adapter
onebeastchris Jun 13, 2024
a5ecee7
Update Bungee warning for outdated proxy checks
onebeastchris Jun 13, 2024
4a334a2
Bed block sanity check for villagers
Camotoy Jun 13, 2024
6a71577
Update mod dependencies to their official 1.21 releases
onebeastchris Jun 13, 2024
09c0ada
Catch Throwable when trying to load world adapter
onebeastchris Jun 13, 2024
138c7b4
Catch EOFExceptions while pinging Java servers when it is misconfigur…
onebeastchris Jun 14, 2024
28e4661
Fix incoming player chat
Camotoy Jun 14, 2024
a9ba1ad
Properly translate ominous items
Camotoy Jun 14, 2024
7e87af7
Fix item attribute modifiers
Camotoy Jun 14, 2024
be83fe7
Re-enable crafter inventory
Camotoy Jun 14, 2024
b1d319b
Add Spigot 1.21 world adapter
onebeastchris Jun 15, 2024
851ed36
Translate vault block entity
Camotoy Jun 15, 2024
6025931
Properly translate player entity UUID for vaults
Camotoy Jun 16, 2024
bd30b34
Bump MCPL
AJ-Ferguson Jun 16, 2024
3b46622
Merge branch 'master' of https://github.com/GeyserMC/Geyser into feat…
Camotoy Jun 16, 2024
0484782
Merge branch 'feature/1.21' of https://github.com/GeyserMC/Geyser int…
Camotoy Jun 16, 2024
d9f9fcf
Bump Protocol
Camotoy Jun 16, 2024
6cda7c2
Partially implement handling of "hide_tooltip" and fix attribute modi…
YHDiamond Jun 16, 2024
1efb633
Bump MCPL (#4756)
basaigh Jun 16, 2024
63a3da7
Fix reading custom jukebox songs (#4757)
eclipseisoffline Jun 16, 2024
deb25d7
Bump mappings to fix effects error on startup (#4760)
basaigh Jun 17, 2024
29928c2
Sanity check for shulker boxes (#4762)
onebeastchris Jun 17, 2024
77fa37f
Fix: readme not being synched to modrinth, publish spigot/bungee/velo…
onebeastchris Jun 17, 2024
a9300fb
Vault: show some components in block entity (enchantments, potion types)
Camotoy Jun 18, 2024
6884a0f
Fix: norwegian locale handling (#4716)
onebeastchris Jun 19, 2024
2c47330
Use integrated world managers for decorated pot animation
Camotoy Jun 19, 2024
34158f9
Feat: Add changelog to modrinth releases (#4770)
onebeastchris Jun 19, 2024
126d56d
Fix: Ignore invalid block entity data sent by Java server (#4766)
onebeastchris Jun 19, 2024
57cb854
Update Floodgate download location
Camotoy Jun 19, 2024
2e6cf2f
Update mappings
Camotoy Jun 20, 2024
ded6f6b
Fix NPEs caused by custom head blocks from Polymer (#4764)
eclipseisoffline Jun 20, 2024
fc529a6
Fix build errors reporting to the wrong directory by updating blossom…
AlexProgrammerDE Jun 20, 2024
f49acb2
Indicate support for Bedrock 1.21.1
Camotoy Jun 20, 2024
dd9d5f3
Work around Bedrock players looking like Steve
Camotoy Jun 20, 2024
78642db
Ensure players get disconnected with no Java disconnect packet
Camotoy Jun 20, 2024
c00a02e
Add trial chambers map icon (#4783)
basaigh Jun 21, 2024
1104707
Fix: Bedrock players dying of fall damage, instead of falling in the …
onebeastchris Jun 21, 2024
a12d60d
Show trial chamber map item texture
Camotoy Jun 21, 2024
21ccafc
DataComponentType.ITEM_NAME should remove italics
Camotoy Jun 21, 2024
e6bf3ff
Proper trial spawner block entity data
Camotoy Jun 21, 2024
55e90b6
Show build number in startup log, fix Geyser version command(#4336)
onebeastchris Jun 22, 2024
a8bd93a
Add fix (#4792)
letsgoawaydev Jun 23, 2024
ca2312c
Create .editorconfig (#4615)
AlexProgrammerDE Jun 24, 2024
835ba9e
Remove casting from block mappings
Camotoy Jun 24, 2024
130b272
Limit particle amount in LevelParticlesPacket (#4802)
AJ-Ferguson Jun 29, 2024
c621e93
Merge branch 'master' of https://github.com/GeyserMC/Geyser
Camotoy Jun 29, 2024
d800f73
Update license to 2024
Camotoy Jun 29, 2024
7612686
Don't show git version string twice
Camotoy Jul 1, 2024
48ea81e
Update mappings (#4812)
onebeastchris Jul 1, 2024
ff1e1dd
Fix attribute modifier tooltips (#4816)
eclipseisoffline Jul 2, 2024
b9c2f61
Updating cosmetica to 1.21 + Better README.MD
oliik2013 Jul 5, 2024
c55cbe9
Deleted gradle
oliik2013 Jul 5, 2024
adaaa20
Deleted broken github workflows
oliik2013 Jul 5, 2024
2ebd9ce
deleted: README.md
oliik2013 Jul 7, 2024
077f1a5
new file: README.md
oliik2013 Jul 7, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Tiny fixes
  • Loading branch information
Camotoy committed Apr 24, 2024
commit 687ddbb520dc71cd5dfbdc928ba62a0d3992cf12
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,14 @@
import com.github.steveice10.mc.protocol.data.game.item.component.DataComponentType;
import com.github.steveice10.mc.protocol.data.game.item.component.DataComponents;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.cloudburstmc.nbt.NbtType;
import org.geysermc.geyser.registry.type.ItemMapping;
import org.geysermc.geyser.session.GeyserSession;
import org.geysermc.geyser.translator.item.BedrockItemBuilder;

import java.util.ArrayList;
import java.util.List;

public class DecoratedPotItem extends BlockItem {

public DecoratedPotItem(String javaIdentifier, Builder builder) {
Expand All @@ -41,12 +46,14 @@ public DecoratedPotItem(String javaIdentifier, Builder builder) {
public void translateComponentsToBedrock(@NonNull GeyserSession session, @NonNull DataComponents components, @NonNull BedrockItemBuilder builder) {
super.translateComponentsToBedrock(session, components, builder);

components.get(DataComponentType.POT_DECORATIONS); // TODO what does this look like on Bedrock?
// if (tag.remove("BlockEntityTag") instanceof CompoundTag blockEntityTag) {
// if (blockEntityTag.remove("sherds") instanceof ListTag sherds) {
// // bedrock wants it on the root level
// tag.put(sherds);
// }
// }
List<Integer> decorations = components.get(DataComponentType.POT_DECORATIONS); // TODO maybe unbox in MCProtocolLib
if (decorations != null) {
List<String> sherds = new ArrayList<>(decorations.size());
for (Integer decoration : decorations) {
ItemMapping mapping = session.getItemMappings().getMapping(decoration);
sherds.add(mapping.getBedrockIdentifier());
}
builder.putList("sherds", NbtType.STRING, sherds);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,6 @@
import com.github.steveice10.mc.protocol.data.game.item.component.DataComponents;
import com.github.steveice10.mc.protocol.data.game.item.component.Filterable;
import com.github.steveice10.mc.protocol.data.game.item.component.WrittenBookContent;
import com.github.steveice10.opennbt.tag.builtin.CompoundTag;
import com.github.steveice10.opennbt.tag.builtin.ListTag;
import com.github.steveice10.opennbt.tag.builtin.StringTag;
import com.github.steveice10.opennbt.tag.builtin.Tag;
import net.kyori.adventure.text.Component;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.cloudburstmc.nbt.NbtMap;
Expand All @@ -47,7 +43,6 @@

public class WrittenBookItem extends Item {
public static final int MAXIMUM_PAGE_EDIT_LENGTH = 1024;
public static final int MAXIMUM_PAGE_LENGTH = 32768;
public static final int MAXIMUM_PAGE_COUNT = 100; // Java edition limit. Bedrock edition has a limit of 50 pages.
public static final int MAXIMUM_TITLE_LENGTH = 16;

Expand All @@ -73,33 +68,8 @@ public void translateComponentsToBedrock(@NonNull GeyserSession session, @NonNul
builder.putList("pages", NbtType.COMPOUND, bedrockPages);

builder.putString("title", bookContent.getTitle().getRaw())
.putString("author", bookContent.getAuthor());
.putString("author", bookContent.getAuthor())
.putInt("generation", bookContent.getGeneration());
// TODO isResolved
}

private boolean isValidWrittenBook(CompoundTag tag) {
if (!(tag.get("title") instanceof StringTag title)) {
return false;
}
if (title.getValue().length() > (MAXIMUM_TITLE_LENGTH * 2)) {
// Java rejects books with titles more than 2x the maximum length allowed in the input box
return false;
}

if (!(tag.get("author") instanceof StringTag)) {
return false;
}

if (!(tag.get("pages") instanceof ListTag pages)) {
return false;
}
for (Tag pageTag : pages) {
if (pageTag instanceof StringTag page) {
if (page.getValue().length() > MAXIMUM_PAGE_LENGTH) {
return false;
}
}
}
return true;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@

package org.geysermc.geyser.translator.inventory;

import com.github.steveice10.mc.protocol.data.game.item.ItemStack;
import com.github.steveice10.mc.protocol.data.game.inventory.ContainerType;
import com.github.steveice10.mc.protocol.data.game.item.ItemStack;
import com.github.steveice10.mc.protocol.data.game.item.component.DataComponentType;
import com.github.steveice10.mc.protocol.data.game.item.component.DataComponents;
import com.github.steveice10.mc.protocol.data.game.recipe.Ingredient;
import com.github.steveice10.opennbt.tag.builtin.IntTag;
import com.github.steveice10.opennbt.tag.builtin.Tag;
import it.unimi.dsi.fastutil.ints.*;
import lombok.AllArgsConstructor;
import org.checkerframework.checker.nullness.qual.Nullable;
Expand Down Expand Up @@ -909,10 +909,11 @@ private static ItemStackResponseSlot makeItemEntry(int bedrockSlot, GeyserItemSt
// As of 1.16.210: Bedrock needs confirmation on what the current item durability is.
// If 0 is sent, then Bedrock thinks the item is not damaged
int durability = 0;
if (itemStack.getNbt() != null) {
Tag damage = itemStack.getNbt().get("Damage");
if (damage instanceof IntTag) {
durability = ItemUtils.getCorrectBedrockDurability(itemStack.asItem(), ((IntTag) damage).getValue());
DataComponents components = itemStack.getComponents();
if (components != null) {
Integer damage = components.get(DataComponentType.DAMAGE);
if (damage != null) {
durability = ItemUtils.getCorrectBedrockDurability(itemStack.asItem(), damage);
}
}

Expand Down