Skip to content

Commit

Permalink
Fix sliding doors not dropping when broken (#447)
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexNijjar committed Feb 1, 2024
1 parent b7e0f58 commit 9f2bf46
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 9 deletions.
7 changes: 3 additions & 4 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
## WARNING

This is an alpha release. Expect bugs and frequent updates until we reach a stable version.
If you're updating from 1.15.5 or below, please back up your world and expect the following breaking changes:
This is an beta release. If you're updating from 1.15.5 or below, please back up your world and expect the following
breaking changes:

- Sliding doors will break and need to be placed again.
- Launch pads will break and need to be placed again.
Expand All @@ -12,5 +12,4 @@ See https://modrinth.com/mod/ad-astra/version/1.15.7 for the full changelog.

## Changes

- Fixed Rocket not opening planet screen for some people.
- Added missing rocket subtitle translations.
- Fixed sliding doors not dropping when broken (#447)
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.ChunkPos;
import net.minecraft.world.level.Level;
import org.apache.commons.lang3.text.WordUtils;
import org.jetbrains.annotations.Nullable;

import java.util.ArrayList;
Expand Down Expand Up @@ -124,7 +125,7 @@ private void createSolarSystemButtons() {
pageIndex = 1;
selectedSolarSystem = solarSystem;
rebuildWidgets();
}, Component.translatable("solar_system.%s.%s".formatted(solarSystem.getNamespace(), solarSystem.getPath()))));
}, Component.translatableWithFallback("solar_system.%s.%s".formatted(solarSystem.getNamespace(), solarSystem.getPath()), title(solarSystem.getPath()))));
buttons.add(button);
});
}
Expand Down Expand Up @@ -247,10 +248,10 @@ protected void renderBg(GuiGraphics graphics, float partialTick, int mouseX, int
}

if (pageIndex == 2 && selectedPlanet != null) {
var title = Component.translatable("planet.%s.%s".formatted(selectedPlanet.dimension().location().getNamespace(), selectedPlanet.dimension().location().getPath()));
var title = Component.translatableWithFallback("planet.%s.%s".formatted(selectedPlanet.dimension().location().getNamespace(), selectedPlanet.dimension().location().getPath()), title(selectedPlanet.dimension().location().getPath()));
graphics.drawCenteredString(font, title, 57, height / 2 - 60, 0xffffff);
} else if (pageIndex == 1 && selectedSolarSystem != null) {
var title = Component.translatable("solar_system.%s.%s".formatted(selectedSolarSystem.getNamespace(), selectedSolarSystem.getPath()));
var title = Component.translatableWithFallback("solar_system.%s.%s".formatted(selectedSolarSystem.getNamespace(), selectedSolarSystem.getPath()), title(selectedSolarSystem.getPath()));
graphics.drawCenteredString(font, title, 57, height / 2 - 60, 0xffffff);
} else {
graphics.drawCenteredString(font, ConstantComponents.CATALOG, 57, height / 2 - 60, 0xffffff);
Expand Down Expand Up @@ -391,4 +392,10 @@ public void landOnSpaceStation(ResourceKey<Level> dimension, ChunkPos pos) {
NetworkHandler.CHANNEL.sendToServer(new ServerboundLandOnSpaceStationPacket(dimension, pos));
close();
}

// StringUtils only replaces the first word so WordUtils is needed
@SuppressWarnings("deprecation")
private String title(String string) {
return WordUtils.capitalizeFully(string.replace("_", " "));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ private void destroy(Level level, BlockPos pos, BlockState state) {
var controllerPos = getController(state, pos);
for (var part : SlidingDoorPartProperty.values()) {
var partPos = controllerPos.relative(direction, part.xOffset()).above(part.yOffset());
level.destroyBlock(partPos, false);
level.destroyBlock(partPos, true);
}
}

Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ org.gradle.jvmargs=-Xmx2G

enabledPlatforms=fabric,forge

version=1.15.14
version=1.15.15
group=earth.terrarium.adastra

minecraftVersion=1.20.1
Expand Down

0 comments on commit 9f2bf46

Please sign in to comment.