Skip to content

Commit

Permalink
Merge pull request #28 from takunology/2.0.3-dev
Browse files Browse the repository at this point in the history
update to 2.1.0
  • Loading branch information
takunology authored Aug 25, 2023
2 parents 7283353 + c1eea8e commit 3838bba
Show file tree
Hide file tree
Showing 37 changed files with 420 additions and 36 deletions.
3 changes: 3 additions & 0 deletions MinecraftConnection/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
*.userosscache
*.sln.docstates

# TestApp
./TestApp

# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs

Expand Down
Binary file not shown.
Binary file modified MinecraftConnection/.vs/MinecraftConnection/v17/.suo
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ namespace MinecraftConnection.Entity.Base
public class LivingEntityBase
{
public string EntityId { get; set; }
public Position Postision { get; set; }
public Position Position { get; set; }
public Rotation Rotation { get; set; }
public Motion Motion { get; set; }
public double FallDistance { get; set; }
Expand All @@ -27,7 +27,7 @@ public void GetPosition()
double posX = PublicRcon.Rcon.SendCommand($"data get entity {EntityId} Pos[0]").DataToDouble();
double posY = PublicRcon.Rcon.SendCommand($"data get entity {EntityId} Pos[1]").DataToDouble();
double posZ = PublicRcon.Rcon.SendCommand($"data get entity {EntityId} Pos[2]").DataToDouble();
this.Postision = new Position(posX, posY, posZ);
this.Position = new Position(posX, posY, posZ);
}

public void GetRotation()
Expand Down
67 changes: 67 additions & 0 deletions MinecraftConnection/MinecraftConnection/Extends/PlaySound.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
using System;
using System.Collections.Generic;
using System.Text;

namespace MinecraftConnection.Extends
{
public class PlaySound
{
private string _sound;

public PlaySound(Sound sound)
{
_sound = sound switch
{
Sound.Banjo => "block.note_block.banjo",
Sound.BaseDrum => "block.note_block.basedrum",
Sound.Bass => "block.note_block.bass",
Sound.Bell => "block.note_block.bell",
Sound.Bit => "block.note_block.bit",
Sound.Chime => "block.note_block.basedrum",
Sound.CowBell => "block.note_block.cow_bell",
Sound.DidGeridoo => "block.note_block.didgeridoo",
Sound.Flute => "block.note_block.flute",
Sound.Guiter => "block.note_block.guiter",
Sound.Harp => "block.note_block.harp",
Sound.Hat => "block.note_block.hat",
Sound.IronXylophone => "block.note_block.iron_xylophone",
Sound.Pling => "block.note_block.pling",
Sound.Snare => "block.note_block.snare",
Sound.Xylophone => "block.note_block.xylophone",
_ => ""
};
}

public string MakeCommand()
{
var command = $"execute as @p at @s run playsound {_sound} master @a ~ ~ ~ 1";
return command;
}

public string MakeCommand(double pitch)
{
var command = $"execute as @p at @s run playsound {_sound} master @a ~ ~ ~ 1 {pitch}";
return command;
}
}

public enum Sound
{
Banjo,
BaseDrum,
Bass,
Bell,
Bit,
Chime,
CowBell,
DidGeridoo,
Flute,
Guiter,
Harp,
Hat,
IronXylophone,
Pling,
Snare,
Xylophone
}
}
46 changes: 46 additions & 0 deletions MinecraftConnection/MinecraftConnection/MinecraftCommands.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,31 @@ public string SendCommand(string command)
/// <returns>Result of command execution</returns>
public string TimeSet(ushort time) => PublicRcon.Rcon.SendCommand($"time set {time}");

/// <summary>
/// Sets the time in Minecraft.
/// </summary>
/// <param name="time">Any time</param>
/// <returns>Result of command execution</returns>
public string TimeSet(Time time) => PublicRcon.Rcon.SendCommand($"time set {time.GetHashCode()}");

/// <summary>
/// Teleports any entity to the specified coordinates.
/// </summary>
/// <param name="entityName">Entity ID or Player ID</param>
/// <param name="x">Coordinate x</param>
/// <param name="y">Coordinate y</param>
/// <param name="z">Coordinate z</param>
/// <returns></returns>
public string Teleport(string entityName, int x, int y, int z) => PublicRcon.Rcon.SendCommand($"tp {entityName} {x} {y} {z}");

/// <summary>
/// Teleports any entity to the specified coordinates.
/// </summary>
/// <param name="entityName">Entity ID or Player ID</param>
/// <param name="position">Coordinates to be teleport</param>
/// <returns></returns>
public string Teleport(string entityName, Position position) => PublicRcon.Rcon.SendCommand($"tp {entityName} {position.X} {position.Y} {position.Z}");

/// <summary>
/// Wait for a specified period of time.
/// </summary>
Expand Down Expand Up @@ -196,5 +221,26 @@ public void SetChestItems(int x, int y, int z, List<ItemStack> items)
var chestItems = new ChestBlock(x, y, z);
chestItems.SetItems(items);
}

/// <summary>
/// Play Minecraft sound effects.
/// </summary>
/// <param name="sound">Type of sound effects</param>
public void PlaySound(Sound sound)
{
var playSound = new PlaySound(sound);
SendCommand(playSound.MakeCommand());
}

/// <summary>
/// Play Minecraft sound effects.
/// </summary>
/// <param name="sound">Type of sound effects</param>
/// <param name="pitch">Sound height (up to 2.0)</param>
public void PlaySound(Sound sound, double pitch)
{
var playSound = new PlaySound(sound);
SendCommand(playSound.MakeCommand(pitch));
}
}
}
17 changes: 7 additions & 10 deletions MinecraftConnection/MinecraftConnection/MinecraftConnection.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<LangVersion>latest</LangVersion>
<Authors>Takumi Okawa (Takunology)</Authors>
<Company>Minecraft_with_Code_Project</Company>
<Version>2.0.2</Version>
<Version>2.1.0</Version>
<PackageId>MinecraftConnection</PackageId>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
Expand All @@ -15,23 +15,20 @@
<RepositoryUrl>https://github.com/takunology/MinecraftConnection</RepositoryUrl>
<Description>MinecraftConnection is a library for sending commands via RCON using C# to support you learn and automate your programming. It can be run on a vanilla server as well as a Spigot server, including plugins. Before running the program, you need to start a Minecraft server that allows RCON connections.</Description>
<PackageLicenseFile></PackageLicenseFile>
<Copyright>Copyright (c) 2021 Takumi Okawa (Takunology)</Copyright>
<Copyright>Copyright (c) 2023 Takumi Okawa (Takunology)</Copyright>
<PackageIconUrl />
<PackageTags>Minecraft</PackageTags>
<PackageReleaseNotes>Version 2.0.2
<PackageReleaseNotes>Version 2.1.0

- Fixed RandomColors() method in FireworkOption class
- Added SetBlock method overload</PackageReleaseNotes>
- Add PlaySound() method and "Minecraft block note" sounds
- Add Teleport() method
- Fixed a misspelling of "Position" in LivingEntity class</PackageReleaseNotes>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<PackageReadmeFile>README.md</PackageReadmeFile>
<PackageReadmeFile></PackageReadmeFile>
</PropertyGroup>

<ItemGroup>
<None Include="..\..\README.md">
<Pack>True</Pack>
<PackagePath>\</PackagePath>
</None>
<None Include="MCLogo.png">
<Pack>True</Pack>
<PackagePath></PackagePath>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
-->
<Project>
<PropertyGroup>
<History>True|2023-04-09T16:39:46.9733314Z;True|2023-04-10T01:32:58.9666530+09:00;True|2022-08-20T10:40:40.1812269+09:00;True|2022-08-20T10:36:51.1034346+09:00;True|2022-08-20T09:10:23.4166908+09:00;True|2022-02-15T21:50:15.1469967+09:00;</History>
<History>True|2023-08-25T14:20:16.1536840Z;True|2023-04-10T02:05:01.7621327+09:00;True|2023-04-10T01:53:28.9821493+09:00;True|2023-04-10T01:39:46.9733314+09:00;True|2023-04-10T01:32:58.9666530+09:00;True|2022-08-20T10:40:40.1812269+09:00;True|2022-08-20T10:36:51.1034346+09:00;True|2022-08-20T09:10:23.4166908+09:00;True|2022-02-15T21:50:15.1469967+09:00;</History>
<LastFailureDetails />
</PropertyGroup>
</Project>
14 changes: 14 additions & 0 deletions MinecraftConnection/MinecraftConnection/Time.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Text;

namespace MinecraftConnection
{
public enum Time
{
Day = 1000,
Noon = 6000,
Night = 13000,
Midnight = 18000
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"targets": {
".NETStandard,Version=v2.1": {},
".NETStandard,Version=v2.1/": {
"MinecraftConnection/2.0.1": {
"MinecraftConnection/2.0.2": {
"dependencies": {
"System.Text.Json": "6.0.3"
},
Expand Down Expand Up @@ -104,7 +104,7 @@
}
},
"libraries": {
"MinecraftConnection/2.0.1": {
"MinecraftConnection/2.0.2": {
"type": "project",
"serviceable": false,
"sha512": ""
Expand Down
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"targets": {
".NETStandard,Version=v2.1": {},
".NETStandard,Version=v2.1/": {
"MinecraftConnection/2.0.2": {
"MinecraftConnection/2.1.0": {
"dependencies": {
"System.Text.Json": "6.0.3"
},
Expand Down Expand Up @@ -104,7 +104,7 @@
}
},
"libraries": {
"MinecraftConnection/2.0.2": {
"MinecraftConnection/2.1.0": {
"type": "project",
"serviceable": false,
"sha512": ""
Expand Down
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@

[assembly: System.Reflection.AssemblyCompanyAttribute("Minecraft_with_Code_Project")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2021 Takumi Okawa (Takunology)")]
[assembly: System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2023 Takumi Okawa (Takunology)")]
[assembly: System.Reflection.AssemblyDescriptionAttribute(@"MinecraftConnection is a library for sending commands via RCON using C# to support you learn and automate your programming. It can be run on a vanilla server as well as a Spigot server, including plugins. Before running the program, you need to start a Minecraft server that allows RCON connections.")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("2.0.2.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("2.0.2")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("2.1.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("2.1.0")]
[assembly: System.Reflection.AssemblyProductAttribute("MinecraftConnection")]
[assembly: System.Reflection.AssemblyTitleAttribute("MinecraftConnection")]
[assembly: System.Reflection.AssemblyVersionAttribute("2.0.2.0")]
[assembly: System.Reflection.AssemblyVersionAttribute("2.1.0.0")]
[assembly: System.Reflection.AssemblyMetadataAttribute("RepositoryUrl", "https://github.com/takunology/MinecraftConnection")]

// MSBuild WriteCodeFragment クラスによって生成されました。
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
282d325dab411b029c2b700535254c4e10846814
61cb29eec0fdd22046b4ec01cf885acc87c9a0e8
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1 +1 @@
58ac09808e49a60d39082e10803bbe07bec02c70
849158c32200dd797771d9988dec7bbc26078e5b
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
},
"projects": {
"D:\\GitHub\\MinecraftConnection\\MinecraftConnection\\MinecraftConnection\\MinecraftConnection.csproj": {
"version": "2.0.2",
"version": "2.1.0",
"restore": {
"projectUniqueName": "D:\\GitHub\\MinecraftConnection\\MinecraftConnection\\MinecraftConnection\\MinecraftConnection.csproj",
"projectName": "MinecraftConnection",
Expand Down Expand Up @@ -67,7 +67,7 @@
"privateAssets": "all"
}
},
"runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\7.0.100\\RuntimeIdentifierGraph.json"
"runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\7.0.306\\RuntimeIdentifierGraph.json"
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<NuGetPackageRoot Condition=" '$(NuGetPackageRoot)' == '' ">$(UserProfile)\.nuget\packages\</NuGetPackageRoot>
<NuGetPackageFolders Condition=" '$(NuGetPackageFolders)' == '' ">C:\Users\takun\.nuget\packages\;C:\Program Files (x86)\Microsoft Visual Studio\Shared\NuGetPackages</NuGetPackageFolders>
<NuGetProjectStyle Condition=" '$(NuGetProjectStyle)' == '' ">PackageReference</NuGetProjectStyle>
<NuGetToolVersion Condition=" '$(NuGetToolVersion)' == '' ">6.3.0</NuGetToolVersion>
<NuGetToolVersion Condition=" '$(NuGetToolVersion)' == '' ">6.6.0</NuGetToolVersion>
</PropertyGroup>
<ItemGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
<SourceRoot Include="C:\Users\takun\.nuget\packages\" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@

[assembly: System.Reflection.AssemblyCompanyAttribute("Minecraft_with_Code_Project")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Release")]
[assembly: System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2021 Takumi Okawa (Takunology)")]
[assembly: System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2023 Takumi Okawa (Takunology)")]
[assembly: System.Reflection.AssemblyDescriptionAttribute(@"MinecraftConnection is a library for sending commands via RCON using C# to support you learn and automate your programming. It can be run on a vanilla server as well as a Spigot server, including plugins. Before running the program, you need to start a Minecraft server that allows RCON connections.")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("2.0.2.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("2.0.2")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("2.1.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("2.1.0")]
[assembly: System.Reflection.AssemblyProductAttribute("MinecraftConnection")]
[assembly: System.Reflection.AssemblyTitleAttribute("MinecraftConnection")]
[assembly: System.Reflection.AssemblyVersionAttribute("2.0.2.0")]
[assembly: System.Reflection.AssemblyVersionAttribute("2.1.0.0")]
[assembly: System.Reflection.AssemblyMetadataAttribute("RepositoryUrl", "https://github.com/takunology/MinecraftConnection")]

// MSBuild WriteCodeFragment クラスによって生成されました。
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
8a61b2791601bc8bb386901640ecee29366c6deb
b3acf231274fd2c3494e3b68faaa31ce510a1d88
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1 +1 @@
55ebbe7502f00ee1b87d8abba2101c645c018603
fb3be4d7b6bf6f883ff96a5808967b15003e738a
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,7 @@
"C:\\Program Files (x86)\\Microsoft Visual Studio\\Shared\\NuGetPackages": {}
},
"project": {
"version": "2.0.2",
"version": "2.1.0",
"restore": {
"projectUniqueName": "D:\\GitHub\\MinecraftConnection\\MinecraftConnection\\MinecraftConnection\\MinecraftConnection.csproj",
"projectName": "MinecraftConnection",
Expand Down Expand Up @@ -472,7 +472,7 @@
"privateAssets": "all"
}
},
"runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\7.0.100\\RuntimeIdentifierGraph.json"
"runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\7.0.306\\RuntimeIdentifierGraph.json"
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"version": 2,
"dgSpecHash": "cU6fsN63IMU1wYKa0NKRGWa64cFX+k5Chnv9uI9V8XI2CWZcUTN4v5e0PMexkAQm+WPjv7E0K4ChbQoO/v1JTQ==",
"dgSpecHash": "DqGAk/JyxtMS5tR36kX2HLXUU/tUcutDyuo9Cp2ZbzuLgvYGAVfCe2BK0XpA5RLdG6aiH8xpssEFrm7Y8oVb3Q==",
"success": true,
"projectFilePath": "D:\\GitHub\\MinecraftConnection\\MinecraftConnection\\MinecraftConnection\\MinecraftConnection.csproj",
"expectedPackageFiles": [
Expand Down
Loading

0 comments on commit 3838bba

Please sign in to comment.