Skip to content

Commit

Permalink
Potential POI check
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeryn99 committed Nov 25, 2024
1 parent 5ef1ced commit 0d53360
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 12 deletions.
1 change: 1 addition & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
- Console cannot be removed/changed with the console configurator outside of 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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,14 @@ private static PoiType registerPointOfInterest(int maxTickets, int validRange, B
return new PoiType(builder.build(), maxTickets, validRange);
}

private static boolean hasPOIbeenSetup = false;

// Call this at Server starting
public static void registerBlockStates(){
if (hasPOIbeenSetup) return;
PoiTypes.registerBlockStates(BuiltInRegistries.POINT_OF_INTEREST_TYPE.getHolderOrThrow(CONSOLE_UNIT), CONSOLE_UNIT_POI.get().matchingStates());
PoiTypes.registerBlockStates(BuiltInRegistries.POINT_OF_INTEREST_TYPE.getHolderOrThrow(ASTRAL_MAP), ASTRAL_MAP_POI.get().matchingStates());
hasPOIbeenSetup = true;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@
import java.util.concurrent.Executor;
import java.util.function.BiFunction;

import static whocraft.tardis_refined.common.dimension.DimensionHandler.*;
import static whocraft.tardis_refined.common.dimension.DimensionHandler.LEVELS;
import static whocraft.tardis_refined.common.dimension.DimensionHandler.addDimension;
import static whocraft.tardis_refined.common.util.Platform.getServer;

public class DimensionHandlerImpl {
Expand Down Expand Up @@ -62,11 +63,10 @@ public static ServerLevel createDimension(Level level, ResourceKey<Level> id) {
//Actually register our dimension
Registry<LevelStem> dimensionRegistry = server.registryAccess().registryOrThrow(Registries.LEVEL_STEM);
if (dimensionRegistry instanceof MappedRegistry<LevelStem> writableRegistry) {
MappedRegistryAccessor accessor = (MappedRegistryAccessor)writableRegistry;
MappedRegistryAccessor accessor = (MappedRegistryAccessor) writableRegistry;
accessor.setFrozen(false); //Must unfreeze registry to allow our dimension to persist
writableRegistry.register(dimensionKey, dimension, Lifecycle.stable());
}
else {
} else {
throw new IllegalStateException(String.format("Unable to register dimension %s -- dimension registry not writable", dimensionKey.location()));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public void onInitialize() {
register(SERVER_DATA, new ResourceLocation(TardisRefined.MODID, TardisRefined.MODID + "/" + "shell_patterns"), ShellPatterns.getReloadListener());
register(SERVER_DATA, new ResourceLocation(TardisRefined.MODID, TardisRefined.MODID + "/" + "hums"), TardisHums.getReloadListener());

if (ModCompatChecker.immersivePortals()) {
if (ModCompatChecker.immersivePortals()) {
if (TRConfig.COMMON.COMPATIBILITY_IP.get()) {
ImmersivePortals.init();
PortalsCompatFabric.init();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.world.level.Level;
import whocraft.tardis_refined.ControlGroupCheckers;
import whocraft.tardis_refined.client.overlays.ExteriorViewOverlay;
import whocraft.tardis_refined.client.overlays.GravityOverlay;
import whocraft.tardis_refined.client.TRItemColouring;
import whocraft.tardis_refined.client.TardisClientLogic;
import whocraft.tardis_refined.client.overlays.ExteriorViewOverlay;
import whocraft.tardis_refined.client.overlays.GravityOverlay;
import whocraft.tardis_refined.command.TardisRefinedCommand;
import whocraft.tardis_refined.common.capability.tardis.TardisLevelOperator;
import whocraft.tardis_refined.common.dimension.DimensionHandler;
Expand Down Expand Up @@ -66,7 +66,7 @@ public static void addCommonEvents() {
ServerLifecycleEvents.SERVER_STOPPING.register(server -> {
DimensionHandlerImpl.clear();

if(ModCompatChecker.immersivePortals()){
if (ModCompatChecker.immersivePortals()) {
ImmersivePortals.onServerStopping(server);
}
});
Expand All @@ -80,13 +80,13 @@ public static void addCommonEvents() {
});

ServerPlayerEvents.AFTER_RESPAWN.register((oldPlayer, newPlayer, alive) -> {
if (newPlayer != null){
if (newPlayer != null) {
TardisHelper.handlePlayerJoinWorldEvents(newPlayer);
}
});

ServerEntityWorldChangeEvents.AFTER_PLAYER_CHANGE_WORLD.register((player, origin, destination) -> {
if (player != null){
if (player != null) {
TardisHelper.handlePlayerJoinWorldEvents(player);
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import com.mojang.serialization.Codec;
import net.fabricmc.fabric.api.event.registry.FabricRegistryBuilder;
import net.fabricmc.fabric.api.event.registry.RegistryAttribute;
import net.minecraft.core.MappedRegistry;
import net.minecraft.core.Registry;
import net.minecraft.core.WritableRegistry;
import net.minecraft.core.registries.BuiltInRegistries;
Expand Down Expand Up @@ -83,7 +82,7 @@ public Supplier<Registry<T>> getRegistry() {
}

@Override
public ResourceKey<? extends Registry<T>> key(){
public ResourceKey<? extends Registry<T>> key() {
return this.resourceKey;
}

Expand Down

0 comments on commit 0d53360

Please sign in to comment.