-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor and arrangement for future port
- Loading branch information
OreCruncher
committed
Jan 3, 2025
1 parent
822514c
commit bac5533
Showing
23 changed files
with
212 additions
and
146 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...round/config/dimension/DimensionInfo.java → ...ncher/dsurround/config/DimensionInfo.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
common/src/main/java/org/orecruncher/dsurround/config/libraries/IDimensionInformation.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package org.orecruncher.dsurround.config.libraries; | ||
|
||
import net.minecraft.client.multiplayer.ClientLevel; | ||
import net.minecraft.resources.ResourceLocation; | ||
|
||
public interface IDimensionInformation { | ||
/** | ||
* The resource location ID of the dimension | ||
*/ | ||
ResourceLocation name(); | ||
/** | ||
* The client level for the dimension | ||
*/ | ||
ClientLevel level(); | ||
/** | ||
* The sea level configured for the dimension | ||
*/ | ||
int seaLevel(); | ||
/** | ||
* Whether the dimension is considered always outside, like Nether. | ||
*/ | ||
boolean alwaysOutside(); | ||
/** | ||
* The vertical Y level which is the threshold of outer space. | ||
*/ | ||
int getSpaceHeight(); | ||
/** | ||
* The veritical Y level where clouds are expected to be | ||
*/ | ||
int getCloudHeight(); | ||
} |
2 changes: 1 addition & 1 deletion
2
common/src/main/java/org/orecruncher/dsurround/config/libraries/IDimensionLibrary.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 56 additions & 0 deletions
56
...n/src/main/java/org/orecruncher/dsurround/config/libraries/impl/DimensionInformation.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
package org.orecruncher.dsurround.config.libraries.impl; | ||
|
||
import dev.architectury.event.events.client.ClientLifecycleEvent; | ||
import net.minecraft.client.multiplayer.ClientLevel; | ||
import net.minecraft.resources.ResourceLocation; | ||
import org.orecruncher.dsurround.config.DimensionInfo; | ||
import org.orecruncher.dsurround.config.libraries.AssetLibraryEvent; | ||
import org.orecruncher.dsurround.config.libraries.IDimensionInformation; | ||
import org.orecruncher.dsurround.config.libraries.IDimensionLibrary; | ||
import org.orecruncher.dsurround.lib.GameUtils; | ||
import org.orecruncher.dsurround.lib.events.HandlerPriority; | ||
|
||
public class DimensionInformation implements IDimensionInformation { | ||
|
||
private final IDimensionLibrary dimensionLibrary; | ||
private DimensionInfo info; | ||
|
||
public DimensionInformation(IDimensionLibrary dimensionLibrary) { | ||
this.dimensionLibrary = dimensionLibrary; | ||
|
||
// Need to reset the cached dimension info whenever the client world | ||
// changes or if there is a resource reload. | ||
ClientLifecycleEvent.CLIENT_LEVEL_LOAD.register(state -> this.info = null); | ||
AssetLibraryEvent.RELOAD.register((x, y) -> this.info = null, HandlerPriority.HIGH); | ||
} | ||
|
||
public ResourceLocation name() { | ||
return this.getInfo().getName(); | ||
} | ||
|
||
public ClientLevel level() { | ||
return GameUtils.getWorld().orElseThrow(); | ||
} | ||
|
||
public int seaLevel() { | ||
return this.getInfo().getSeaLevel(); | ||
} | ||
|
||
public boolean alwaysOutside() { | ||
return this.getInfo().alwaysOutside(); | ||
} | ||
|
||
public int getSpaceHeight() { | ||
return this.getInfo().getSpaceHeight(); | ||
} | ||
|
||
public int getCloudHeight() { | ||
return this.getInfo().getCloudHeight(); | ||
} | ||
|
||
private DimensionInfo getInfo() { | ||
if (this.info == null) | ||
this.info = this.dimensionLibrary.getData(this.level()); | ||
return this.info; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 0 additions & 39 deletions
39
common/src/main/java/org/orecruncher/dsurround/lib/BlockPosUtil.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.