Skip to content

Commit

Permalink
- Fixes 50s unfinished commit
Browse files Browse the repository at this point in the history
- Fixes Forge Rendering being weird at certain angles
- Bumped Version
  • Loading branch information
Jeryn99 committed Aug 19, 2024
1 parent 02d0ff3 commit f8357a0
Show file tree
Hide file tree
Showing 9 changed files with 108 additions and 23 deletions.
65 changes: 60 additions & 5 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,64 @@
# Version 2.0.6
# Version 2.0.7

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

## Changes
- Added 50x speed upgrade
## New Features

- Datapack Console Patterns and Shell Patterns can now define the sounds used by the Tardis.
- Console Patterns can define Left Click and Right Click sounds for Generic interactions, as well as Throttle and
Handbrake specific sounds
- Shell Patterns can define Door Unlock/Lock, Door Open/Close sounds.

**Note:** These additions are optional fields, meaning all existing Pattern datapacks will not need to be updated.

## Gameplay Fixes

- Fixes left clicking controls during flight dance activating the control's function unexpectedly. E.g. Left clicking X
Coordinate control actually changing the X coordinate when re-aligning a control
- Fixed blocks causing player's hand to swing twice in every interaction. Caused by the wrong InteractionResult being
used on the serverside.
- Fixes Dimensions not being registered to the server, causing the world to not exist upon reloading the save. This also
increases performance for world loading as it means the server doesn't need to create a new world everytime a player
enters a Tardis after server restart (for multiplayer) or logging out then reopening a save file (singleplayer).
- Comprehensive fix for Root Shell not updating its `OPEN` state during terraforming (#299). This has been achieved by
cleaning up and unifying door update logic as well as patching the desktop regeneration logic.
- Attempting to land a Tardis on a block where there are no valid positions caused an infinite crash loop #309
- Fixes issue where (Neo) Forge rendering would cause Consoles and Shells to stop rendering at certain angles

## Technical Debt
- Cleaned up all Tardis manager classes and implemented common methods stuch as ``tick(ServerLevel level)``,
``saveData`` and ``loadData``
- Unified door closing and door locking logic by implementing the ``TardisInternalDoor`` interface on
``AbstractDoorBlockEntity`` instead of some classes sometimes using the Blockstate property, and other classes
sometimes using the BlockState properties directly.
- Before this cleanup the codebase logic would continue to become even more inconsistent, difficult to maintain, test,
debug and enable poor practices to slip in.
- Example: Forgetting to update the exterior shell but not the internal door, and vice versa.
- Unified shell open and locking logic by using ``ExteriorShell`` interface which was introduced early on in the 1.19,2
development but was hidden in a random package and never referenced again.
- Relocated ``ExteriorShell`` interface to another package so that it's more noticeable
- Moved desktop generation logic into a method for ease of viewing
- Reordered some getter and setter methods in classes for ease of viewing
- Fixed teleportation via Tardis doors not using the correct facing, requiring us to call `Direction#getOpposite` in
many places to compensate. Previously it created great difficulty to debug teleportation issues.
- Removed `AbstractDoorBlockEntity#isLocked` in favour of a Blockstate Property. This allows the locking logic to use
the BlockState Property to be consistent with the Exterior Shell.
- Enhanced ``TardisExteriorManager#setOrUpdateExteriorBlock`` to not be as verbose with the parameters. Removed the
boolean field, and added a default method called ``TardisExteriorManager.placeExteriorBlockForLanding`` which
implements the correct logic for when the Tardis is landing, and thus requires a new Shell blockstate instance to be
created.
- Exterior Shell updates using duplicate implementations across multiple classes, include `AestheticHandler`,
`TardisExteriorManager` and `TardisInteriorManager`. This is now unified in `TardisLevelOperator` for ease of
maintenance.

## API Changes

- Added new events for addon mods - `LockDoor` and `UnlockDoor`, which are fired after the internal door and exterior
shell blocks are locked/unlocked
- Made `OpenDoor` and `CloseDoor` events fire after doors have been updated. Previously it fired after the internal door
updates, but before the exterior shell updated. This would have caused some issues when addon mods subscribe to these
events because it would mean addon mods are applying logic before the exterior shell door has closed, which can have
unintended consequences.
- Added `ShellChangeSource`, an object to identify why a Shell was updated. This provides additional data to use for
differentiate logic between updating shell from landing the Tardis to when the shell is updated during terraforming

## Fixes
- Fixed Speed Upgrades not correctly applying
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@
import whocraft.tardis_refined.patterns.ShellPattern;
import whocraft.tardis_refined.patterns.ShellPatterns;

import java.util.Objects;

public class GlobalConsoleRenderer implements BlockEntityRenderer<GlobalConsoleBlockEntity>, BlockEntityRendererProvider<GlobalConsoleBlockEntity> {

private static final Vec3 crystalHolo = new Vec3(0.3f, -1.725, 0.655);
Expand Down Expand Up @@ -105,5 +103,6 @@ public boolean shouldRenderOffScreen(GlobalConsoleBlockEntity blockEntity) {
public BlockEntityRenderer<GlobalConsoleBlockEntity> create(BlockEntityRendererProvider.Context context) {
return new GlobalConsoleRenderer(context);
}



}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
import whocraft.tardis_refined.common.block.door.GlobalDoorBlock;
import whocraft.tardis_refined.common.blockentity.console.GlobalConsoleBlockEntity;
import whocraft.tardis_refined.common.blockentity.device.ConsoleConfigurationBlockEntity;
import whocraft.tardis_refined.common.tardis.themes.ConsoleTheme;

public class ConsoleConfigurationRenderer implements BlockEntityRenderer<ConsoleConfigurationBlockEntity>, BlockEntityRendererProvider<ConsoleConfigurationBlockEntity> {

Expand Down Expand Up @@ -59,4 +58,9 @@ public void render(ConsoleConfigurationBlockEntity blockEntity, float partialTic

poseStack.popPose();
}

@Override
public boolean shouldRenderOffScreen(ConsoleConfigurationBlockEntity blockEntity) {
return true;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@
import net.minecraft.world.level.block.state.BlockState;
import org.jetbrains.annotations.Nullable;
import whocraft.tardis_refined.common.capability.TardisLevelOperator;
import whocraft.tardis_refined.patterns.sound.ConfiguredSound;
import whocraft.tardis_refined.common.tardis.themes.ShellTheme;
import whocraft.tardis_refined.constants.NbtConstants;
import whocraft.tardis_refined.patterns.ShellPattern;
import whocraft.tardis_refined.patterns.ShellPatterns;
import whocraft.tardis_refined.patterns.sound.ConfiguredSound;
import whocraft.tardis_refined.registry.TRBlockEntityRegistry;

public class GlobalDoorBlockEntity extends InternalDoorBlockEntity {
Expand Down Expand Up @@ -138,10 +138,13 @@ public void playDoorCloseSound(boolean closeDoor) {
ShellPattern pattern = this.pattern();
if (pattern != null){
Level currentLevel = this.getLevel();
ConfiguredSound configuredSound = pattern.soundProfile().getDoorClose();
if (configuredSound != null){
currentLevel.playSound(null, this.getBlockPos(), configuredSound.getSoundEvent(), SoundSource.BLOCKS, configuredSound.getPitch(), configuredSound.getVolume());
}

pattern.soundProfile().ifPresent(shellSoundProfile -> {
ConfiguredSound configuredSound = shellSoundProfile.getDoorClose();
if (configuredSound != null) {
currentLevel.playSound(null, this.getBlockPos(), configuredSound.getSoundEvent(), SoundSource.BLOCKS, configuredSound.getPitch(), configuredSound.getVolume());
}
});
}
}

Expand All @@ -150,10 +153,12 @@ public void playDoorLockedSound(boolean lockDoor) {
ShellPattern pattern = this.pattern();
if (pattern != null){
Level currentLevel = this.getLevel();
ConfiguredSound configuredSound = pattern.soundProfile().getDoorLocked();
if (configuredSound != null){
currentLevel.playSound(null, this.getBlockPos(), configuredSound.getSoundEvent(), SoundSource.BLOCKS, configuredSound.getPitch(), configuredSound.getVolume());
}
pattern.soundProfile().ifPresent(shellSoundProfile -> {
ConfiguredSound configuredSound = shellSoundProfile.getDoorClose();
if (configuredSound != null) {
currentLevel.playSound(null, this.getBlockPos(), configuredSound.getSoundEvent(), SoundSource.BLOCKS, configuredSound.getPitch(), configuredSound.getVolume());
}
});
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,9 @@
import whocraft.tardis_refined.common.entity.ControlEntity;
import whocraft.tardis_refined.common.tardis.control.Control;
import whocraft.tardis_refined.common.tardis.themes.ConsoleTheme;
import whocraft.tardis_refined.patterns.sound.ConfiguredSound;
import whocraft.tardis_refined.common.tardis.themes.console.sound.PitchedSound;
import whocraft.tardis_refined.common.util.PlayerUtil;
import whocraft.tardis_refined.constants.ModMessages;
import whocraft.tardis_refined.patterns.sound.ConfiguredSound;

public class ToggleDoorControl extends Control {
public ToggleDoorControl(ResourceLocation id) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,9 @@
import whocraft.tardis_refined.common.capability.upgrades.SpeedUpgrade;
import whocraft.tardis_refined.common.capability.upgrades.Upgrade;
import whocraft.tardis_refined.common.capability.upgrades.UpgradeHandler;
import whocraft.tardis_refined.common.util.LevelHelper;
import whocraft.tardis_refined.registry.TRUpgrades;
import whocraft.tardis_refined.common.tardis.TardisArchitectureHandler;
import whocraft.tardis_refined.common.tardis.TardisNavLocation;
import whocraft.tardis_refined.common.util.LevelHelper;
import whocraft.tardis_refined.common.util.PlayerUtil;
import whocraft.tardis_refined.common.util.TardisHelper;
import whocraft.tardis_refined.constants.ModMessages;
Expand Down Expand Up @@ -301,7 +300,9 @@ private void checkThrottleStatesForFlight() {
}

private void onCrashCooldownTick() {

ticksSinceCrash++;

// After 10 minutes
if (ticksSinceCrash >= TICKS_COOLDOWN_MAX) {
this.canUseControls = true;
Expand All @@ -310,6 +311,7 @@ private void onCrashCooldownTick() {
}
}


/**
* Load the fast return into the target location.
*
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package whocraft.tardis_refined.mixin.forge;

import net.minecraft.client.renderer.blockentity.BlockEntityRenderDispatcher;
import net.minecraft.client.renderer.culling.Frustum;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.neoforged.neoforge.client.ClientHooks;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;

@Mixin(ClientHooks.class)
public class ClientHooksMixin {

@Inject(method = "isBlockEntityRendererVisible(Lnet/minecraft/client/renderer/blockentity/BlockEntityRenderDispatcher;Lnet/minecraft/world/level/block/entity/BlockEntity;Lnet/minecraft/client/renderer/culling/Frustum;)Z", at = @At("HEAD"), cancellable = true)
private static void getRenderBoundingBox(BlockEntityRenderDispatcher dispatcher, BlockEntity blockEntity, Frustum frustum, CallbackInfoReturnable<Boolean> cir) {
cir.setReturnValue(blockEntity.getClass().getPackageName().contains("whocraft.tardis_refined"));
}

}
1 change: 1 addition & 0 deletions forge/src/main/resources/tardis_refined.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"package": "whocraft.tardis_refined.mixin.forge",
"compatibilityLevel": "JAVA_17",
"mixins": [
"ClientHooksMixin"
],
"client": [
],
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ neoforge_data_pack_format=18
##Mod Information

#Common Mod Information
mod_version=2.0.6
mod_version=2.0.7
license=https://github.com/Whocraft/TardisRefined/blob/minecraft/1.20/LICENSE.MD
credits=Commoble, Lucraft, starray1000000, Monsterwaill, TheJudge, LoxiGoose
mod_authors=CommandrMoose / River, Jeryn99, Magic Man, ILikePandas, Jacob K, 50ap5ud5
Expand Down

0 comments on commit f8357a0

Please sign in to comment.