Skip to content

Commit

Permalink
- Bug Fix: Enter TARDIS with door closed [#422](#422)
Browse files Browse the repository at this point in the history
- Bug Fix: [FORGE] Shell Patterns not shown on computer bank [#425](#425)
- Bug Fix: Consoles not animating correctly - Bug fix: Tardis can travel to it's own dimension #435
- Bug fix: Tardis Shell Viewer not in correct position #434  #434
  • Loading branch information
Jeryn99 committed Dec 29, 2024
1 parent d8b6fc7 commit 6e3ad1a
Show file tree
Hide file tree
Showing 21 changed files with 120 additions and 32 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ githubRelease {
owner "WhoCraft"
repo "TardisRefined"
tagName "v$rootProject.minecraft_version-$project.mod_version"
targetCommitish "mc/1.20.1"
targetCommitish "mc/1.20.2"
releaseName "[$rootProject.minecraft_version] Tardis Refined - v$project.mod_version"
generateReleaseNotes true
body new File("${rootProject.projectDir}/changelog.md").text
Expand Down
8 changes: 6 additions & 2 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,13 @@

![TARDIS Refined](https://wiki.tardisrefined.net/TARDIS-Refined-Wiki/tardis_refined_v2_1.png)


#### Bug Fixes
- Bug Fix: Tardis will change locations without taking off, just by setting coordinates.[#427](https://github.com/WhoCraft/TardisRefined/issues/427)
- Bug Fix: Using the amethyst screwdriver to interact with the terraformer causes a freeze crash. (v2.1.1) [#426](https://github.com/WhoCraft/TardisRefined/issues/426)
- Bug Fix: Instantaneous Travel [#421](https://github.com/WhoCraft/TardisRefined/issues/421)

- Bug Fix: Crash loop when using the console changer [#432](https://github.com/WhoCraft/TardisRefined/issues/432)
- Bug Fix: [FORGE] Shell Patterns not shown on computer bank [#425](https://github.com/WhoCraft/TardisRefined/issues/425)
- Bug Fix: Consoles not animating correctly
- Bug Fix: Tardis can travel to it's own dimension [#435](https://github.com/WhoCraft/TardisRefined/issues/435)
- Bug Fix: Enter TARDIS with door closed [#422](https://github.com/WhoCraft/TardisRefined/issues/422)
- Bug Fix: Tardis Shell Viewer not in correct position [#434](https://github.com/WhoCraft/TardisRefined/issues/434)
1 change: 1 addition & 0 deletions common/src/main/java/dev/jeryn/frame/tardis/Frame.java
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ public static AnimationDefinition loadAnimation(ResourceManager resourceManager,
);
}


return animationDefinition.build();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,12 @@ public void renderConsole(GlobalConsoleBlockEntity globalConsoleBlock, Level lev
root().getAllParts().forEach(ModelPart::resetPose);
TardisClientData reactions = TardisClientData.getInstance(level.dimension());
if (globalConsoleBlock == null) return;
if (globalConsoleBlock.getBlockState() == null) return;

Boolean powered = globalConsoleBlock.getBlockState() == null ? true : globalConsoleBlock.getBlockState().getValue(GlobalConsoleBlock.POWERED);


if (powered) {

if (!globalConsoleBlock.powerOn.isStarted()) {
globalConsoleBlock.powerOff.stop();
globalConsoleBlock.powerOn.start(Minecraft.getInstance().player.tickCount);
Expand Down Expand Up @@ -92,10 +92,10 @@ public void renderConsole(GlobalConsoleBlockEntity globalConsoleBlock, Level lev

this.handbrake.xRot = reactions.isHandbrakeEngaged() ? -155f : -125f;
root().render(poseStack, vertexConsumer, packedLight, packedOverlay, red, green, blue, alpha);

}



@Override
public ModelPart root() {
return root;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -926,9 +926,12 @@ public void setupAnim(Entity entity, float f, float g, float h, float i, float j
public void renderConsole(GlobalConsoleBlockEntity globalConsoleBlock, Level level, PoseStack poseStack, VertexConsumer vertexConsumer, int packedLight, int packedOverlay, float red, float green, float blue, float alpha) {
root().getAllParts().forEach(ModelPart::resetPose);
TardisClientData reactions = TardisClientData.getInstance(level.dimension());
if (globalConsoleBlock == null) return;
if (globalConsoleBlock.getBlockState() == null) return;

Boolean powered = globalConsoleBlock.getBlockState() == null ? true : globalConsoleBlock.getBlockState().getValue(GlobalConsoleBlock.POWERED);


if (powered) {
if (!globalConsoleBlock.powerOn.isStarted()) {
globalConsoleBlock.powerOff.stop();
Expand All @@ -948,6 +951,7 @@ public void renderConsole(GlobalConsoleBlockEntity globalConsoleBlock, Level lev
this.animate(globalConsoleBlock.liveliness, IDLE, Minecraft.getInstance().player.tickCount);
}
}

} else {
if (globalConsoleBlock != null) {
if (!globalConsoleBlock.powerOff.isStarted()) {
Expand All @@ -958,12 +962,14 @@ public void renderConsole(GlobalConsoleBlockEntity globalConsoleBlock, Level lev
}
}


float rot = 1f + (2 * ((float) reactions.getThrottleStage() / TardisPilotingManager.MAX_THROTTLE_STAGE));
throttle_control.yRot = rot;

root().render(poseStack, vertexConsumer, packedLight, packedOverlay, red, green, blue, alpha);
}


@Override
public ResourceLocation getDefaultTexture() {
return VICTORIAN_TEXTURE;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ public static void renderOverlay(GuiGraphics gg) {
pose.mulPose(Axis.ZP.rotationDegrees(mul * VORTEX.lightning_strike * 90 * Mth.sin(VORTEX.lightning_strike)));

pose.pushPose();
pose.translate(0.5,0,0);
renderShell(gg, IMMERSION, 1 - demat_transparency, tardisClientData.getThrottleStage());
pose.popPose();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
import net.minecraft.client.renderer.texture.TextureAtlas;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.level.block.state.BlockState;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.lwjgl.opengl.GL11;
import whocraft.tardis_refined.TRConfig;
import whocraft.tardis_refined.TardisRefined;
Expand All @@ -47,6 +49,8 @@ public class RenderTargetHelper {
private static final RenderTargetHelper RENDER_TARGET_HELPER = new RenderTargetHelper();
public static StencilBufferStorage stencilBufferStorage = new StencilBufferStorage();

public static Logger LOGGER = LogManager.getLogger("TardisRefinbed/StencilRendering");

public static void renderVortex(GlobalDoorBlockEntity blockEntity, float partialTick, PoseStack stack, MultiBufferSource bufferSource, int packedLight, int packedOverlay) {

BlockState blockstate = blockEntity.getBlockState();
Expand Down Expand Up @@ -106,6 +110,8 @@ private static void renderDoorOpen(GlobalDoorBlockEntity blockEntity, PoseStack

// Enable and configure stencil buffer
GL11.glEnable(GL11.GL_STENCIL_TEST);
checkGLError("Enabling stencil test");

GL11.glStencilMask(0xFF); // Ensure stencil mask is set before clearing
GL11.glClear(GL11.GL_STENCIL_BUFFER_BIT); // Clear stencil buffer
GL11.glStencilFunc(GL11.GL_ALWAYS, 1, 0xFF);
Expand Down Expand Up @@ -154,7 +160,13 @@ private static void renderDoorOpen(GlobalDoorBlockEntity blockEntity, PoseStack
stack.popPose();
}

public static void checkGLError(String msg) {
int error;
while ((error = GL11.glGetError()) != GL11.GL_NO_ERROR) {
LOGGER.debug("{}: {}", msg, error);
}

}

private static void renderNoVortex(GlobalDoorBlockEntity blockEntity, PoseStack stack, MultiBufferSource bufferSource, int packedLight, float rotation, ShellDoorModel currentModel, boolean isOpen) {
stack.pushPose();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,12 @@ public static void renderShell(GuiGraphics guiGraphics, float control, float alp
GLOBALSHELL_BLOCKENTITY.setTardisId(tardisClientData.getLevelKey());

if(Platform.isForge()) {

float scale = 2.5F;
pose.scale(scale, scale, scale);
}


model.renderShell(GLOBALSHELL_BLOCKENTITY, false, false, pose, vertexConsumer, 15728880, OverlayTexture.NO_OVERLAY, 1.0F, 1.0F, 1.0F, alpha);

if (fullPattern.shellTexture().emissive()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,10 @@ protected void init() {
.size(70, 20).build());
vortxSelectButton.active = true;
*/
BackgroundlessButton extView = addRenderableWidget(BackgroundlessButton.backgroundlessBuilder(Component.literal(""), button -> new C2SBeginShellView().send()).pos(hPos + 20, -30 + height / 2).size(40, 60).build());
BackgroundlessButton extView = addRenderableWidget(BackgroundlessButton.backgroundlessBuilder(Component.literal(""), button -> {
new C2SBeginShellView().send();
Minecraft.getInstance().setScreen(null);
}).pos(hPos + 20, -30 + height / 2).size(40, 60).build());
extView.setTooltip(Tooltip.create(Component.translatable(ModMessages.UI_MONITOR_SHELL_VIEW)));
extView.active = true;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ public ShellSelectionScreen(ResourceLocation currentShellTheme) {
super(Component.translatable(ModMessages.UI_EXTERNAL_SHELL), currentShellTheme);
}

@Override
public ResourceLocation getPatternForRender() {
return PATTERN.id();
}

@Override
protected void init() {
super.init();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ public void entityInside(BlockState blockState, Level level, BlockPos blockPos,
ServerLevel serverLevel = (ServerLevel) level;
if (serverLevel.getBlockEntity(blockPos) instanceof ExteriorShell shellEntity) {
AABB teleportAABB = this.getCollisionShape(blockState, level, blockPos, CollisionContext.of(entity)).bounds().move(blockPos);
if (TRTeleporter.teleportIfCollided(serverLevel, blockPos, entity, teleportAABB)) {
if (blockState.getValue(OPEN) && TRTeleporter.teleportIfCollided(serverLevel, blockPos, entity, teleportAABB)) {
shellEntity.onAttemptEnter(blockState, serverLevel, blockPos, entity);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import whocraft.tardis_refined.common.dimension.DimensionHandler;
import whocraft.tardis_refined.common.tardis.TardisDesktops;
import whocraft.tardis_refined.common.tardis.TardisNavLocation;
import whocraft.tardis_refined.common.tardis.manager.AestheticHandler;
import whocraft.tardis_refined.common.tardis.manager.TardisPilotingManager;
import whocraft.tardis_refined.common.tardis.themes.DesktopTheme;
import whocraft.tardis_refined.common.util.Platform;
Expand Down Expand Up @@ -113,10 +114,11 @@ public void onAttemptEnter(BlockState blockState, Level level, BlockPos external
TardisLevelOperator.get(interior).ifPresent(cap -> {

UpgradeHandler upgradeHandler = cap.getUpgradeHandler();
AestheticHandler aesthetics = cap.getAestheticHandler();

if (cap.isTardisReady() && (blockState.getValue(ShellBaseBlock.OPEN) || (cap.getPilotingManager().isLanding() && TRUpgrades.MATERIALIZE_AROUND.get().isUnlocked(upgradeHandler)))) {
if (cap.getAestheticHandler().getShellTheme() != null) {
ResourceLocation theme = cap.getAestheticHandler().getShellTheme();
if (aesthetics.getShellTheme() != null) {
ResourceLocation theme = aesthetics.getShellTheme();

if (ModCompatChecker.immersivePortals()) {
if (ImmersivePortals.isShellThemeSupported(theme) && ImmersivePortals.doPortalsExistForTardis(UUID.fromString(TARDIS_ID.location().getPath()))) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ public interface TardisPilot {

void updatePlayerAbilities(ServerPlayer player, Abilities abilities, boolean isWatcher);

void setupPlayerForInspection(ServerPlayer serverPlayer, TardisLevelOperator tardisLevelOperator, TardisNavLocation spectateTarget, boolean timeVortex);
void startShellView(ServerPlayer serverPlayer, TardisLevelOperator tardisLevelOperator, TardisNavLocation spectateTarget, boolean timeVortex);

void endPlayerForInspection(ServerPlayer serverPlayer);
void endShellView(ServerPlayer serverPlayer);

UUID getViewedTardis();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
import net.minecraft.world.entity.player.Abilities;
import net.minecraft.world.entity.player.Player;
import whocraft.tardis_refined.common.capability.tardis.TardisLevelOperator;
import whocraft.tardis_refined.common.dimension.TardisTeleportData;
import whocraft.tardis_refined.common.network.messages.player.C2SExitTardisView;
import whocraft.tardis_refined.common.network.messages.player.S2CResetPostShellView;
import whocraft.tardis_refined.common.network.messages.sync.S2CSyncTardisPlayerView;
Expand Down Expand Up @@ -48,7 +47,7 @@ public static void updateTardisForAllPlayers(TardisLevelOperator tardisLevelOper
TardisPlayerInfo.get(serverPlayer).ifPresent(tardisPlayerInfo -> {
if (tardisPlayerInfo.isViewingTardis()) {
if (Objects.equals(tardisPlayerInfo.getViewedTardis().toString(), UUID.fromString(tardisLevelOperator.getLevelKey().location().getPath()).toString())) {
tardisPlayerInfo.setupPlayerForInspection(serverPlayer, tardisLevelOperator, tardisNavLocation, timeVortex);
tardisPlayerInfo.startShellView(serverPlayer, tardisLevelOperator, tardisNavLocation, timeVortex);
}
}
});
Expand Down Expand Up @@ -88,7 +87,7 @@ public void updatePlayerAbilities(ServerPlayer player, Abilities abilities, bool
}

@Override
public void setupPlayerForInspection(ServerPlayer serverPlayer, TardisLevelOperator tardisLevelOperator, TardisNavLocation spectateTarget, boolean timeVortex) {
public void startShellView(ServerPlayer serverPlayer, TardisLevelOperator tardisLevelOperator, TardisNavLocation spectateTarget, boolean timeVortex) {

// Set the player's viewed TARDIS UUID
UUID uuid = UUID.fromString(tardisLevelOperator.getLevelKey().location().getPath());
Expand All @@ -106,7 +105,7 @@ public void setupPlayerForInspection(ServerPlayer serverPlayer, TardisLevelOpera
BlockPos spectatePos = spectateTarget.getPosition();

if (spectateTarget.getPosition().distManhattan(new Vec3i((int) player.position().x, (int) player.position().y, (int) player.position().z)) > 3 || !player.level().dimension().location().toString().equals(spectateTarget.getDimensionKey().location().toString())) {
TRTeleporter.simpleTeleport(player, spectateTarget.getLevel(), spectatePos.getX(), spectatePos.getY(), spectatePos.getZ(), playerPreviousRot, playerPreviousYaw);
TRTeleporter.simpleTeleport(player, spectateTarget.getLevel(), spectatePos.getX() + 0.5, spectatePos.getY(), spectatePos.getZ() + 0.5, playerPreviousRot, playerPreviousYaw);
}
updatePlayerAbilities(serverPlayer, serverPlayer.getAbilities(), true);
setRenderVortex(timeVortex);
Expand Down Expand Up @@ -197,11 +196,11 @@ public Player getPlayer() {
}

@Override
public void endPlayerForInspection(ServerPlayer serverPlayer) {
public void endShellView(ServerPlayer serverPlayer) {
if (!isViewingTardis()) return;
BlockPos targetPosition = getPlayerPreviousPos().getPosition();

TRTeleporter.simpleTeleport(serverPlayer, getPlayerPreviousPos().getLevel(), targetPosition.getX(), targetPosition.getY(), targetPosition.getZ(), playerPreviousYaw, playerPreviousRot);
TRTeleporter.simpleTeleport(serverPlayer, Platform.getServer().getLevel(getPlayerPreviousPos().getDimensionKey()), targetPosition.getX() + 0.5, targetPosition.getY(), targetPosition.getZ() + 0.5, playerPreviousYaw, playerPreviousRot);
updatePlayerAbilities(serverPlayer, serverPlayer.getAbilities(), false);
serverPlayer.onUpdateAbilities();
new S2CResetPostShellView().send(serverPlayer);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public void handle(MessageContext context) {
Level level = context.getPlayer().level();
if (level instanceof ServerLevel serverLevel) {
TardisLevelOperator.get(serverLevel).ifPresent(tardisLevelOperator -> TardisPlayerInfo.get(context.getPlayer()).ifPresent(tardisInfo ->
tardisInfo.setupPlayerForInspection(player, tardisLevelOperator, tardisLevelOperator.getPilotingManager().isTakingOff() ? tardisLevelOperator.getPilotingManager().getCurrentLocation() : tardisLevelOperator.getPilotingManager().getTargetLocation(), !tardisLevelOperator.getPilotingManager().isTakingOff())
tardisInfo.startShellView(player, tardisLevelOperator, tardisLevelOperator.getPilotingManager().isTakingOff() ? tardisLevelOperator.getPilotingManager().getCurrentLocation() : tardisLevelOperator.getPilotingManager().getTargetLocation(), tardisLevelOperator.getPilotingManager().isInFlight())
));
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public void handle(MessageContext context) {
ServerLevel tardisLevel = Platform.getServer().getLevel(key);
if (tardisLevel != null) {
TardisLevelOperator.get(tardisLevel).ifPresent(tardisLevelOperator -> {
tardisInfo.endPlayerForInspection(player);
tardisInfo.endShellView(player);
});
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
package whocraft.tardis_refined.common.network.messages.player;

import net.minecraft.core.registries.Registries;
import net.minecraft.network.FriendlyByteBuf;
import net.minecraft.resources.ResourceKey;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.world.level.Level;
import org.jetbrains.annotations.NotNull;
import whocraft.tardis_refined.TardisRefined;
import whocraft.tardis_refined.common.capability.player.TardisPlayerInfo;
import whocraft.tardis_refined.common.capability.tardis.TardisLevelOperator;
import whocraft.tardis_refined.common.network.MessageC2S;
import whocraft.tardis_refined.common.network.MessageContext;
import whocraft.tardis_refined.common.network.MessageType;
import whocraft.tardis_refined.common.network.TardisNetwork;
import whocraft.tardis_refined.common.util.Platform;

public class ExitTardisViewMessage extends MessageC2S {

public ExitTardisViewMessage() {
}

public ExitTardisViewMessage(FriendlyByteBuf buf) {
}

@Override
public @NotNull MessageType getType() {
return TardisNetwork.TARDIS_EXIT;
}

@Override
public void toBytes(FriendlyByteBuf buf) {

}

@Override
public void handle(MessageContext context) {
ServerPlayer player = context.getPlayer();

TardisPlayerInfo.get(player).ifPresent(tardisInfo -> {
if (tardisInfo.isViewingTardis()) {
ResourceKey<Level> key = ResourceKey.create(Registries.DIMENSION,
new ResourceLocation(TardisRefined.MODID, tardisInfo.getViewedTardis().toString()));
ServerLevel tardisLevel = Platform.getServer().getLevel(key);
if (tardisLevel != null) {
TardisLevelOperator.get(tardisLevel).ifPresent(tardisLevelOperator -> {
tardisInfo.endShellView(player);
});
}
}
});

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

import java.util.ArrayList;
import java.util.List;
import java.util.function.Predicate;

import static net.minecraft.world.level.Level.OVERWORLD;

Expand All @@ -33,15 +34,17 @@ public DimensionalControl(ResourceLocation id, String langId) {

private List<ServerLevel> getAllowedDimensions(TardisLevelOperator tardisLevelOperator) {
var filteredDimensions = new ArrayList<ServerLevel>();

var filteredLevels = Platform.getServer().getAllLevels();


filteredLevels.forEach(x -> {
if (tardisLevelOperator.getProgressionManager().isLevelDiscovered(x.dimension())) {
filteredDimensions.add(x);
}
});

return filteredDimensions;
return filteredDimensions.stream().filter(serverLevel -> DimensionUtil.isAllowedDimension(serverLevel.dimension())).toList();
}

@Override
Expand Down
Loading

0 comments on commit 6e3ad1a

Please sign in to comment.