3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-12-18 20:40:08 +01:00
Commit graph

130 Commits

Autor SHA1 Nachricht Datum
md_5
38de0b81e2
SPIGOT-5805: NPE when getting an Attribute from a Player 2020-06-25 13:19:51 +10:00
md_5
7ea3c040bc
Update to Minecraft 1.16.1 2020-06-25 10:00:00 +10:00
Aikar
1b2830a3b3 SPIGOT-4441: Fix serializing Components to and from Legacy
While cfeef75cd9 might of semi helped being able to save black text
lore, it actually took a fundamental problem with the legacy serialization
code and expanded it to break even more aspects of the server when dealing
with Component to Legacy conversion.

This is causing data loss in Spigot with cases such as setting an item name
to white gets stripped resulting in it being italic.

Additionally, things such as book pages have been returning black formatting
codes for the end of the line even when the user doesn't have colors in the book.

The root issue is that the "Default Color" system is fundamentally wrong.

Components do not and should not care about what element of the game they
are being used by, and that's what the default color system did.

It results in components that if obtained from 1 source such as a Book
where the default / rendered color is black, is then copied to another
source such as an Entity name, the black is carried forward and shown
in the Entity name, when in reality it should have been white.

This commit reverts cfeef75cd9 and fixes the underlying serialization
issues when it comes to Legacy to and From conversions.

There was quite a number of issues with this code overall, in how
it handles inserting color codes, new line parsing and such.

Books was using mojangs own "getLegacyString" which doesn't match behavior.
We also do not want to use Mojangs method as there is no guarantee they don't
remove that in future.
Plus, everything about books uses the CB implementation anyways, and it should
be consistent (this was mandatory to avoid serialization format changes on old vs new)

These changes as is results in Item Stacks already serialized will not
change contents when they go to component and back, so this won't impact
any existing data.

Newly created books though for example will change behavior in that they
will no longer insert black color codes in the serialized data and will
only represent intentional color changes by the creator of the book.
This will result in cleaner data on them, and books are the only thing
I'm aware of that has a behavioral shift due to the likelyhood of the
default color system kicking in on other parts of the string.

A unit test has been added to verify integrity of serialization to
ensure that any legacy string that is converted into Components will
always re-encode back in the same way when going back to Legacy.
2020-06-01 19:19:42 +10:00
ben
aae46f82ea #665: Add test for Material#getCraftingRemainingItem() 2020-05-28 19:31:27 +10:00
md_5
ce66f6937b Misc checkstyle fixes 2020-04-14 12:34:43 +10:00
Bjarne Koll
6b00b14539 #639: Deep clone itemmetas persistent container on clone
After this commit, spigot now creates a deep copy of the
itemmeta's persistent data container when the itemmeta
instance is cloned.

This change fixes the bug that, after cloning itemmeta, the container
instance the cloned meta would point to was equal to the original one.
This resulted in two itemmeta instances sharing a single persistent
container.
2020-03-02 13:10:21 +11:00
md_5
fba9f4876b Improve legacy conversion of some materials that changed post flattening 2020-02-21 12:13:05 +11:00
ysl3000
2d151f4c33 #624: Add an API for passing the heightmap to getHighestBlockAt* method 2020-02-09 10:32:24 +11:00
md_5
a0e88fb362 SPIGOT-5536: Material.values() causes legacy data init 2020-01-23 08:53:36 +11:00
md_5
efd6cf55fc Only load legacy support data if something uses it 2020-01-22 11:15:58 +11:00
md_5
ec4b2b5ef1 SPIGOT-5516: Correct EnchantmentTarget values 2020-01-15 14:20:14 +11:00
md_5
de42aa13f3 Update to Minecraft 1.15 2019-12-11 09:00:00 +11:00
ShaneBeee
db98d54df9 SPIGOT-5362: Suspicious stews fail isSimilar check 2019-10-14 21:04:58 +11:00
md_5
46351e1783 SPIGOT-5341: Add Material.isAir 2019-10-06 18:41:56 +11:00
ShaneBeee
03b145b300 SPIGOT-5158: Add SuspiciousStewMeta 2019-09-09 19:22:40 +10:00
md_5
e73aabd666 Update to Minecraft 1.14.4 2019-07-20 09:00:00 +10:00
md_5
bf0ea33de6 SPIGOT-5105: The EntityTag nbt tag disappears from preset armor_stand items. 2019-06-29 16:55:36 +10:00
md_5
fe3930ce00 Update to Minecraft 1.14.3-pre4 2019-06-21 20:00:00 +10:00
PurkkaKoodari
b7db6fba12 SPIGOT-2000: Picking up items to shield slot working inconsistently when inventory is full 2019-06-08 19:48:49 +10:00
md_5
cb3d14c5a7 Update to Minecraft 1.14.2 2019-05-28 06:30:00 +10:00
Yannick Lamprecht
eb99127a36 SPIGOT-4833: Allow access to LivingEntity memories 2019-05-19 20:09:15 +10:00
md_5
3057b72c7d SPIGOT-4880: Potion effects with unknown names. 2019-05-07 09:22:45 +10:00
md_5
0d76f8658d SPIGOT-4872: LootTables missing a few loot tables 2019-05-06 08:40:15 +10:00
md_5
84400e66b8 SPIGOT-4871: Manually opened double chest doesn't have close animation 2019-05-05 18:39:58 +10:00
md_5
1fa9a81514 SPIGOT-4802: Add CrossbowMeta 2019-05-01 20:18:01 +10:00
md_5
d7d28b1244 SPIGOT-4818: Unit test banner patterns 2019-04-30 15:20:11 +10:00
md_5
e3df3d5cda Add Override annotations where appropriate 2019-04-28 11:38:01 +10:00
Bjarne Koll
42f88f72b5 Replace ItemTag API with new API that also expands to Tiles and Entities 2019-04-25 14:42:39 +10:00
md_5
58c5c617d8 SPIGOT-4736: Serialized ItemStack Lore Doesn't Deserialize 2019-04-25 10:06:40 +10:00
md_5
93ad381a68 SPIGOT-4727: Fix CraftEvil for legacy plugins 2019-04-24 09:40:42 +10:00
md_5
364b6fbb73 Fix weird test import in EnderDragonPhaseTest 2019-04-23 21:28:41 +10:00
md_5
5fea790398 Apply import ordering rules to CraftBukkit classes 2019-04-23 14:56:58 +10:00
md_5
48c4c5ca81 Begin implementation of CheckStyle style checking 2019-04-23 14:00:30 +10:00
md_5
a2d787f6eb Update to Minecraft 1.14-pre5 2019-04-23 12:00:00 +10:00
blablubbabc
c3749a2358 Remove the Damage tag from items when it is 0.
CraftBukkit (and Minecraft as well in some cases, such as when getting
an item from the creative inventory menu) will omit the Damage tag when
it is zero. However, minecraft will add the tag in some situations
nevertheless, such as when loading the ItemStack, or when explictly
setting the item undamaged.

These items (with and without the Damage tag for undamaged items) will
be considered as different by minecraft and CraftBukkit in various
situations, even though they should not. In CraftBukkit these items will
actually only be considered unsimilar if the items' metadata is not
'empty' (if it contains other additional metadata, such as enchantments,
etc.).

If the item's tag is empty after removing the Damage tag, it gets
completely removed. The setRepairCost function was adapted to behave in
the same way (removal of the tag if it becomes empty).
2019-04-20 13:00:41 +10:00
md_5
a49270b28b Mappings Update 2019-03-17 11:48:53 +11:00
md_5
1dbe87c8cc SPIGOT-4646: Test + fix InventoryWrapper.getContents 2019-03-05 16:59:40 +11:00
Brokkonaut
d158f2e993 Fix EntityPickupItemEvent getRemaining / PlayerInventory#canHold
Without this change the calculation of fitting items was incorrect, so event.getRemaining() did return 0 when it should not be 0.
2019-02-13 16:59:39 +11:00
Bjarne Koll
8059a937eb SPIGOT-4577: Fix loss of int/double custom tags when serialized to yaml 2019-01-14 10:12:55 +11:00
Parker Hawke
4b843638ea Add BlockData#getAsString(boolean) to hide unspecified states 2018-12-18 11:03:20 +11:00
md_5
c64fe5080c Mappings Update 2018-12-13 11:00:00 +11:00
Bjarne Koll
38e4c013b6 SPIGOT-4347: Add API to allow storing arbitrary values on ItemStacks 2018-12-04 09:44:56 +11:00
md_5
b1d149cfd0 SPIGOT-4489: NOTE_BLOCK incorrectly has BlockStateMeta 2018-11-16 15:18:28 +11:00
md_5
f3f2fe5795 SPIGOT-4455: ChunkData.getType returns legacy material 2018-10-29 07:17:59 +11:00
md_5
b4230a9a7e Update to Minecraft 1.13.2 2018-10-23 06:00:00 +11:00
Nathan Wolf
116cb9a1bc SPIGOT-4399: Add attribute modifier equality test 2018-09-27 20:56:49 +10:00
Senmori
88a5346fea Add API to locate structures. 2018-09-22 17:11:17 +10:00
md_5
d0bb0a1d7e Fix some tests randomly failing 2018-08-26 20:44:50 +10:00
Senmori
a677257885 Add additional tests for CraftBlockData 2018-08-26 18:17:55 +10:00
md_5
ce1af0c348 Update to Minecraft 1.13.1 2018-08-26 12:00:00 +10:00