Add fluid ticking and refactor post-processing a bit (#1554)

* Make postProcessSet a default method and change to void

* Throwable#getMessage is nullable

* Move (re-)ticking to a post-processor per "platform"
 - Add fluid ticking

* chore: Ignore (for us) irrelevant rules

* chore: Fix correct toml syntax?

* Re-add removed method for API-compliance and refactor it to have a use

* Switch to javax annotations

* Switch to recalcBlockCounts for ticking blocks.

* No need to set air count anymore either

* We can still "not tick" in fast mode in 1.17.2

* update adapters

* Let paper create the chunk section if biomes are null

* Adjust notes to settings

* 1.17.2 didn't exist

* Add 1.18.2

* Don't attempt to cache plains biome ID

* Use correct annotation

Co-authored-by: NotMyFault <mc.cache@web.de>
This commit is contained in:
Jordan
2022-03-10 14:27:25 +00:00
committed by GitHub
parent 5d18e15128
commit e9db749e2f
47 changed files with 975 additions and 399 deletions

View File

@ -198,6 +198,9 @@ public class BlockTypesCache {
public static final BlockType[] values;
public static final BlockState[] states;
/**
* Array of blockstates in order of ordinal indicating if the block ticks, e.g. leaves, water
*/
public static final boolean[] ticking;
private static final Map<String, List<Property<?>>> allProperties = new HashMap<>();
@ -283,7 +286,8 @@ public class BlockTypesCache {
String enumName = (typeName.startsWith("minecraft:") ? typeName.substring(10) : typeName).toUpperCase(Locale.ROOT);
int oldsize = states.size();
BlockType existing = new BlockType(id, internalId, states);
tickList.addAll(Collections.nCopies(states.size() - oldsize, existing.getMaterial().isTicksRandomly()));
tickList.addAll(Collections.nCopies(states.size() - oldsize,
existing.getMaterial().isTicksRandomly() || existing.getMaterial().isLiquid()));
// register states
BlockType.REGISTRY.register(typeName, existing);
String nameSpace = typeName.substring(0, typeName.indexOf(':'));