Skip to content
This repository has been archived by the owner on Jun 26, 2022. It is now read-only.

Commit

Permalink
Add files.
Browse files Browse the repository at this point in the history
  • Loading branch information
Luminoso-256 committed Jan 17, 2021
1 parent 9330175 commit 26cb7f6
Show file tree
Hide file tree
Showing 36 changed files with 655 additions and 0 deletions.
Binary file not shown.
Binary file added .vs/EarthBuildplateEditor/v16/.suo
Binary file not shown.
53 changes: 53 additions & 0 deletions Buildplate.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
using System;
using System.Collections.Generic;
using System.Text;

namespace EarthBuildplateEditor.model
{
class Buildplate
{

public List<Entity> entities;
public int format_version;
public List<SubChunk> sub_chunks;



public class SubChunk
{
public List<PaletteBlock> block_palette;
public List<int> blocks;
public PositionInt position;
}

public class PaletteBlock
{
public int data;
public String name;
}


public class Entity
{
public int changeColor;
public int multiplicitiveTintChangeColor;
public String name;
public PositionDouble position;
public PositionDouble rotation;
public PositionDouble shadowPosition;
public double shadowSize;
}
public class PositionDouble
{
public double x;
public double y;
public double z;
}
public class PositionInt
{
public int x;
public int y;
public int z;
}
}
}
13 changes: 13 additions & 0 deletions EarthBuildplateEditor.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
<PackageReference Include="Raylib-cs" Version="3.5.0" />
</ItemGroup>

</Project>
25 changes: 25 additions & 0 deletions EarthBuildplateEditor.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.30804.86
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EarthBuildplateEditor", "EarthBuildplateEditor.csproj", "{85B1A52A-9F36-48FF-B4AC-C7CAA9A5774A}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{85B1A52A-9F36-48FF-B4AC-C7CAA9A5774A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{85B1A52A-9F36-48FF-B4AC-C7CAA9A5774A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{85B1A52A-9F36-48FF-B4AC-C7CAA9A5774A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{85B1A52A-9F36-48FF-B4AC-C7CAA9A5774A}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {A21830FA-C586-489F-A28F-41F74501A34D}
EndGlobalSection
EndGlobal
120 changes: 120 additions & 0 deletions Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
using System;
using EarthBuildplateEditor.model;
using System.IO;
using Newtonsoft.Json;
using Raylib_cs;
using static Raylib_cs.Raylib;
using static Raylib_cs.CameraType;
using static Raylib_cs.CameraMode;
using static Raylib_cs.Color;
using System.Numerics;
using System.Collections.Generic;
namespace EarthBuildplateEditor
{
class Program
{
public static String version = "1.0.0";
public static String textureBasePath = @"C:\Workspace\Programming\c#\EarthBuildplateEditor\earth_res\textures\blocks\";
static void Main(string[] args)
{

Console.WriteLine("Minecraft Earth Buildplate File Format Editor \n Version " + version +"\n Enter path to input file:");
// String targetFilePath = Console.ReadLine();
String targetFilePath = @"C:\Workspace\Programming\c#\EarthBuildplateEditor\plates\test.plate";
if (!File.Exists(targetFilePath))
{
Console.WriteLine("Error: File does not exist");
return;
}
String fileData = File.ReadAllText(targetFilePath);
//Deserialize
Buildplate plate = JsonConvert.DeserializeObject<Buildplate>(fileData);
Console.WriteLine("Version: "+plate.format_version+" Subchunk Count: "+plate.sub_chunks.Count+" Entity Count: "+plate.entities.Count);
Console.WriteLine("Opening Editor");
Camera3D camera = new Camera3D();
camera.position = new Vector3(4.0f, 2.0f, 4.0f);
camera.target = new Vector3(0.0f, 1.8f, 0.0f);
camera.up = new Vector3(0.0f, 1.0f, 0.0f);
camera.fovy = 60.0f;
camera.type = (int)CAMERA_PERSPECTIVE;

float camY = 2.0f;
Raylib.InitWindow(800, 600, "Earth Buildplate Editor");
SetCameraMode(camera, CAMERA_FIRST_PERSON);
SetTargetFPS(60);
List<Texture2D> textures = new List<Texture2D> { };
Dictionary<int, int> airVals = new Dictionary<int, int>();
for (int subchunk = 0; subchunk < plate.sub_chunks.Count; subchunk++) {
for(int paletteIndex = 0; paletteIndex < plate.sub_chunks[subchunk].block_palette.Count; paletteIndex++)
{
Buildplate.PaletteBlock paletteBlock = plate.sub_chunks[subchunk].block_palette[paletteIndex];
String blockName = paletteBlock.name.Split(":")[1]; //gives us a clean texture name like dirt or grass_block
if (blockName != "air")
{
textures.Add(LoadTexture(textureBasePath + blockName + ".png"));
}
else
{
airVals.Add(subchunk, paletteIndex);
}
}
}


while (!Raylib.WindowShouldClose())
{
//Render file
UpdateCamera(ref camera);
camera.position.Y = camY;
BeginDrawing();
ClearBackground(WHITE);
BeginMode3D(camera);

for (int subchunk = 0; subchunk < plate.sub_chunks.Count; subchunk++)
{

int xOffset = plate.sub_chunks[subchunk].position.x;
int yOffset = plate.sub_chunks[subchunk].position.y;
int zOffset = plate.sub_chunks[subchunk].position.z;


int x = 0;
int y = 0;
int z = 0;

for (int currentBlock = 0; currentBlock < 4096; currentBlock++)
{
x++;
if (x == 16) { x = 0; y += 1; }
if (y == 16) { y = 0; z += 1; }

if (plate.sub_chunks[subchunk].blocks[currentBlock] != airVals[subchunk])
{
DrawCubeTexture(textures[plate.sub_chunks[0].blocks[currentBlock]], new Vector3(x + xOffset, y + yOffset, z + zOffset), 1.0f, 1.0f, 1.0f, WHITE);
//DrawCube(new Vector3(x, y, z), 1.0f, 1.0f, 1.0f, GREEN);
//DrawCubeWires(new Vector3(x, y, z), 1.0f, 1.0f, 1.0f, BLACK);
}
}
}

EndMode3D();
EndDrawing();


//Movement for player in file
if (IsKeyDown(KeyboardKey.KEY_SPACE))
{
camY += 0.1f;
}
if (IsKeyDown(KeyboardKey.KEY_LEFT_SHIFT))
{
camY -= 0.1f;
}

//Other controls

}
CloseWindow();
}
}
}
84 changes: 84 additions & 0 deletions bin/Debug/netcoreapp3.1/EarthBuildplateEditor.deps.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
{
"runtimeTarget": {
"name": ".NETCoreApp,Version=v3.1",
"signature": ""
},
"compilationOptions": {},
"targets": {
".NETCoreApp,Version=v3.1": {
"EarthBuildplateEditor/1.0.0": {
"dependencies": {
"Newtonsoft.Json": "12.0.3",
"Raylib-cs": "3.5.0"
},
"runtime": {
"EarthBuildplateEditor.dll": {}
}
},
"Newtonsoft.Json/12.0.3": {
"runtime": {
"lib/netstandard2.0/Newtonsoft.Json.dll": {
"assemblyVersion": "12.0.0.0",
"fileVersion": "12.0.3.23909"
}
}
},
"Raylib-cs/3.5.0": {
"runtime": {
"lib/netstandard2.1/Raylib-cs.dll": {
"assemblyVersion": "0.0.0.0",
"fileVersion": "0.0.0.0"
}
},
"runtimeTargets": {
"runtimes/linux-x64/native/libraylib.so": {
"rid": "linux-x64",
"assetType": "native",
"fileVersion": "0.0.0.0"
},
"runtimes/linux-x86/native/libraylib.so": {
"rid": "linux-x86",
"assetType": "native",
"fileVersion": "0.0.0.0"
},
"runtimes/osx-x64/native/libraylib.dylib": {
"rid": "osx-x64",
"assetType": "native",
"fileVersion": "0.0.0.0"
},
"runtimes/win-x64/native/raylib.dll": {
"rid": "win-x64",
"assetType": "native",
"fileVersion": "3.1.0.0"
},
"runtimes/win-x86/native/raylib.dll": {
"rid": "win-x86",
"assetType": "native",
"fileVersion": "3.1.0.0"
}
}
}
}
},
"libraries": {
"EarthBuildplateEditor/1.0.0": {
"type": "project",
"serviceable": false,
"sha512": ""
},
"Newtonsoft.Json/12.0.3": {
"type": "package",
"serviceable": true,
"sha512": "sha512-6mgjfnRB4jKMlzHSl+VD+oUc1IebOZabkbyWj2RiTgWwYPPuaK1H97G1sHqGwPlS5npiF5Q0OrxN1wni2n5QWg==",
"path": "newtonsoft.json/12.0.3",
"hashPath": "newtonsoft.json.12.0.3.nupkg.sha512"
},
"Raylib-cs/3.5.0": {
"type": "package",
"serviceable": true,
"sha512": "sha512-4yIGm0ZkSjp4W9XpyY4dv20dQv9VkCXvYBL08g6pmTLL5usAHplXEedFcDOQFaE4XBud93dv0e/dyJXLOJU1HQ==",
"path": "raylib-cs/3.5.0",
"hashPath": "raylib-cs.3.5.0.nupkg.sha512"
}
}
}
Binary file not shown.
Binary file not shown.
Binary file added bin/Debug/netcoreapp3.1/EarthBuildplateEditor.pdb
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"runtimeOptions": {
"additionalProbingPaths": [
"C:\\Users\\Lumen\\.dotnet\\store\\|arch|\\|tfm|",
"C:\\Users\\Lumen\\.nuget\\packages",
"C:\\Microsoft\\Xamarin\\NuGet",
"C:\\Program Files\\dotnet\\sdk\\NuGetFallbackFolder"
]
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"runtimeOptions": {
"tfm": "netcoreapp3.1",
"framework": {
"name": "Microsoft.NETCore.App",
"version": "3.1.0"
}
}
}
Binary file added bin/Debug/netcoreapp3.1/Newtonsoft.Json.dll
Binary file not shown.
Binary file added bin/Debug/netcoreapp3.1/Raylib-cs.dll
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// <autogenerated />
using System;
using System.Reflection;
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETCoreApp,Version=v3.1", FrameworkDisplayName = "")]
23 changes: 23 additions & 0 deletions obj/Debug/netcoreapp3.1/EarthBuildplateEditor.AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------

using System;
using System.Reflection;

[assembly: System.Reflection.AssemblyCompanyAttribute("EarthBuildplateEditor")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0")]
[assembly: System.Reflection.AssemblyProductAttribute("EarthBuildplateEditor")]
[assembly: System.Reflection.AssemblyTitleAttribute("EarthBuildplateEditor")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]

// Generated by the MSBuild WriteCodeFragment class.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
62ba655a9af2d118e7f348a0c56055a84f7615b6
Binary file not shown.
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
72b2738ab82c59a8c1483c24b428349b4d9de12e
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
C:\Workspace\Programming\c#\EarthBuildplateEditor\EarthBuildplateEditor\bin\Debug\netcoreapp3.1\EarthBuildplateEditor.exe
C:\Workspace\Programming\c#\EarthBuildplateEditor\EarthBuildplateEditor\bin\Debug\netcoreapp3.1\EarthBuildplateEditor.deps.json
C:\Workspace\Programming\c#\EarthBuildplateEditor\EarthBuildplateEditor\bin\Debug\netcoreapp3.1\EarthBuildplateEditor.runtimeconfig.json
C:\Workspace\Programming\c#\EarthBuildplateEditor\EarthBuildplateEditor\bin\Debug\netcoreapp3.1\EarthBuildplateEditor.runtimeconfig.dev.json
C:\Workspace\Programming\c#\EarthBuildplateEditor\EarthBuildplateEditor\bin\Debug\netcoreapp3.1\EarthBuildplateEditor.dll
C:\Workspace\Programming\c#\EarthBuildplateEditor\EarthBuildplateEditor\bin\Debug\netcoreapp3.1\EarthBuildplateEditor.pdb
C:\Workspace\Programming\c#\EarthBuildplateEditor\EarthBuildplateEditor\obj\Debug\netcoreapp3.1\EarthBuildplateEditor.csprojAssemblyReference.cache
C:\Workspace\Programming\c#\EarthBuildplateEditor\EarthBuildplateEditor\obj\Debug\netcoreapp3.1\EarthBuildplateEditor.AssemblyInfoInputs.cache
C:\Workspace\Programming\c#\EarthBuildplateEditor\EarthBuildplateEditor\obj\Debug\netcoreapp3.1\EarthBuildplateEditor.AssemblyInfo.cs
C:\Workspace\Programming\c#\EarthBuildplateEditor\EarthBuildplateEditor\obj\Debug\netcoreapp3.1\EarthBuildplateEditor.csproj.CoreCompileInputs.cache
C:\Workspace\Programming\c#\EarthBuildplateEditor\EarthBuildplateEditor\obj\Debug\netcoreapp3.1\EarthBuildplateEditor.dll
C:\Workspace\Programming\c#\EarthBuildplateEditor\EarthBuildplateEditor\obj\Debug\netcoreapp3.1\EarthBuildplateEditor.pdb
C:\Workspace\Programming\c#\EarthBuildplateEditor\EarthBuildplateEditor\obj\Debug\netcoreapp3.1\EarthBuildplateEditor.genruntimeconfig.cache
C:\Workspace\Programming\c#\EarthBuildplateEditor\EarthBuildplateEditor\bin\Debug\netcoreapp3.1\Newtonsoft.Json.dll
C:\Workspace\Programming\c#\EarthBuildplateEditor\EarthBuildplateEditor\obj\Debug\netcoreapp3.1\EarthBuildplateEditor.csproj.CopyComplete
C:\Workspace\Programming\c#\EarthBuildplateEditor\EarthBuildplateEditor\bin\Debug\netcoreapp3.1\Raylib-cs.dll
C:\Workspace\Programming\c#\EarthBuildplateEditor\EarthBuildplateEditor\bin\Debug\netcoreapp3.1\runtimes\linux-x64\native\libraylib.so
C:\Workspace\Programming\c#\EarthBuildplateEditor\EarthBuildplateEditor\bin\Debug\netcoreapp3.1\runtimes\linux-x86\native\libraylib.so
C:\Workspace\Programming\c#\EarthBuildplateEditor\EarthBuildplateEditor\bin\Debug\netcoreapp3.1\runtimes\osx-x64\native\libraylib.dylib
C:\Workspace\Programming\c#\EarthBuildplateEditor\EarthBuildplateEditor\bin\Debug\netcoreapp3.1\runtimes\win-x64\native\raylib.dll
C:\Workspace\Programming\c#\EarthBuildplateEditor\EarthBuildplateEditor\bin\Debug\netcoreapp3.1\runtimes\win-x86\native\raylib.dll
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
cd94a37c7a8330d53920fa6fd85a2aa6da7e4b87
Binary file added obj/Debug/netcoreapp3.1/EarthBuildplateEditor.pdb
Binary file not shown.
Binary file added obj/Debug/netcoreapp3.1/apphost.exe
Binary file not shown.
Loading

0 comments on commit 26cb7f6

Please sign in to comment.