Skip to content

Commit

Permalink
Add initial code
Browse files Browse the repository at this point in the history
  • Loading branch information
potato1234x committed Oct 1, 2024
1 parent a755694 commit da0d9e7
Show file tree
Hide file tree
Showing 40 changed files with 376 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
*.vmf
*.bsp
*.log
*.prt
*.vmx
40 changes: 38 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,38 @@
# minecraft-to-vmf
A python script to convert minecraft chunks into source games via VMF
# Minecraft to VMF
A python script to convert minecraft chunks into VMF files.

## Usage
This is a python script, find a tutorial on how to install python and run the .bat file to start.

- Paste in your world directory. This will be in C:/Users/(username)/AppData/Roaming/.minecraft/saves/(save name)
- Find the coordinates of the chunk to export, these will be in the F3 menu below the regular coordinates and copy them in. (the first and last numbers)
- Currently there is no brush optimisation, but it's coming. Hopefully.

## Future Features
These arent guaranteed but i'll hopefully get around to it, you could also make a PR if you know what you're doing.

- Brush optimisation (merging brushes/only converting blocks adjacent to air)
- Custom scale parameter
- Bulk chunk converting
- Automatic detection for multi texture blocks
- Persistent options
- Auto converting textures to vtfs
- Auto converting json models to mdls
- Auto generating skybox brushes
- Spawnpoints

## How to convert textures/models in the meantime

### Textures
- Extract the .jar of the version of your choice
- Go to assets/minecraft/textures/blocks/ and open a texture with the vtf editor of your choice.
- Export as uncompressed vtf with point sampling and no mipmap flags checked.
- Save in example_assets/materials/minecraft (unless its for a model in which case it goes in materials/models/minecraft)
- Make sure the vmt points to the right texture and right surface property.

### Models
- Extract the .jar of the version of your choice
- Go to assets/minecraft/models/blocks/ and open a json with blockbench.
- Export as obj.
- Open in blender and using source tools export and follow a blender to source model tutorial but in the qc file set the scale to 32 (or if you're reading this in the future, whatever size you want the blocks to be in HU)
- Save in example_assets/models/minecraft
6 changes: 6 additions & 0 deletions example_assets/materials/minecraft/andesite.vmt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
"LightmappedGeneric"
{
"$basetexture" "minecraft/andesite"
"$surfaceprop" "rock"
"%keywords" "minecraft"
}
Binary file added example_assets/materials/minecraft/andesite.vtf
Binary file not shown.
7 changes: 7 additions & 0 deletions example_assets/materials/minecraft/birch_leaves.vmt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
"LightmappedGeneric"
{
"$basetexture" "minecraft/birch_leaves"
"$alphatest" 1
"$surfaceprop" "foliage"
"%keywords" "minecraft"
}
Binary file not shown.
6 changes: 6 additions & 0 deletions example_assets/materials/minecraft/birch_log.vmt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
"LightmappedGeneric"
{
"$basetexture" "minecraft/birch_log"
"$surfaceprop" "wood_Solid"
"%keywords" "minecraft"
}
Binary file added example_assets/materials/minecraft/birch_log.vtf
Binary file not shown.
6 changes: 6 additions & 0 deletions example_assets/materials/minecraft/birch_log_top.vmt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
"LightmappedGeneric"
{
"$basetexture" "minecraft/birch_log_top"
"$surfaceprop" "wood_Solid"
"%keywords" "minecraft"
}
Binary file not shown.
6 changes: 6 additions & 0 deletions example_assets/materials/minecraft/coal_ore.vmt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
"LightmappedGeneric"
{
"$basetexture" "minecraft/coal_ore"
"$surfaceprop" "rock"
"%keywords" "minecraft"
}
Binary file added example_assets/materials/minecraft/coal_ore.vtf
Binary file not shown.
6 changes: 6 additions & 0 deletions example_assets/materials/minecraft/diorite.vmt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
"LightmappedGeneric"
{
"$basetexture" "minecraft/diorite"
"$surfaceprop" "rock"
"%keywords" "minecraft"
}
Binary file added example_assets/materials/minecraft/diorite.vtf
Binary file not shown.
6 changes: 6 additions & 0 deletions example_assets/materials/minecraft/dirt.vmt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
"LightmappedGeneric"
{
"$basetexture" "minecraft/dirt"
"$surfaceprop" "dirt"
"%keywords" "minecraft"
}
Binary file added example_assets/materials/minecraft/dirt.vtf
Binary file not shown.
6 changes: 6 additions & 0 deletions example_assets/materials/minecraft/granite.vmt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
"LightmappedGeneric"
{
"$basetexture" "minecraft/granite"
"$surfaceprop" "rock"
"%keywords" "minecraft"
}
Binary file added example_assets/materials/minecraft/granite.vtf
Binary file not shown.
6 changes: 6 additions & 0 deletions example_assets/materials/minecraft/grass_block_side.vmt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
"LightmappedGeneric"
{
"$basetexture" "minecraft/grass_block_side"
"$surfaceprop" "dirt"
"%keywords" "minecraft"
}
Binary file not shown.
6 changes: 6 additions & 0 deletions example_assets/materials/minecraft/grass_block_top.vmt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
"LightmappedGeneric"
{
"$basetexture" "minecraft/grass_block_top"
"$surfaceprop" "grass"
"%keywords" "minecraft"
}
Binary file not shown.
6 changes: 6 additions & 0 deletions example_assets/materials/minecraft/gravel.vmt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
"LightmappedGeneric"
{
"$basetexture" "minecraft/gravel"
"$surfaceprop" "gravel"
"%keywords" "minecraft"
}
Binary file added example_assets/materials/minecraft/gravel.vtf
Binary file not shown.
6 changes: 6 additions & 0 deletions example_assets/materials/minecraft/iron_ore.vmt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
"LightmappedGeneric"
{
"$basetexture" "minecraft/iron_ore"
"$surfaceprop" "rock"
"%keywords" "minecraft"
}
Binary file added example_assets/materials/minecraft/iron_ore.vtf
Binary file not shown.
6 changes: 6 additions & 0 deletions example_assets/materials/minecraft/sand.vmt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
"LightmappedGeneric"
{
"$basetexture" "minecraft/sand"
"$surfaceprop" "gravel"
"%keywords" "minecraft"
}
Binary file added example_assets/materials/minecraft/sand.vtf
Binary file not shown.
6 changes: 6 additions & 0 deletions example_assets/materials/minecraft/stone.vmt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
"LightmappedGeneric"
{
"$basetexture" "minecraft/stone"
"$surfaceprop" "rock"
"%keywords" "minecraft"
}
Binary file added example_assets/materials/minecraft/stone.vtf
Binary file not shown.
7 changes: 7 additions & 0 deletions example_assets/materials/models/minecraft/grass.vmt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
"VertexLitGeneric"
{
"$basetexture" "models/minecraft/grass"
"$surfaceprop" "grass"
"%compilepassbullets" 1
"$alphatest" 1
}
Binary file not shown.
Binary file added example_assets/models/minecraft/grass.dx80.vtx
Binary file not shown.
Binary file added example_assets/models/minecraft/grass.dx90.vtx
Binary file not shown.
Binary file added example_assets/models/minecraft/grass.mdl
Binary file not shown.
Binary file added example_assets/models/minecraft/grass.vvd
Binary file not shown.
Binary file not shown.
6 changes: 6 additions & 0 deletions example_assets/models/minecraft/uncompiled/grass.qc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
$modelname minecraft/grass
$scale 32
$body Body grass
$cdmaterials models/minecraft/
$sequence idle grass
$staticprop
2 changes: 2 additions & 0 deletions mc_to_vmf.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
python mc_to_vmf.py %*
pause >nul
Loading

0 comments on commit da0d9e7

Please sign in to comment.