Last active
May 6, 2021 18:53
-
-
Save NeraSnow/df2a7c10e880940899a8d6d7d868de21 to your computer and use it in GitHub Desktop.
Minecraft Custom Map
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
$ToNatural = { [regex]::Replace($_, '\d+', { $args[0].Value.PadLeft(20) }) } | |
######## Need to modify here | |
Set-Variable -Name "StartIndex" -Value 299 | |
###### Modify Above!!!! | |
Set-Variable -Name "EndIndex" -Value $StartIndex | |
Set-Variable -Name "Count" -Value 0 | |
foreach ($file in $(dir | Sort-Object $ToNatural)) { | |
echo $file | |
Rename-Item -Path $file -NewName "map_${EndIndex}.dat" | |
$Count++ | |
$EndIndex++ | |
} | |
echo $StartIndex | |
echo $EndIndex | |
$i = $StartIndex | |
$FileCount = 0 | |
while ($i -lt $EndIndex) | |
{ | |
Clear-Content -Path "E:\Minecraft Server\world\datapacks\giveMapCommand\data\std\functions\givemap${FileCount}.mcfunction" | |
for (($j = 0); ($j -lt 9) -and ($i -lt $EndIndex); $j++, $i++ ) | |
{ | |
# echo "Now with a j of $j" | |
$str = "give NeraSnow filled_map{map:$i}" | |
echo $str | |
Add-Content -Path "E:\Minecraft Server\world\datapacks\giveMapCommand\data\std\functions\givemap${FileCount}.mcfunction" -Value $str | |
} | |
$FileCount++ | |
echo "Done Processing" | |
} | |
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
###### Caution | |
### Rename Current Directory File!!!!! | |
$ToNatural = { [regex]::Replace($_, '\d+', { $args[0].Value.PadLeft(20) }) } | |
######## Need to modify here | |
Set-Variable -Name "StartIndex" -Value 4504 | |
### Manual Placement?? | |
Set-Variable -Name "ManualPlace" -Value $false | |
######## | |
## 12 x 12 | |
Set-Variable -Name "Width" -Value 12 # Number of Columns | |
Set-Variable -Name "Height" -Value 12 # Number of Rows | |
###### | |
# Towards negative z - 2b | |
Set-Variable -Name "ItemFrameFacing" -Value 2b | |
# Below is the coordinates | |
Set-Variable -Name "ColumnStartRowPosition" -Value 82 | |
Set-Variable -Name "RowStartColumnPosition" -Value 2013 | |
Set-Variable -Name "Invariant" -Value (2032-1) | |
### Renme | |
###### Modify Above!!!! | |
Set-Variable -Name "EndIndex" -Value $StartIndex | |
Set-Variable -Name "Count" -Value 0 | |
foreach ($file in $(dir *.dat | Sort-Object $ToNatural)) { | |
echo $file | |
Rename-Item -Path $file -NewName "map_${EndIndex}.dat" | |
$Count++ | |
$EndIndex++ | |
} | |
echo $StartIndex | |
echo $EndIndex | |
$i = $StartIndex | |
$FileCount = 0 | |
if ($ManualPlace) { | |
Get-Item -Path "E:\Minecraft Forge Server\world\datapacks\giveMapCommand\data\std\functions\*" | foreach { $_.Delete()} | |
while ($i -lt $EndIndex) | |
{ | |
Clear-Content -Path "E:\Minecraft Forge Server\world\datapacks\giveMapCommand\data\std\functions\givemap${FileCount}.mcfunction" | |
for (($j = 0); ($j -lt 9) -and ($i -lt $EndIndex); $j++, $i++ ) | |
{ | |
# echo "Now with a j of $j" | |
$str = "give @p filled_map{map:$i}" | |
echo $str | |
Add-Content -Path "E:\Minecraft Forge Server\world\datapacks\giveMapCommand\data\std\functions\givemap${FileCount}.mcfunction" -Value $str | |
} | |
$FileCount++ | |
echo "Done Processing" | |
} | |
} | |
else { | |
Clear-Content -Path "E:\Minecraft Forge Server\world\datapacks\giveMapCommand\data\autofill\functions\fillatonce.mcfunction" | |
for (($col = 0); ($col -lt $Width); $col++) | |
{ | |
for (($row = 0); ($row -lt $Height); $row++) | |
{ | |
# Go towards Positive z | |
# $str = "summon minecraft:item_frame $Invariant $($ColumnStartRowPosition-$row) $($RowStartColumnPosition+$col) {Motion: [0.0d, 0.0d, 0.0d], Facing: ${ItemFrameFacing}, Rotation: [90.0f, 0.0f], Item: {id: `"minecraft:filled_map`", Count: 1b, tag: {map: $($StartIndex + $col * $Height + $row)}}}" | |
# Go towards negative x | |
$str = "summon minecraft:item_frame $($RowStartColumnPosition-$col) $($ColumnStartRowPosition-$row) $Invariant {Motion: [0.0d, 0.0d, 0.0d], Facing: ${ItemFrameFacing}, Rotation: [90.0f, 0.0f], Item: {id: `"minecraft:filled_map`", Count: 1b, tag: {map: $($StartIndex + $col * $Height + $row)}}}" | |
echo $str | |
Add-Content -Path "E:\Minecraft Forge Server\world\datapacks\giveMapCommand\data\autofill\functions\fillatonce.mcfunction" -Value $str | |
} | |
} | |
} | |
Move-Item -Path ".\*" -Destination "E:\Minecraft Forge Server\world\data" -Force | |
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
###### Caution | |
### Rename Current Directory File!!!!! | |
$ToNatural = { [regex]::Replace($_, '\d+', { $args[0].Value.PadLeft(20) }) } | |
######## Need to modify here | |
Set-Variable -Name "StartIndex" -Value 7151 | |
# ready to go numbering | |
### Manual Placement?? | |
Set-Variable -Name "ManualPlace" -Value $false | |
######## | |
## 6 x 4 | |
Set-Variable -Name "Width" -Value 6 # Number of Columns | |
Set-Variable -Name "Height" -Value 4 # Number of Rows | |
###### | |
# Towards negative z - 2b | |
# Towards positive z - 3b | |
# Towards negative x - 4b | |
# Towards positive x - 5b | |
Set-Variable -Name "ItemFrameFacing" -Value 2b | |
# Below is the coordinates | |
Set-Variable -Name "ColumnStartRowPosition" -Value 82 | |
Set-Variable -Name "RowStartColumnPosition" -Value 171 | |
Set-Variable -Name "Invariant" -Value (143-1) | |
###### Modify Above!!!! | |
Set-Variable -Name "EndIndex" -Value $StartIndex | |
Set-Variable -Name "Count" -Value 0 | |
foreach ($file in $(dir *.dat | Sort-Object $ToNatural)) { | |
echo $file | |
Rename-Item -Path $file -NewName "map_${EndIndex}.dat" | |
$Count++ | |
$EndIndex++ | |
} | |
echo $StartIndex | |
echo $EndIndex | |
$i = $StartIndex | |
$FileCount = 0 | |
if ($ManualPlace) { | |
Get-Item -Path "E:\Minecraft Fabric Server\world\datapacks\giveMapCommand\data\std\functions\*" | foreach { $_.Delete()} | |
while ($i -lt $EndIndex) | |
{ | |
Clear-Content -Path "E:\Minecraft Fabric Server\world\datapacks\giveMapCommand\data\std\functions\givemap${FileCount}.mcfunction" | |
for (($j = 0); ($j -lt 9) -and ($i -lt $EndIndex); $j++, $i++ ) | |
{ | |
# echo "Now with a j of $j" | |
$str = "give @p filled_map{map:$i}" | |
echo $str | |
Add-Content -Path "E:\Minecraft Fabric Server\world\datapacks\giveMapCommand\data\std\functions\givemap${FileCount}.mcfunction" -Value $str | |
} | |
$FileCount++ | |
echo "Done Processing" | |
} | |
} | |
else { | |
Clear-Content -Path "E:\Minecraft Fabric Server\world\datapacks\giveMapCommand\data\autofill\functions\fillatonce.mcfunction" | |
for (($col = 0); ($col -lt $Width); $col++) | |
{ | |
for (($row = 0); ($row -lt $Height); $row++) | |
{ | |
# Go towards Positive z | |
# $str = "summon minecraft:item_frame $Invariant $($ColumnStartRowPosition-$row) $($RowStartColumnPosition+$col) {Motion: [0.0d, 0.0d, 0.0d], Facing: ${ItemFrameFacing}, Rotation: [90.0f, 0.0f], Item: {id: `"minecraft:filled_map`", Count: 1b, tag: {map: $($StartIndex + $col * $Height + $row)}}}" | |
# Go towards negative x | |
$str = "summon minecraft:item_frame $($RowStartColumnPosition-$col) $($ColumnStartRowPosition-$row) $Invariant {Motion: [0.0d, 0.0d, 0.0d], Facing: ${ItemFrameFacing}, Rotation: [90.0f, 0.0f], Item: {id: `"minecraft:filled_map`", Count: 1b, tag: {map: $($StartIndex + $col * $Height + $row)}}}" | |
# Go towards positive x | |
# $str = "summon minecraft:item_frame $($RowStartColumnPosition+$col) $($ColumnStartRowPosition-$row) $Invariant {Motion: [0.0d, 0.0d, 0.0d], Facing: ${ItemFrameFacing}, Rotation: [90.0f, 0.0f], Item: {id: `"minecraft:filled_map`", Count: 1b, tag: {map: $($StartIndex + $col * $Height + $row)}}}" | |
# Go towards negative z | |
# $str = "summon minecraft:item_frame $Invariant $($ColumnStartRowPosition-$row) $($RowStartColumnPosition-$col) {Motion: [0.0d, 0.0d, 0.0d], Facing: ${ItemFrameFacing}, Rotation: [90.0f, 0.0f], Item: {id: `"minecraft:filled_map`", Count: 1b, tag: {map: $($StartIndex + $col * $Height + $row)}}}" | |
echo $str | |
Add-Content -Path "E:\Minecraft Fabric Server\world\datapacks\giveMapCommand\data\autofill\functions\fillatonce.mcfunction" -Value $str | |
} | |
} | |
} | |
Move-Item -Path ".\*.dat" -Destination "E:\Minecraft Fabric Server\world\data" -Force | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment