Skip to content

Commit

Permalink
Added a config option to reduce the rendering range of drawers
Browse files Browse the repository at this point in the history
  • Loading branch information
Buuz135 committed Jun 6, 2022
1 parent 37deecb commit 6afd5ee
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 1 deletion.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ buildscript {
apply plugin: 'net.minecraftforge.gradle'

group = 'com.buuz135'
version = '1.18.2-0.0.15'
version = '1.18.2-0.0.16'

java {
archivesBaseName = 'functionalstorage'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.block.entity.BlockEntityType;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.phys.AABB;
import net.minecraft.world.phys.BlockHitResult;
import net.minecraft.world.phys.HitResult;
import net.minecraftforge.common.capabilities.Capability;
Expand Down Expand Up @@ -127,4 +128,5 @@ public int getBaseSize(int lost) {
public BigInventoryHandler getHandler() {
return handler;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ public class CompactingDrawerRenderer implements BlockEntityRenderer<CompactingD

@Override
public void render(CompactingDrawerTile tile, float partialTicks, PoseStack matrixStack, MultiBufferSource bufferIn, int combinedLightIn, int combinedOverlayIn) {
if (Minecraft.getInstance().player != null && !tile.getBlockPos().closerThan(Minecraft.getInstance().player.getOnPos(), FunctionalStorageClientConfig.DRAWER_RENDER_RANGE)){
return;
}
matrixStack.pushPose();

Direction facing = tile.getFacingDirection();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ public class DrawerRenderer implements BlockEntityRenderer<DrawerTile> {

@Override
public void render(DrawerTile tile, float partialTicks, PoseStack matrixStack, MultiBufferSource bufferIn, int combinedLightIn, int combinedOverlayIn) {
if (Minecraft.getInstance().player != null && !tile.getBlockPos().closerThan(Minecraft.getInstance().player.getOnPos(), FunctionalStorageClientConfig.DRAWER_RENDER_RANGE)){
return;
}
matrixStack.pushPose();

Direction facing = tile.getFacingDirection();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ public class EnderDrawerRenderer implements BlockEntityRenderer<EnderDrawerTile>

@Override
public void render(EnderDrawerTile tile, float partialTicks, PoseStack matrixStack, MultiBufferSource bufferIn, int combinedLightIn, int combinedOverlayIn) {
if (Minecraft.getInstance().player != null && !tile.getBlockPos().closerThan(Minecraft.getInstance().player.getOnPos(), FunctionalStorageClientConfig.DRAWER_RENDER_RANGE)){
return;
}
matrixStack.pushPose();

Direction facing = tile.getFacingDirection();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package com.buuz135.functionalstorage.client;

import com.hrznstudio.titanium.annotation.config.ConfigFile;
import com.hrznstudio.titanium.annotation.config.ConfigVal;

@ConfigFile(value = "functionalstorage-client")
public class FunctionalStorageClientConfig {

@ConfigVal(comment = "Drawer content render range in blocks")
@ConfigVal.InRangeInt(min = 1)
public static int DRAWER_RENDER_RANGE = 16;
}

0 comments on commit 6afd5ee

Please sign in to comment.