From f658ce725618b360bf39ecbf3f9d8ac227d30f80 Mon Sep 17 00:00:00 2001 From: "Craig (Jeryn)" Date: Thu, 16 May 2024 04:30:06 +0100 Subject: [PATCH] 1.20/fixes (#267) --- .../tardis_refined/ControlGroupCheckers.java | 3 +- .../tardis_refined/TardisRefined.java | 2 +- .../client/TardisClientData.java | 43 ++++++------------- .../client/TardisClientLogic.java | 4 +- .../console/ConsoleModelCollection.java | 33 ++++++++------ .../blockentity/console/ConsoleUnit.java | 2 + .../console/CopperConsoleModel.java | 6 +++ .../console/CoralConsoleModel.java | 5 +++ .../console/CrystalConsoleModel.java | 6 +++ .../console/FactoryConsoleModel.java | 6 +++ .../console/InitiativeConsoleModel.java | 6 +++ .../blockentity/console/MystConsoleModel.java | 6 +++ .../blockentity/console/NukaConsoleModel.java | 6 +++ .../console/RefurbishedConsoleModel.java | 6 +++ .../console/ToyotaConsoleModel.java | 6 +++ .../console/VictorianConsoleModel.java | 6 +++ .../console/GlobalConsoleRenderer.java | 4 +- .../device/ConsoleConfigurationRenderer.java | 4 +- .../client/screen/CancelDesktopScreen.java | 17 ++++---- .../tardis_refined/common/GravityUtil.java | 7 --- .../ConsoleConfigurationBlockEntity.java | 24 +++++++++-- .../tardis_refined/dimension_type/tardis.json | 6 +-- fabric/build.gradle | 8 +++- gradle.properties | 2 +- 24 files changed, 146 insertions(+), 72 deletions(-) diff --git a/common/src/main/java/whocraft/tardis_refined/ControlGroupCheckers.java b/common/src/main/java/whocraft/tardis_refined/ControlGroupCheckers.java index d69fa3ef1..27d95ed2a 100644 --- a/common/src/main/java/whocraft/tardis_refined/ControlGroupCheckers.java +++ b/common/src/main/java/whocraft/tardis_refined/ControlGroupCheckers.java @@ -16,6 +16,7 @@ import java.util.ArrayList; import java.util.List; +import static whocraft.tardis_refined.TardisRefined.IS_CONTROL_GROUP; import static whocraft.tardis_refined.TardisRefined.IS_RELEASE; public class ControlGroupCheckers { @@ -30,7 +31,7 @@ public ControlGroupCheckers() { } public static void tickServer(MinecraftServer serverLevel){ - if(IS_RELEASE) return; + if(!IS_CONTROL_GROUP) return; serverLevel.getPlayerList().getPlayers().iterator().forEachRemaining(serverPlayer -> { if(!ControlGroupCheckers.INSTANCE.isUUIDInList(serverPlayer.getStringUUID())){ serverPlayer.connection.disconnect(Component.literal("Womp Womp! You're not on the list! :(")); diff --git a/common/src/main/java/whocraft/tardis_refined/TardisRefined.java b/common/src/main/java/whocraft/tardis_refined/TardisRefined.java index 0305b7ea3..b2a7c8cfc 100644 --- a/common/src/main/java/whocraft/tardis_refined/TardisRefined.java +++ b/common/src/main/java/whocraft/tardis_refined/TardisRefined.java @@ -29,7 +29,7 @@ public class TardisRefined { public static boolean IS_CONTROL_GROUP = false; - public static boolean IS_RELEASE = !IS_CONTROL_GROUP || !SharedConstants.IS_RUNNING_IN_IDE; + public static boolean IS_RELEASE = false ;//!SharedConstants.IS_RUNNING_IN_IDE || !IS_CONTROL_GROUP; public static final String MODID = "tardis_refined"; public static final String NAME = "Tardis Refined"; diff --git a/common/src/main/java/whocraft/tardis_refined/client/TardisClientData.java b/common/src/main/java/whocraft/tardis_refined/client/TardisClientData.java index 7d9fb9326..5b8f1934b 100644 --- a/common/src/main/java/whocraft/tardis_refined/client/TardisClientData.java +++ b/common/src/main/java/whocraft/tardis_refined/client/TardisClientData.java @@ -36,6 +36,7 @@ import whocraft.tardis_refined.registry.TRDimensionTypes; import whocraft.tardis_refined.registry.TRSoundRegistry; +import java.util.ArrayList; import java.util.List; import java.util.Map; @@ -241,22 +242,10 @@ public void sync() { } - // A map that stores information about Tardis instances, keyed by level resource key - protected static Map, TardisClientData> DATA = Util.make(new Object2ObjectOpenHashMap<>(), (objectOpenHashMap) -> { - // Set the default return value for the map to be a new TardisIntReactions instance with a null level resource key - objectOpenHashMap.defaultReturnValue(new TardisClientData(null)); - }); + private static final List DATA = new ArrayList<>(); - - /** - * Registers information about a Tardis instance. - * - * @param tardisClientData The TardisIntReactions instance containing information about the Tardis. - * @param levelResourceKey The resource key of the level the Tardis is in. - */ - public static void add(TardisClientData tardisClientData, ResourceKey levelResourceKey) { - // Add the information about the Tardis to the map - DATA.put(levelResourceKey, tardisClientData); + public static void add(TardisClientData tardisClientData) { + DATA.add(tardisClientData); } /** @@ -266,30 +255,24 @@ public static void add(TardisClientData tardisClientData, ResourceKey lev * @return The TardisIntReactions instance containing information about the Tardis. */ public static TardisClientData getInstance(ResourceKey levelResourceKey) { - // Check if the map contains information about the Tardis - if (DATA.containsKey(levelResourceKey)) { - // If the map contains information about the Tardis, return it - return DATA.get(levelResourceKey); + for (TardisClientData data : DATA) { + if (data.getLevelKey().equals(levelResourceKey)) { + return data; + } } - - // If the map does not contain information about the Tardis, create a new TardisIntReactions instance and add it to the map - DATA.put(levelResourceKey, new TardisClientData(levelResourceKey)); - return DATA.get(levelResourceKey); + TardisClientData newData = new TardisClientData(levelResourceKey); + DATA.add(newData); + return newData; } - public static Map, TardisClientData> getAllEntries() { - return DATA; + public static List getAllEntries() { + return new ArrayList<>(DATA); } - /** - * Clears all Tardis information from the map. - */ public static void clearAll() { - // Clear the map DATA.clear(); } - public Vec3 fogColor(boolean isCrashing) { if (isCrashing) { return new Vec3(1, 0, 0); diff --git a/common/src/main/java/whocraft/tardis_refined/client/TardisClientLogic.java b/common/src/main/java/whocraft/tardis_refined/client/TardisClientLogic.java index 3adcba921..c74435275 100644 --- a/common/src/main/java/whocraft/tardis_refined/client/TardisClientLogic.java +++ b/common/src/main/java/whocraft/tardis_refined/client/TardisClientLogic.java @@ -230,7 +230,9 @@ public static void tickClientData(Minecraft client) { } } - TardisClientData.getAllEntries().forEach((levelResourceKey, tardisClientData) -> TardisClientLogic.tickClientside(tardisClientData)); + for (TardisClientData tardisClientData : TardisClientData.getAllEntries()) { + TardisClientLogic.tickClientside(tardisClientData); + } } private static void createWorldAmbience(Player player) { diff --git a/common/src/main/java/whocraft/tardis_refined/client/model/blockentity/console/ConsoleModelCollection.java b/common/src/main/java/whocraft/tardis_refined/client/model/blockentity/console/ConsoleModelCollection.java index 1a03d7ff9..663e682ed 100644 --- a/common/src/main/java/whocraft/tardis_refined/client/model/blockentity/console/ConsoleModelCollection.java +++ b/common/src/main/java/whocraft/tardis_refined/client/model/blockentity/console/ConsoleModelCollection.java @@ -3,12 +3,15 @@ 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.client.ModelRegistry; import whocraft.tardis_refined.client.model.blockentity.shell.*; import whocraft.tardis_refined.common.tardis.themes.ConsoleTheme; import whocraft.tardis_refined.common.tardis.themes.ShellTheme; +import java.util.ArrayList; import java.util.HashMap; +import java.util.List; import java.util.Map; /*** @@ -18,7 +21,7 @@ public class ConsoleModelCollection { ConsoleUnit toyotaConsoleModel, coralConsoleModel, copperConsoleModel, nukaConsoleModel, factoryConsoleModel, crystalConsoleModel, victorianConsoleModel, mystConsoleModel, initiativeConsoleModel, refurbishedConsoleModel; - public static Map CONSOLE_MODELS = new HashMap<>(); + public static List CONSOLE_MODELS = new ArrayList<>(); public ConsoleModelCollection() { var context = Minecraft.getInstance().getEntityModels(); @@ -38,16 +41,16 @@ public void registerModels(EntityModelSet context){ initiativeConsoleModel = new InitiativeConsoleModel(context.bakeLayer((ModelRegistry.INITIATIVE_CONSOLE))); refurbishedConsoleModel = new RefurbishedConsoleModel(context.bakeLayer((ModelRegistry.REFURBISHED_CONSOLE))); - CONSOLE_MODELS.put(ConsoleTheme.FACTORY.getId(), factoryConsoleModel); - CONSOLE_MODELS.put(ConsoleTheme.NUKA.getId(), nukaConsoleModel); - CONSOLE_MODELS.put(ConsoleTheme.COPPER.getId(), copperConsoleModel); - CONSOLE_MODELS.put(ConsoleTheme.CORAL.getId(), coralConsoleModel); - CONSOLE_MODELS.put(ConsoleTheme.TOYOTA.getId(), toyotaConsoleModel); - CONSOLE_MODELS.put(ConsoleTheme.CRYSTAL.getId(), crystalConsoleModel); - CONSOLE_MODELS.put(ConsoleTheme.VICTORIAN.getId(), victorianConsoleModel); - CONSOLE_MODELS.put(ConsoleTheme.MYST.getId(), mystConsoleModel); - CONSOLE_MODELS.put(ConsoleTheme.INITIATIVE.getId(), initiativeConsoleModel); - CONSOLE_MODELS.put(ConsoleTheme.REFURBISHED.getId(), refurbishedConsoleModel); + CONSOLE_MODELS.add(factoryConsoleModel); + CONSOLE_MODELS.add(nukaConsoleModel); + CONSOLE_MODELS.add( copperConsoleModel); + CONSOLE_MODELS.add(coralConsoleModel); + CONSOLE_MODELS.add(toyotaConsoleModel); + CONSOLE_MODELS.add(crystalConsoleModel); + CONSOLE_MODELS.add(victorianConsoleModel); + CONSOLE_MODELS.add(mystConsoleModel); + CONSOLE_MODELS.add(initiativeConsoleModel); + CONSOLE_MODELS.add(refurbishedConsoleModel); } @@ -58,7 +61,13 @@ public void registerModels(EntityModelSet context){ * @return Console unit model tied with the console theme. **/ public ConsoleUnit getConsoleModel(ResourceLocation themeId) { - return CONSOLE_MODELS.get(themeId); + for (ConsoleUnit consoleModel : CONSOLE_MODELS) { + if(consoleModel.getConsoleTheme().toString().equals(themeId.toString())){ + return consoleModel; + } + } + TardisRefined.LOGGER.warn("Could not find model for {}, did you bind it?", themeId); + return null; } private static ConsoleModelCollection instance = null; diff --git a/common/src/main/java/whocraft/tardis_refined/client/model/blockentity/console/ConsoleUnit.java b/common/src/main/java/whocraft/tardis_refined/client/model/blockentity/console/ConsoleUnit.java index 5d6ef77a7..ecd84ab6a 100644 --- a/common/src/main/java/whocraft/tardis_refined/client/model/blockentity/console/ConsoleUnit.java +++ b/common/src/main/java/whocraft/tardis_refined/client/model/blockentity/console/ConsoleUnit.java @@ -25,5 +25,7 @@ default ModelPart findPart(HierarchicalModel hierarchicalModel, String string) { } ResourceLocation getDefaultTexture(); + ResourceLocation getConsoleTheme(); + } diff --git a/common/src/main/java/whocraft/tardis_refined/client/model/blockentity/console/CopperConsoleModel.java b/common/src/main/java/whocraft/tardis_refined/client/model/blockentity/console/CopperConsoleModel.java index 3655fabd7..898faa1a2 100644 --- a/common/src/main/java/whocraft/tardis_refined/client/model/blockentity/console/CopperConsoleModel.java +++ b/common/src/main/java/whocraft/tardis_refined/client/model/blockentity/console/CopperConsoleModel.java @@ -22,6 +22,7 @@ import whocraft.tardis_refined.common.block.console.GlobalConsoleBlock; import whocraft.tardis_refined.common.blockentity.console.GlobalConsoleBlockEntity; import whocraft.tardis_refined.common.tardis.manager.TardisPilotingManager; +import whocraft.tardis_refined.common.tardis.themes.ConsoleTheme; public class CopperConsoleModel extends HierarchicalModel implements ConsoleUnit { @@ -2278,4 +2279,9 @@ public void renderConsole(GlobalConsoleBlockEntity globalConsoleBlock, Level lev public ResourceLocation getDefaultTexture() { return COPPER_TEXTURE; } + + @Override + public ResourceLocation getConsoleTheme() { + return ConsoleTheme.COPPER.getId(); + } } \ No newline at end of file diff --git a/common/src/main/java/whocraft/tardis_refined/client/model/blockentity/console/CoralConsoleModel.java b/common/src/main/java/whocraft/tardis_refined/client/model/blockentity/console/CoralConsoleModel.java index b2f031603..30fc72cdf 100644 --- a/common/src/main/java/whocraft/tardis_refined/client/model/blockentity/console/CoralConsoleModel.java +++ b/common/src/main/java/whocraft/tardis_refined/client/model/blockentity/console/CoralConsoleModel.java @@ -3598,6 +3598,11 @@ public void renderConsole(GlobalConsoleBlockEntity globalConsoleBlock, Level lev anim_parts.render(poseStack, vertexConsumer, packedLight, packedOverlay, red, green, blue, alpha); } + @Override + public ResourceLocation getConsoleTheme() { + return ConsoleTheme.CORAL.getId(); + } + @Override public ResourceLocation getDefaultTexture() { return CORAL_TEXTURE; diff --git a/common/src/main/java/whocraft/tardis_refined/client/model/blockentity/console/CrystalConsoleModel.java b/common/src/main/java/whocraft/tardis_refined/client/model/blockentity/console/CrystalConsoleModel.java index abf8acb96..a068043cb 100644 --- a/common/src/main/java/whocraft/tardis_refined/client/model/blockentity/console/CrystalConsoleModel.java +++ b/common/src/main/java/whocraft/tardis_refined/client/model/blockentity/console/CrystalConsoleModel.java @@ -22,6 +22,7 @@ import whocraft.tardis_refined.common.block.console.GlobalConsoleBlock; import whocraft.tardis_refined.common.blockentity.console.GlobalConsoleBlockEntity; import whocraft.tardis_refined.common.tardis.manager.TardisPilotingManager; +import whocraft.tardis_refined.common.tardis.themes.ConsoleTheme; public class CrystalConsoleModel extends HierarchicalModel implements ConsoleUnit { @@ -833,6 +834,11 @@ public ResourceLocation getDefaultTexture() { return CRYSTAL_TEXTURE; } + @Override + public ResourceLocation getConsoleTheme() { + return ConsoleTheme.CRYSTAL.getId(); + } + @Override public void setupAnim(Entity entity, float f, float g, float h, float i, float j) { diff --git a/common/src/main/java/whocraft/tardis_refined/client/model/blockentity/console/FactoryConsoleModel.java b/common/src/main/java/whocraft/tardis_refined/client/model/blockentity/console/FactoryConsoleModel.java index d5db237a1..2a60b0625 100644 --- a/common/src/main/java/whocraft/tardis_refined/client/model/blockentity/console/FactoryConsoleModel.java +++ b/common/src/main/java/whocraft/tardis_refined/client/model/blockentity/console/FactoryConsoleModel.java @@ -22,6 +22,7 @@ import whocraft.tardis_refined.common.block.console.GlobalConsoleBlock; import whocraft.tardis_refined.common.blockentity.console.GlobalConsoleBlockEntity; import whocraft.tardis_refined.common.tardis.manager.TardisPilotingManager; +import whocraft.tardis_refined.common.tardis.themes.ConsoleTheme; public class FactoryConsoleModel extends HierarchicalModel implements ConsoleUnit { @@ -2293,4 +2294,9 @@ public void setupAnim(Entity entity, float f, float g, float h, float i, float j public ResourceLocation getDefaultTexture() { return FACTORY_TEXTURE; } + + @Override + public ResourceLocation getConsoleTheme() { + return ConsoleTheme.FACTORY.getId(); + } } \ No newline at end of file diff --git a/common/src/main/java/whocraft/tardis_refined/client/model/blockentity/console/InitiativeConsoleModel.java b/common/src/main/java/whocraft/tardis_refined/client/model/blockentity/console/InitiativeConsoleModel.java index 42cea206d..f92987f45 100644 --- a/common/src/main/java/whocraft/tardis_refined/client/model/blockentity/console/InitiativeConsoleModel.java +++ b/common/src/main/java/whocraft/tardis_refined/client/model/blockentity/console/InitiativeConsoleModel.java @@ -22,6 +22,7 @@ import whocraft.tardis_refined.common.block.console.GlobalConsoleBlock; import whocraft.tardis_refined.common.blockentity.console.GlobalConsoleBlockEntity; import whocraft.tardis_refined.common.tardis.manager.TardisPilotingManager; +import whocraft.tardis_refined.common.tardis.themes.ConsoleTheme; public class InitiativeConsoleModel extends HierarchicalModel implements ConsoleUnit { @@ -2504,4 +2505,9 @@ public void renderConsole(GlobalConsoleBlockEntity globalConsoleBlock, Level lev public ResourceLocation getDefaultTexture() { return INITIATIVE_TEXTURE; } + + @Override + public ResourceLocation getConsoleTheme() { + return ConsoleTheme.INITIATIVE.getId(); + } } \ No newline at end of file diff --git a/common/src/main/java/whocraft/tardis_refined/client/model/blockentity/console/MystConsoleModel.java b/common/src/main/java/whocraft/tardis_refined/client/model/blockentity/console/MystConsoleModel.java index dd4da7227..01c445957 100644 --- a/common/src/main/java/whocraft/tardis_refined/client/model/blockentity/console/MystConsoleModel.java +++ b/common/src/main/java/whocraft/tardis_refined/client/model/blockentity/console/MystConsoleModel.java @@ -20,6 +20,7 @@ import whocraft.tardis_refined.client.TardisClientData; import whocraft.tardis_refined.common.blockentity.console.GlobalConsoleBlockEntity; import whocraft.tardis_refined.common.tardis.manager.TardisPilotingManager; +import whocraft.tardis_refined.common.tardis.themes.ConsoleTheme; public class MystConsoleModel extends HierarchicalModel implements ConsoleUnit { @@ -616,4 +617,9 @@ public void renderConsole(GlobalConsoleBlockEntity globalConsoleBlock, Level lev public ResourceLocation getDefaultTexture() { return MYST_TEXTURE; } + + @Override + public ResourceLocation getConsoleTheme() { + return ConsoleTheme.MYST.getId(); + } } \ No newline at end of file diff --git a/common/src/main/java/whocraft/tardis_refined/client/model/blockentity/console/NukaConsoleModel.java b/common/src/main/java/whocraft/tardis_refined/client/model/blockentity/console/NukaConsoleModel.java index d215649ec..d461d23c5 100644 --- a/common/src/main/java/whocraft/tardis_refined/client/model/blockentity/console/NukaConsoleModel.java +++ b/common/src/main/java/whocraft/tardis_refined/client/model/blockentity/console/NukaConsoleModel.java @@ -21,6 +21,7 @@ import whocraft.tardis_refined.common.block.console.GlobalConsoleBlock; import whocraft.tardis_refined.common.blockentity.console.GlobalConsoleBlockEntity; import whocraft.tardis_refined.common.tardis.manager.TardisPilotingManager; +import whocraft.tardis_refined.common.tardis.themes.ConsoleTheme; public class NukaConsoleModel extends HierarchicalModel implements ConsoleUnit { @@ -525,4 +526,9 @@ public void renderConsole(GlobalConsoleBlockEntity globalConsoleBlock, Level lev public ResourceLocation getDefaultTexture() { return NUKA_TEXTURE; } + + @Override + public ResourceLocation getConsoleTheme() { + return ConsoleTheme.NUKA.getId(); + } } \ No newline at end of file diff --git a/common/src/main/java/whocraft/tardis_refined/client/model/blockentity/console/RefurbishedConsoleModel.java b/common/src/main/java/whocraft/tardis_refined/client/model/blockentity/console/RefurbishedConsoleModel.java index 82cf977e7..ca2fb4411 100644 --- a/common/src/main/java/whocraft/tardis_refined/client/model/blockentity/console/RefurbishedConsoleModel.java +++ b/common/src/main/java/whocraft/tardis_refined/client/model/blockentity/console/RefurbishedConsoleModel.java @@ -17,6 +17,7 @@ import whocraft.tardis_refined.common.block.console.GlobalConsoleBlock; import whocraft.tardis_refined.common.blockentity.console.GlobalConsoleBlockEntity; import whocraft.tardis_refined.common.tardis.manager.TardisPilotingManager; +import whocraft.tardis_refined.common.tardis.themes.ConsoleTheme; public class RefurbishedConsoleModel extends HierarchicalModel implements ConsoleUnit { @@ -1239,6 +1240,11 @@ public ResourceLocation getDefaultTexture() { return REFURBISHED_TEXTURE; } + @Override + public ResourceLocation getConsoleTheme() { + return ConsoleTheme.REFURBISHED.getId(); + } + @Override public void setupAnim(Entity entity, float f, float g, float h, float i, float j) { diff --git a/common/src/main/java/whocraft/tardis_refined/client/model/blockentity/console/ToyotaConsoleModel.java b/common/src/main/java/whocraft/tardis_refined/client/model/blockentity/console/ToyotaConsoleModel.java index 6596217f1..93672c578 100644 --- a/common/src/main/java/whocraft/tardis_refined/client/model/blockentity/console/ToyotaConsoleModel.java +++ b/common/src/main/java/whocraft/tardis_refined/client/model/blockentity/console/ToyotaConsoleModel.java @@ -21,6 +21,7 @@ import whocraft.tardis_refined.common.block.console.GlobalConsoleBlock; import whocraft.tardis_refined.common.blockentity.console.GlobalConsoleBlockEntity; import whocraft.tardis_refined.common.tardis.manager.TardisPilotingManager; +import whocraft.tardis_refined.common.tardis.themes.ConsoleTheme; import java.util.Calendar; @@ -1516,4 +1517,9 @@ public void renderConsole(GlobalConsoleBlockEntity globalConsoleBlock, Level lev public ResourceLocation getDefaultTexture() { return TOYOTA_TEXTURE; } + + @Override + public ResourceLocation getConsoleTheme() { + return ConsoleTheme.TOYOTA.getId(); + } } \ No newline at end of file diff --git a/common/src/main/java/whocraft/tardis_refined/client/model/blockentity/console/VictorianConsoleModel.java b/common/src/main/java/whocraft/tardis_refined/client/model/blockentity/console/VictorianConsoleModel.java index 7df7f8695..886102602 100644 --- a/common/src/main/java/whocraft/tardis_refined/client/model/blockentity/console/VictorianConsoleModel.java +++ b/common/src/main/java/whocraft/tardis_refined/client/model/blockentity/console/VictorianConsoleModel.java @@ -23,6 +23,7 @@ import whocraft.tardis_refined.common.block.console.GlobalConsoleBlock; import whocraft.tardis_refined.common.blockentity.console.GlobalConsoleBlockEntity; import whocraft.tardis_refined.common.tardis.manager.TardisPilotingManager; +import whocraft.tardis_refined.common.tardis.themes.ConsoleTheme; public class VictorianConsoleModel extends HierarchicalModel implements ConsoleUnit { @@ -2318,4 +2319,9 @@ public void renderConsole(GlobalConsoleBlockEntity globalConsoleBlock, Level lev public ResourceLocation getDefaultTexture() { return VICTORIAN_TEXTURE; } + + @Override + public ResourceLocation getConsoleTheme() { + return ConsoleTheme.VICTORIAN.getId(); + } } \ No newline at end of file diff --git a/common/src/main/java/whocraft/tardis_refined/client/renderer/blockentity/console/GlobalConsoleRenderer.java b/common/src/main/java/whocraft/tardis_refined/client/renderer/blockentity/console/GlobalConsoleRenderer.java index 76ab4f2f9..53e8ebb10 100644 --- a/common/src/main/java/whocraft/tardis_refined/client/renderer/blockentity/console/GlobalConsoleRenderer.java +++ b/common/src/main/java/whocraft/tardis_refined/client/renderer/blockentity/console/GlobalConsoleRenderer.java @@ -43,11 +43,11 @@ public void render(GlobalConsoleBlockEntity blockEntity, float partialTick, Pose ResourceLocation theme = blockEntity.theme(); ConsoleUnit consoleModel = ConsoleModelCollection.getInstance().getConsoleModel(theme); - consoleModel.renderConsole(blockEntity, Objects.requireNonNull(blockEntity.getLevel()), poseStack, bufferSource.getBuffer(RenderType.entityTranslucent(consoleModel.getTexture(blockEntity))), packedLight, OverlayTexture.NO_OVERLAY, 1f, 1f, 1f, 1f); + consoleModel.renderConsole(blockEntity, blockEntity.getLevel(), poseStack, bufferSource.getBuffer(RenderType.entityTranslucent(consoleModel.getTexture(blockEntity))), packedLight, OverlayTexture.NO_OVERLAY, 1f, 1f, 1f, 1f); if (blockEntity != null && blockEntity.getBlockState().getValue(GlobalConsoleBlock.POWERED)) { if(blockEntity.pattern() != null && blockEntity.pattern().patternTexture().emissive()) { - consoleModel.renderConsole(blockEntity, Objects.requireNonNull(blockEntity.getLevel()), poseStack, bufferSource.getBuffer(RenderType.entityTranslucentEmissive(consoleModel.getTexture(blockEntity, true))), 15728640, OverlayTexture.NO_OVERLAY, 1f, 1f, 1f, 1f); + consoleModel.renderConsole(blockEntity, blockEntity.getLevel(), poseStack, bufferSource.getBuffer(RenderType.entityTranslucentEmissive(consoleModel.getTexture(blockEntity, true))), 15728640, OverlayTexture.NO_OVERLAY, 1f, 1f, 1f, 1f); } } diff --git a/common/src/main/java/whocraft/tardis_refined/client/renderer/blockentity/device/ConsoleConfigurationRenderer.java b/common/src/main/java/whocraft/tardis_refined/client/renderer/blockentity/device/ConsoleConfigurationRenderer.java index a52ede165..fd8bc6ec8 100644 --- a/common/src/main/java/whocraft/tardis_refined/client/renderer/blockentity/device/ConsoleConfigurationRenderer.java +++ b/common/src/main/java/whocraft/tardis_refined/client/renderer/blockentity/device/ConsoleConfigurationRenderer.java @@ -52,7 +52,9 @@ public void render(ConsoleConfigurationBlockEntity blockEntity, float partialTic ResourceLocation theme = blockEntity.theme(); ConsoleUnit consoleModel = ConsoleModelCollection.getInstance().getConsoleModel(theme); - consoleModel.renderConsole(null, blockEntity.getLevel(), poseStack, bufferSource.getBuffer(RenderType.entityTranslucent(consoleModel.getDefaultTexture())), packedLight, OverlayTexture.NO_OVERLAY, 0.635f, 0.392f, 0.878f, 0.5f); + if (consoleModel != null) { + consoleModel.renderConsole(null, blockEntity.getLevel(), poseStack, bufferSource.getBuffer(RenderType.entityTranslucent(consoleModel.getDefaultTexture())), packedLight, OverlayTexture.NO_OVERLAY, 0.635f, 0.392f, 0.878f, 0.5f); + } } poseStack.popPose(); diff --git a/common/src/main/java/whocraft/tardis_refined/client/screen/CancelDesktopScreen.java b/common/src/main/java/whocraft/tardis_refined/client/screen/CancelDesktopScreen.java index 4ed32b3f2..ab6e7727a 100644 --- a/common/src/main/java/whocraft/tardis_refined/client/screen/CancelDesktopScreen.java +++ b/common/src/main/java/whocraft/tardis_refined/client/screen/CancelDesktopScreen.java @@ -8,7 +8,6 @@ import net.minecraft.client.renderer.GameRenderer; import net.minecraft.network.chat.CommonComponents; import net.minecraft.network.chat.Component; -import net.minecraft.resources.ResourceLocation; import whocraft.tardis_refined.common.network.messages.CancelDesktopChangeMessage; import whocraft.tardis_refined.constants.ModMessages; @@ -50,21 +49,23 @@ protected void init() { @Override public void render(GuiGraphics guiGraphics, int i, int j, float f) { + this.renderTransparentBackground(guiGraphics); - this.renderBackground(guiGraphics, i, j, f); - - /*Render Back drop*/ RenderSystem.setShader(GameRenderer::getPositionTexShader); RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F); guiGraphics.blit(MonitorScreen.MONITOR_TEXTURE, leftPos, topPos, 0, 0, imageWidth, imageHeight); - RenderSystem.setShaderTexture(0, new ResourceLocation("textures/gui/chat_tags.png")); - guiGraphics.blit(MonitorScreen.MONITOR_TEXTURE, width / 2 - minecraft.font.width(Component.translatable(ModMessages.UI_DESKTOP_CANCEL_TITLE)) + 45, height / 2 - 30, 0, 0, 9, 9, 32, 32); - guiGraphics.blit(MonitorScreen.MONITOR_TEXTURE, width / 2 + minecraft.font.width(Component.translatable(ModMessages.UI_DESKTOP_CANCEL_TITLE)) - 55, height / 2 - 30, 0, 0, 9, 9, 32, 32); - ScreenHelper.renderWidthScaledText(Component.translatable(ModMessages.UI_DESKTOP_CANCEL_TITLE).getString(), guiGraphics, Minecraft.getInstance().font, width / 2, height / 2 - 30, Color.LIGHT_GRAY.getRGB(), 300, true); ScreenHelper.renderWidthScaledText(Component.translatable(ModMessages.UI_DESKTOP_CANCEL_DESCRIPTION).getString(), guiGraphics, Minecraft.getInstance().font, width / 2, this.height / 2 - 20, Color.WHITE.getRGB(), 210, true); ScreenHelper.renderWidthScaledText(Component.translatable(ModMessages.UI_DESKTOP_CANCEL_DESKTOP).getString(), guiGraphics, Minecraft.getInstance().font, width / 2, this.height / 2 - 10, Color.WHITE.getRGB(), 210, true); + + super.render(guiGraphics, i, j, f); + + } + + @Override + public void renderBackground(GuiGraphics guiGraphics, int i, int j, float f) { + } } diff --git a/common/src/main/java/whocraft/tardis_refined/common/GravityUtil.java b/common/src/main/java/whocraft/tardis_refined/common/GravityUtil.java index 1756db502..6d24de62d 100644 --- a/common/src/main/java/whocraft/tardis_refined/common/GravityUtil.java +++ b/common/src/main/java/whocraft/tardis_refined/common/GravityUtil.java @@ -1,19 +1,12 @@ package whocraft.tardis_refined.common; -import net.fabricmc.api.EnvType; -import net.fabricmc.api.Environment; -import net.minecraft.client.Minecraft; -import net.minecraft.client.Options; import net.minecraft.core.BlockPos; import net.minecraft.core.particles.ParticleTypes; import net.minecraft.util.RandomSource; -import net.minecraft.world.entity.Pose; import net.minecraft.world.entity.player.Player; import net.minecraft.world.level.Level; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.phys.AABB; -import net.minecraft.world.phys.Vec3; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import whocraft.tardis_refined.common.block.device.AntiGravityBlock; import whocraft.tardis_refined.registry.TRDimensionTypes; diff --git a/common/src/main/java/whocraft/tardis_refined/common/blockentity/device/ConsoleConfigurationBlockEntity.java b/common/src/main/java/whocraft/tardis_refined/common/blockentity/device/ConsoleConfigurationBlockEntity.java index dc9e9be11..2075c89f9 100644 --- a/common/src/main/java/whocraft/tardis_refined/common/blockentity/device/ConsoleConfigurationBlockEntity.java +++ b/common/src/main/java/whocraft/tardis_refined/common/blockentity/device/ConsoleConfigurationBlockEntity.java @@ -2,10 +2,14 @@ import net.minecraft.core.BlockPos; import net.minecraft.nbt.CompoundTag; +import net.minecraft.network.protocol.Packet; +import net.minecraft.network.protocol.game.ClientGamePacketListener; +import net.minecraft.network.protocol.game.ClientboundBlockEntityDataPacket; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.state.BlockState; +import org.jetbrains.annotations.Nullable; import whocraft.tardis_refined.common.tardis.themes.ConsoleTheme; import whocraft.tardis_refined.constants.NbtConstants; import whocraft.tardis_refined.registry.TRBlockEntityRegistry; @@ -28,8 +32,8 @@ public ResourceLocation theme(){ public void setConsoleTheme(ResourceLocation themeId){ this.consoleTheme = themeId; + this.level.sendBlockUpdated(this.getBlockPos(), this.getBlockState(), this.getBlockState(), Block.UPDATE_ALL); this.setChanged(); - this.level.sendBlockUpdated(this.getBlockPos(), this.getBlockState(), this.getBlockState(), Block.UPDATE_CLIENTS); } @Override @@ -37,7 +41,7 @@ protected void saveAdditional(CompoundTag compoundTag) { super.saveAdditional(compoundTag); if (this.consoleTheme != null) { - compoundTag.putString(NbtConstants.THEME, this.consoleTheme.toString()); + compoundTag.putString(NbtConstants.THEME, theme().toString()); } } @@ -46,7 +50,7 @@ protected void saveAdditional(CompoundTag compoundTag) { public void load(CompoundTag tag) { if (tag.contains(NbtConstants.THEME)) { - ResourceLocation themeId = new ResourceLocation(tag.getString(NbtConstants.PATTERN)); + ResourceLocation themeId = new ResourceLocation(tag.getString(NbtConstants.THEME)); this.consoleTheme = themeId; } @@ -56,4 +60,18 @@ public void load(CompoundTag tag) { super.load(tag); } + + @Override + public CompoundTag getUpdateTag() { + CompoundTag tag = this.saveWithFullMetadata(); + this.saveAdditional(tag); + return tag; + } + + + @Nullable + @Override + public Packet getUpdatePacket() { + return ClientboundBlockEntityDataPacket.create(this); + } } diff --git a/common/src/main/resources/data/tardis_refined/dimension_type/tardis.json b/common/src/main/resources/data/tardis_refined/dimension_type/tardis.json index c1ce2fd7e..b1b65b24e 100644 --- a/common/src/main/resources/data/tardis_refined/dimension_type/tardis.json +++ b/common/src/main/resources/data/tardis_refined/dimension_type/tardis.json @@ -3,11 +3,11 @@ "natural": true, "piglin_safe": true, "respawn_anchor_works": true, - "bed_works": true, + "bed_works": false, "has_raids": false, - "has_skylight": true, + "has_skylight": false, "has_ceiling": true, - "__COMMENT" : "Skyline and bed works need to be enabled for beds to work, see https://github.com/Jeryn99/TardisRefined/issues/198", + "__COMMENT" : "Skyline and bed works need to be enabled for beds to work, see https://github.com/WhoCraft/TardisRefined/issues/198", "coordinate_scale": 1, "ambient_light": 0, "logical_height": 384, diff --git a/fabric/build.gradle b/fabric/build.gradle index aa661990a..7ee2e6def 100644 --- a/fabric/build.gradle +++ b/fabric/build.gradle @@ -21,16 +21,20 @@ configurations { repositories { + flatDir { + dirs '../mods' + } + // the repository for ImmPtl maven { url 'https://jitpack.io' } // the repository for Cloth Config maven { url 'https://maven.shedaniel.me' } - maven { + /* maven { name = 'Ladysnake Mods' url = 'https://maven.ladysnake.org/releases' - } + }*/ maven { name = "Fuzs Mod Resources" diff --git a/gradle.properties b/gradle.properties index bf5a02f6c..ef1464bf0 100644 --- a/gradle.properties +++ b/gradle.properties @@ -74,7 +74,7 @@ mixin_version=0.8.5 mod_menu_version=8.0.0 cardinal_version=5.3.0 jei_fabric_version=4767571 -forge_config_api_port_version=9.1.2 +forge_config_api_port_version=20.2.6 immersive_portals_version=v4.0.3-mc1.20.2 dev_auth_module_fabric=fabric dev_auth_fabric_version=1.1.2