Skip to content

Commit

Permalink
Time Vortex & External Viewer (#393)
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 Nov 30, 2024
1 parent 5f116ff commit ee0ec4c
Show file tree
Hide file tree
Showing 354 changed files with 35,174 additions and 22,994 deletions.
62 changes: 5 additions & 57 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,10 @@ plugins {
id "me.shedaniel.unified-publishing" version "0.1.+"
}

apply plugin: "io.github.pacifistmc.forgix"

architectury {
minecraft = rootProject.minecraft_version
}



forgix {
group = "whocraft.tardis_refined"
mergedJarName = "$rootProject.jar_name-mc$project.minecraft_version-v${rootProject.mod_version}.jar"
outputDir = "build/libs"
}

subprojects {
apply plugin: "dev.architectury.loom"

Expand All @@ -46,47 +36,6 @@ subprojects {
}
implementation group: 'com.google.code.findbugs', name: 'jsr305', version: '3.0.2'
}

build.finalizedBy(mergeJars)
assemble.finalizedBy(mergeJars)
}
if (System.getenv("curseforge") != null && System.getenv("modrinth") != null) {
unifiedPublishing {
project {
displayName = "Tardis Refined - mc${rootProject.minecraft_version}-v${rootProject.mod_version}"
releaseType = "release"
changelog = new File("${rootProject.projectDir}/changelog.md").text
gameVersions = ["$rootProject.minecraft_version"]
mainPublication project.layout.file(project.provider {
new File("${project.projectDir}/build/libs/$rootProject.jar_name-mc$project.minecraft_version-v${rootProject.mod_version}.jar")
})
gameLoaders = ["fabric", "neoforge"]
relations {
optional {
curseforge = "immersive-portals-mod"
modrinth = "immersiveportals"
}
}

var CURSE_API_KEY = project.findProperty("curseforge") ?: System.getenv("curseforge") ?: ""
if (CURSE_API_KEY != "") {
curseforge {
token = CURSE_API_KEY
id = "782697"
gameVersions.addAll "Java 17", "$rootProject.minecraft_version"
}
}

var MODRINTH_TOKEN = project.findProperty("modrinth") ?: System.getenv("modrinth") ?: ""
if (MODRINTH_TOKEN != "") {
modrinth {
token = MODRINTH_TOKEN
id = "nqVt6aES"
version = "$project.version"
}
}
}
}
}

allprojects {
Expand Down Expand Up @@ -129,12 +78,11 @@ allprojects {
}
}

tasks.mergeJars.dependsOn(tasks.build)
def generatedResources = project(":forge").file("src/generated/resources")

tasks.register('publishMeEverywhere') {
dependsOn tasks.mergeJars, tasks.publishUnified
sourceSets {
main {
resources.srcDir generatedResources
}
}

tasks.publishUnified {
mustRunAfter tasks.mergeJars
}
6 changes: 4 additions & 2 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Version 2.0.8
# Version 2.1.0

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

Expand All @@ -10,6 +10,7 @@
- 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
Expand All @@ -19,4 +20,5 @@
- 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
- Speed up downwards descent for Gravity Shaft
- Fixed a bug where the overlay keybinds always rendered the default key
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ public ControlGroupCheckers() {
fetchUUIDsFromAPI();
}

public static void tickServer(MinecraftServer serverLevel){
public static void tickServer(MinecraftServer serverLevel) {
if (!IS_CONTROL_GROUP) return;
serverLevel.getPlayerList().getPlayers().iterator().forEachRemaining(serverPlayer -> {
if(!ControlGroupCheckers.INSTANCE.isUUIDInList(serverPlayer.getStringUUID())){
if (!ControlGroupCheckers.INSTANCE.isUUIDInList(serverPlayer.getStringUUID())) {
serverPlayer.connection.disconnect(Component.literal("Womp Womp! You're not on the list! :("));
}
});
Expand Down
1 change: 0 additions & 1 deletion common/src/main/java/whocraft/tardis_refined/TRConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ public class TRConfig {
}



public static class Client {
public final ModConfigSpec.BooleanValue CONTROL_NAMES;
public final ModConfigSpec.BooleanValue PLAY_CONSOLE_IDLE_ANIMATIONS;
Expand Down
14 changes: 7 additions & 7 deletions common/src/main/java/whocraft/tardis_refined/TardisRefined.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,11 @@

public class TardisRefined {

public static boolean IS_CONTROL_GROUP = false;

public static final String MODID = "tardis_refined";
public static final String NAME = "Tardis Refined";
public static final String PLATFORM_ERROR = "Something has gone critically wrong with platform definitions. Please contact the mod author.";

public static final Logger LOGGER = LogUtils.getLogger();
public static boolean IS_CONTROL_GROUP = false;
public static Gson GSON = new GsonBuilder()
.disableHtmlEscaping()
.registerTypeHierarchyAdapter(Component.class, new Component.Serializer()).
Expand Down Expand Up @@ -63,7 +61,7 @@ public static void init() {

TRPointOfInterestTypes.POIS.registerToModBus();
TRVillagerProfession.PROFESSIONS.registerToModBus();
// TRPointOfInterestTypes.registerBlockStates();
// TRPointOfInterestTypes.registerBlockStates();

TRTagKeys.init();
TardisNetwork.init();
Expand All @@ -75,11 +73,13 @@ public static void init() {
registerFallbackEntries();
}

/** Register default entries for data-driven registries. This is encapsulated in a method to call at different game load stages depending on the mod-loader
/**
* Register default entries for data-driven registries. This is encapsulated in a method to call at different game load stages depending on the mod-loader
* <br> E.g. On Forge, Console Patterns require Console Theme registry to be fully populated before the pattern can lookup a Console Theme object
* <br> On Forge: This is called in ServerAboutToStartEvent, which is after registries are frozen, but before the server has started and before commands are registered, because commands still reference Console/Shell Themes
* <br> On Fabric: The custom registries for Console/Shell Theme are created instantly, so there is no need to register the patterns at a specific stage.*/
public static void registerFallbackEntries(){
* <br> On Fabric: The custom registries for Console/Shell Theme are created instantly, so there is no need to register the patterns at a specific stage.
*/
public static void registerFallbackEntries() {
/* Need to register a default list of entries because on Fabric Cardinal Components classloads the TardisClientData class early on, before datapack entries have been added.
We will use these as fallback values when looking up patterns.
*/
Expand Down
34 changes: 17 additions & 17 deletions common/src/main/java/whocraft/tardis_refined/api/event/Event.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,23 @@ public Event(Class<T> handlerClass, Function<List<T>, T> multiplexer) {
update();
}

public static <T> EventResult result(List<T> listeners, Function<T, EventResult> function) {
boolean cancel = false;

for (T listener : listeners) {
EventResult result = function.apply(listener);

if (result.cancelsEvent()) {
cancel = true;
}

if (result.stopsListeners()) {
break;
}
}
return cancel ? EventResult.cancel() : EventResult.pass();
}

public void register(T handler) {
this.register(Priority.NORMAL, handler);
}
Expand All @@ -34,23 +51,6 @@ public T invoker() {
return invoker;
}

public static <T> EventResult result(List<T> listeners, Function<T, EventResult> function) {
boolean cancel = false;

for (T listener : listeners) {
EventResult result = function.apply(listener);

if (result.cancelsEvent()) {
cancel = true;
}

if (result.stopsListeners()) {
break;
}
}
return cancel ? EventResult.cancel() : EventResult.pass();
}

public enum Priority {

HIGHEST,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,6 @@ private EventResult(boolean cancelEvent, boolean stopListeners) {
this.stopListeners = stopListeners;
}

public boolean cancelsEvent() {
return this.cancelEvent;
}

public boolean stopsListeners() {
return this.stopListeners;
}

/**
* @return Cancel the event and prevent further listeners from being executed
*/
Expand Down Expand Up @@ -51,4 +43,12 @@ public static EventResult pass() {
return PASS;
}

public boolean cancelsEvent() {
return this.cancelEvent;
}

public boolean stopsListeners() {
return this.stopListeners;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@

import net.minecraft.resources.ResourceLocation;

/** Object to identify the source of Shell updates.*/
/**
* Object to identify the source of Shell updates.
*/
public class ShellChangeSource {

private ResourceLocation id;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package whocraft.tardis_refined.api.event;

import net.minecraft.resources.ResourceLocation;
import whocraft.tardis_refined.common.util.MiscHelper;
import whocraft.tardis_refined.common.util.RegistryHelper;

public class ShellChangeSources {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
public class TardisClientEvents {

public static final Event<TardisClientEvents.SetupModels> SHELLENTRY_MODELS_SETUP = new Event<>(TardisClientEvents.SetupModels.class, listeners -> (EntityModelSet context) -> {
for(TardisClientEvents.SetupModels listener : listeners) {
for (TardisClientEvents.SetupModels listener : listeners) {
listener.setUpShellAndInteriorModels(context);
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,25 +33,25 @@ public class TardisCommonEvents {
});

public static final Event<CloseDoor> DOOR_CLOSED_EVENT = new Event<>(CloseDoor.class, listeners -> (tardisLevelOperator) -> {
for(CloseDoor listener : listeners) {
for (CloseDoor listener : listeners) {
listener.onDoorClosed(tardisLevelOperator);
}
});

public static final Event<OpenDoor> DOOR_OPENED_EVENT = new Event<>(OpenDoor.class, listeners -> (tardisLevelOperator) -> {
for(OpenDoor listener : listeners) {
for (OpenDoor listener : listeners) {
listener.onDoorOpen(tardisLevelOperator);
}
});

public static final Event<LockDoor> DOOR_LOCKED_EVENT = new Event<>(LockDoor.class, listeners -> (tardisLevelOperator) -> {
for(LockDoor listener : listeners) {
for (LockDoor listener : listeners) {
listener.onDoorLocked(tardisLevelOperator);
}
});

public static final Event<UnlockDoor> DOOR_UNLOCKED_EVENT = new Event<>(UnlockDoor.class, listeners -> (tardisLevelOperator) -> {
for(UnlockDoor listener : listeners) {
for (UnlockDoor listener : listeners) {
listener.onDoorUnlocked(tardisLevelOperator);
}
});
Expand Down Expand Up @@ -87,7 +87,6 @@ public class TardisCommonEvents {
public static final Event<CanControlBeUsed> PLAYER_CONTROL_INTERACT = new Event<>(CanControlBeUsed.class, listeners -> (tardisLevelOperator, control, controlEntity) -> Event.result(listeners, takeOff -> takeOff.canControlBeUsed(tardisLevelOperator, control, controlEntity)));



/**
* Functional interface to define the conditions for using player control.
*/
Expand All @@ -98,8 +97,8 @@ public interface CanControlBeUsed {
* Checks whether player control can be used based on specified parameters.
*
* @param tardisLevelOperator The Tardis level operator.
* @param control The control to be used.
* @param controlEntity The entity associated with the control.
* @param control The control to be used.
* @param controlEntity The entity associated with the control.
* @return True if control can be used, false otherwise.
*/
EventResult canControlBeUsed(TardisLevelOperator tardisLevelOperator, Control control, ControlEntity controlEntity);
Expand All @@ -115,8 +114,8 @@ public interface TakeOff {
* Called when a TARDIS takes off.
*
* @param tardisLevelOperator The operator of the TARDIS level.
* @param level The level where the TARDIS is taking off from.
* @param pos The position of the TARDIS.
* @param level The level where the TARDIS is taking off from.
* @param pos The position of the TARDIS.
* @return The result of the event.
*/
EventResult onTakeOff(TardisLevelOperator tardisLevelOperator, LevelAccessor level, BlockPos pos);
Expand Down Expand Up @@ -199,8 +198,8 @@ public interface Land {
* Called when a TARDIS lands.
*
* @param tardisLevelOperator The operator of the TARDIS level.
* @param level The level where the TARDIS is landing.
* @param pos The position of the TARDIS.
* @param level The level where the TARDIS is landing.
* @param pos The position of the TARDIS.
*/
void onLand(TardisLevelOperator tardisLevelOperator, LevelAccessor level, BlockPos pos);
}
Expand All @@ -214,8 +213,8 @@ public interface ShellChange {
* Called when a TARDIS lands.
*
* @param tardisLevelOperator The operator of the TARDIS level.
* @param theme The theme the TARDIS changed to.
* @param shellChangeSource - Finds the source of the Shell Update. E.g. If the Shell Change event was caused by a Tardis being setup from a Root Shell to a fully functioning version
* @param theme The theme the TARDIS changed to.
* @param shellChangeSource - Finds the source of the Shell Update. E.g. If the Shell Change event was caused by a Tardis being setup from a Root Shell to a fully functioning version
*/
void onShellChange(TardisLevelOperator tardisLevelOperator, ResourceLocation theme, ShellChangeSource shellChangeSource);
}
Expand All @@ -229,8 +228,8 @@ public interface TardisEntry {
* Called when a living entity enters a TARDIS.
*
* @param tardisLevelOperator The Tardis capability
* @param livingEntity The living entity who is entering the TARDIS.
* @param sourceLocation The position, level and direction of the exterior of the TARDIS.
* @param livingEntity The living entity who is entering the TARDIS.
* @param sourceLocation The position, level and direction of the exterior of the TARDIS.
* @param destinationLocation The position, level and direction of the internal door of the TARDIS.
*/
void onEnterTardis(TardisLevelOperator tardisLevelOperator, LivingEntity livingEntity, TardisNavLocation sourceLocation, TardisNavLocation destinationLocation);
Expand All @@ -243,8 +242,8 @@ public interface TardisExit {
* Called when a living entity exits a TARDIS.
*
* @param tardisLevelOperator The Tardis capability
* @param livingEntity The living entity who is exiting the TARDIS.
* @param sourceLocation The position, level and direction of the internal door of the TARDIS.
* @param livingEntity The living entity who is exiting the TARDIS.
* @param sourceLocation The position, level and direction of the internal door of the TARDIS.
* @param destinationLocation The position, level and direction of the exterior of the TARDIS.
*/
void onExitTardis(TardisLevelOperator tardisLevelOperator, LivingEntity livingEntity, TardisNavLocation sourceLocation, TardisNavLocation destinationLocation);
Expand Down Expand Up @@ -273,7 +272,7 @@ public interface UpgradeUnlocked {
* Called when a TARDIS unlocks a new Upgrade.
*
* @param tardisLevelOperator The TARDIS Level Operator.
* @param upgrade The Upgrade
* @param upgrade The Upgrade
*/
void onUpgradeUnlock(TardisLevelOperator tardisLevelOperator, Upgrade upgrade);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public class ParticleGallifrey extends BaseAshSmokeParticle {
protected ParticleGallifrey(ClientLevel arg, double d, double e, double f, double g, double h, double i, float j, SpriteSet arg2) {
super(arg, d, e, f, 0.0F, 0.1F, 0.0F, g, h, i, j, arg2, 0.3F, 8, -0.1F, true);
this.sprites = arg2;
setColor(1,1,1);
setColor(1, 1, 1);
setLifetime(lifetime * 2);
}

Expand Down
Loading

0 comments on commit ee0ec4c

Please sign in to comment.