From db91ba311b7ca73cae90a22043d0d0b809041c88 Mon Sep 17 00:00:00 2001 From: Up Date: Mon, 6 Jan 2025 01:05:51 +0100 Subject: [PATCH] dont access ticking maps from outside --- .../cca/internal/block/CardinalBlockInternals.java | 3 +-- .../cca/internal/block/StaticBlockComponentPlugin.java | 9 +++++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/cardinal-components-block/src/main/java/dev/onyxstudios/cca/internal/block/CardinalBlockInternals.java b/cardinal-components-block/src/main/java/dev/onyxstudios/cca/internal/block/CardinalBlockInternals.java index 01cd5778..454976ab 100644 --- a/cardinal-components-block/src/main/java/dev/onyxstudios/cca/internal/block/CardinalBlockInternals.java +++ b/cardinal-components-block/src/main/java/dev/onyxstudios/cca/internal/block/CardinalBlockInternals.java @@ -58,8 +58,7 @@ private static synchronized ComponentContainer.Factory getBeCompone factory = /* recursive call */ getBeComponentFactory(superclass); // if parent class needs to tick, this one does, too! - if(StaticBlockComponentPlugin.INSTANCE.clientTicking.contains(superclass)) StaticBlockComponentPlugin.INSTANCE.clientTicking.add(entityClass); - if(StaticBlockComponentPlugin.INSTANCE.serverTicking.contains(superclass)) StaticBlockComponentPlugin.INSTANCE.serverTicking.add(entityClass); + StaticBlockComponentPlugin.INSTANCE.registerTickersFor(entityClass, superclass); } entityContainerFactories.put(entityClass, factory); return factory; diff --git a/cardinal-components-block/src/main/java/dev/onyxstudios/cca/internal/block/StaticBlockComponentPlugin.java b/cardinal-components-block/src/main/java/dev/onyxstudios/cca/internal/block/StaticBlockComponentPlugin.java index 7f832f96..9613a18d 100644 --- a/cardinal-components-block/src/main/java/dev/onyxstudios/cca/internal/block/StaticBlockComponentPlugin.java +++ b/cardinal-components-block/src/main/java/dev/onyxstudios/cca/internal/block/StaticBlockComponentPlugin.java @@ -122,6 +122,15 @@ public ComponentContainer.Factory buildDedicatedFactory(Class entityClass, Class parentClass) { + if(this.clientTicking.contains(parentClass)) { + this.clientTicking.add(entityClass); + } + if(this.serverTicking.contains(parentClass)) { + this.serverTicking.add(entityClass); + } + } + private void addToBuilder(ComponentContainer.Factory.Builder builder, Map.Entry, QualifiedComponentFactory>> entry) { @SuppressWarnings("unchecked") var key = (ComponentKey) entry.getKey(); @SuppressWarnings("unchecked") var factory = (ComponentFactory) entry.getValue().factory();