commit e4ddf4c2dfd3831a3dc5e1823fd69714caa013ba Author: KuroMento Date: Wed Nov 26 15:44:59 2025 +0100 Ancien code projet diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..8e4f89c --- /dev/null +++ b/.gitignore @@ -0,0 +1,675 @@ +# Created by https://www.toptal.com/developers/gitignore/api/csharp,visualstudio,visualstudiocode,rider +# Edit at https://www.toptal.com/developers/gitignore?templates=csharp,visualstudio,visualstudiocode,rider + +### Csharp ### +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. +## +## Get latest from https://github.com/github/gitignore/blob/main/VisualStudio.gitignore + +# User-specific files +*.rsuser +*.suo +*.user +*.userosscache +*.sln.docstates + +# User-specific files (MonoDevelop/Xamarin Studio) +*.userprefs + +# Mono auto generated files +mono_crash.* + +# Build results +[Dd]ebug/ +[Dd]ebugPublic/ +[Rr]elease/ +[Rr]eleases/ +x64/ +x86/ +[Ww][Ii][Nn]32/ +[Aa][Rr][Mm]/ +[Aa][Rr][Mm]64/ +bld/ +[Bb]in/ +[Oo]bj/ +[Ll]og/ +[Ll]ogs/ + +# Visual Studio 2015/2017 cache/options directory +.vs/ +# Uncomment if you have tasks that create the project's static files in wwwroot +#wwwroot/ + +# Visual Studio 2017 auto generated files +Generated\ Files/ + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + +# NUnit +*.VisualState.xml +TestResult.xml +nunit-*.xml + +# Build Results of an ATL Project +[Dd]ebugPS/ +[Rr]eleasePS/ +dlldata.c + +# Benchmark Results +BenchmarkDotNet.Artifacts/ + +# .NET Core +project.lock.json +project.fragment.lock.json +artifacts/ + +# ASP.NET Scaffolding +ScaffoldingReadMe.txt + +# StyleCop +StyleCopReport.xml + +# Files built by Visual Studio +*_i.c +*_p.c +*_h.h +*.ilk +*.meta +*.obj +*.iobj +*.pch +*.pdb +*.ipdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*_wpftmp.csproj +*.log +*.tlog +*.vspscc +*.vssscc +.builds +*.pidb +*.svclog +*.scc + +# Chutzpah Test files +_Chutzpah* + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opendb +*.opensdf +*.sdf +*.cachefile +*.VC.db +*.VC.VC.opendb + +# Visual Studio profiler +*.psess +*.vsp +*.vspx +*.sap + +# Visual Studio Trace Files +*.e2e + +# TFS 2012 Local Workspace +$tf/ + +# Guidance Automation Toolkit +*.gpState + +# ReSharper is a .NET coding add-in +_ReSharper*/ +*.[Rr]e[Ss]harper +*.DotSettings.user + +# TeamCity is a build add-in +_TeamCity* + +# DotCover is a Code Coverage Tool +*.dotCover + +# AxoCover is a Code Coverage Tool +.axoCover/* +!.axoCover/settings.json + +# Coverlet is a free, cross platform Code Coverage Tool +coverage*.json +coverage*.xml +coverage*.info + +# Visual Studio code coverage results +*.coverage +*.coveragexml + +# NCrunch +_NCrunch_* +.*crunch*.local.xml +nCrunchTemp_* + +# MightyMoose +*.mm.* +AutoTest.Net/ + +# Web workbench (sass) +.sass-cache/ + +# Installshield output folder +[Ee]xpress/ + +# DocProject is a documentation generator add-in +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html + +# Click-Once directory +publish/ + +# Publish Web Output +*.[Pp]ublish.xml +*.azurePubxml +# Note: Comment the next line if you want to checkin your web deploy settings, +# but database connection strings (with potential passwords) will be unencrypted +*.pubxml +*.publishproj + +# Microsoft Azure Web App publish settings. Comment the next line if you want to +# checkin your Azure Web App publish settings, but sensitive information contained +# in these scripts will be unencrypted +PublishScripts/ + +# NuGet Packages +*.nupkg +# NuGet Symbol Packages +*.snupkg +# The packages folder can be ignored because of Package Restore +**/[Pp]ackages/* +# except build/, which is used as an MSBuild target. +!**/[Pp]ackages/build/ +# Uncomment if necessary however generally it will be regenerated when needed +#!**/[Pp]ackages/repositories.config +# NuGet v3's project.json files produces more ignorable files +*.nuget.props +*.nuget.targets + +# Microsoft Azure Build Output +csx/ +*.build.csdef + +# Microsoft Azure Emulator +ecf/ +rcf/ + +# Windows Store app package directories and files +AppPackages/ +BundleArtifacts/ +Package.StoreAssociation.xml +_pkginfo.txt +*.appx +*.appxbundle +*.appxupload + +# Visual Studio cache files +# files ending in .cache can be ignored +*.[Cc]ache +# but keep track of directories ending in .cache +!?*.[Cc]ache/ + +# Others +ClientBin/ +~$* +*~ +*.dbmdl +*.dbproj.schemaview +*.jfm +*.pfx +*.publishsettings +orleans.codegen.cs + +# Including strong name files can present a security risk +# (https://github.com/github/gitignore/pull/2483#issue-259490424) +#*.snk + +# Since there are multiple workflows, uncomment next line to ignore bower_components +# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) +#bower_components/ + +# RIA/Silverlight projects +Generated_Code/ + +# Backup & report files from converting an old project file +# to a newer Visual Studio version. Backup files are not needed, +# because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML +UpgradeLog*.htm +ServiceFabricBackup/ +*.rptproj.bak + +# SQL Server files +*.mdf +*.ldf +*.ndf + +# Business Intelligence projects +*.rdl.data +*.bim.layout +*.bim_*.settings +*.rptproj.rsuser +*- [Bb]ackup.rdl +*- [Bb]ackup ([0-9]).rdl +*- [Bb]ackup ([0-9][0-9]).rdl + +# Microsoft Fakes +FakesAssemblies/ + +# GhostDoc plugin setting file +*.GhostDoc.xml + +# Node.js Tools for Visual Studio +.ntvs_analysis.dat +node_modules/ + +# Visual Studio 6 build log +*.plg + +# Visual Studio 6 workspace options file +*.opt + +# Visual Studio 6 auto-generated workspace file (contains which files were open etc.) +*.vbw + +# Visual Studio 6 auto-generated project file (contains which files were open etc.) +*.vbp + +# Visual Studio 6 workspace and project file (working project files containing files to include in project) +*.dsw +*.dsp + +# Visual Studio 6 technical files + +# Visual Studio LightSwitch build output +**/*.HTMLClient/GeneratedArtifacts +**/*.DesktopClient/GeneratedArtifacts +**/*.DesktopClient/ModelManifest.xml +**/*.Server/GeneratedArtifacts +**/*.Server/ModelManifest.xml +_Pvt_Extensions + +# Paket dependency manager +.paket/paket.exe +paket-files/ + +# FAKE - F# Make +.fake/ + +# CodeRush personal settings +.cr/personal + +# Python Tools for Visual Studio (PTVS) +__pycache__/ +*.pyc + +# Cake - Uncomment if you are using it +# tools/** +# !tools/packages.config + +# Tabs Studio +*.tss + +# Telerik's JustMock configuration file +*.jmconfig + +# BizTalk build output +*.btp.cs +*.btm.cs +*.odx.cs +*.xsd.cs + +# OpenCover UI analysis results +OpenCover/ + +# Azure Stream Analytics local run output +ASALocalRun/ + +# MSBuild Binary and Structured Log +*.binlog + +# NVidia Nsight GPU debugger configuration file +*.nvuser + +# MFractors (Xamarin productivity tool) working folder +.mfractor/ + +# Local History for Visual Studio +.localhistory/ + +# Visual Studio History (VSHistory) files +.vshistory/ + +# BeatPulse healthcheck temp database +healthchecksdb + +# Backup folder for Package Reference Convert tool in Visual Studio 2017 +MigrationBackup/ + +# Ionide (cross platform F# VS Code tools) working folder +.ionide/ + +# Fody - auto-generated XML schema +FodyWeavers.xsd + +# VS Code files for those working on multiple tools +.vscode/* +!.vscode/settings.json +!.vscode/tasks.json +!.vscode/launch.json +!.vscode/extensions.json +*.code-workspace + +# Local History for Visual Studio Code +.history/ + +# Windows Installer files from build outputs +*.cab +*.msi +*.msix +*.msm +*.msp + +# JetBrains Rider +*.sln.iml + +### Rider ### +# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider +# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 + +# User-specific stuff +.idea/**/workspace.xml +.idea/**/tasks.xml +.idea/**/usage.statistics.xml +.idea/**/dictionaries +.idea/**/shelf + +# AWS User-specific +.idea/**/aws.xml + +# Generated files +.idea/**/contentModel.xml + +# Sensitive or high-churn files +.idea/**/dataSources/ +.idea/**/dataSources.ids +.idea/**/dataSources.local.xml +.idea/**/sqlDataSources.xml +.idea/**/dynamic.xml +.idea/**/uiDesigner.xml +.idea/**/dbnavigator.xml + +# Gradle +.idea/**/gradle.xml +.idea/**/libraries + +# Gradle and Maven with auto-import +# When using Gradle or Maven with auto-import, you should exclude module files, +# since they will be recreated, and may cause churn. Uncomment if using +# auto-import. +# .idea/artifacts +# .idea/compiler.xml +# .idea/jarRepositories.xml +# .idea/modules.xml +# .idea/*.iml +# .idea/modules +# *.iml +# *.ipr + +# CMake +cmake-build-*/ + +# Mongo Explorer plugin +.idea/**/mongoSettings.xml + +# File-based project format +*.iws + +# IntelliJ +out/ + +# mpeltonen/sbt-idea plugin +.idea_modules/ + +# JIRA plugin +atlassian-ide-plugin.xml + +# Cursive Clojure plugin +.idea/replstate.xml + +# SonarLint plugin +.idea/sonarlint/ + +# Crashlytics plugin (for Android Studio and IntelliJ) +com_crashlytics_export_strings.xml +crashlytics.properties +crashlytics-build.properties +fabric.properties + +# Editor-based Rest Client +.idea/httpRequests + +# Android studio 3.1+ serialized cache file +.idea/caches/build_file_checksums.ser + +### VisualStudioCode ### +!.vscode/*.code-snippets + +# Local History for Visual Studio Code + +# Built Visual Studio Code Extensions +*.vsix + +### VisualStudioCode Patch ### +# Ignore all local history of files +.history +.ionide + +### VisualStudio ### + +# User-specific files + +# User-specific files (MonoDevelop/Xamarin Studio) + +# Mono auto generated files + +# Build results + +# Visual Studio 2015/2017 cache/options directory +# Uncomment if you have tasks that create the project's static files in wwwroot + +# Visual Studio 2017 auto generated files + +# MSTest test Results + +# NUnit + +# Build Results of an ATL Project + +# Benchmark Results + +# .NET Core + +# ASP.NET Scaffolding + +# StyleCop + +# Files built by Visual Studio + +# Chutzpah Test files + +# Visual C++ cache files + +# Visual Studio profiler + +# Visual Studio Trace Files + +# TFS 2012 Local Workspace + +# Guidance Automation Toolkit + +# ReSharper is a .NET coding add-in + +# TeamCity is a build add-in + +# DotCover is a Code Coverage Tool + +# AxoCover is a Code Coverage Tool + +# Coverlet is a free, cross platform Code Coverage Tool + +# Visual Studio code coverage results + +# NCrunch + +# MightyMoose + +# Web workbench (sass) + +# Installshield output folder + +# DocProject is a documentation generator add-in + +# Click-Once directory + +# Publish Web Output +# Note: Comment the next line if you want to checkin your web deploy settings, +# but database connection strings (with potential passwords) will be unencrypted + +# Microsoft Azure Web App publish settings. Comment the next line if you want to +# checkin your Azure Web App publish settings, but sensitive information contained +# in these scripts will be unencrypted + +# NuGet Packages +# NuGet Symbol Packages +# The packages folder can be ignored because of Package Restore +# except build/, which is used as an MSBuild target. +# Uncomment if necessary however generally it will be regenerated when needed +# NuGet v3's project.json files produces more ignorable files + +# Microsoft Azure Build Output + +# Microsoft Azure Emulator + +# Windows Store app package directories and files + +# Visual Studio cache files +# files ending in .cache can be ignored +# but keep track of directories ending in .cache + +# Others + +# Including strong name files can present a security risk +# (https://github.com/github/gitignore/pull/2483#issue-259490424) + +# Since there are multiple workflows, uncomment next line to ignore bower_components +# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) + +# RIA/Silverlight projects + +# Backup & report files from converting an old project file +# to a newer Visual Studio version. Backup files are not needed, +# because we have git ;-) + +# SQL Server files + +# Business Intelligence projects + +# Microsoft Fakes + +# GhostDoc plugin setting file + +# Node.js Tools for Visual Studio + +# Visual Studio 6 build log + +# Visual Studio 6 workspace options file + +# Visual Studio 6 auto-generated workspace file (contains which files were open etc.) + +# Visual Studio 6 auto-generated project file (contains which files were open etc.) + +# Visual Studio 6 workspace and project file (working project files containing files to include in project) + +# Visual Studio 6 technical files + +# Visual Studio LightSwitch build output + +# Paket dependency manager + +# FAKE - F# Make + +# CodeRush personal settings + +# Python Tools for Visual Studio (PTVS) + +# Cake - Uncomment if you are using it +# tools/** +# !tools/packages.config + +# Tabs Studio + +# Telerik's JustMock configuration file + +# BizTalk build output + +# OpenCover UI analysis results + +# Azure Stream Analytics local run output + +# MSBuild Binary and Structured Log + +# NVidia Nsight GPU debugger configuration file + +# MFractors (Xamarin productivity tool) working folder + +# Local History for Visual Studio + +# Visual Studio History (VSHistory) files + +# BeatPulse healthcheck temp database + +# Backup folder for Package Reference Convert tool in Visual Studio 2017 + +# Ionide (cross platform F# VS Code tools) working folder + +# Fody - auto-generated XML schema + +# VS Code files for those working on multiple tools + +# Local History for Visual Studio Code + +# Windows Installer files from build outputs + +# JetBrains Rider + +### VisualStudio Patch ### +# Additional files built by Visual Studio + +# End of https://www.toptal.com/developers/gitignore/api/csharp,visualstudio,visualstudiocode,rider \ No newline at end of file diff --git a/Automate.sln b/Automate.sln new file mode 100644 index 0000000..7f610d0 --- /dev/null +++ b/Automate.sln @@ -0,0 +1,31 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.5.33530.505 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Automate", "Automate\Automate.csproj", "{55CD759F-F7AE-47BC-812E-474FD3CE693E}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CakeBuild", "ZZCakeBuild\CakeBuild.csproj", "{81442847-D1B8-4499-BC9B-03FB65182FBE}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {55CD759F-F7AE-47BC-812E-474FD3CE693E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {55CD759F-F7AE-47BC-812E-474FD3CE693E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {55CD759F-F7AE-47BC-812E-474FD3CE693E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {55CD759F-F7AE-47BC-812E-474FD3CE693E}.Release|Any CPU.Build.0 = Release|Any CPU + {81442847-D1B8-4499-BC9B-03FB65182FBE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {81442847-D1B8-4499-BC9B-03FB65182FBE}.Debug|Any CPU.Build.0 = Debug|Any CPU + {81442847-D1B8-4499-BC9B-03FB65182FBE}.Release|Any CPU.ActiveCfg = Release|Any CPU + {81442847-D1B8-4499-BC9B-03FB65182FBE}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {DA43A4CC-D6DC-4089-8B21-FD28C6F587BB} + EndGlobalSection +EndGlobal diff --git a/Automate/Automate.csproj b/Automate/Automate.csproj new file mode 100644 index 0000000..c31156d --- /dev/null +++ b/Automate/Automate.csproj @@ -0,0 +1,65 @@ + + + + net7.0 + false + bin\$(Configuration)\Mods\mod + + + + + $(VINTAGE_STORY)/VintagestoryAPI.dll + false + + + $(VINTAGE_STORY)/Mods/VSSurvivalMod.dll + False + + + $(VINTAGE_STORY)/Mods/VSEssentials.dll + False + + + $(VINTAGE_STORY)/Mods/VSCreativeMod.dll + False + + + $(VINTAGE_STORY)/Lib/Newtonsoft.Json.dll + False + + + $(VINTAGE_STORY)/Lib/0Harmony.dll + False + + + $(VINTAGE_STORY)/VintagestoryLib.dll + false + + + $(VINTAGE_STORY)/Lib/protobuf-net.dll + False + + + $(VINTAGE_STORY)/Lib/cairo-sharp.dll + False + + + $(VINTAGE_STORY)/Lib/Microsoft.Data.Sqlite.dll + False + + + + + + PreserveNewest + + + + + + + PreserveNewest + + + + diff --git a/Automate/AutomateModSystem.cs b/Automate/AutomateModSystem.cs new file mode 100644 index 0000000..d829d7d --- /dev/null +++ b/Automate/AutomateModSystem.cs @@ -0,0 +1,95 @@ +using Vintagestory.API.Client; +using Vintagestory.API.Common; +using Vintagestory.API.Config; +using Vintagestory.API.Server; + +using Automate.BlockEntities; +using Automate.Blocks; +using Vintagestory.GameContent.Mechanics; +using Automate.AutomateMP.Network; +using Automate.src.BlockEntities; + +namespace Automate +{ + public class AutomateModSystem : ModSystem + { + private ICoreClientAPI capi; + private ICoreServerAPI sapi; + private IClientNetworkChannel clientNwChannel; + private IServerNetworkChannel serverNwChannel; + + public override bool ShouldLoad(EnumAppSide forSide) + { + return true; + } + + // Called on server and client + // Useful for registering block/entity classes on both sides + public override void Start(ICoreAPI api) + { + // Starting the Mod System Core + base.Start(api); + + // Registering all blocks, items, entities, etc. + Mod.Logger.Event(" Initialisation of " + api.Side + " side..."); + + api.RegisterBlockClass(AutomateRefs.MODID + ".boiler", typeof(BlockBoiler)); + api.RegisterBlockClass(AutomateRefs.MODID + ".waterchamber", typeof(BlockWaterChamber)); + api.RegisterBlockEntityClass(AutomateRefs.MODID + ".bewaterchamber", typeof(BEWaterChamber)); + api.RegisterBlockEntityClass(AutomateRefs.MODID + ".beboiler", typeof(BEBoiler)); + + Mod.Logger.Event(" Boiler, Water Chamber and Piston registered !"); + + if (api.Side == EnumAppSide.Client) + { + capi = (ICoreClientAPI) api; + clientNwChannel = + capi.Network.RegisterChannel(Mod.Info.ModID + "mechnetwork") + .RegisterMessageType(typeof(AutomateNetworkMessage)) + .SetMessageHandler(OnAutomateWelcome); + } + else + { + sapi = (ICoreServerAPI) api; + //api.World.RegisterGameTickListener(OnServerGameTick, 20); For Server Tick, to update all networks + serverNwChannel = + sapi.Network.RegisterChannel(Mod.Info.ModID + "mechnetwork") + .RegisterMessageType(typeof(AutomateNetworkMessage)); + + //.RegisterMessageType(typeof(MechNetworkPacket)) + api.ChatCommands.Create(Mod.Info.ModID) + .WithDescription("A welcoming message for " + Mod.Info.ModID) + .RequiresPrivilege(Privilege.controlserver) + .HandleWith(new OnCommandDelegate(OnAutomateCommand)); + } + } + + public override void StartServerSide(ICoreServerAPI api) + { + Mod.Logger.Notification("Hello from template mod server side: " + Lang.Get("automate:hello")); + } + + public override void StartClientSide(ICoreClientAPI api) + { + Mod.Logger.Notification("Hello from template mod client side: " + Lang.Get("automate:hello")); + } + + // The command with its data. Here a simple message like in the tuto on github! + private TextCommandResult OnAutomateCommand(TextCommandCallingArgs args){ + serverNwChannel.BroadcastPacket( + new AutomateNetworkMessage() + { + message = "Welcome to the Automate mod, start by checking the handbook with the H key!" + } + ); + return TextCommandResult.Success(); + } + + // Function executed on client upon receiving the packet + private void OnAutomateWelcome(AutomateNetworkMessage networkMessage) + { + capi.ShowChatMessage(networkMessage.message); + } + + } +} \ No newline at end of file diff --git a/Automate/AutomateRefs.cs b/Automate/AutomateRefs.cs new file mode 100644 index 0000000..7a90d20 --- /dev/null +++ b/Automate/AutomateRefs.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Automate +{ + public class AutomateRefs + { + public const String MODID = "automate"; + public const String MODID_COLONS = MODID + ":"; + public const String GAME_COLONS = "game:"; + } +} diff --git a/Automate/Properties/launchSettings.json b/Automate/Properties/launchSettings.json new file mode 100644 index 0000000..5038f3c --- /dev/null +++ b/Automate/Properties/launchSettings.json @@ -0,0 +1,16 @@ +{ + "profiles": { + "Client": { + "commandName": "Executable", + "executablePath": "dotnet", + "commandLineArgs": "\"$(VINTAGE_STORY)/Vintagestory.dll\" --tracelog --addModPath \"$(ProjectDir)/bin/$(Configuration)/Mods\"", + "workingDirectory": "$(VINTAGE_STORY)" + }, + "Server": { + "commandName": "Executable", + "executablePath": "dotnet", + "commandLineArgs": "\"$(VINTAGE_STORY)/VintagestoryServer.dll\" --tracelog --addModPath \"$(ProjectDir)/bin/$(Configuration)/Mods\"", + "workingDirectory": "$(VINTAGE_STORY)" + } + } +} \ No newline at end of file diff --git a/Automate/README.md b/Automate/README.md new file mode 100644 index 0000000..245b587 --- /dev/null +++ b/Automate/README.md @@ -0,0 +1,89 @@ +Créer un équivalent au mod **Create** (de Minecraft) dans **Vintage Story** est un projet ambitieux, mais passionnant ! Le mod Create repose sur des mécaniques de **mouvement de blocs, automation, engrenages, énergie cinétique, et machines complexes**. Voici une **liste structurée** des compétences C# et concepts de l'API Vintage Story à maîtriser pour y parvenir : + +--- + +## **1. Concepts Fondamentaux à Revoir (C#)** +- **Programmation orientée objet (POO)** + - Classes, héritage, interfaces (`IMod`, `ModSystem`). + - Méthodes virtuelles (`Override` dans `ModSystem`). +- **Gestion des événements** + - Comprendre `events`, `delegates` (ex: `OnPlayerInteract`, `OnBlockPlaced`). +- **Collections et LINQ** + - Utilisation de `List`, `Dictionary` pour gérer des données dynamiques (ex: liste de blocs connectés). +- **Threading et tâches asynchrones** + - Pour éviter de bloquer le jeu avec des calculs lourds (ex: `Task.Run` pour des simulations de physique). + +--- + +## **2. API Vintage Story Spécifique** +### **Pour les mécaniques de type "Create"** +| **Fonctionnalité** | **API/Classes à utiliser** | **Exemple d'application** | +|----------------------------------|----------------------------------------------------|---------------------------| +| **Mouvement de blocs** | `BlockEntity`, `BlockEntityBehavior` | Déplacer un bloc via un piston. | +| **Interaction joueur** | `ICorePlayerAPI`, `BlockSelection` | Détecter un clic sur une manivelle. | +| **Rendu custom (GUI/animations)**| `IRenderAPI`, `ShapeRenderer`, `GuiDialog` | Afficher une interface de contrôle. | +| **Physique et collisions** | `Cuboidf`, `BlockCollisionTester` | Vérifier si un bloc peut être poussé. | +| **Réseau (sync client/serveur)** | `IServerNetworkAPI`, `IClientNetworkAPI` | Synchroniser l'état des engrenages. | +| **Sons et particules** | `ISoundAPI`, `ISimpleParticleAPI` | Jouer un bruit de mécanique. | + +--- + +## **3. Composantes Clés à Implémenter** +### **(Inspirées de Create)** +1. **Système d’énergie cinétique** + - Créer une classe `KineticNetwork` pour gérer la transmission de puissance entre engrenages. + - Utiliser `ModSystem` pour mettre à jour les réseaux chaque tick (`OnServerGameTick`). + +2. **Blocs interactifs** + - **Manivelles**, **poulies**, **engrenages** : + - Hériter de `BlockEntity` pour stocker leur état (rotation, puissance transmise). + - Exemple de code pour une manivelle : + ```csharp + public class BlockEntityCrank : BlockEntity + { + public float RotationAngle { get; set; } + public override void OnTick(float dt) => RotationAngle += dt * 10f; + } + ``` + +3. **Mouvement de blocs (pistons, convoyeurs)** + - Utiliser `BlockEntityBehavior` pour détecter les blocs adjacents. + - Pour déplacer un bloc : + ```csharp + api.World.BlockAccessor.SetBlock(0, oldPos); // Supprime l'ancien bloc + api.World.BlockAccessor.SetBlock(blockId, newPos); // Place le bloc à la nouvelle position + ``` + +4. **Machines et automation** + - **Recettes mécaniques** : Utiliser `IModRegistry` pour ajouter des recettes custom. + - **Stockage d’items/fluides** : Inspirer des mods comme `From Golden Combs` pour gérer des inventaires dynamiques. + +--- + +## **4. Outils et Bonnes Pratiques** +- **Débogage** : + - Utiliser `Mod.Logger.Notification()` pour tracer des infos. + - **Attacher un débogueur** (VSCode/Rider) au processus du jeu. +- **Optimisation** : + - Éviter les calculs lourds dans `OnTick()` → Utiliser des timers ou des updates espacés. +- **Compatibilité** : + - Vérifier les dépendances (ex: `"requiredmods": ["game"]` dans `modinfo.json`). + +--- + +## **5. Ressources pour Approfondir** +- **Exemples de mods complexes** : + - [TemporalGearManagement](https://github.com/anegostudios/VintageStory-TemporalGearManagement) (gestion d’états persistants). + - [Primitive Survival](https://github.com/copygirl/PrimitiveSurvival) (machines et automation). +- **Documentation API** : + - [API Vintage Story](https://apidocs.vintagestory.at/api/Vintagestory.API.Common.ICoreAPI.html) (pour explorer les méthodes disponibles). + +--- + +## **6. Prochaines Étapes (Roadmap Suggérée)** +1. **Commencer petit** : Un seul engrenage qui transmet sa rotation à un bloc adjacent. +2. **Ajouter des GUI** : Une interface pour afficher la puissance transmise. +3. **Gérer la physique** : Empêcher les blocs de se chevaucher. +4. **Étendre le système** : Ajouter des convoyeurs, des bras mécaniques, etc. + +Si tu veux des exemples plus précis sur l’une de ces étapes, fais-le-moi savoir ! 🛠️ \ No newline at end of file diff --git a/Automate/assets/automate/blocktypes/boiler.json b/Automate/assets/automate/blocktypes/boiler.json new file mode 100644 index 0000000..9c15dc2 --- /dev/null +++ b/Automate/assets/automate/blocktypes/boiler.json @@ -0,0 +1,24 @@ +{ + "code": "autoboiler", + "class": "automate.boiler", + "entityClass": "automate.beboiler", + "entityBehaviors": [ + { "name": "TemperatureSensitive" }, + ], + "behaviors": [ + { "name": "Lockable" }, + { "name": "Container" }, + { "name": "Ignitable" }, + { "name": "HeatSource" }, + { "name": "HorizontalOrientable" } + ], + "creativeinventory": { + "general": [ "*" ], + "mechanics": [ "*" ], + "automate": [ "*" ] + }, + "drawtype": "Cube", + "texture": { + "base": "block/rock/bauxite1" + } +} \ No newline at end of file diff --git a/Automate/assets/automate/blocktypes/rail.json b/Automate/assets/automate/blocktypes/rail.json new file mode 100644 index 0000000..e222a7e --- /dev/null +++ b/Automate/assets/automate/blocktypes/rail.json @@ -0,0 +1,41 @@ +{ + "code": "rail", + "creativeinventory": { "general": [ "*" ], "mechanics": [ "*" ], "automate": [ "*" ] }, + "blockmaterial": "Metal", + "behaviors": [ + {"name": "Unstable"}, + {"name": "HorizontalOrientable"} + ], + "variantgroups": [ + { "code": "rock", "loadFromProperties": "block/rockwithdeposit" }, + ], + "textures": { + "stainlesssteel": { "base": "block/stainlesssteel" }, + "steel": { "base": "block/steel" }, + "support": { "base": "block/rock/{rock}1" } + }, + "shape": { + "base": "block/rail" + }, + "requiredminingtier": 2, + "resistance": 0.5, + "lightAbsorption": 0, + "replaceable": 5001, + "maxStackSize": 32, + "selectionbox": { + "x1": 0, "y1": 0, "z1": 0, "x2": 1, "y2": 0.2, "z2": 1, + }, + "collisionbox": { + "x1": 0, "y1": 0, "z1": 0, "x2": 1, "y2": 0.15, "z2": 1, + }, + "sidesolid": { + "all": false + }, + "sideopaque": { + "all": false + }, + "sounds": { + "place": "game:block/anvil", + "walk": "game:walk/stone" + } +} \ No newline at end of file diff --git a/Automate/assets/automate/blocktypes/water_chamber.json b/Automate/assets/automate/blocktypes/water_chamber.json new file mode 100644 index 0000000..02934b0 --- /dev/null +++ b/Automate/assets/automate/blocktypes/water_chamber.json @@ -0,0 +1,35 @@ +{ + "code": "waterchamber", + "class": "automate.waterchamber", + "entityClass": "automate.bewaterchamber", + "attributes": { + "canDrinkFrom": false, + "isTopOpened": false, + "allowHeldLiquidTransfer": false, + "capacityLitres": 50 + }, + "creativeinventory": { + "general": [ "*" ], + "mechanics": [ "*" ], + "automate": [ "*" ] + }, + "textures": { + "copper": { "base": "block/copper" }, + "glass": { "base": "block/leaded" } + }, + "shape": { + "base": "block/water_chamber" + }, + "sideao": { + "all": false + }, + "sidesolid": { + "all": false + }, + "emitsideao": { + "all": false + }, + "sideopaque": { + "all": false + } +} \ No newline at end of file diff --git a/Automate/assets/automate/config/handbook/01-automation_basics.json b/Automate/assets/automate/config/handbook/01-automation_basics.json new file mode 100644 index 0000000..70ffc19 --- /dev/null +++ b/Automate/assets/automate/config/handbook/01-automation_basics.json @@ -0,0 +1,5 @@ +{ + "pageCode": "automate:automate", + "title": "automate:automate-title", + "text": "automate:automate-text" +} \ No newline at end of file diff --git a/Automate/assets/automate/itemtypes/railbar.json b/Automate/assets/automate/itemtypes/railbar.json new file mode 100644 index 0000000..be3656b --- /dev/null +++ b/Automate/assets/automate/itemtypes/railbar.json @@ -0,0 +1,91 @@ +{ + "code": "railbar", + "creativeinventory": { + "general": [ "*" ], + "automate": [ "*" ] + }, + "attributes": { + "onTongTransform": { + "translation": { "x": 0.2, "y": -0.5, "z": 0.225 }, + "rotation": { "x": 0, "y": 3, "z": -11 }, + "origin": { "x": 0, "y": 0, "z": 0 }, + "scale": 1.2 + } + }, + "maxStackSize": 32, + "shape": { + "base": "item/railbar" + }, + "guiTransform": { + "translation": { + "x": 0, + "y": 0, + "z": 0 + }, + "rotation": { + "x": -89, + "y": 41, + "z": 33 + }, + "origin": { + "x": 0.48, + "y": 0, + "z": 0.38 + }, + "scale": 1.78 + }, + "fpHandTransform": { + "translation": { + "x": -0.3, + "y": -0.5, + "z": 0.3 + }, + "rotation": { + "x": -29, + "y": 1, + "z": 88 + }, + "origin": { + "x": 0.2, + "y": 0.5, + "z": 0.5 + }, + "scale": 2.5 + }, + "groundTransform": { + "translation": { + "x": 0, + "y": 0, + "z": 0 + }, + "rotation": { + "x": 0, + "y": 0, + "z": 0 + }, + "origin": { + "x": 0.5, + "y": 0, + "z": 0.5 + }, + "scale": 3.4 + }, + "tpHandTransform": { + "translation": { + "x": -0.45, + "y": 0.03, + "z": -0.66 + }, + "rotation": { + "x": 90, + "y": 0, + "z": 0 + }, + "origin": { + "x": 0.5, + "y": 0, + "z": 0.5 + }, + "scale": 0.8 + } +} \ No newline at end of file diff --git a/Automate/assets/automate/lang/en.json b/Automate/assets/automate/lang/en.json new file mode 100644 index 0000000..5608974 --- /dev/null +++ b/Automate/assets/automate/lang/en.json @@ -0,0 +1,37 @@ +{ + // Creative Tab + "game:tabname-automate": "Automate", + // Handbook: + "automate:automate-title": "Automate: Basics", + "automate:automate-text": "Work In Progress, but progress there is not!", + + "block-rail-andesite": "Andesite Rail", + "block-rail-chalk": "Chalk Rail", + "block-rail-chert": "Chert Rail", + "block-rail-conglomerate": "Conglomerate Rail", + "block-rail-limestone": "Limestone Rail", + "block-rail-claystone": "Claystone Rail", + "block-rail-granite": "Granite Rail", + "block-rail-sandstone": "Sandstone Rail", + "block-rail-shale": "Shale Rail", + "block-rail-basalt": "Basalt Rail", + "block-rail-peridotite": "Peridotite Rail", + "block-rail-phyllite": "Phyllite Rail", + "block-rail-slate": "Slate Rail", + "block-rail-bauxite": "Bauxite Rail", + "block-rail-suevite": "Suevite Rail", + "block-rail-whitemarble": "Whitemarble Rail", + "block-rail-greenmarble": "Greenmarble Rail", + "block-rail-redmarble": "Redmarble Rail", + "block-rail-kimberlite": "Kimberlite Rail", + + "blockdesc-rail-*": "A rail that can be connected to other rails to form a circuit V2", + + "block-autoboiler": "Boiler", + "block-waterchamber": "Water Chamber", + "Steam Engine Boiler": "Steam Engine Boiler", + "Temperature: {0}°C": "Temperature: {0}°C", + + "item-railbar": "Rail Bar", + "itemdesc-railbar": "The fondation of every rail" +} \ No newline at end of file diff --git a/Automate/assets/automate/recipes/grid/railrecipe.json b/Automate/assets/automate/recipes/grid/railrecipe.json new file mode 100644 index 0000000..cbe070b --- /dev/null +++ b/Automate/assets/automate/recipes/grid/railrecipe.json @@ -0,0 +1,25 @@ +{ + "ingredientPattern": "BSB", + "width": 3, + "height": 1, + "ingredients": { + "B": { + "type": "item", + "code": "railbar" + }, + "S": { + "type": "item", + "code": "game:stone-*", + "name": "rock", + "allowedVariants": ["andesite", "chalk", "chert", "conglomerate", "limestone", + "claystone", "granite", "sandstone", "shale", "basalt", "peridotite", "phyllite", + "slate", "bauxite", "suevite", "whitemarble", "greenmarble", "redmarble", "kimberlite"], + "quantity": 6 + } + }, + "output": { + "type": "block", + "code": "rail-{rock}", + "quantity" : 2 + } +} \ No newline at end of file diff --git a/Automate/assets/automate/recipes/grid/railrecipe.json.bak b/Automate/assets/automate/recipes/grid/railrecipe.json.bak new file mode 100644 index 0000000..c02f0de --- /dev/null +++ b/Automate/assets/automate/recipes/grid/railrecipe.json.bak @@ -0,0 +1,25 @@ +{ + "ingredientPattern": "B,S,B", + "width": 3, + "height": 1, + "ingredients": { + "B": { + "type": "item", + "code": "railbar", + }, + "S": { + "type": "item", + "code": "stone-*", + "name": "rock", + "allowedVariants": ["andesite", "chalk", "chert", "conglomerate", "limestone", + "claystone", "granite", "sandstone", "shale", "basalt", "peridotite", "phyllite", + "slate", "bauxite", "suevite", "whitemarble", "greenmarble", "redmarble", "kimberlite"], + "quantity": 6 + } + }, + "output": { + "type": "block", + "code": "rail-{rock}", + "quantity" : 2 + } +} \ No newline at end of file diff --git a/Automate/assets/automate/recipes/smithing/rail_bar.json b/Automate/assets/automate/recipes/smithing/rail_bar.json new file mode 100644 index 0000000..d833a84 --- /dev/null +++ b/Automate/assets/automate/recipes/smithing/rail_bar.json @@ -0,0 +1,24 @@ +{ + "ingredient": { + "type": "item", + "code": "game:ingot-steel", + }, + + "pattern": [ + [ + "#_#_#_#", + "#_#_#_#", + "#_#_#_#", + "_______", + "#_#_#_#", + "#_#_#_#", + "#_#_#_#" + ] + ], + + "output": { + "type": "item", + "code": "railbar", + "quantity": 8 + } +} \ No newline at end of file diff --git a/Automate/assets/automate/shapes/block/rail.json b/Automate/assets/automate/shapes/block/rail.json new file mode 100644 index 0000000..ab7491c --- /dev/null +++ b/Automate/assets/automate/shapes/block/rail.json @@ -0,0 +1,116 @@ +{ + "editor": { + "allAngles": false, + "entityTextureMode": false + }, + "textureWidth": 16, + "textureHeight": 16, + "textureSizes": { + "stainlesssteel": [16,16], + "steel": [16,16] + }, + "textures": { + "stainlesssteel": "block/stainlesssteel", + "steel": "block/steel", + "support": "block/rock/{rock}1" + }, + "elements": [ + { + "name": "LeftRail", + "from": [ 2.0, 0.0, 0.0 ], + "to": [ 4.0, 2.0, 16.0 ], + "rotationOrigin": [ 2.0, 0.0, 0.0 ], + "faces": { + "north": { "texture": "#steel", "uv": [ 0.0, 0.0, 2.0, 2.0 ], "autoUv": false }, + "east": { "texture": "#steel", "uv": [ 0.0, 0.0, 16.0, 2.0 ], "autoUv": false }, + "south": { "texture": "#steel", "uv": [ 0.0, 0.0, 2.0, 2.0 ] }, + "west": { "texture": "#steel", "uv": [ 0.0, 0.0, 16.0, 2.0 ] }, + "up": { "texture": "#stainlesssteel", "uv": [ 3.0, 0.0, 5.0, 16.0 ], "windMode": [-1,-1,-1,-1] }, + "down": { "texture": "#steel", "uv": [ 0.0, 0.0, 2.0, 16.0 ] } + } + }, + { + "name": "RightRail", + "from": [ 12.0, 0.0, 0.0 ], + "to": [ 14.0, 2.0, 16.0 ], + "rotationOrigin": [ 12.0, 0.0, 0.0 ], + "faces": { + "north": { "texture": "#steel", "uv": [ 0.0, 0.0, 2.0, 2.0 ] }, + "east": { "texture": "#steel", "uv": [ 0.0, 0.0, 16.0, 2.0 ] }, + "south": { "texture": "#steel", "uv": [ 0.0, 0.0, 2.0, 2.0 ] }, + "west": { "texture": "#steel", "uv": [ 0.0, 0.0, 16.0, 2.0 ] }, + "up": { "texture": "#stainlesssteel", "uv": [ 3.0, 0.0, 5.0, 16.0 ], "windMode": [-1,-1,-1,-1] }, + "down": { "texture": "#steel", "uv": [ 0.0, 0.0, 2.0, 16.0 ] } + } + }, + { + "name": "Support", + "from": [ 0.0, 0.0, 1.0 ], + "to": [ 16.0, 1.0, 3.0 ], + "rotationOrigin": [ 0.0, 0.0, 1.0 ], + "faces": { + "north": { "texture": "#support", "uv": [ 0.0, 0.0, 16.0, 1.0 ] }, + "east": { "texture": "#support", "uv": [ 0.0, 0.0, 2.0, 1.0 ] }, + "south": { "texture": "#support", "uv": [ 0.0, 0.0, 16.0, 1.0 ] }, + "west": { "texture": "#support", "uv": [ 0.0, 0.0, 2.0, 1.0 ] }, + "up": { "texture": "#support", "uv": [ 0.0, 0.0, 16.0, 2.0 ] }, + "down": { "texture": "#support", "uv": [ 0.0, 0.0, 16.0, 2.0 ] } + } + }, + { + "name": "Support2", + "from": [ 0.0, 0.0, 4.0 ], + "to": [ 16.0, 1.0, 6.0 ], + "rotationOrigin": [ 0.0, 0.0, 4.0 ], + "faces": { + "north": { "texture": "#support", "uv": [ 0.0, 0.0, 16.0, 1.0 ] }, + "east": { "texture": "#support", "uv": [ 0.0, 0.0, 2.0, 1.0 ] }, + "south": { "texture": "#support", "uv": [ 0.0, 0.0, 16.0, 1.0 ] }, + "west": { "texture": "#support", "uv": [ 0.0, 0.0, 2.0, 1.0 ] }, + "up": { "texture": "#support", "uv": [ 0.0, 0.0, 16.0, 2.0 ] }, + "down": { "texture": "#support", "uv": [ 0.0, 0.0, 16.0, 2.0 ] } + } + }, + { + "name": "Support3", + "from": [ 0.0, 0.0, 7.0 ], + "to": [ 16.0, 1.0, 9.0 ], + "rotationOrigin": [ 0.0, 0.0, 7.0 ], + "faces": { + "north": { "texture": "#support", "uv": [ 0.0, 0.0, 16.0, 1.0 ] }, + "east": { "texture": "#support", "uv": [ 0.0, 0.0, 2.0, 1.0 ] }, + "south": { "texture": "#support", "uv": [ 0.0, 0.0, 16.0, 1.0 ] }, + "west": { "texture": "#support", "uv": [ 0.0, 0.0, 2.0, 1.0 ] }, + "up": { "texture": "#support", "uv": [ 0.0, 0.0, 16.0, 2.0 ] }, + "down": { "texture": "#support", "uv": [ 0.0, 0.0, 16.0, 2.0 ] } + } + }, + { + "name": "Support4", + "from": [ 0.0, 0.0, 10.0 ], + "to": [ 16.0, 1.0, 12.0 ], + "rotationOrigin": [ 0.0, 0.0, 10.0 ], + "faces": { + "north": { "texture": "#support", "uv": [ 0.0, 0.0, 16.0, 1.0 ] }, + "east": { "texture": "#support", "uv": [ 0.0, 0.0, 2.0, 1.0 ] }, + "south": { "texture": "#support", "uv": [ 0.0, 0.0, 16.0, 1.0 ] }, + "west": { "texture": "#support", "uv": [ 0.0, 0.0, 2.0, 1.0 ] }, + "up": { "texture": "#support", "uv": [ 0.0, 0.0, 16.0, 2.0 ] }, + "down": { "texture": "#support", "uv": [ 0.0, 0.0, 16.0, 2.0 ] } + } + }, + { + "name": "Support5", + "from": [ 0.0, 0.0, 13.0 ], + "to": [ 16.0, 1.0, 15.0 ], + "rotationOrigin": [ 0.0, 0.0, 13.0 ], + "faces": { + "north": { "texture": "#support", "uv": [ 0.0, 0.0, 16.0, 1.0 ] }, + "east": { "texture": "#support", "uv": [ 0.0, 0.0, 2.0, 1.0 ] }, + "south": { "texture": "#support", "uv": [ 0.0, 0.0, 16.0, 1.0 ] }, + "west": { "texture": "#support", "uv": [ 0.0, 0.0, 2.0, 1.0 ] }, + "up": { "texture": "#support", "uv": [ 0.0, 0.0, 16.0, 2.0 ] }, + "down": { "texture": "#support", "uv": [ 0.0, 0.0, 16.0, 2.0 ] } + } + } + ]} \ No newline at end of file diff --git a/Automate/assets/automate/shapes/block/rail.json.bak b/Automate/assets/automate/shapes/block/rail.json.bak new file mode 100644 index 0000000..2aab49e --- /dev/null +++ b/Automate/assets/automate/shapes/block/rail.json.bak @@ -0,0 +1,115 @@ +{ + "editor": { + "allAngles": false, + "entityTextureMode": false + }, + "textureWidth": 16, + "textureHeight": 16, + "textureSizes": { + "stainlesssteel": [16,16], + "steel": [16,16] + }, + "textures": { + "stainlesssteel": "block/stainlesssteel", + "steel": "block/steel" + }, + "elements": [ + { + "name": "LeftRail", + "from": [ 2.0, 0.0, 0.0 ], + "to": [ 4.0, 2.0, 16.0 ], + "rotationOrigin": [ 2.0, 0.0, 0.0 ], + "faces": { + "north": { "texture": "#steel", "uv": [ 0.0, 0.0, 2.0, 2.0 ], "autoUv": false }, + "east": { "texture": "#steel", "uv": [ 0.0, 0.0, 16.0, 2.0 ], "autoUv": false }, + "south": { "texture": "#steel", "uv": [ 0.0, 0.0, 2.0, 2.0 ] }, + "west": { "texture": "#steel", "uv": [ 0.0, 0.0, 16.0, 2.0 ] }, + "up": { "texture": "#stainlesssteel", "uv": [ 3.0, 0.0, 5.0, 16.0 ], "windMode": [-1,-1,-1,-1] }, + "down": { "texture": "#steel", "uv": [ 0.0, 0.0, 2.0, 16.0 ] } + } + }, + { + "name": "RightRail", + "from": [ 12.0, 0.0, 0.0 ], + "to": [ 14.0, 2.0, 16.0 ], + "rotationOrigin": [ 12.0, 0.0, 0.0 ], + "faces": { + "north": { "texture": "#steel", "uv": [ 0.0, 0.0, 2.0, 2.0 ] }, + "east": { "texture": "#steel", "uv": [ 0.0, 0.0, 16.0, 2.0 ] }, + "south": { "texture": "#steel", "uv": [ 0.0, 0.0, 2.0, 2.0 ] }, + "west": { "texture": "#steel", "uv": [ 0.0, 0.0, 16.0, 2.0 ] }, + "up": { "texture": "#stainlesssteel", "uv": [ 3.0, 0.0, 5.0, 16.0 ], "windMode": [-1,-1,-1,-1] }, + "down": { "texture": "#steel", "uv": [ 0.0, 0.0, 2.0, 16.0 ] } + } + }, + { + "name": "Support", + "from": [ 0.0, 0.0, 1.0 ], + "to": [ 16.0, 1.0, 3.0 ], + "rotationOrigin": [ 0.0, 0.0, 1.0 ], + "faces": { + "north": { "texture": "#support", "uv": [ 0.0, 0.0, 16.0, 1.0 ] }, + "east": { "texture": "#support", "uv": [ 0.0, 0.0, 2.0, 1.0 ] }, + "south": { "texture": "#support", "uv": [ 0.0, 0.0, 16.0, 1.0 ] }, + "west": { "texture": "#support", "uv": [ 0.0, 0.0, 2.0, 1.0 ] }, + "up": { "texture": "#support", "uv": [ 0.0, 0.0, 16.0, 2.0 ] }, + "down": { "texture": "#support", "uv": [ 0.0, 0.0, 16.0, 2.0 ] } + } + }, + { + "name": "Support2", + "from": [ 0.0, 0.0, 4.0 ], + "to": [ 16.0, 1.0, 6.0 ], + "rotationOrigin": [ 0.0, 0.0, 4.0 ], + "faces": { + "north": { "texture": "#support", "uv": [ 0.0, 0.0, 16.0, 1.0 ] }, + "east": { "texture": "#support", "uv": [ 0.0, 0.0, 2.0, 1.0 ] }, + "south": { "texture": "#support", "uv": [ 0.0, 0.0, 16.0, 1.0 ] }, + "west": { "texture": "#support", "uv": [ 0.0, 0.0, 2.0, 1.0 ] }, + "up": { "texture": "#support", "uv": [ 0.0, 0.0, 16.0, 2.0 ] }, + "down": { "texture": "#support", "uv": [ 0.0, 0.0, 16.0, 2.0 ] } + } + }, + { + "name": "Support3", + "from": [ 0.0, 0.0, 7.0 ], + "to": [ 16.0, 1.0, 9.0 ], + "rotationOrigin": [ 0.0, 0.0, 7.0 ], + "faces": { + "north": { "texture": "#support", "uv": [ 0.0, 0.0, 16.0, 1.0 ] }, + "east": { "texture": "#support", "uv": [ 0.0, 0.0, 2.0, 1.0 ] }, + "south": { "texture": "#support", "uv": [ 0.0, 0.0, 16.0, 1.0 ] }, + "west": { "texture": "#support", "uv": [ 0.0, 0.0, 2.0, 1.0 ] }, + "up": { "texture": "#support", "uv": [ 0.0, 0.0, 16.0, 2.0 ] }, + "down": { "texture": "#support", "uv": [ 0.0, 0.0, 16.0, 2.0 ] } + } + }, + { + "name": "Support4", + "from": [ 0.0, 0.0, 10.0 ], + "to": [ 16.0, 1.0, 12.0 ], + "rotationOrigin": [ 0.0, 0.0, 10.0 ], + "faces": { + "north": { "texture": "#support", "uv": [ 0.0, 0.0, 16.0, 1.0 ] }, + "east": { "texture": "#support", "uv": [ 0.0, 0.0, 2.0, 1.0 ] }, + "south": { "texture": "#support", "uv": [ 0.0, 0.0, 16.0, 1.0 ] }, + "west": { "texture": "#support", "uv": [ 0.0, 0.0, 2.0, 1.0 ] }, + "up": { "texture": "#support", "uv": [ 0.0, 0.0, 16.0, 2.0 ] }, + "down": { "texture": "#support", "uv": [ 0.0, 0.0, 16.0, 2.0 ] } + } + }, + { + "name": "Support5", + "from": [ 0.0, 0.0, 13.0 ], + "to": [ 16.0, 1.0, 15.0 ], + "rotationOrigin": [ 0.0, 0.0, 13.0 ], + "faces": { + "north": { "texture": "#support", "uv": [ 0.0, 0.0, 16.0, 1.0 ] }, + "east": { "texture": "#support", "uv": [ 0.0, 0.0, 2.0, 1.0 ] }, + "south": { "texture": "#support", "uv": [ 0.0, 0.0, 16.0, 1.0 ] }, + "west": { "texture": "#support", "uv": [ 0.0, 0.0, 2.0, 1.0 ] }, + "up": { "texture": "#support", "uv": [ 0.0, 0.0, 16.0, 2.0 ] }, + "down": { "texture": "#support", "uv": [ 0.0, 0.0, 16.0, 2.0 ] } + } + } + ]} \ No newline at end of file diff --git a/Automate/assets/automate/shapes/block/water_chamber.json b/Automate/assets/automate/shapes/block/water_chamber.json new file mode 100644 index 0000000..baf9df4 --- /dev/null +++ b/Automate/assets/automate/shapes/block/water_chamber.json @@ -0,0 +1,164 @@ +{ + "editor": { + "allAngles": false, + "entityTextureMode": false + }, + "textureWidth": 16, + "textureHeight": 16, + "textureSizes": { + "leaded": [16,16], + "copper": [16,16] + }, + "textures": { + "copper": "block/copper", + "leaded": "block/leaded" + }, + "elements": [ + { + "name": "Bottom", + "from": [ 0.0, 0.0, 0.0 ], + "to": [ 16.0, 1.0, 16.0 ], + "faces": { + "north": { "texture": "#copper", "uv": [ 0.0, 0.0, 16.0, 1.0 ] }, + "east": { "texture": "#copper", "uv": [ 0.0, 0.0, 16.0, 1.0 ], "autoUv": false }, + "south": { "texture": "#copper", "uv": [ 0.0, 0.0, 16.0, 1.0 ] }, + "west": { "texture": "#copper", "uv": [ 0.0, 0.0, 16.0, 1.0 ] }, + "up": { "texture": "#copper", "uv": [ 0.0, 0.0, 16.0, 16.0 ] }, + "down": { "texture": "#copper", "uv": [ 0.0, 0.0, 16.0, 16.0 ] } + } + }, + { + "name": "Top", + "from": [ 0.0, 15.0, 0.0 ], + "to": [ 16.0, 16.0, 16.0 ], + "rotationOrigin": [ 0.0, 15.0, 0.0 ], + "faces": { + "north": { "texture": "#copper", "uv": [ 0.0, 0.0, 16.0, 1.0 ] }, + "east": { "texture": "#copper", "uv": [ 0.0, 0.0, 16.0, 1.0 ] }, + "south": { "texture": "#copper", "uv": [ 0.0, 0.0, 16.0, 1.0 ] }, + "west": { "texture": "#copper", "uv": [ 0.0, 0.0, 16.0, 1.0 ] }, + "up": { "texture": "#copper", "uv": [ 0.0, 0.0, 16.0, 16.0 ] }, + "down": { "texture": "#copper", "uv": [ 0.0, 0.0, 16.0, 16.0 ] } + } + }, + { + "name": "Pillar1", + "from": [ 0.0, 1.0, 0.0 ], + "to": [ 2.0, 15.0, 2.0 ], + "rotationOrigin": [ 0.0, 1.0, 0.0 ], + "faces": { + "north": { "texture": "#copper", "uv": [ 0.0, 0.0, 2.0, 14.0 ] }, + "east": { "texture": "#copper", "uv": [ 0.0, 0.0, 2.0, 14.0 ] }, + "south": { "texture": "#copper", "uv": [ 0.0, 0.0, 2.0, 14.0 ] }, + "west": { "texture": "#copper", "uv": [ 0.0, 0.0, 2.0, 14.0 ] }, + "up": { "texture": "#copper", "uv": [ 0.0, 0.0, 2.0, 2.0 ] }, + "down": { "texture": "#copper", "uv": [ 0.0, 0.0, 2.0, 2.0 ] } + }, + "children": [ + { + "name": "Pillar2", + "from": [ 14.0, 0.0, 0.0 ], + "to": [ 16.0, 14.0, 2.0 ], + "rotationOrigin": [ 14.0, 0.0, 0.0 ], + "faces": { + "north": { "texture": "#copper", "uv": [ 0.0, 0.0, 2.0, 14.0 ] }, + "east": { "texture": "#copper", "uv": [ 0.0, 0.0, 2.0, 14.0 ] }, + "south": { "texture": "#copper", "uv": [ 0.0, 0.0, 2.0, 14.0 ] }, + "west": { "texture": "#copper", "uv": [ 0.0, 0.0, 2.0, 14.0 ] }, + "up": { "texture": "#copper", "uv": [ 0.0, 0.0, 2.0, 2.0 ] }, + "down": { "texture": "#copper", "uv": [ 0.0, 0.0, 2.0, 2.0 ] } + } + }, + { + "name": "Pillar3", + "from": [ 0.0, 0.0, 14.0 ], + "to": [ 2.0, 14.0, 16.0 ], + "rotationOrigin": [ 0.0, 0.0, 14.0 ], + "faces": { + "north": { "texture": "#copper", "uv": [ 0.0, 0.0, 2.0, 14.0 ] }, + "east": { "texture": "#copper", "uv": [ 0.0, 0.0, 2.0, 14.0 ] }, + "south": { "texture": "#copper", "uv": [ 0.0, 0.0, 2.0, 14.0 ] }, + "west": { "texture": "#copper", "uv": [ 0.0, 0.0, 2.0, 14.0 ] }, + "up": { "texture": "#copper", "uv": [ 0.0, 0.0, 2.0, 2.0 ] }, + "down": { "texture": "#copper", "uv": [ 0.0, 0.0, 2.0, 2.0 ] } + } + }, + { + "name": "Pillar4", + "from": [ 14.0, 0.0, 14.0 ], + "to": [ 16.0, 14.0, 16.0 ], + "rotationOrigin": [ 14.0, 0.0, 14.0 ], + "faces": { + "north": { "texture": "#copper", "uv": [ 0.0, 0.0, 2.0, 14.0 ] }, + "east": { "texture": "#copper", "uv": [ 0.0, 0.0, 2.0, 14.0 ] }, + "south": { "texture": "#copper", "uv": [ 0.0, 0.0, 2.0, 14.0 ] }, + "west": { "texture": "#copper", "uv": [ 0.0, 0.0, 2.0, 14.0 ] }, + "up": { "texture": "#copper", "uv": [ 0.0, 0.0, 2.0, 2.0 ] }, + "down": { "texture": "#copper", "uv": [ 0.0, 0.0, 2.0, 2.0 ] } + } + } + ] + }, + { + "name": "Glass1", + "from": [ 1.0, 1.0, 2.0 ], + "to": [ 2.0, 15.0, 14.0 ], + "renderPass": 3, + "rotationOrigin": [ 1.0, 1.0, 2.0 ], + "faces": { + "north": { "texture": "#leaded", "uv": [ 1.0, 7.5, 15.0, 8.5 ], "rotation": 90 }, + "east": { "texture": "#leaded", "uv": [ 0.0, 0.0, 12.0, 14.0 ] }, + "south": { "texture": "#leaded", "uv": [ 0.0, 0.0, 1.0, 14.0 ] }, + "west": { "texture": "#leaded", "uv": [ 0.0, 0.0, 12.0, 14.0 ] }, + "up": { "texture": "#leaded", "uv": [ 0.0, 0.0, 1.0, 12.0 ] }, + "down": { "texture": "#leaded", "uv": [ 0.0, 0.0, 1.0, 12.0 ] } + }, + "children": [ + { + "name": "Glass2", + "from": [ 1.0, 0.0, -1.0 ], + "to": [ 13.0, 14.0, 0.0 ], + "renderPass": 3, + "rotationOrigin": [ 1.0, 0.0, -1.0 ], + "faces": { + "north": { "texture": "#leaded", "uv": [ 0.0, 0.0, 12.0, 14.0 ] }, + "east": { "texture": "#leaded", "uv": [ 0.0, 0.0, 1.0, 14.0 ] }, + "south": { "texture": "#leaded", "uv": [ 0.0, 0.0, 12.0, 14.0 ] }, + "west": { "texture": "#leaded", "uv": [ 0.0, 0.0, 1.0, 14.0 ] }, + "up": { "texture": "#leaded", "uv": [ 0.0, 0.0, 12.0, 1.0 ] }, + "down": { "texture": "#leaded", "uv": [ 0.0, 0.0, 12.0, 1.0 ] } + } + }, + { + "name": "Glass3", + "from": [ 13.0, 0.0, 0.0 ], + "to": [ 14.0, 14.0, 12.0 ], + "renderPass": 3, + "rotationOrigin": [ 13.0, 0.0, 0.0 ], + "faces": { + "north": { "texture": "#leaded", "uv": [ 0.0, 0.0, 1.0, 14.0 ] }, + "east": { "texture": "#leaded", "uv": [ 0.0, 0.0, 12.0, 14.0 ] }, + "south": { "texture": "#leaded", "uv": [ 0.0, 0.0, 1.0, 14.0 ] }, + "west": { "texture": "#leaded", "uv": [ 0.0, 0.0, 12.0, 14.0 ] }, + "up": { "texture": "#leaded", "uv": [ 0.0, 0.0, 1.0, 12.0 ] }, + "down": { "texture": "#leaded", "uv": [ 0.0, 0.0, 1.0, 12.0 ] } + } + }, + { + "name": "Glass4", + "from": [ 1.0, 0.0, 12.0 ], + "to": [ 13.0, 14.0, 13.0 ], + "renderPass": 3, + "rotationOrigin": [ 1.0, 0.0, 12.0 ], + "faces": { + "north": { "texture": "#leaded", "uv": [ 0.0, 0.0, 12.0, 14.0 ] }, + "east": { "texture": "#leaded", "uv": [ 0.0, 0.0, 1.0, 14.0 ] }, + "south": { "texture": "#leaded", "uv": [ 0.0, 0.0, 12.0, 14.0 ] }, + "west": { "texture": "#leaded", "uv": [ 0.0, 0.0, 1.0, 14.0 ] }, + "up": { "texture": "#leaded", "uv": [ 0.0, 0.0, 12.0, 1.0 ] }, + "down": { "texture": "#leaded", "uv": [ 0.0, 0.0, 12.0, 1.0 ] } + } + } + ] + } + ]} \ No newline at end of file diff --git a/Automate/assets/automate/shapes/item/railbar.json b/Automate/assets/automate/shapes/item/railbar.json new file mode 100644 index 0000000..2a2f008 --- /dev/null +++ b/Automate/assets/automate/shapes/item/railbar.json @@ -0,0 +1,27 @@ +{ + "editor": { + "allAngles": false, + "entityTextureMode": false + }, + "textureWidth": 16, + "textureHeight": 16, + "textureSizes": { + }, + "textures": { + }, + "elements": [ + { + "name": "Bar", + "from": [ 0.0, 0.0, 7.0 ], + "to": [ 16.0, 1.0, 8.0 ], + "rotationOrigin": [ 0.0, 0.0, 7.0 ], + "faces": { + "north": { "texture": "#null", "uv": [ 0.0, 0.0, 16.0, 1.0 ] }, + "east": { "texture": "#null", "uv": [ 0.0, 0.0, 1.0, 1.0 ] }, + "south": { "texture": "#null", "uv": [ 0.0, 0.0, 16.0, 1.0 ] }, + "west": { "texture": "#null", "uv": [ 0.0, 0.0, 1.0, 1.0 ] }, + "up": { "texture": "#null", "uv": [ 0.0, 0.0, 16.0, 1.0 ] }, + "down": { "texture": "#null", "uv": [ 0.0, 0.0, 16.0, 1.0 ] } + } + } + ]} \ No newline at end of file diff --git a/Automate/assets/automate/textures/block/copper.png b/Automate/assets/automate/textures/block/copper.png new file mode 100644 index 0000000..cee84f8 Binary files /dev/null and b/Automate/assets/automate/textures/block/copper.png differ diff --git a/Automate/assets/automate/textures/block/leaded.png b/Automate/assets/automate/textures/block/leaded.png new file mode 100644 index 0000000..46a2477 Binary files /dev/null and b/Automate/assets/automate/textures/block/leaded.png differ diff --git a/Automate/assets/automate/textures/block/rock/andesite1.png b/Automate/assets/automate/textures/block/rock/andesite1.png new file mode 100644 index 0000000..05c9b0e Binary files /dev/null and b/Automate/assets/automate/textures/block/rock/andesite1.png differ diff --git a/Automate/assets/automate/textures/block/rock/andesite2.png b/Automate/assets/automate/textures/block/rock/andesite2.png new file mode 100644 index 0000000..f889c31 Binary files /dev/null and b/Automate/assets/automate/textures/block/rock/andesite2.png differ diff --git a/Automate/assets/automate/textures/block/rock/andesite3.png b/Automate/assets/automate/textures/block/rock/andesite3.png new file mode 100644 index 0000000..2c0f75b Binary files /dev/null and b/Automate/assets/automate/textures/block/rock/andesite3.png differ diff --git a/Automate/assets/automate/textures/block/rock/andesite4.png b/Automate/assets/automate/textures/block/rock/andesite4.png new file mode 100644 index 0000000..cd0957f Binary files /dev/null and b/Automate/assets/automate/textures/block/rock/andesite4.png differ diff --git a/Automate/assets/automate/textures/block/rock/basalt1.png b/Automate/assets/automate/textures/block/rock/basalt1.png new file mode 100644 index 0000000..d13896a Binary files /dev/null and b/Automate/assets/automate/textures/block/rock/basalt1.png differ diff --git a/Automate/assets/automate/textures/block/rock/basalt2.png b/Automate/assets/automate/textures/block/rock/basalt2.png new file mode 100644 index 0000000..bd7b1fd Binary files /dev/null and b/Automate/assets/automate/textures/block/rock/basalt2.png differ diff --git a/Automate/assets/automate/textures/block/rock/basalt3.png b/Automate/assets/automate/textures/block/rock/basalt3.png new file mode 100644 index 0000000..953894b Binary files /dev/null and b/Automate/assets/automate/textures/block/rock/basalt3.png differ diff --git a/Automate/assets/automate/textures/block/rock/basalt4.png b/Automate/assets/automate/textures/block/rock/basalt4.png new file mode 100644 index 0000000..1b844ad Binary files /dev/null and b/Automate/assets/automate/textures/block/rock/basalt4.png differ diff --git a/Automate/assets/automate/textures/block/rock/bauxite1.png b/Automate/assets/automate/textures/block/rock/bauxite1.png new file mode 100644 index 0000000..8851d5a Binary files /dev/null and b/Automate/assets/automate/textures/block/rock/bauxite1.png differ diff --git a/Automate/assets/automate/textures/block/rock/bauxite2.png b/Automate/assets/automate/textures/block/rock/bauxite2.png new file mode 100644 index 0000000..7b1f48f Binary files /dev/null and b/Automate/assets/automate/textures/block/rock/bauxite2.png differ diff --git a/Automate/assets/automate/textures/block/rock/bauxite3.png b/Automate/assets/automate/textures/block/rock/bauxite3.png new file mode 100644 index 0000000..92f7ed4 Binary files /dev/null and b/Automate/assets/automate/textures/block/rock/bauxite3.png differ diff --git a/Automate/assets/automate/textures/block/rock/bauxite4.png b/Automate/assets/automate/textures/block/rock/bauxite4.png new file mode 100644 index 0000000..a2699c1 Binary files /dev/null and b/Automate/assets/automate/textures/block/rock/bauxite4.png differ diff --git a/Automate/assets/automate/textures/block/rock/chalk1.png b/Automate/assets/automate/textures/block/rock/chalk1.png new file mode 100644 index 0000000..56675ff Binary files /dev/null and b/Automate/assets/automate/textures/block/rock/chalk1.png differ diff --git a/Automate/assets/automate/textures/block/rock/chalk2.png b/Automate/assets/automate/textures/block/rock/chalk2.png new file mode 100644 index 0000000..1cc5373 Binary files /dev/null and b/Automate/assets/automate/textures/block/rock/chalk2.png differ diff --git a/Automate/assets/automate/textures/block/rock/chalk3.png b/Automate/assets/automate/textures/block/rock/chalk3.png new file mode 100644 index 0000000..340939a Binary files /dev/null and b/Automate/assets/automate/textures/block/rock/chalk3.png differ diff --git a/Automate/assets/automate/textures/block/rock/chalk4.png b/Automate/assets/automate/textures/block/rock/chalk4.png new file mode 100644 index 0000000..98619d1 Binary files /dev/null and b/Automate/assets/automate/textures/block/rock/chalk4.png differ diff --git a/Automate/assets/automate/textures/block/rock/chert1.png b/Automate/assets/automate/textures/block/rock/chert1.png new file mode 100644 index 0000000..7973593 Binary files /dev/null and b/Automate/assets/automate/textures/block/rock/chert1.png differ diff --git a/Automate/assets/automate/textures/block/rock/chert2.png b/Automate/assets/automate/textures/block/rock/chert2.png new file mode 100644 index 0000000..0a918e5 Binary files /dev/null and b/Automate/assets/automate/textures/block/rock/chert2.png differ diff --git a/Automate/assets/automate/textures/block/rock/chert3.png b/Automate/assets/automate/textures/block/rock/chert3.png new file mode 100644 index 0000000..7709a23 Binary files /dev/null and b/Automate/assets/automate/textures/block/rock/chert3.png differ diff --git a/Automate/assets/automate/textures/block/rock/chert4.png b/Automate/assets/automate/textures/block/rock/chert4.png new file mode 100644 index 0000000..2fbd2d1 Binary files /dev/null and b/Automate/assets/automate/textures/block/rock/chert4.png differ diff --git a/Automate/assets/automate/textures/block/rock/claystone1.png b/Automate/assets/automate/textures/block/rock/claystone1.png new file mode 100644 index 0000000..425d15e Binary files /dev/null and b/Automate/assets/automate/textures/block/rock/claystone1.png differ diff --git a/Automate/assets/automate/textures/block/rock/claystone2.png b/Automate/assets/automate/textures/block/rock/claystone2.png new file mode 100644 index 0000000..831a136 Binary files /dev/null and b/Automate/assets/automate/textures/block/rock/claystone2.png differ diff --git a/Automate/assets/automate/textures/block/rock/claystone3.png b/Automate/assets/automate/textures/block/rock/claystone3.png new file mode 100644 index 0000000..52d1202 Binary files /dev/null and b/Automate/assets/automate/textures/block/rock/claystone3.png differ diff --git a/Automate/assets/automate/textures/block/rock/claystone4.png b/Automate/assets/automate/textures/block/rock/claystone4.png new file mode 100644 index 0000000..f5fa538 Binary files /dev/null and b/Automate/assets/automate/textures/block/rock/claystone4.png differ diff --git a/Automate/assets/automate/textures/block/rock/conglomerate1.png b/Automate/assets/automate/textures/block/rock/conglomerate1.png new file mode 100644 index 0000000..772281c Binary files /dev/null and b/Automate/assets/automate/textures/block/rock/conglomerate1.png differ diff --git a/Automate/assets/automate/textures/block/rock/conglomerate2.png b/Automate/assets/automate/textures/block/rock/conglomerate2.png new file mode 100644 index 0000000..3314fe5 Binary files /dev/null and b/Automate/assets/automate/textures/block/rock/conglomerate2.png differ diff --git a/Automate/assets/automate/textures/block/rock/conglomerate3.png b/Automate/assets/automate/textures/block/rock/conglomerate3.png new file mode 100644 index 0000000..861af91 Binary files /dev/null and b/Automate/assets/automate/textures/block/rock/conglomerate3.png differ diff --git a/Automate/assets/automate/textures/block/rock/conglomerate4.png b/Automate/assets/automate/textures/block/rock/conglomerate4.png new file mode 100644 index 0000000..7684cfb Binary files /dev/null and b/Automate/assets/automate/textures/block/rock/conglomerate4.png differ diff --git a/Automate/assets/automate/textures/block/rock/granite1.png b/Automate/assets/automate/textures/block/rock/granite1.png new file mode 100644 index 0000000..8d8953a Binary files /dev/null and b/Automate/assets/automate/textures/block/rock/granite1.png differ diff --git a/Automate/assets/automate/textures/block/rock/granite2.png b/Automate/assets/automate/textures/block/rock/granite2.png new file mode 100644 index 0000000..828f2ca Binary files /dev/null and b/Automate/assets/automate/textures/block/rock/granite2.png differ diff --git a/Automate/assets/automate/textures/block/rock/granite3.png b/Automate/assets/automate/textures/block/rock/granite3.png new file mode 100644 index 0000000..66cd855 Binary files /dev/null and b/Automate/assets/automate/textures/block/rock/granite3.png differ diff --git a/Automate/assets/automate/textures/block/rock/granite4.png b/Automate/assets/automate/textures/block/rock/granite4.png new file mode 100644 index 0000000..5f374ea Binary files /dev/null and b/Automate/assets/automate/textures/block/rock/granite4.png differ diff --git a/Automate/assets/automate/textures/block/rock/greenmarble1.png b/Automate/assets/automate/textures/block/rock/greenmarble1.png new file mode 100644 index 0000000..47b3288 Binary files /dev/null and b/Automate/assets/automate/textures/block/rock/greenmarble1.png differ diff --git a/Automate/assets/automate/textures/block/rock/greenmarble2.png b/Automate/assets/automate/textures/block/rock/greenmarble2.png new file mode 100644 index 0000000..2798cda Binary files /dev/null and b/Automate/assets/automate/textures/block/rock/greenmarble2.png differ diff --git a/Automate/assets/automate/textures/block/rock/greenmarble3.png b/Automate/assets/automate/textures/block/rock/greenmarble3.png new file mode 100644 index 0000000..76b9d3d Binary files /dev/null and b/Automate/assets/automate/textures/block/rock/greenmarble3.png differ diff --git a/Automate/assets/automate/textures/block/rock/greenmarble4.png b/Automate/assets/automate/textures/block/rock/greenmarble4.png new file mode 100644 index 0000000..3773373 Binary files /dev/null and b/Automate/assets/automate/textures/block/rock/greenmarble4.png differ diff --git a/Automate/assets/automate/textures/block/rock/halite1.png b/Automate/assets/automate/textures/block/rock/halite1.png new file mode 100644 index 0000000..2b4017a Binary files /dev/null and b/Automate/assets/automate/textures/block/rock/halite1.png differ diff --git a/Automate/assets/automate/textures/block/rock/halite2.png b/Automate/assets/automate/textures/block/rock/halite2.png new file mode 100644 index 0000000..6976cab Binary files /dev/null and b/Automate/assets/automate/textures/block/rock/halite2.png differ diff --git a/Automate/assets/automate/textures/block/rock/halite3.png b/Automate/assets/automate/textures/block/rock/halite3.png new file mode 100644 index 0000000..59b0a27 Binary files /dev/null and b/Automate/assets/automate/textures/block/rock/halite3.png differ diff --git a/Automate/assets/automate/textures/block/rock/halite4.png b/Automate/assets/automate/textures/block/rock/halite4.png new file mode 100644 index 0000000..b406db9 Binary files /dev/null and b/Automate/assets/automate/textures/block/rock/halite4.png differ diff --git a/Automate/assets/automate/textures/block/rock/kimberlite1.png b/Automate/assets/automate/textures/block/rock/kimberlite1.png new file mode 100644 index 0000000..5fe33fb Binary files /dev/null and b/Automate/assets/automate/textures/block/rock/kimberlite1.png differ diff --git a/Automate/assets/automate/textures/block/rock/limestone1.png b/Automate/assets/automate/textures/block/rock/limestone1.png new file mode 100644 index 0000000..f460cd8 Binary files /dev/null and b/Automate/assets/automate/textures/block/rock/limestone1.png differ diff --git a/Automate/assets/automate/textures/block/rock/limestone2.png b/Automate/assets/automate/textures/block/rock/limestone2.png new file mode 100644 index 0000000..a3ff343 Binary files /dev/null and b/Automate/assets/automate/textures/block/rock/limestone2.png differ diff --git a/Automate/assets/automate/textures/block/rock/limestone3.png b/Automate/assets/automate/textures/block/rock/limestone3.png new file mode 100644 index 0000000..191d1a3 Binary files /dev/null and b/Automate/assets/automate/textures/block/rock/limestone3.png differ diff --git a/Automate/assets/automate/textures/block/rock/limestone4.png b/Automate/assets/automate/textures/block/rock/limestone4.png new file mode 100644 index 0000000..e79b3e4 Binary files /dev/null and b/Automate/assets/automate/textures/block/rock/limestone4.png differ diff --git a/Automate/assets/automate/textures/block/rock/meteorite-iron1.png b/Automate/assets/automate/textures/block/rock/meteorite-iron1.png new file mode 100644 index 0000000..902f6d1 Binary files /dev/null and b/Automate/assets/automate/textures/block/rock/meteorite-iron1.png differ diff --git a/Automate/assets/automate/textures/block/rock/meteorite-iron2.png b/Automate/assets/automate/textures/block/rock/meteorite-iron2.png new file mode 100644 index 0000000..a79d69a Binary files /dev/null and b/Automate/assets/automate/textures/block/rock/meteorite-iron2.png differ diff --git a/Automate/assets/automate/textures/block/rock/meteorite-iron3.png b/Automate/assets/automate/textures/block/rock/meteorite-iron3.png new file mode 100644 index 0000000..1df9685 Binary files /dev/null and b/Automate/assets/automate/textures/block/rock/meteorite-iron3.png differ diff --git a/Automate/assets/automate/textures/block/rock/meteorite-iron4.png b/Automate/assets/automate/textures/block/rock/meteorite-iron4.png new file mode 100644 index 0000000..2d8627d Binary files /dev/null and b/Automate/assets/automate/textures/block/rock/meteorite-iron4.png differ diff --git a/Automate/assets/automate/textures/block/rock/obsidian1.png b/Automate/assets/automate/textures/block/rock/obsidian1.png new file mode 100644 index 0000000..270aecf Binary files /dev/null and b/Automate/assets/automate/textures/block/rock/obsidian1.png differ diff --git a/Automate/assets/automate/textures/block/rock/peridotite1.png b/Automate/assets/automate/textures/block/rock/peridotite1.png new file mode 100644 index 0000000..d65404d Binary files /dev/null and b/Automate/assets/automate/textures/block/rock/peridotite1.png differ diff --git a/Automate/assets/automate/textures/block/rock/peridotite2.png b/Automate/assets/automate/textures/block/rock/peridotite2.png new file mode 100644 index 0000000..5068b53 Binary files /dev/null and b/Automate/assets/automate/textures/block/rock/peridotite2.png differ diff --git a/Automate/assets/automate/textures/block/rock/peridotite3.png b/Automate/assets/automate/textures/block/rock/peridotite3.png new file mode 100644 index 0000000..8838452 Binary files /dev/null and b/Automate/assets/automate/textures/block/rock/peridotite3.png differ diff --git a/Automate/assets/automate/textures/block/rock/peridotite4.png b/Automate/assets/automate/textures/block/rock/peridotite4.png new file mode 100644 index 0000000..58b26c9 Binary files /dev/null and b/Automate/assets/automate/textures/block/rock/peridotite4.png differ diff --git a/Automate/assets/automate/textures/block/rock/phyllite1.png b/Automate/assets/automate/textures/block/rock/phyllite1.png new file mode 100644 index 0000000..9c30c98 Binary files /dev/null and b/Automate/assets/automate/textures/block/rock/phyllite1.png differ diff --git a/Automate/assets/automate/textures/block/rock/phyllite2.png b/Automate/assets/automate/textures/block/rock/phyllite2.png new file mode 100644 index 0000000..e5b48d6 Binary files /dev/null and b/Automate/assets/automate/textures/block/rock/phyllite2.png differ diff --git a/Automate/assets/automate/textures/block/rock/phyllite3.png b/Automate/assets/automate/textures/block/rock/phyllite3.png new file mode 100644 index 0000000..0d7fab4 Binary files /dev/null and b/Automate/assets/automate/textures/block/rock/phyllite3.png differ diff --git a/Automate/assets/automate/textures/block/rock/phyllite4.png b/Automate/assets/automate/textures/block/rock/phyllite4.png new file mode 100644 index 0000000..599b73d Binary files /dev/null and b/Automate/assets/automate/textures/block/rock/phyllite4.png differ diff --git a/Automate/assets/automate/textures/block/rock/redmarble1.png b/Automate/assets/automate/textures/block/rock/redmarble1.png new file mode 100644 index 0000000..849dfb3 Binary files /dev/null and b/Automate/assets/automate/textures/block/rock/redmarble1.png differ diff --git a/Automate/assets/automate/textures/block/rock/redmarble2.png b/Automate/assets/automate/textures/block/rock/redmarble2.png new file mode 100644 index 0000000..0ce61b8 Binary files /dev/null and b/Automate/assets/automate/textures/block/rock/redmarble2.png differ diff --git a/Automate/assets/automate/textures/block/rock/redmarble3.png b/Automate/assets/automate/textures/block/rock/redmarble3.png new file mode 100644 index 0000000..998483d Binary files /dev/null and b/Automate/assets/automate/textures/block/rock/redmarble3.png differ diff --git a/Automate/assets/automate/textures/block/rock/redmarble4.png b/Automate/assets/automate/textures/block/rock/redmarble4.png new file mode 100644 index 0000000..62a07bc Binary files /dev/null and b/Automate/assets/automate/textures/block/rock/redmarble4.png differ diff --git a/Automate/assets/automate/textures/block/rock/sandstone1.png b/Automate/assets/automate/textures/block/rock/sandstone1.png new file mode 100644 index 0000000..7c948c1 Binary files /dev/null and b/Automate/assets/automate/textures/block/rock/sandstone1.png differ diff --git a/Automate/assets/automate/textures/block/rock/sandstone2.png b/Automate/assets/automate/textures/block/rock/sandstone2.png new file mode 100644 index 0000000..597d48a Binary files /dev/null and b/Automate/assets/automate/textures/block/rock/sandstone2.png differ diff --git a/Automate/assets/automate/textures/block/rock/sandstone3.png b/Automate/assets/automate/textures/block/rock/sandstone3.png new file mode 100644 index 0000000..8ea7ea6 Binary files /dev/null and b/Automate/assets/automate/textures/block/rock/sandstone3.png differ diff --git a/Automate/assets/automate/textures/block/rock/sandstone4.png b/Automate/assets/automate/textures/block/rock/sandstone4.png new file mode 100644 index 0000000..3725f55 Binary files /dev/null and b/Automate/assets/automate/textures/block/rock/sandstone4.png differ diff --git a/Automate/assets/automate/textures/block/rock/scoria1.png b/Automate/assets/automate/textures/block/rock/scoria1.png new file mode 100644 index 0000000..eeae402 Binary files /dev/null and b/Automate/assets/automate/textures/block/rock/scoria1.png differ diff --git a/Automate/assets/automate/textures/block/rock/scoria2.png b/Automate/assets/automate/textures/block/rock/scoria2.png new file mode 100644 index 0000000..38d670b Binary files /dev/null and b/Automate/assets/automate/textures/block/rock/scoria2.png differ diff --git a/Automate/assets/automate/textures/block/rock/scoria3.png b/Automate/assets/automate/textures/block/rock/scoria3.png new file mode 100644 index 0000000..59b544c Binary files /dev/null and b/Automate/assets/automate/textures/block/rock/scoria3.png differ diff --git a/Automate/assets/automate/textures/block/rock/scoria4.png b/Automate/assets/automate/textures/block/rock/scoria4.png new file mode 100644 index 0000000..03d19e3 Binary files /dev/null and b/Automate/assets/automate/textures/block/rock/scoria4.png differ diff --git a/Automate/assets/automate/textures/block/rock/shale1.png b/Automate/assets/automate/textures/block/rock/shale1.png new file mode 100644 index 0000000..3153fb1 Binary files /dev/null and b/Automate/assets/automate/textures/block/rock/shale1.png differ diff --git a/Automate/assets/automate/textures/block/rock/shale2.png b/Automate/assets/automate/textures/block/rock/shale2.png new file mode 100644 index 0000000..f96e4c4 Binary files /dev/null and b/Automate/assets/automate/textures/block/rock/shale2.png differ diff --git a/Automate/assets/automate/textures/block/rock/shale3.png b/Automate/assets/automate/textures/block/rock/shale3.png new file mode 100644 index 0000000..aadd84c Binary files /dev/null and b/Automate/assets/automate/textures/block/rock/shale3.png differ diff --git a/Automate/assets/automate/textures/block/rock/shale4.png b/Automate/assets/automate/textures/block/rock/shale4.png new file mode 100644 index 0000000..4db2707 Binary files /dev/null and b/Automate/assets/automate/textures/block/rock/shale4.png differ diff --git a/Automate/assets/automate/textures/block/rock/slate1.png b/Automate/assets/automate/textures/block/rock/slate1.png new file mode 100644 index 0000000..b05651d Binary files /dev/null and b/Automate/assets/automate/textures/block/rock/slate1.png differ diff --git a/Automate/assets/automate/textures/block/rock/slate2.png b/Automate/assets/automate/textures/block/rock/slate2.png new file mode 100644 index 0000000..434e96b Binary files /dev/null and b/Automate/assets/automate/textures/block/rock/slate2.png differ diff --git a/Automate/assets/automate/textures/block/rock/slate3.png b/Automate/assets/automate/textures/block/rock/slate3.png new file mode 100644 index 0000000..e26d77a Binary files /dev/null and b/Automate/assets/automate/textures/block/rock/slate3.png differ diff --git a/Automate/assets/automate/textures/block/rock/slate4.png b/Automate/assets/automate/textures/block/rock/slate4.png new file mode 100644 index 0000000..b88a45a Binary files /dev/null and b/Automate/assets/automate/textures/block/rock/slate4.png differ diff --git a/Automate/assets/automate/textures/block/rock/suevite1.png b/Automate/assets/automate/textures/block/rock/suevite1.png new file mode 100644 index 0000000..92cf5b9 Binary files /dev/null and b/Automate/assets/automate/textures/block/rock/suevite1.png differ diff --git a/Automate/assets/automate/textures/block/rock/suevite2.png b/Automate/assets/automate/textures/block/rock/suevite2.png new file mode 100644 index 0000000..7965c2d Binary files /dev/null and b/Automate/assets/automate/textures/block/rock/suevite2.png differ diff --git a/Automate/assets/automate/textures/block/rock/sulfur1.png b/Automate/assets/automate/textures/block/rock/sulfur1.png new file mode 100644 index 0000000..3cb763a Binary files /dev/null and b/Automate/assets/automate/textures/block/rock/sulfur1.png differ diff --git a/Automate/assets/automate/textures/block/rock/tuff1.png b/Automate/assets/automate/textures/block/rock/tuff1.png new file mode 100644 index 0000000..1b38382 Binary files /dev/null and b/Automate/assets/automate/textures/block/rock/tuff1.png differ diff --git a/Automate/assets/automate/textures/block/rock/tuff2.png b/Automate/assets/automate/textures/block/rock/tuff2.png new file mode 100644 index 0000000..1d70080 Binary files /dev/null and b/Automate/assets/automate/textures/block/rock/tuff2.png differ diff --git a/Automate/assets/automate/textures/block/rock/tuff3.png b/Automate/assets/automate/textures/block/rock/tuff3.png new file mode 100644 index 0000000..61945b5 Binary files /dev/null and b/Automate/assets/automate/textures/block/rock/tuff3.png differ diff --git a/Automate/assets/automate/textures/block/rock/tuff4.png b/Automate/assets/automate/textures/block/rock/tuff4.png new file mode 100644 index 0000000..cc4b148 Binary files /dev/null and b/Automate/assets/automate/textures/block/rock/tuff4.png differ diff --git a/Automate/assets/automate/textures/block/rock/whitemarble1.png b/Automate/assets/automate/textures/block/rock/whitemarble1.png new file mode 100644 index 0000000..804a8e7 Binary files /dev/null and b/Automate/assets/automate/textures/block/rock/whitemarble1.png differ diff --git a/Automate/assets/automate/textures/block/rock/whitemarble2.png b/Automate/assets/automate/textures/block/rock/whitemarble2.png new file mode 100644 index 0000000..51c7bde Binary files /dev/null and b/Automate/assets/automate/textures/block/rock/whitemarble2.png differ diff --git a/Automate/assets/automate/textures/block/rock/whitemarble3.png b/Automate/assets/automate/textures/block/rock/whitemarble3.png new file mode 100644 index 0000000..8cc98f8 Binary files /dev/null and b/Automate/assets/automate/textures/block/rock/whitemarble3.png differ diff --git a/Automate/assets/automate/textures/block/rock/whitemarble4.png b/Automate/assets/automate/textures/block/rock/whitemarble4.png new file mode 100644 index 0000000..8dcd927 Binary files /dev/null and b/Automate/assets/automate/textures/block/rock/whitemarble4.png differ diff --git a/Automate/assets/automate/textures/block/shinygoldtexture.png b/Automate/assets/automate/textures/block/shinygoldtexture.png new file mode 100644 index 0000000..264d117 Binary files /dev/null and b/Automate/assets/automate/textures/block/shinygoldtexture.png differ diff --git a/Automate/assets/automate/textures/block/stainlesssteel.png b/Automate/assets/automate/textures/block/stainlesssteel.png new file mode 100644 index 0000000..74d5893 Binary files /dev/null and b/Automate/assets/automate/textures/block/stainlesssteel.png differ diff --git a/Automate/assets/automate/textures/block/steel.png b/Automate/assets/automate/textures/block/steel.png new file mode 100644 index 0000000..c23e89d Binary files /dev/null and b/Automate/assets/automate/textures/block/steel.png differ diff --git a/Automate/assets/automate/textures/item/simplewand.png b/Automate/assets/automate/textures/item/simplewand.png new file mode 100644 index 0000000..f8e899d Binary files /dev/null and b/Automate/assets/automate/textures/item/simplewand.png differ diff --git a/Automate/modinfo.json b/Automate/modinfo.json new file mode 100644 index 0000000..eccad53 --- /dev/null +++ b/Automate/modinfo.json @@ -0,0 +1,13 @@ +{ + "type": "code", + "modid": "automate", + "name": "Automate", + "authors": [ + "KuMiShi" + ], + "description": "Steam engines, Trains, Electricity and much more!", + "version": "0.1.0", + "dependencies": { + "game": "" + } +} \ No newline at end of file diff --git a/Automate/src/AutomateMP/AutomateNode.cs b/Automate/src/AutomateMP/AutomateNode.cs new file mode 100644 index 0000000..84c0d01 --- /dev/null +++ b/Automate/src/AutomateMP/AutomateNode.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Automate.AutomateMP +{ + public class AutomateNode + { + } +} diff --git a/Automate/src/AutomateMP/IMechConsumer.cs b/Automate/src/AutomateMP/IMechConsumer.cs new file mode 100644 index 0000000..6dcc31a --- /dev/null +++ b/Automate/src/AutomateMP/IMechConsumer.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Automate.AutomateMP.Network; + +namespace Automate.AutomateMP +{ + public interface IMechConsumer + { + void consumeMechPower(float amount, AutoMPNetwork network); + } +} diff --git a/Automate/src/AutomateMP/IMechProducer.cs b/Automate/src/AutomateMP/IMechProducer.cs new file mode 100644 index 0000000..8937891 --- /dev/null +++ b/Automate/src/AutomateMP/IMechProducer.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Automate.AutomateMP +{ + public interface IMechProducer + { + double getPowerProduction(); + } +} diff --git a/Automate/src/AutomateMP/IMechPropagator.cs b/Automate/src/AutomateMP/IMechPropagator.cs new file mode 100644 index 0000000..1eb93ef --- /dev/null +++ b/Automate/src/AutomateMP/IMechPropagator.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Automate.AutomateMP.Network; + +namespace Automate.AutomateMP +{ + public interface IMechPropagator + { + void propagatePower(AutomateNode node, AutoMPNetwork network); + } +} diff --git a/Automate/src/AutomateMP/Network/AutoMPNetwork.cs b/Automate/src/AutomateMP/Network/AutoMPNetwork.cs new file mode 100644 index 0000000..a0e0bca --- /dev/null +++ b/Automate/src/AutomateMP/Network/AutoMPNetwork.cs @@ -0,0 +1,37 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Automate.AutomateMP.Network +{ + /// + /// Represents the aggregation of multiples mechanical blocks (producers,consumers,propagators). + /// + /// + /// Networks can be visualised as oriented and weighted graphs where each node is a mechanical component. + /// + public class AutoMPNetwork + { + + internal AutomateModSystem mod; + public float totalCapacity; + public float availableCapacity; + + /// + /// Ne sert qu'a avoir un exemple de documentation + /// + /// Le nom de l'utilisateur. + /// Un message de salutation. + public string Saluer(string nom) + { + return "Bonjour, " + nom + "!"; + } + + public AutoMPNetwork(AutomateModSystem mod) + { + this.mod = mod; + } + } +} diff --git a/Automate/src/AutomateMP/Network/AutomateNetworkMessage.cs b/Automate/src/AutomateMP/Network/AutomateNetworkMessage.cs new file mode 100644 index 0000000..5debc13 --- /dev/null +++ b/Automate/src/AutomateMP/Network/AutomateNetworkMessage.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using ProtoBuf; + +namespace Automate.AutomateMP.Network +{ + // Packet qui envoie un message de bienvenue (voir AutoMPNetwork.cs) + [ProtoContract] + internal class AutomateNetworkMessage + { + [ProtoMember(1)] + public String message; + } +} diff --git a/Automate/src/BlockEntities/BEBoiler.cs b/Automate/src/BlockEntities/BEBoiler.cs new file mode 100644 index 0000000..de19b1f --- /dev/null +++ b/Automate/src/BlockEntities/BEBoiler.cs @@ -0,0 +1,157 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Automate.Inventory; +using Automate.src.Gui; +using Automate.src.Inventory; +using Vintagestory.API.Client; +using Vintagestory.API.Common; +using Vintagestory.API.Config; +using Vintagestory.API.Datastructures; +using Vintagestory.API.MathTools; +using Vintagestory.GameContent; + +namespace Automate.src.BlockEntities +{ + internal class BEBoiler: BlockEntityOpenableContainer, IHeatSource, ITemperatureSensitive + { + // Specific Inventory: See Inventory/InventoryBoiler.cs + internal InventoryBoiler inventory; + + // Current temperature of the boiler + public float boilerTemperature = 20; + // Maximum temperature that can be reached with the currently used fuel + public int maxTemperature; + // How much of the current fuel is consumed + public float fuelBurnTime; + // How much fuel is available + public float maxFuelBurnTime; + // Hot enough to burn a new combustible + public bool canIgniteFuel; + public float cachedFuel; + public double extinguishedTotalHours; + + public override InventoryBase Inventory => inventory; + public override string InventoryClassName => inventory.ClassName; + + // Use consistent instance ID format + private string InventoryInstanceId => $"boiler-{Pos.X}|{Pos.Y}|{Pos.Z}"; + + public bool IsHot => false; + + GuiDialogBlockEntityBoiler clientDialog; + public virtual string DialogTitle + { + get { return Lang.Get("Steam Engine Boiler"); } + } + + public SyncedTreeAttribute dialogTree = new SyncedTreeAttribute(); + + + public BEBoiler() :base() { + inventory = new InventoryBoiler(null,null); + } + + public override void Initialize(ICoreAPI api) + { + base.Initialize(api); + inventory.LateInitialize(InventoryInstanceId, api); + // Initialize dialog tree + dialogTree.SetAttribute("boilerTemperature", new FloatAttribute(boilerTemperature)); + + } + + // Retrieves the Combustible properties of a fuel slot from the InventoryBoiler + public CombustibleProperties getFuelCombustibleProperties(int slotId) + { + ItemSlot fuelSlot = inventory[slotId]; + if (fuelSlot.Itemstack == null ) { return null; } + return fuelSlot.Itemstack.Collectible.CombustibleProps; + } + + public override void FromTreeAttributes(ITreeAttribute tree, IWorldAccessor worldForResolving) + { + base.FromTreeAttributes(tree, worldForResolving); + + if (Api != null) + { + Inventory.FromTreeAttributes(tree.GetOrAddTreeAttribute("inventoryBoiler")); + Inventory.AfterBlocksLoaded(Api.World); + Api.Logger.Debug("Loading inventory: {0}", inventory[0]?.Itemstack); + } + + /*boilerTemperature = tree.GetFloat("boilerTemperature", 20); + maxTemperature = tree.GetInt("maxTemperature", 0); + fuelBurnTime = tree.GetFloat("fuelBurnTime", 0); + maxFuelBurnTime = tree.GetFloat("maxFuelBurnTime", 0); + canIgniteFuel = tree.GetBool("canIgniteFuel", false); + cachedFuel = tree.GetFloat("cachedFuel", 0); + extinguishedTotalHours = tree.GetDouble("extinguishedTotalHours", 0);*/ + } + + public override void ToTreeAttributes(ITreeAttribute tree) + { + base.ToTreeAttributes(tree); + + // Save inventory + ITreeAttribute invtree = new TreeAttribute(); + Inventory.ToTreeAttributes(invtree); + tree["inventoryBoiler"] = invtree; + + // Save other fields + /*tree.SetFloat("boilerTemperature", boilerTemperature); + tree.SetInt("maxTemperature", maxTemperature); + tree.SetFloat("fuelBurnTime", fuelBurnTime); + tree.SetFloat("maxFuelBurnTime", maxFuelBurnTime); + tree.SetBool("canIgniteFuel", canIgniteFuel); + tree.SetFloat("cachedFuel", cachedFuel); + tree.SetDouble("extinguishedTotalHours", extinguishedTotalHours);*/ + + Api.Logger.Debug("Saving inventory: {0}", inventory[0]?.Itemstack); + } + + public float EnvironmentTemperature() + { + return Api.World.BlockAccessor.GetClimateAt(Pos, EnumGetClimateMode.NowValues).Temperature; + } + + public float GetHeatStrength(IWorldAccessor world, BlockPos heatSourcePos, BlockPos heatReceiverPos) + { + float envTemp = Math.Max(15, (int)EnvironmentTemperature()); + return envTemp; + } + + public void CoolNow(float amountRel) + { + return; + } + + + public override bool OnPlayerRightClick(IPlayer byPlayer, BlockSelection blockSel) + { + if (Api.Side == EnumAppSide.Client) + { + toggleInventoryDialogClient(byPlayer, () => { + // Update dialog values before opening + SetDialogValues(dialogTree); + return new GuiDialogBlockEntityBoiler( + DialogTitle, + Inventory, + Pos, + dialogTree, + Api as ICoreClientAPI + ); + }); + } + return true; + } + + void SetDialogValues(ITreeAttribute tree) + { + tree.SetFloat("boilerTemperature", boilerTemperature); + } + } +} diff --git a/Automate/src/BlockEntities/BEWaterChamber.cs b/Automate/src/BlockEntities/BEWaterChamber.cs new file mode 100644 index 0000000..500a296 --- /dev/null +++ b/Automate/src/BlockEntities/BEWaterChamber.cs @@ -0,0 +1,50 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Automate.Blocks; +using HarmonyLib; +using Microsoft.VisualBasic; +using Vintagestory.API.Client; +using Vintagestory.API.Common; +using Vintagestory.API.Config; +using Vintagestory.API.MathTools; +using Vintagestory.API.Server; +using Vintagestory.API.Util; +using Vintagestory.GameContent; + +namespace Automate.BlockEntities +{ + public class BEWaterChamber : BlockEntityLiquidContainer + { + public int GasCapacityLitres { get; set; } = 50; + + // Slot 0: Liquid slot + // Slot 1: Gas slot + public override string InventoryClassName => AutomateRefs.MODID_COLONS + "waterchamber"; + public BEWaterChamber() { + inventory = new InventoryGeneric(2, null, null, (id, self) => + { + if (id == 0) return new ItemSlotLiquidOnly(self, 50); + else return new ItemSlot(self); + }); + inventory.BaseWeight = 1; + } + + public String GetCurrentLitres() + { + ItemSlotLiquidOnly liquidSlot = inventory[0] as ItemSlotLiquidOnly; + ItemStack currentLiquidStack = liquidSlot.Itemstack; + if (currentLiquidStack != null) + { + float currentLitres = (float)currentLiquidStack.StackSize * 0.01f; + return currentLitres.ToString(); + } + else + { + return "0"; + } + } + } +} diff --git a/Automate/src/Blocks/BlockBoiler.cs b/Automate/src/Blocks/BlockBoiler.cs new file mode 100644 index 0000000..4d7f542 --- /dev/null +++ b/Automate/src/Blocks/BlockBoiler.cs @@ -0,0 +1,45 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Automate.src.BlockEntities; +using Vintagestory.API.Common; +using Vintagestory.API.MathTools; + +namespace Automate.Blocks +{ + public class BlockBoiler : Block + { + //Any code within this 'override' function will be called when a trampoline block is placed. + public override void OnBlockPlaced(IWorldAccessor world, BlockPos blockPos, ItemStack byItemStack = null) + { + //Log a message to the console. + api.Logger.Event("Boiler Block Placed!"); + //Perform any default logic when our block is placed. + base.OnBlockPlaced(world, blockPos, byItemStack); + } + + //Any code within this 'override' function will be called when a trampoline block is broken. + public override void OnBlockBroken(IWorldAccessor world, BlockPos pos, IPlayer byPlayer, float dropQuantityMultiplier = 1) + { + //Log a message to the console. + api.Logger.Event("Boiler Block Broken!"); + //Perform any default logic when our block is broken (e.g., dropping the block as an item.) + base.OnBlockBroken(world, pos, byPlayer, dropQuantityMultiplier); + } + + public override string GetPlacedBlockInfo(IWorldAccessor world, BlockPos pos, IPlayer forPlayer) + { + BEBoiler beb = GetBlockEntity(pos); + if (beb != null) + { + return "Heat Strength: " + beb.GetHeatStrength(world,pos, forPlayer.Entity.Pos.AsBlockPos).ToString(); + } + else + { + return "No Entity or issue with saving/loading"; + } + } + } +} diff --git a/Automate/src/Blocks/BlockWaterChamber.cs b/Automate/src/Blocks/BlockWaterChamber.cs new file mode 100644 index 0000000..731c896 --- /dev/null +++ b/Automate/src/Blocks/BlockWaterChamber.cs @@ -0,0 +1,119 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Automate.BlockEntities; +using Vintagestory.API.Client; +using Vintagestory.API.Common; +using Vintagestory.API.Config; +using Vintagestory.API.MathTools; +using Vintagestory.API.Server; +using Vintagestory.API.Util; +using Vintagestory.GameContent; + +namespace Automate.Blocks +{ + public class BlockWaterChamber : BlockLiquidContainerBase + { + //public override bool AllowHeldLiquidTransfer => false; + //public override bool IsTopOpened => false; + //Any code within this 'override' function will be called when a trampoline block is placed. + public override void OnBlockPlaced(IWorldAccessor world, BlockPos blockPos, ItemStack byItemStack = null) + { + //Log a message to the console. + + api.Logger.Event("Water Chamber placed!"); + //Perform any default logic when our block is placed. + base.OnBlockPlaced(world, blockPos, byItemStack); + } + + //Any code within this 'override' function will be called when a trampoline block is broken. + public override void OnBlockBroken(IWorldAccessor world, BlockPos pos, IPlayer byPlayer, float dropQuantityMultiplier = 1) + { + //Log a message to the console. + api.Logger.Event("Water Chamber Broken!"); + //Perform any default logic when our block is broken (e.g., dropping the block as an item.) + base.OnBlockBroken(world, pos, byPlayer, dropQuantityMultiplier); + } + + public override void OnLoaded(ICoreAPI api) + { + base.OnLoaded(api); + + + if (api.Side != EnumAppSide.Client) return; + ICoreClientAPI capi = api as ICoreClientAPI; + + if (Attributes?["capacityLitres"].Exists == true) + { + capacityLitresFromAttributes = Attributes["capacityLitres"].AsInt(10); + } + else + { + capacityLitresFromAttributes = 50; + } + /* + ObjectCacheUtil.Delete(api, "liquidContainerBase"); + interactions = ObjectCacheUtil.GetOrCreate(api, "liquidContainerBase", () => + { + List liquidContainerStacks = new List(); + + foreach (CollectibleObject obj in api.World.Collectibles) + { + if (obj is BlockLiquidContainerBase blc && blc.IsTopOpened && blc.AllowHeldLiquidTransfer) + liquidContainerStacks.Add(new ItemStack(obj)); + } + + var lcstacks = liquidContainerStacks.ToArray(); + + return new WorldInteraction[] { + new WorldInteraction() + { + ActionLangCode = "blockhelp-bucket-rightclick", + MouseButton = EnumMouseButton.Right, + Itemstacks = lcstacks + }, + new WorldInteraction() + { + ActionLangCode = "blockhelp-bucket-rightclick-sneak", + MouseButton = EnumMouseButton.Right, + HotKeyCode = "shift", + Itemstacks = lcstacks + }, + new WorldInteraction() + { + ActionLangCode = "blockhelp-bucket-rightclick-sprint", + MouseButton = EnumMouseButton.Right, + HotKeyCode = "ctrl", + Itemstacks = lcstacks + } + }; + }); + */ + } + + public override String GetPlacedBlockInfo(IWorldAccessor world, BlockPos pos, IPlayer forPlayer) + { + BEWaterChamber bewc = GetBlockEntity(pos); + if (bewc != null) + { + return "Water Level : " + bewc.GetCurrentLitres() + "L"; + } + else + { + return "Water Level : " + GetCurrentLitres(null as ItemStack) + "L"; + } + } + + public override int TryPutLiquid(BlockPos pos, ItemStack liquidStack, float desiredLitres) + { + return base.TryPutLiquid(pos, liquidStack, desiredLitres); + } + + public override int TryPutLiquid(ItemStack containerStack, ItemStack liquidStack, float desiredLitres) + { + return base.TryPutLiquid(containerStack, liquidStack, desiredLitres); + } + } +} diff --git a/Automate/src/Gui/GuiDialogBlockEntityBoiler.cs b/Automate/src/Gui/GuiDialogBlockEntityBoiler.cs new file mode 100644 index 0000000..95ea5c9 --- /dev/null +++ b/Automate/src/Gui/GuiDialogBlockEntityBoiler.cs @@ -0,0 +1,91 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Automate.src.BlockEntities; +using Vintagestory.API.Client; +using Vintagestory.API.Common; +using Vintagestory.API.Config; +using Vintagestory.API.Datastructures; +using Vintagestory.API.MathTools; +using Vintagestory.GameContent; + +namespace Automate.src.Gui +{ + internal class GuiDialogBlockEntityBoiler: GuiDialogBlockEntity + { + private BEBoiler boiler; + private BlockPos blockEntityPos; + private SyncedTreeAttribute dialogTree; + + public GuiDialogBlockEntityBoiler(string title, InventoryBase inventory, BlockPos blockEntityPos, + SyncedTreeAttribute dialogTree, ICoreClientAPI capi) + : base(title, inventory, blockEntityPos, capi) + { + this.boiler = capi.World.BlockAccessor.GetBlockEntity(blockEntityPos) as BEBoiler; + this.blockEntityPos = blockEntityPos; + this.dialogTree = dialogTree; + SetupDialog(); + } + + private void SetupDialog() + { + // Dialog dimensions + ElementBounds dialogBounds = ElementStdBounds.AutosizedMainDialog; + + // Background + ElementBounds bgBounds = ElementBounds.Fixed(0, 0, 300, 200); + + // Inventory slots + ElementBounds slotBounds = ElementStdBounds.SlotGrid(EnumDialogArea.None, 0, 30, 1, 1).FixedGrow(0, 30); + + // Temperature display + ElementBounds tempBounds = ElementBounds.Fixed(0, 100, 200, 30); + + // Create dialog + SingleComposer = capi.Gui + .CreateCompo("boilerDialog_" + blockEntityPos, dialogBounds) + .AddShadedDialogBG(bgBounds) + .AddDialogTitleBar(Lang.Get("Steam Engine Boiler"), OnTitleBarClose) + .BeginChildElements(bgBounds) + .AddItemSlotGrid(boiler.Inventory, SendInvPacket, 1, new int[] { 0 }, slotBounds) + .AddDynamicText("", CairoFont.WhiteSmallText(), tempBounds, "tempDisplay") + .EndChildElements() + .Compose(); + + // Register updates + RegisterUpdate(); + } + + private void RegisterUpdate() + { + // Update temperature display every 500ms + SingleComposer.GetDynamicText("tempDisplay").SetNewText(GetTemperatureText()); + capi.Event.RegisterGameTickListener(dt => { + SingleComposer.GetDynamicText("tempDisplay").SetNewText(GetTemperatureText()); + }, 500); + } + + private string GetTemperatureText() + { + return Lang.Get("Temperature: {0}°C", (int)boiler.boilerTemperature); + } + + private void SendInvPacket(object packet) + { + capi.Network.SendBlockEntityPacket(blockEntityPos.X, blockEntityPos.Y, blockEntityPos.Z, packet); + } + + private void OnTitleBarClose() + { + TryClose(); + } + + public override bool OnEscapePressed() + { + TryClose(); + return true; + } + } +} \ No newline at end of file diff --git a/Automate/src/Inventory/InventoryBoiler.cs b/Automate/src/Inventory/InventoryBoiler.cs new file mode 100644 index 0000000..01aae38 --- /dev/null +++ b/Automate/src/Inventory/InventoryBoiler.cs @@ -0,0 +1,89 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Runtime.CompilerServices; +using System.Text; +using System.Threading.Tasks; +using Automate.src.Inventory; +using Vintagestory.API.Common; +using Vintagestory.API.Datastructures; +using Vintagestory.API.MathTools; +using Vintagestory.GameContent; +using static System.Reflection.Metadata.BlobBuilder; + +namespace Automate.Inventory +{ + internal class InventoryBoiler: InventoryBase, ISlotProvider + { + ItemSlot[] fuelSlots; // 0: solidFuel; 1: liquidFuel + + // Slots for ISlotProvider + public ItemSlot[] Slots + { + get { return fuelSlots; } + } + + // Count and this[int] for InventoryBase + public override int Count + { + get { return fuelSlots.Length; } + } + + public override ItemSlot this[int slotId] + { + get + { + if (slotId < 0 || slotId >= Count) return null; + return fuelSlots[slotId]; + } + set + { + if (slotId < 0 || slotId >= Count) throw new ArgumentOutOfRangeException(nameof(slotId)); + if (value == null) throw new ArgumentNullException(nameof(value)); + fuelSlots[slotId] = value; + } + } + + public InventoryBoiler(string instanceID, ICoreAPI api) :base(AutomateRefs.MODID_COLONS + "inventoryBoiler", instanceID, api) { + fuelSlots = GenEmptySlots(2); // See NewSlot(int i) for ItemSlot creation + } + + public override void AfterBlocksLoaded(IWorldAccessor world) + { + for (int i = 0; i < Count; i++) + { + this[i]?.Itemstack?.ResolveBlockOrItem(world); + } + } + + public override ItemSlot GetAutoPushIntoSlot(BlockFacing atBlockFace, ItemSlot fromSlot) + { + return null; + } + + public override ItemSlot GetAutoPullFromSlot(BlockFacing atBlockFace) + { + return null; + } + + + public override void FromTreeAttributes(ITreeAttribute tree) + { + List modifiedSlots = new List(); + fuelSlots = SlotsFromTreeAttributes(tree, fuelSlots, modifiedSlots); + for (int i = 0; i < modifiedSlots.Count; i++) DidModifyItemSlot(modifiedSlots[i]); + } + + public override void ToTreeAttributes(ITreeAttribute tree) + { + SlotsToTreeAttributes(fuelSlots, tree); + } + + protected override ItemSlot NewSlot(int i) + { + if (i == 0) return new ItemSlotFuel(this); // 0: Solid Fuel + if (i == 1) return new ItemSlotLiquidOnly(this, 50); // 1: Liquid Fuel + else return null; + } + } +} diff --git a/Automate/src/Inventory/ItemSlotFuel.cs b/Automate/src/Inventory/ItemSlotFuel.cs new file mode 100644 index 0000000..4a2c2ba --- /dev/null +++ b/Automate/src/Inventory/ItemSlotFuel.cs @@ -0,0 +1,38 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Vintagestory.API.Common; +using Vintagestory.Common; +using Vintagestory.Server; + +namespace Automate.src.Inventory +{ + internal class ItemSlotFuel: ItemSlot + { + public ItemSlotFuel(InventoryBase inventory) : base(inventory) { } + + public override bool CanHold(ItemSlot sourceSlot) + { + // Check base conditions (stackable, etc.) + if (!base.CanHold(sourceSlot)) return false; + + return IsFuelValid(sourceSlot.Itemstack); + } + + public override bool CanTakeFrom(ItemSlot sourceSlot, EnumMergePriority priority = EnumMergePriority.AutoMerge) + { + return IsFuelValid(sourceSlot.Itemstack); + } + + private bool IsFuelValid(ItemStack stack) + { + if (stack == null) return true; // Allow empty slots + + // 3. Check combustible properties + CombustibleProperties props = stack.Collectible.CombustibleProps; + return props != null && props.BurnTemperature > 0 && props.BurnDuration > 0; + } + } +} diff --git a/ZZCakeBuild/CakeBuild.csproj b/ZZCakeBuild/CakeBuild.csproj new file mode 100644 index 0000000..8e2c970 --- /dev/null +++ b/ZZCakeBuild/CakeBuild.csproj @@ -0,0 +1,19 @@ + + + Exe + net7.0 + $(MSBuildProjectDirectory) + + + + + + + + + + + $(VINTAGE_STORY)/VintagestoryAPI.dll + + + \ No newline at end of file diff --git a/ZZCakeBuild/Program.cs b/ZZCakeBuild/Program.cs new file mode 100644 index 0000000..9c11cd6 --- /dev/null +++ b/ZZCakeBuild/Program.cs @@ -0,0 +1,120 @@ +using System; +using System.IO; +using Cake.Common; +using Cake.Common.IO; +using Cake.Common.Tools.DotNet; +using Cake.Common.Tools.DotNet.Clean; +using Cake.Common.Tools.DotNet.Publish; +using Cake.Core; +using Cake.Frosting; +using Cake.Json; +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; +using Vintagestory.API.Common; + +namespace CakeBuild +{ + public static class Program + { + public static int Main(string[] args) + { + return new CakeHost() + .UseContext() + .Run(args); + } + } + + public class BuildContext : FrostingContext + { + public const string ProjectName = "Automate"; + public string BuildConfiguration { get; } + public string Version { get; } + public string Name { get; } + public bool SkipJsonValidation { get; } + + public BuildContext(ICakeContext context) + : base(context) + { + BuildConfiguration = context.Argument("configuration", "Release"); + SkipJsonValidation = context.Argument("skipJsonValidation", false); + var modInfo = context.DeserializeJsonFromFile($"../{ProjectName}/modinfo.json"); + Version = modInfo.Version; + Name = modInfo.ModID; + } + } + + [TaskName("ValidateJson")] + public sealed class ValidateJsonTask : FrostingTask + { + public override void Run(BuildContext context) + { + if (context.SkipJsonValidation) + { + return; + } + var jsonFiles = context.GetFiles($"../{BuildContext.ProjectName}/assets/**/*.json"); + foreach (var file in jsonFiles) + { + try + { + var json = File.ReadAllText(file.FullPath); + JToken.Parse(json); + } + catch (JsonException ex) + { + throw new Exception($"Validation failed for JSON file: {file.FullPath}{Environment.NewLine}{ex.Message}", ex); + } + } + } + } + + [TaskName("Build")] + [IsDependentOn(typeof(ValidateJsonTask))] + public sealed class BuildTask : FrostingTask + { + public override void Run(BuildContext context) + { + context.DotNetClean($"../{BuildContext.ProjectName}/{BuildContext.ProjectName}.csproj", + new DotNetCleanSettings + { + Configuration = context.BuildConfiguration + }); + + + context.DotNetPublish($"../{BuildContext.ProjectName}/{BuildContext.ProjectName}.csproj", + new DotNetPublishSettings + { + Configuration = context.BuildConfiguration + }); + } + } + + [TaskName("Package")] + [IsDependentOn(typeof(BuildTask))] + public sealed class PackageTask : FrostingTask + { + public override void Run(BuildContext context) + { + context.EnsureDirectoryExists("../Releases"); + context.CleanDirectory("../Releases"); + context.EnsureDirectoryExists($"../Releases/{context.Name}"); + context.CopyFiles($"../{BuildContext.ProjectName}/bin/{context.BuildConfiguration}/Mods/mod/publish/*", $"../Releases/{context.Name}"); + if (context.DirectoryExists($"../{BuildContext.ProjectName}/assets")) + { + context.CopyDirectory($"../{BuildContext.ProjectName}/assets", $"../Releases/{context.Name}/assets"); + } + context.CopyFile($"../{BuildContext.ProjectName}/modinfo.json", $"../Releases/{context.Name}/modinfo.json"); + if (context.FileExists($"../{BuildContext.ProjectName}/modicon.png")) + { + context.CopyFile($"../{BuildContext.ProjectName}/modicon.png", $"../Releases/{context.Name}/modicon.png"); + } + context.Zip($"../Releases/{context.Name}", $"../Releases/{context.Name}_{context.Version}.zip"); + } + } + + [TaskName("Default")] + [IsDependentOn(typeof(PackageTask))] + public class DefaultTask : FrostingTask + { + } +} \ No newline at end of file diff --git a/build.ps1 b/build.ps1 new file mode 100644 index 0000000..a2ee10a --- /dev/null +++ b/build.ps1 @@ -0,0 +1,2 @@ +dotnet run --project ZZCakeBuild/CakeBuild.csproj -- $args +exit $LASTEXITCODE; \ No newline at end of file diff --git a/build.sh b/build.sh new file mode 100644 index 0000000..1a40ae7 --- /dev/null +++ b/build.sh @@ -0,0 +1 @@ +dotnet run --project ./ZZCakeBuild/CakeBuild.csproj -- "$@"