Fix: Ignore invalid block entity data sent by Java server (#4766)

* Proper block entity checks; ignore invalid block entity data sent by Java server

* fix intelliJ warning about potentially null block state

* Use auto-generated block entity types instead of hardcoding them

* undo some diff

* Update BlockRegistryPopulator.java

* Access block entity type of state by getting the block first

* deprecate JavaBlockState#hasBlockEntity

* Simplify check

* Add type check in JavaBlockEntityDataTranslator, ensure deprecated setBlockEntity() method still sets piston behavior

* nullability annotations

* yeet duplicate check
This commit is contained in:
chris 2024-06-19 23:48:55 +02:00 committed by GitHub
parent 34158f9463
commit 126d56d144
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
16 changed files with 225 additions and 224 deletions

View file

@ -73,7 +73,10 @@ public interface JavaBlockState {
* Gets whether the block state has block entity
*
* @return whether the block state has block entity
* @deprecated Does not have an effect. If you were using this to
* set piston behavior, use {@link #pistonBehavior()} instead.
*/
@Deprecated(forRemoval = true)
boolean hasBlockEntity();
/**
@ -104,6 +107,11 @@ public interface JavaBlockState {
Builder pistonBehavior(@Nullable String pistonBehavior);
/**
* @deprecated Does not have an effect. If you were using this to
* * set piston behavior, use {@link #pistonBehavior(String)} instead.
*/
@Deprecated(forRemoval = true)
Builder hasBlockEntity(boolean hasBlockEntity);
JavaBlockState build();