Skip to content

Commit

Permalink
Time Vortex in Doors and various other changes (#401)
Browse files Browse the repository at this point in the history
Co-authored-by: Edrax Doodles <[email protected]>
Co-authored-by: River Thomas van der Meulen <[email protected]>
  • Loading branch information
3 people authored Dec 7, 2024
1 parent 35f3a10 commit 4f7999f
Show file tree
Hide file tree
Showing 231 changed files with 84,720 additions and 5,341 deletions.
6 changes: 5 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ buildscript {

plugins {
id "architectury-plugin" version "3.4-SNAPSHOT"
id "dev.architectury.loom" version "1.5+" apply false
id "dev.architectury.loom" version "1.6+" apply false
id "me.shedaniel.unified-publishing" version "0.1.+"
}

Expand Down Expand Up @@ -54,6 +54,10 @@ allprojects {
url = "https://raw.githubusercontent.com/Fuzss/modresources/main/maven/"
}

maven {
name = "Modrinth"
url = "https://api.modrinth.com/maven"
}

maven {
url "https://cursemaven.com"
Expand Down
105 changes: 85 additions & 20 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,88 @@

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

## Github Fixes
- Added "Compatibility" with [Diagonal Windows](https://www.curseforge.com/minecraft/mc-mods/diagonal-windows)
- Exception Ticking World [#388](https://github.com/WhoCraft/TardisRefined/issues/388)
- Nuka Console Duplicate Control Entity Failing Flight Dance Events [#376](https://github.com/WhoCraft/TardisRefined/issues/376)
- land pad dont work and crash on server [#377](https://github.com/WhoCraft/TardisRefined/issues/377)
- tardis is damaged [#351](https://github.com/WhoCraft/TardisRefined/issues/351)
- Diagonal Windows makes it impossible to craft the terraformer [#383](https://github.com/WhoCraft/TardisRefined/issues/383)
- relogging causes TARDIS Dance events to not occur [#387](https://github.com/WhoCraft/TardisRefined/issues/387)
- [Incompatibility] Tardis refined dimensions fail to load with Dimension Threads [#374](https://github.com/WhoCraft/TardisRefined/issues/374)
- Console cannot be removed/changed with the console configurator outside the TARDIS dimension [#380](https://github.com/WhoCraft/TardisRefined/issues/380)

## Gameplay changes
- Standing in a Crashed smoke of a crashed TARDIS will cause 0.5 damage to the player for the duration their standing in it
- Recovery Progress of crashed TARDIS now displayed on controls until repair is complete
- Recovery Progress of crashed TARDIS is now displayed on Key tooltip
- You can now view your TARDIS exterior via the Monitor
- Holographic exteriors on consoles now spin according to throttle
- Improved UI for Gravity Shaft
- Speed up downwards descent for Gravity Shaft
- Fixed a bug where the overlay keybinds always rendered the default key
## Bug Fixes
- Bug fix: Added "Compatibility" with [Diagonal Windows](https://www.curseforge.com/minecraft/mc-mods/diagonal-windows)
- Bug fix: Exception Ticking World [#388](https://github.com/WhoCraft/TardisRefined/issues/388)
- Bug fix: Nuka Console Duplicate Control Entity Failing Flight Dance Events [#376](https://github.com/WhoCraft/TardisRefined/issues/376)
- Bug fix: land pad dont work and crash on server [#377](https://github.com/WhoCraft/TardisRefined/issues/377)
- Bug fix: tardis is damaged [#351](https://github.com/WhoCraft/TardisRefined/issues/351)
- Bug fix: Diagonal Windows makes it impossible to craft the terraformer [#383](https://github.com/WhoCraft/TardisRefined/issues/383)
- Bug fix: relogging causes TARDIS Dance events to not occur [#387](https://github.com/WhoCraft/TardisRefined/issues/387)
- Bug fix: [Incompatibility] Tardis refined dimensions fail to load with Dimension Threads [#374](https://github.com/WhoCraft/TardisRefined/issues/374)
- Bug fix: Console cannot be removed/changed with the console configurator outside the TARDIS dimension [#380](https://github.com/WhoCraft/TardisRefined/issues/380)
- Bug fix: Fixed a bug where the overlay keybinds always rendered the default key

## Enhancements
- Enhancement: Standing in a Crashed smoke of a crashed TARDIS will cause 0.5 damage to the player for the duration their standing in it
- Enhancement: Recovery Progress of crashed TARDIS now displayed on controls until repair is complete
- Enhancement: Recovery Progress of crashed TARDIS is now displayed on Key tooltip
- Enhancement: Holographic exteriors on consoles now spin according to throttle
- Enhancement: Shell Viewer/Time Vortex (Accessed Via Monitor Screen)
- Enhancement: Speed up downwards descent for Gravity Shaft
- Enhancement: UI for Gravity Shaft
- Enhancement: Colored various texts on Key item
- Enhancement: Alarm now sounds when Fuel is below 5% and the TARDIS is not fueling+

## Additions
- Added Item: Mallet
- Added Villager: Pilot (POI: Console)
- Added Interior: Useable Terraformed
- "Added" Shell: Half Baked
- Added Vortex: Clouds
- Added Vortex: Flow
- Added Vortex: Space
- Added Vortex: Waves
- Added Vortex: Stars
- Added Vortex: Twilight Glow
- Added Vortex: Aurora Dreams
- Added Vortex: Desert Mirage
- Added Vortex: Neon Pulse
- Added Vortex: Ocean Breeze
- Added Vortex: Solar Flare
- Added Vortex: Crystal Lagoon
- Added Vortex: Velvet Night
- Added Vortex: Candy Pop
- Added Vortex: Emerald Forest
- Added Vortex: LGBT Rainbow
- Added Vortex: Transgender Flag
- Added Vortex: Bisexual Flag
- Added Vortex: Lesbian Flag
- Added Vortex: Non-Binary Flag
- Added Vortex: Agender Flag
- Added Vortex: Gay Flag

## Textures, Models & Animations
- Texture: Updated all Factory Console Variants
- Model: Updated Coral Console Model
- Model: Updated Victorian Console Model
- Model: Updated Factory Console Model
- Model: Updated Big Ben Interior Model
- Model: Updated Pathfinder Interior Model
- Animation: Updated Factory Console Flight Animation
- Animation: Updated Factory Console Idle Animation
- Animation: Added Factory Console Crash Animation
- Animation: Added Factory Console Power on Animation
- Animation: Added Factory Console Power off Animation
- Animation: Updated Victorian Console Flight Animation
- Animation: Updated Victorian Console Idle Animation
- Animation: Added Victorian Console Crash Animation
- Animation: Added Victorian Console Power on Animation
- Animation: Added Victorian Console Power off Animation


## Compatibility
- [Trinkets](https://wiki.tardisrefined.net/extendedinventorymods.html#trinkets)
- [Curios](https://wiki.tardisrefined.net/extendedinventorymods.html#curios)
- [Diagonal Windows](https://wiki.tardisrefined.net/diagonal-blocks-windows-walls.html#diagonal-walls)


## Technical changes
- Most animations for Consoles are now loaded from JSON
- Some models for Consoles are now loaded from JSON

## NOTE
- Upon updating to this version, your previous: ``Return Location``, ``Current Location`` and ``Target Location`` will be reset
This will not lead to any other data loss and your TARDIS will be exactly where you left it, take off once and you will be all sorted. This was a required change to resolve some issues


Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
import net.minecraft.client.animation.AnimationDefinition;
import net.minecraft.client.animation.Keyframe;
import net.minecraft.client.animation.KeyframeAnimations;
import net.minecraft.client.model.HierarchicalModel;
import net.minecraft.client.model.geom.ModelPart;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.server.packs.resources.ResourceManager;
import org.joml.Vector3f;
Expand All @@ -21,8 +23,7 @@

import static net.minecraft.client.animation.AnimationChannel.Interpolations.CATMULLROM;
import static net.minecraft.client.animation.AnimationChannel.Interpolations.LINEAR;
import static net.minecraft.client.animation.AnimationChannel.Targets.POSITION;
import static net.minecraft.client.animation.AnimationChannel.Targets.ROTATION;
import static net.minecraft.client.animation.AnimationChannel.Targets.*;

/**
* <h1>JsonToAnimationDefinition</h1>
Expand All @@ -41,6 +42,9 @@
*/
public class JsonToAnimationDefinition {

public static ModelPart findPart(HierarchicalModel hierarchicalModel, String string) {
return hierarchicalModel.root().getAllParts().filter((modelPart) -> modelPart.hasChild(string)).findFirst().map((modelPart) -> modelPart.getChild(string)).get();
}

public static final AnimationChannel.Interpolation SNAP_TO = (destination, progress, keyFrames, startIndex, endIndex, scaleFactor) -> {
Vector3f startVector = keyFrames[startIndex].target();
Expand Down Expand Up @@ -70,15 +74,13 @@ public static AnimationDefinition loadAnimation(ResourceManager resourceManager,

for (JsonElement boneEntry : animations.getAsJsonArray()) {
JsonObject boneData = boneEntry.getAsJsonObject();
System.out.println(boneData);

List<Keyframe> rotationKeyframes = new ArrayList<>();
List<Keyframe> positionKeyframes = new ArrayList<>();
List<Keyframe> scaleKeyframes = new ArrayList<>();

String boneName = boneData.get("bone").getAsString();

System.out.println(boneData.get("target").getAsString());


if(boneData.get("target").getAsString().equals("rotation")){
rotationKeyframes = parseKeyframes(boneData, ROTATION);
}
Expand All @@ -87,10 +89,15 @@ public static AnimationDefinition loadAnimation(ResourceManager resourceManager,
positionKeyframes = parseKeyframes(boneData, POSITION);
}

if(boneData.get("target").getAsString().equals("scale")){
scaleKeyframes = parseKeyframes(boneData, SCALE);
}



AnimationChannel positionChannel = positionKeyframes.isEmpty() ? null : new AnimationChannel(POSITION, positionKeyframes.toArray(new Keyframe[0]));
AnimationChannel rotationChannel = rotationKeyframes.isEmpty() ? null : new AnimationChannel(ROTATION, rotationKeyframes.toArray(new Keyframe[0]));
AnimationChannel scaleChannel = scaleKeyframes.isEmpty() ? null : new AnimationChannel(SCALE, scaleKeyframes.toArray(new Keyframe[0]));

if (positionChannel != null) {
animationDefinition.addAnimation(boneName, positionChannel);
Expand All @@ -99,6 +106,10 @@ public static AnimationDefinition loadAnimation(ResourceManager resourceManager,
animationDefinition.addAnimation(boneName, rotationChannel);
}

if (scaleChannel != null) {
animationDefinition.addAnimation(boneName, scaleChannel);
}


}

Expand All @@ -112,8 +123,6 @@ private static List<Keyframe> parseKeyframes(JsonElement transformationData, Ani

JsonObject jsonObject = transformationData.getAsJsonObject();

System.out.println(jsonObject);

if (!jsonObject.has("keyframes") || !jsonObject.get("keyframes").isJsonArray()) {
return keyframes;
}
Expand All @@ -129,47 +138,75 @@ private static List<Keyframe> parseKeyframes(JsonElement transformationData, Ani
JsonArray targetArray = keyframeObject.has("target") ? keyframeObject.getAsJsonArray("target") : null;
AnimationChannel.Interpolation interpolation = keyframeObject.has("interpolation") ? getInterpolation(keyframeObject.get("interpolation").getAsString()) : getInterpolation("linear");

Vector3f vector3f = new Vector3f();
Vector3f vector3f;

// Validate and convert the target array to a 3D vector (e.g., float[])
float[] target = new float[3];
if (targetArray != null && targetArray.size() == 3) {
for (int i = 0; i < 3; i++) {
target[i] = targetArray.get(i).getAsFloat();
}
vector3f = new Vector3f(
targetArray.get(0).getAsFloat(),
targetArray.get(1).getAsFloat(),
targetArray.get(2).getAsFloat()
);
} else {
continue; // Skip this keyframe if target is invalid
}

vector3f.set(target);
System.out.println(vector3f);

// Create a new Keyframe object and add it to the list
Keyframe keyframe = new Keyframe(timestamp, targetType == POSITION ? KeyframeAnimations.posVec(vector3f.x, vector3f.y, vector3f.z) : KeyframeAnimations.degreeVec(vector3f.x, vector3f.y, vector3f.z), interpolation);
Keyframe keyframe = new Keyframe(timestamp, Objects.requireNonNull(targetToVector(targetType, vector3f)), interpolation);
keyframes.add(keyframe);
}

// Log the total number of keyframes parsed
TardisRefined.LOGGER.info("Total keyframes parsed for target " + targetType + ": " + keyframes.size());
TardisRefined.LOGGER.debug("({} + {}) Total keyframes parsed: {}", targetToString(targetType), jsonObject.get("bone").getAsString(), keyframes.size());

return keyframes;
}


private static AnimationChannel.Interpolation getInterpolation(String easingType) {
if(easingType.equals("linear")){
return LINEAR;
private static String targetToString(AnimationChannel.Target target){
if(target == POSITION){
return "Position";
}

if(target == ROTATION){
return "Rotation";
}

if(easingType.equals("catmullrom")){
return CATMULLROM;
if(target == SCALE){
return "Scale";
}

return SNAP_TO;
return null; // We should never get here
}

private static Vector3f targetToVector(AnimationChannel.Target target, Vector3f vector3f){
if(target == POSITION){
return KeyframeAnimations.posVec(vector3f.x, vector3f.y, vector3f.z);
}

if(target == ROTATION){
return KeyframeAnimations.degreeVec(vector3f.x, vector3f.y, vector3f.z);
}

if(target == SCALE){
return KeyframeAnimations.scaleVec(vector3f.x, vector3f.y, vector3f.z);
}

return null; // We should never get here
}

private static AnimationChannel.Interpolation getInterpolation(String easingType) {
return switch (easingType) {
case "linear" -> LINEAR;
case "catmullrom" -> CATMULLROM;
default -> SNAP_TO;
};
}



public static JsonObject loadJsonFromResource(ResourceManager resourceManager, ResourceLocation resourceLocation) {
try {
TardisRefined.LOGGER.info("Loading Animation: {}", resourceLocation);
InputStream inputStream = resourceManager.getResource(resourceLocation).get().open();
JsonReader reader = new JsonReader(new InputStreamReader(inputStream));
return JsonParser.parseReader(reader).getAsJsonObject();
Expand Down

This file was deleted.

Loading

0 comments on commit 4f7999f

Please sign in to comment.