-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
79 additions
and
34 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
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
1 change: 0 additions & 1 deletion
1
src/main/kotlin/net/mcbrawls/blueprint/editor/BlueprintEditorHandler.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
1 change: 0 additions & 1 deletion
1
src/main/kotlin/net/mcbrawls/blueprint/editor/BlueprintEditorWorld.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
16 changes: 16 additions & 0 deletions
16
src/main/kotlin/net/mcbrawls/blueprint/editor/block/BlueprintEditorBlocks.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,16 @@ | ||
package net.mcbrawls.blueprint.editor.block | ||
|
||
import net.mcbrawls.blueprint.BlueprintMod | ||
import net.minecraft.block.AbstractBlock | ||
import net.minecraft.block.Block | ||
import net.minecraft.registry.Registries | ||
import net.minecraft.registry.Registry | ||
import net.minecraft.util.Identifier | ||
|
||
object BlueprintEditorBlocks { | ||
val POINT_REGION = register("point_region", PointRegionBlock(AbstractBlock.Settings.create().dropsNothing())) | ||
|
||
private fun register(id: String, block: Block): Block { | ||
return Registry.register(Registries.BLOCK, Identifier.of(BlueprintMod.MOD_ID, id), block) | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
src/main/kotlin/net/mcbrawls/blueprint/editor/block/PointRegionBlock.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,12 @@ | ||
package net.mcbrawls.blueprint.editor.block | ||
|
||
import eu.pb4.polymer.core.api.block.PolymerBlock | ||
import net.minecraft.block.Block | ||
import net.minecraft.block.BlockState | ||
import net.minecraft.block.Blocks | ||
|
||
class PointRegionBlock(settings: Settings) : Block(settings), PolymerBlock, RegionBlock { | ||
override fun getPolymerBlockState(state: BlockState): BlockState { | ||
return Blocks.YELLOW_WOOL.defaultState | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
src/main/kotlin/net/mcbrawls/blueprint/editor/block/RegionBlock.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,26 @@ | ||
package net.mcbrawls.blueprint.editor.block | ||
|
||
import net.mcbrawls.blueprint.region.PointRegion | ||
import net.mcbrawls.blueprint.region.serialization.SerializableRegion | ||
import net.minecraft.block.BlockState | ||
import net.minecraft.server.world.ServerWorld | ||
import net.minecraft.util.math.BlockPos | ||
import net.minecraft.util.math.Vec3d | ||
|
||
interface RegionBlock { | ||
companion object { | ||
fun trySaveRegion( | ||
world: ServerWorld, | ||
pos: BlockPos, | ||
state: BlockState, | ||
regions: MutableMap<String, SerializableRegion> | ||
): Boolean { | ||
if (state.block is PointRegionBlock) { | ||
regions["${regions.size}"] = PointRegion(Vec3d.ofCenter(pos)) | ||
return true | ||
} | ||
|
||
return false | ||
} | ||
} | ||
} |
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