Skip to content

Commit

Permalink
feat: ✨ Allow storage upgrades to be rendered on top of chests
Browse files Browse the repository at this point in the history
  • Loading branch information
P3pp3rF1y committed Jan 15, 2025
1 parent 33b9db8 commit 224ec0a
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 6 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ loader_version_range=[4,)
mod_id=sophisticatedstorage
mod_name=Sophisticated Storage
mod_license=GNU General Public License v3.0
mod_version=1.2.2
mod_version=1.2.3
mod_group_id=sophisticatedstorage
mod_authors=P3pp3rF1y, Ridanisaurus
mod_description=Fancy and functional storage containers.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ public class ChestBlockEntity extends WoodStorageBlockEntity {

@Nullable
private BlockPos doubleMainPos = null;
public boolean showUpgradesOnTop = false;
private final ContainerOpenersCounter openersCounter = new ContainerOpenersCounter() {
protected void onOpen(Level level, BlockPos pos, BlockState state) {
if (state.getValue(ChestBlock.TYPE) != ChestType.LEFT) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,18 @@ public void render(ChestBlockEntity chestEntity, float partialTick, PoseStack po
if (chestType == ChestType.LEFT) {
poseStack.translate(1, 0, 0);
}

if (chestEntity.showUpgradesOnTop) {
if (lidAngle > 0) {
poseStack.translate(0, 9/16D, 14/16D);
poseStack.mulPose(Axis.XP.rotationDegrees(lidAngle * 90));
poseStack.translate(0, -9/16D, -14/16D);
}
poseStack.translate(0.5, 0.5, (0.5 - 1 / 16f));
poseStack.mulPose(Axis.XP.rotationDegrees(90));
poseStack.translate(-0.5, -(0.5 - 1/16f), -(0.5 - 2 / 16f));
}

displayItemRenderer.renderUpgradeItems(chestEntity, poseStack, bufferSource, packedLight, packedOverlay, holdsItemThatShowsUpgrades(), shouldShowDisabledUpgradesDisplay(chestEntity));
poseStack.popPose();
}
Expand Down Expand Up @@ -188,11 +200,6 @@ private void renderDisplayItem(RenderInfo.DisplayItem displayItem, PoseStack pos

private void renderLocked(ChestBlockEntity chestEntity, PoseStack poseStack, MultiBufferSource bufferSource, int packedLight, int packedOverlay, ChestType chestType, float lidAngle) {
poseStack.pushPose();
if (lidAngle > 0) {
poseStack.translate(0, 9/16D, 14/16D);
poseStack.mulPose(Axis.XP.rotationDegrees(lidAngle * 90));
poseStack.translate(0, -9/16D, -14/16D);
}
if (chestType == ChestType.LEFT) {
poseStack.translate(0.5, 0, 0);
} else if (chestType == ChestType.RIGHT) {
Expand Down

0 comments on commit 224ec0a

Please sign in to comment.