-
-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactored the way buildings are stored on the client separating clie…
…nt manager from everything else
- Loading branch information
Showing
26 changed files
with
238 additions
and
320 deletions.
There are no files selected for viewing
39 changes: 39 additions & 0 deletions
39
...java/net/remmintan/mods/minefortress/core/interfaces/buildings/IClientBuildingsManager.kt
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,39 @@ | ||
package net.remmintan.mods.minefortress.core.interfaces.buildings | ||
|
||
import net.minecraft.block.BlockState | ||
import net.minecraft.entity.player.PlayerEntity | ||
import net.minecraft.util.math.BlockPos | ||
import net.remmintan.mods.minefortress.core.dtos.buildings.BuildingHealthRenderInfo | ||
import net.remmintan.mods.minefortress.core.interfaces.blueprints.ProfessionType | ||
import java.util.* | ||
|
||
interface IClientBuildingsManager { | ||
|
||
fun updateBuildings(buildings: List<BlockPos>) | ||
|
||
fun getBuildingSelection(pos: BlockPos?): List<BlockPos> | ||
|
||
fun isBuildingHovered(): Boolean { | ||
return getHoveredBuilding().isPresent | ||
} | ||
|
||
fun getHoveredBuildingName(): Optional<String> { | ||
return getHoveredBuilding().map { obj: IFortressBuilding -> obj.name } | ||
} | ||
|
||
fun getHoveredBuilding(): Optional<IFortressBuilding> | ||
|
||
fun countBuildings(type: ProfessionType, level: Int): Int | ||
|
||
fun getBuildingHealths(): List<BuildingHealthRenderInfo> | ||
|
||
fun openRepairBuildingScreen(pos: BlockPos, blocksToRepair: Map<BlockPos, BlockState>) | ||
|
||
fun hasRequiredBuilding(type: ProfessionType, level: Int, minCount: Int): Boolean | ||
|
||
fun openBuildingScreen(playerEntity: PlayerEntity) { | ||
val hoveredBuilding = getHoveredBuilding().orElseThrow() | ||
playerEntity.openHandledScreen(hoveredBuilding.screenHandlerFactory) | ||
} | ||
|
||
} |
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
3 changes: 1 addition & 2 deletions
3
...ts/buildings/IServerBuildingsManager.java → ...es/buildings/IServerBuildingsManager.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
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
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
Oops, something went wrong.