diff --git a/common/build.gradle b/common/build.gradle index c804f3510..340400fa9 100644 --- a/common/build.gradle +++ b/common/build.gradle @@ -1,7 +1,5 @@ architectury { - common(rootProject.enabled_platforms.split(",")) { - it.platformPackage("neoforge", "forge") - } + common(rootProject.enabled_platforms.split(",")) } loom { diff --git a/common/src/main/java/whocraft/tardis_refined/api/event/TardisEvents.java b/common/src/main/java/whocraft/tardis_refined/api/event/TardisEvents.java index 46046c3ad..a9ebd1262 100644 --- a/common/src/main/java/whocraft/tardis_refined/api/event/TardisEvents.java +++ b/common/src/main/java/whocraft/tardis_refined/api/event/TardisEvents.java @@ -1,5 +1,6 @@ package whocraft.tardis_refined.api.event; +import net.minecraft.client.model.geom.EntityModelSet; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.resources.ResourceLocation; @@ -13,9 +14,6 @@ import whocraft.tardis_refined.common.tardis.TardisNavLocation; import whocraft.tardis_refined.common.tardis.control.Control; -import java.util.List; -import java.util.function.Function; - public class TardisEvents { public static final Event TAKE_OFF = new Event<>(TakeOff.class, listeners -> (tardisLevelOperator, level, pos) -> Event.result(listeners, takeOff -> takeOff.onTakeOff(tardisLevelOperator, level, pos))); @@ -62,6 +60,12 @@ public class TardisEvents { } })); + public static final Event SHELLENTRY_MODELS_SETUP = new Event<>(SetupModels.class, listeners -> (EntityModelSet context) -> { + for(SetupModels listener : listeners) { + listener.setUpShellAndInteriorModels(context); + } + }); + /** * Represents an event that allows checking whether player control can be used. @@ -69,6 +73,12 @@ public class TardisEvents { public static final Event PLAYER_CONTROL_INTERACT = new Event<>(CanControlBeUsed.class, listeners -> (tardisLevelOperator, control, controlEntity) -> Event.result(listeners, takeOff -> takeOff.canControlBeUsed(tardisLevelOperator, control, controlEntity))); + @FunctionalInterface + public interface SetupModels { + void setUpShellAndInteriorModels(EntityModelSet context); + } + + /** * Functional interface to define the conditions for using player control. */ diff --git a/common/src/main/java/whocraft/tardis_refined/client/model/blockentity/shell/ShellModelCollection.java b/common/src/main/java/whocraft/tardis_refined/client/model/blockentity/shell/ShellModelCollection.java index ad4c68a8d..bb2326760 100644 --- a/common/src/main/java/whocraft/tardis_refined/client/model/blockentity/shell/ShellModelCollection.java +++ b/common/src/main/java/whocraft/tardis_refined/client/model/blockentity/shell/ShellModelCollection.java @@ -3,6 +3,8 @@ import net.minecraft.client.Minecraft; import net.minecraft.client.model.geom.EntityModelSet; import net.minecraft.resources.ResourceLocation; +import whocraft.tardis_refined.TardisRefined; +import whocraft.tardis_refined.api.event.TardisEvents; import whocraft.tardis_refined.client.ModelRegistry; import whocraft.tardis_refined.client.model.blockentity.door.interior.*; import whocraft.tardis_refined.client.model.blockentity.shell.shells.*; @@ -67,6 +69,8 @@ public void registerModels(EntityModelSet context){ hieroglyphDoorModel = new HieroglyphShellDoor(context.bakeLayer((ModelRegistry.HIEROGLYPH_DOOR))); castleDoorModel = new CastleShellDoorModel(context.bakeLayer((ModelRegistry.CASTLE_DOOR))); + TardisEvents.SHELLENTRY_MODELS_SETUP.invoker().setUpShellAndInteriorModels(context); + registerShellEntry(ShellTheme.FACTORY.get(), factoryShellModel, factoryDoorModel); registerShellEntry(ShellTheme.POLICE_BOX.get(), policeBoxModel, policeBoxDoorModel); registerShellEntry(ShellTheme.PHONE_BOOTH.get(), phoneBoothModel, phoneBoothDoorModel); diff --git a/forge/src/main/java/whocraft/tardis_refined/common/data/ModelProviderBlock.java b/forge/src/main/java/whocraft/tardis_refined/common/data/ModelProviderBlock.java deleted file mode 100644 index e69de29bb..000000000