From c0666ed84c96ff37bca2ee163d59730c760ebfed Mon Sep 17 00:00:00 2001 From: FoundationGames <43485105+FoundationGames@users.noreply.github.com> Date: Sun, 2 Jun 2024 22:13:53 -0700 Subject: [PATCH] Formatting fixes --- gradle.properties | 1 - .../enhancedblockentities/EnhancedBlockEntities.java | 12 ++++++------ .../client/model/DynamicModelProvidingPlugin.java | 2 +- .../client/model/ModelSelector.java | 4 ++-- .../client/render/BlockEntityRenderCondition.java | 2 +- .../enhancedblockentities/config/EBEConfig.java | 8 ++++---- .../enhancedblockentities/event/EBEEvents.java | 2 +- .../mixin/AbstractBlockStateMixin.java | 2 +- .../mixin/BlockEntityRenderDispatcherMixin.java | 4 ++-- .../enhancedblockentities/util/DateUtil.java | 4 ++-- .../enhancedblockentities/util/EBEUtil.java | 2 +- .../enhancedblockentities/util/WorldUtil.java | 7 +++---- 12 files changed, 24 insertions(+), 26 deletions(-) diff --git a/gradle.properties b/gradle.properties index 90499015..b0712ebd 100644 --- a/gradle.properties +++ b/gradle.properties @@ -14,4 +14,3 @@ arrp_version=0.8.1 modmenu_version=9.2.0-beta.2 sodium_version=mc1.20.4-0.5.8 -indium_version=1.0.30+mc1.20.4 \ No newline at end of file diff --git a/src/main/java/foundationgames/enhancedblockentities/EnhancedBlockEntities.java b/src/main/java/foundationgames/enhancedblockentities/EnhancedBlockEntities.java index 477e46fb..4657e868 100644 --- a/src/main/java/foundationgames/enhancedblockentities/EnhancedBlockEntities.java +++ b/src/main/java/foundationgames/enhancedblockentities/EnhancedBlockEntities.java @@ -49,32 +49,32 @@ public static void load() { ResourceUtil.resetBasePack(); ResourceUtil.resetTopLevelPack(); - if(CONFIG.renderEnhancedChests) { + if (CONFIG.renderEnhancedChests) { EBESetup.setupChests(); EBESetup.setupRRPChests(); } - if(CONFIG.renderEnhancedSigns) { + if (CONFIG.renderEnhancedSigns) { EBESetup.setupSigns(); EBESetup.setupRRPSigns(); } - if(CONFIG.renderEnhancedBells) { + if (CONFIG.renderEnhancedBells) { EBESetup.setupBells(); EBESetup.setupRRPBells(); } - if(CONFIG.renderEnhancedBeds) { + if (CONFIG.renderEnhancedBeds) { EBESetup.setupBeds(); EBESetup.setupRRPBeds(); } - if(CONFIG.renderEnhancedShulkerBoxes) { + if (CONFIG.renderEnhancedShulkerBoxes) { EBESetup.setupShulkerBoxes(); EBESetup.setupRRPShulkerBoxes(); } - if(CONFIG.renderEnhancedDecoratedPots) { + if (CONFIG.renderEnhancedDecoratedPots) { EBESetup.setupDecoratedPots(); EBESetup.setupRRPDecoratedPots(); } diff --git a/src/main/java/foundationgames/enhancedblockentities/client/model/DynamicModelProvidingPlugin.java b/src/main/java/foundationgames/enhancedblockentities/client/model/DynamicModelProvidingPlugin.java index 5b05873e..51c29e01 100644 --- a/src/main/java/foundationgames/enhancedblockentities/client/model/DynamicModelProvidingPlugin.java +++ b/src/main/java/foundationgames/enhancedblockentities/client/model/DynamicModelProvidingPlugin.java @@ -24,7 +24,7 @@ public void onInitializeModelLoader(ModelLoadingPlugin.Context ctx) { @Override public @Nullable UnbakedModel resolveModel(ModelResolver.Context ctx) { - if(ctx.id().equals(this.id)) return this.model.get(); + if (ctx.id().equals(this.id)) return this.model.get(); return null; } } diff --git a/src/main/java/foundationgames/enhancedblockentities/client/model/ModelSelector.java b/src/main/java/foundationgames/enhancedblockentities/client/model/ModelSelector.java index 81de3e5c..328e6107 100644 --- a/src/main/java/foundationgames/enhancedblockentities/client/model/ModelSelector.java +++ b/src/main/java/foundationgames/enhancedblockentities/client/model/ModelSelector.java @@ -19,7 +19,7 @@ public abstract class ModelSelector { public static final ModelSelector STATE_HOLDER_SELECTOR = new ModelSelector() { @Override public void writeModelIndices(BlockRenderView view, BlockState state, BlockPos pos, Supplier rand, @Nullable RenderContext ctx, int[] indices) { - if(view.getBlockEntity(pos) instanceof AppearanceStateHolder stateHolder) { + if (view.getBlockEntity(pos) instanceof AppearanceStateHolder stateHolder) { indices[0] = stateHolder.getModelState(); return; } @@ -37,7 +37,7 @@ public int getParticleModelIndex() { @Override public void writeModelIndices(BlockRenderView view, BlockState state, BlockPos pos, Supplier rand, @Nullable RenderContext ctx, int[] indices) { - if(view.getBlockEntity(pos) instanceof AppearanceStateHolder stateHolder) { + if (view.getBlockEntity(pos) instanceof AppearanceStateHolder stateHolder) { indices[0] = stateHolder.getModelState() + this.getParticleModelIndex(); return; } diff --git a/src/main/java/foundationgames/enhancedblockentities/client/render/BlockEntityRenderCondition.java b/src/main/java/foundationgames/enhancedblockentities/client/render/BlockEntityRenderCondition.java index 36beea70..8c1e6929 100644 --- a/src/main/java/foundationgames/enhancedblockentities/client/render/BlockEntityRenderCondition.java +++ b/src/main/java/foundationgames/enhancedblockentities/client/render/BlockEntityRenderCondition.java @@ -11,7 +11,7 @@ @FunctionalInterface public interface BlockEntityRenderCondition { BlockEntityRenderCondition NON_ZERO_STATE = entity -> { - if(entity instanceof AppearanceStateHolder stateHolder) { + if (entity instanceof AppearanceStateHolder stateHolder) { return stateHolder.getRenderState() > 0; } return false; diff --git a/src/main/java/foundationgames/enhancedblockentities/config/EBEConfig.java b/src/main/java/foundationgames/enhancedblockentities/config/EBEConfig.java index d420aedb..4ac26f73 100644 --- a/src/main/java/foundationgames/enhancedblockentities/config/EBEConfig.java +++ b/src/main/java/foundationgames/enhancedblockentities/config/EBEConfig.java @@ -77,14 +77,14 @@ public void readFrom(Properties properties) { this.renderEnhancedShulkerBoxes = ConvUtil.defaultedBool(properties.getProperty(RENDER_ENHANCED_SHULKER_BOXES_KEY), true); this.renderEnhancedDecoratedPots = ConvUtil.defaultedBool(properties.getProperty(RENDER_ENHANCED_DECORATED_POTS_KEY), true); String pCC = properties.getProperty(CHRISTMAS_CHESTS_KEY); - if(pCC != null && (pCC.equals("allowed") || pCC.equals("forced") || pCC.equals("disabled"))) { + if (pCC != null && (pCC.equals("allowed") || pCC.equals("forced") || pCC.equals("disabled"))) { this.christmasChests = pCC; } else { EnhancedBlockEntities.LOG.warn("Configuration option 'christmas_chests' must be one of: 'allowed', 'forced', 'disabled'"); this.christmasChests = "allowed"; } String sST = properties.getProperty(SIGN_TEXT_RENDERING_KEY); - if(sST != null && (sST.equals("smart") || sST.equals("all") || sST.equals("most") || sST.equals("some") || sST.equals("few"))) { + if (sST != null && (sST.equals("smart") || sST.equals("all") || sST.equals("most") || sST.equals("some") || sST.equals("few"))) { this.signTextRendering = sST; } else { EnhancedBlockEntities.LOG.warn("Configuration option 'sign_text_rendering' must be one of: 'smart', 'all', 'most', 'some', 'few'"); @@ -106,7 +106,7 @@ public void save() { Properties properties = new Properties(); writeTo(properties); Path configPath = FabricLoader.getInstance().getConfigDir().resolve("enhanced_bes.properties"); - if(!Files.exists(configPath)) { + if (!Files.exists(configPath)) { try { Files.createFile(configPath); } catch (IOException e) { @@ -126,7 +126,7 @@ public void save() { public void load() { Properties properties = new Properties(); Path configPath = FabricLoader.getInstance().getConfigDir().resolve("enhanced_bes.properties"); - if(!Files.exists(configPath)) { + if (!Files.exists(configPath)) { try { Files.createFile(configPath); save(); diff --git a/src/main/java/foundationgames/enhancedblockentities/event/EBEEvents.java b/src/main/java/foundationgames/enhancedblockentities/event/EBEEvents.java index 62b07070..f863085c 100644 --- a/src/main/java/foundationgames/enhancedblockentities/event/EBEEvents.java +++ b/src/main/java/foundationgames/enhancedblockentities/event/EBEEvents.java @@ -8,7 +8,7 @@ public enum EBEEvents {; public static final Event RELOAD_MODELS = EventFactory.createArrayBacked(Reload.class, (callbacks) -> (loader, manager, profiler) -> { - for(Reload event : callbacks) { + for (Reload event : callbacks) { event.onReload(loader, manager, profiler); } }); diff --git a/src/main/java/foundationgames/enhancedblockentities/mixin/AbstractBlockStateMixin.java b/src/main/java/foundationgames/enhancedblockentities/mixin/AbstractBlockStateMixin.java index c454355f..f473ea76 100644 --- a/src/main/java/foundationgames/enhancedblockentities/mixin/AbstractBlockStateMixin.java +++ b/src/main/java/foundationgames/enhancedblockentities/mixin/AbstractBlockStateMixin.java @@ -17,7 +17,7 @@ public abstract class AbstractBlockStateMixin { @Inject(method = "getRenderType", at = @At("HEAD"), cancellable = true) public void enhanced_bes$overrideRenderType(CallbackInfoReturnable cir) { Block block = this.getBlock(); - if(EnhancedBlockEntityRegistry.BLOCKS.contains(block)) { + if (EnhancedBlockEntityRegistry.BLOCKS.contains(block)) { cir.setReturnValue(BlockRenderType.MODEL); } } diff --git a/src/main/java/foundationgames/enhancedblockentities/mixin/BlockEntityRenderDispatcherMixin.java b/src/main/java/foundationgames/enhancedblockentities/mixin/BlockEntityRenderDispatcherMixin.java index 25f14e27..609d2ea9 100644 --- a/src/main/java/foundationgames/enhancedblockentities/mixin/BlockEntityRenderDispatcherMixin.java +++ b/src/main/java/foundationgames/enhancedblockentities/mixin/BlockEntityRenderDispatcherMixin.java @@ -24,9 +24,9 @@ public class BlockEntityRenderDispatcherMixin { cancellable = true ) private static void enhanced_bes$renderOverrides(BlockEntityRenderer renderer, BlockEntity blockEntity, float tickDelta, MatrixStack matrices, VertexConsumerProvider vertexConsumers, CallbackInfo ci) { - if(EnhancedBlockEntityRegistry.ENTITIES.containsKey(blockEntity.getType()) && EnhancedBlockEntityRegistry.BLOCKS.contains(blockEntity.getCachedState().getBlock())) { + if (EnhancedBlockEntityRegistry.ENTITIES.containsKey(blockEntity.getType()) && EnhancedBlockEntityRegistry.BLOCKS.contains(blockEntity.getCachedState().getBlock())) { Pair entry = EnhancedBlockEntityRegistry.ENTITIES.get(blockEntity.getType()); - if(entry.getLeft().shouldRender(blockEntity)) { + if (entry.getLeft().shouldRender(blockEntity)) { entry.getRight().render(renderer, blockEntity, tickDelta, matrices, vertexConsumers, WorldRenderer.getLightmapCoordinates(blockEntity.getWorld(), blockEntity.getPos()), OverlayTexture.DEFAULT_UV); } ci.cancel(); diff --git a/src/main/java/foundationgames/enhancedblockentities/util/DateUtil.java b/src/main/java/foundationgames/enhancedblockentities/util/DateUtil.java index b609acb1..b3d28202 100644 --- a/src/main/java/foundationgames/enhancedblockentities/util/DateUtil.java +++ b/src/main/java/foundationgames/enhancedblockentities/util/DateUtil.java @@ -7,8 +7,8 @@ public enum DateUtil {; public static boolean isChristmas() { String config = EnhancedBlockEntities.CONFIG.christmasChests; - if(config.equals("disabled")) return false; - if(config.equals("forced")) return true; + if (config.equals("disabled")) return false; + if (config.equals("forced")) return true; Calendar calendar = Calendar.getInstance(); return (calendar.get(Calendar.MONTH) + 1 == 12 && calendar.get(Calendar.DATE) >= 24 && calendar.get(Calendar.DATE) <= 26); } diff --git a/src/main/java/foundationgames/enhancedblockentities/util/EBEUtil.java b/src/main/java/foundationgames/enhancedblockentities/util/EBEUtil.java index 268dd4af..0d161f83 100644 --- a/src/main/java/foundationgames/enhancedblockentities/util/EBEUtil.java +++ b/src/main/java/foundationgames/enhancedblockentities/util/EBEUtil.java @@ -39,7 +39,7 @@ public enum EBEUtil {; public static void renderBakedModel(VertexConsumerProvider vertexConsumers, BlockState state, MatrixStack matrices, BakedModel model, int light, int overlay) { VertexConsumer vertices = vertexConsumers.getBuffer(RenderLayers.getEntityBlockLayer(state, false)); for (int i = 0; i <= 6; i++) { - for(BakedQuad q : model.getQuads(null, ModelHelper.faceFromIndex(i), dummy)) { + for (BakedQuad q : model.getQuads(null, ModelHelper.faceFromIndex(i), dummy)) { vertices.quad(matrices.peek(), q, 1, 1, 1, light, overlay); } } diff --git a/src/main/java/foundationgames/enhancedblockentities/util/WorldUtil.java b/src/main/java/foundationgames/enhancedblockentities/util/WorldUtil.java index 3f1bc88c..6d3c4365 100644 --- a/src/main/java/foundationgames/enhancedblockentities/util/WorldUtil.java +++ b/src/main/java/foundationgames/enhancedblockentities/util/WorldUtil.java @@ -20,14 +20,13 @@ public enum WorldUtil implements ClientTickEvents.EndWorldTick { private static final Map, Long2ObjectMap> TIMED_TASKS = new HashMap<>(); public static void rebuildChunk(World world, BlockPos pos) { - var bState = world.getBlockState(pos); - MinecraftClient.getInstance().worldRenderer.updateBlock(world, pos, bState, bState, 8); + var state = world.getBlockState(pos); + MinecraftClient.getInstance().worldRenderer.updateBlock(world, pos, state, state, 8); } public static void rebuildChunkAndThen(World world, BlockPos pos, Runnable action) { - var state = world.getBlockState(pos); CHUNK_UPDATE_TASKS.computeIfAbsent(ChunkSectionPos.from(pos), k -> new ExecutableRunnableHashSet()).add(action); - MinecraftClient.getInstance().worldRenderer.updateBlock(world, pos, state, state, 8); + rebuildChunk(world, pos); } public static void scheduleTimed(World world, long time, Runnable action) {