From 1122fefaf0bac7d0b83f92c4bcbd2943c92aebe7 Mon Sep 17 00:00:00 2001 From: MattN-L Date: Fri, 15 Mar 2024 17:22:44 -0400 Subject: [PATCH] Added Shulker Box Overlay to tile data Not used, but it appears that this is what 4J was trying to do --- .../Editor/TextureAtlasEditor.Designer.cs | 91 ++++++++++--------- PCK-Studio/Forms/Editor/TextureAtlasEditor.cs | 17 +++- PCK-Studio/Resources/atlases/tileData.json | 4 +- 3 files changed, 63 insertions(+), 49 deletions(-) diff --git a/PCK-Studio/Forms/Editor/TextureAtlasEditor.Designer.cs b/PCK-Studio/Forms/Editor/TextureAtlasEditor.Designer.cs index a76914f5..56d2003c 100644 --- a/PCK-Studio/Forms/Editor/TextureAtlasEditor.Designer.cs +++ b/PCK-Studio/Forms/Editor/TextureAtlasEditor.Designer.cs @@ -29,7 +29,7 @@ private void InitializeComponent() { System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(TextureAtlasEditor)); - this.variantLabel = new MetroFramework.Controls.MetroLabel(); + this.internalTileNameLabel = new MetroFramework.Controls.MetroLabel(); this.menuStrip1 = new System.Windows.Forms.MenuStrip(); this.fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.saveToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); @@ -54,18 +54,20 @@ ((System.ComponentModel.ISupportInitialize)(this.selectTilePictureBox)).BeginInit(); this.SuspendLayout(); // - // variantLabel + // internalTileNameLabel // - this.variantLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right))); - this.variantLabel.AutoSize = true; - this.tableLayoutPanel1.SetColumnSpan(this.variantLabel, 2); - this.variantLabel.Location = new System.Drawing.Point(3, 239); - this.variantLabel.Name = "variantLabel"; - this.variantLabel.Size = new System.Drawing.Size(208, 19); - this.variantLabel.TabIndex = 18; - this.variantLabel.Text = "Variant:"; - this.variantLabel.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; - this.variantLabel.Theme = MetroFramework.MetroThemeStyle.Dark; + this.internalTileNameLabel.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.tableLayoutPanel1.SetColumnSpan(this.internalTileNameLabel, 2); + this.internalTileNameLabel.FontSize = MetroFramework.MetroLabelSize.Small; + this.internalTileNameLabel.Location = new System.Drawing.Point(3, 281); + this.internalTileNameLabel.Name = "internalTileNameLabel"; + this.internalTileNameLabel.Size = new System.Drawing.Size(208, 15); + this.internalTileNameLabel.TabIndex = 18; + this.internalTileNameLabel.Text = "InternalTileName"; + this.internalTileNameLabel.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + this.internalTileNameLabel.Theme = MetroFramework.MetroThemeStyle.Dark; + this.internalTileNameLabel.WrapToLine = true; // // menuStrip1 // @@ -145,20 +147,20 @@ this.tableLayoutPanel1.Controls.Add(this.colorSlider, 1, 4); this.tableLayoutPanel1.Controls.Add(this.colorSliderLabel, 0, 4); this.tableLayoutPanel1.Controls.Add(this.variantComboBox, 0, 3); - this.tableLayoutPanel1.Controls.Add(this.variantLabel, 0, 2); + this.tableLayoutPanel1.Controls.Add(this.internalTileNameLabel, 0, 2); this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill; this.tableLayoutPanel1.Location = new System.Drawing.Point(20, 84); this.tableLayoutPanel1.Name = "tableLayoutPanel1"; this.tableLayoutPanel1.RowCount = 6; - this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 38.68709F)); - this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 4.835886F)); - this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 4.835886F)); - this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 16.14977F)); - this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 16.14977F)); - this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 4.835886F)); - this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 4.833951F)); - this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 4.835886F)); - this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 4.835886F)); + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 42.82212F)); + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 8.938088F)); + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 8.943623F)); + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 8.943623F)); + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 8.943623F)); + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 5.352765F)); + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 5.350623F)); + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 5.352765F)); + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 5.352765F)); this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F)); this.tableLayoutPanel1.Size = new System.Drawing.Size(590, 565); this.tableLayoutPanel1.TabIndex = 17; @@ -173,7 +175,7 @@ this.originalPictureBox.Location = new System.Drawing.Point(217, 3); this.originalPictureBox.Name = "originalPictureBox"; this.tableLayoutPanel1.SetRowSpan(this.originalPictureBox, 9); - this.originalPictureBox.Size = new System.Drawing.Size(370, 536); + this.originalPictureBox.Size = new System.Drawing.Size(370, 535); this.originalPictureBox.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; this.originalPictureBox.TabIndex = 4; this.originalPictureBox.TabStop = false; @@ -192,7 +194,7 @@ this.selectTilePictureBox.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.NearestNeighbor; this.selectTilePictureBox.Location = new System.Drawing.Point(3, 3); this.selectTilePictureBox.Name = "selectTilePictureBox"; - this.selectTilePictureBox.Size = new System.Drawing.Size(208, 204); + this.selectTilePictureBox.Size = new System.Drawing.Size(208, 227); this.selectTilePictureBox.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; this.selectTilePictureBox.TabIndex = 0; this.selectTilePictureBox.TabStop = false; @@ -204,9 +206,9 @@ | System.Windows.Forms.AnchorStyles.Right))); this.replaceButton.AutoSize = true; this.tableLayoutPanel1.SetColumnSpan(this.replaceButton, 2); - this.replaceButton.Location = new System.Drawing.Point(3, 519); + this.replaceButton.Location = new System.Drawing.Point(3, 515); this.replaceButton.Name = "replaceButton"; - this.replaceButton.Size = new System.Drawing.Size(208, 20); + this.replaceButton.Size = new System.Drawing.Size(208, 23); this.replaceButton.TabIndex = 14; this.replaceButton.Text = "Replace Tile on Atlas"; this.replaceButton.Theme = MetroFramework.MetroThemeStyle.Dark; @@ -215,23 +217,25 @@ // // tileNameLabel // - this.tileNameLabel.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) + this.tileNameLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.tableLayoutPanel1.SetColumnSpan(this.tileNameLabel, 2); - this.tileNameLabel.Location = new System.Drawing.Point(3, 217); + this.tileNameLabel.Location = new System.Drawing.Point(3, 233); this.tileNameLabel.Name = "tileNameLabel"; - this.tileNameLabel.Size = new System.Drawing.Size(208, 19); + this.tileNameLabel.Size = new System.Drawing.Size(208, 48); this.tileNameLabel.TabIndex = 19; this.tileNameLabel.Text = "TileName"; this.tileNameLabel.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; this.tileNameLabel.Theme = MetroFramework.MetroThemeStyle.Dark; + this.tileNameLabel.WrapToLine = true; // // setColorButton // this.setColorButton.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.tableLayoutPanel1.SetColumnSpan(this.setColorButton, 2); - this.setColorButton.Location = new System.Drawing.Point(3, 444); + this.setColorButton.Location = new System.Drawing.Point(3, 434); this.setColorButton.Name = "setColorButton"; this.setColorButton.Size = new System.Drawing.Size(208, 17); this.setColorButton.TabIndex = 25; @@ -246,9 +250,9 @@ | System.Windows.Forms.AnchorStyles.Right))); this.animationButton.AutoSize = true; this.tableLayoutPanel1.SetColumnSpan(this.animationButton, 2); - this.animationButton.Location = new System.Drawing.Point(3, 545); + this.animationButton.Location = new System.Drawing.Point(3, 544); this.animationButton.Name = "animationButton"; - this.animationButton.Size = new System.Drawing.Size(208, 17); + this.animationButton.Size = new System.Drawing.Size(208, 18); this.animationButton.TabIndex = 16; this.animationButton.Text = "Animation"; this.animationButton.Theme = MetroFramework.MetroThemeStyle.Dark; @@ -261,9 +265,9 @@ | System.Windows.Forms.AnchorStyles.Right))); this.clearColorButton.AutoSize = true; this.tableLayoutPanel1.SetColumnSpan(this.clearColorButton, 2); - this.clearColorButton.Location = new System.Drawing.Point(3, 467); + this.clearColorButton.Location = new System.Drawing.Point(3, 457); this.clearColorButton.Name = "clearColorButton"; - this.clearColorButton.Size = new System.Drawing.Size(208, 20); + this.clearColorButton.Size = new System.Drawing.Size(208, 23); this.clearColorButton.TabIndex = 24; this.clearColorButton.Text = "Clear Custom Colour"; this.clearColorButton.Theme = MetroFramework.MetroThemeStyle.Dark; @@ -276,9 +280,9 @@ | System.Windows.Forms.AnchorStyles.Right))); this.extractButton.AutoSize = true; this.tableLayoutPanel1.SetColumnSpan(this.extractButton, 2); - this.extractButton.Location = new System.Drawing.Point(3, 493); + this.extractButton.Location = new System.Drawing.Point(3, 486); this.extractButton.Name = "extractButton"; - this.extractButton.Size = new System.Drawing.Size(208, 20); + this.extractButton.Size = new System.Drawing.Size(208, 23); this.extractButton.TabIndex = 27; this.extractButton.Text = "Extract Tile from Atlas"; this.extractButton.Theme = MetroFramework.MetroThemeStyle.Dark; @@ -289,10 +293,10 @@ // this.colorSlider.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom))); this.colorSlider.BackColor = System.Drawing.Color.Transparent; - this.colorSlider.Location = new System.Drawing.Point(64, 353); + this.colorSlider.Location = new System.Drawing.Point(64, 380); this.colorSlider.Maximum = 255; this.colorSlider.Name = "colorSlider"; - this.colorSlider.Size = new System.Drawing.Size(147, 82); + this.colorSlider.Size = new System.Drawing.Size(147, 42); this.colorSlider.TabIndex = 26; this.colorSlider.Text = "metroTrackBar1"; this.colorSlider.Theme = MetroFramework.MetroThemeStyle.Dark; @@ -306,11 +310,12 @@ | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.colorSliderLabel.BackColor = System.Drawing.Color.Transparent; - this.colorSliderLabel.Location = new System.Drawing.Point(3, 350); + this.colorSliderLabel.FontSize = MetroFramework.MetroLabelSize.Small; + this.colorSliderLabel.Location = new System.Drawing.Point(3, 377); this.colorSliderLabel.Name = "colorSliderLabel"; - this.colorSliderLabel.Size = new System.Drawing.Size(55, 88); + this.colorSliderLabel.Size = new System.Drawing.Size(55, 48); this.colorSliderLabel.TabIndex = 19; - this.colorSliderLabel.Text = "Color Range:"; + this.colorSliderLabel.Text = "Color Value:"; this.colorSliderLabel.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; this.colorSliderLabel.Theme = MetroFramework.MetroThemeStyle.Dark; this.colorSliderLabel.Visible = false; @@ -323,7 +328,7 @@ this.variantComboBox.Enabled = false; this.variantComboBox.FormattingEnabled = true; this.variantComboBox.ItemHeight = 23; - this.variantComboBox.Location = new System.Drawing.Point(3, 291); + this.variantComboBox.Location = new System.Drawing.Point(3, 338); this.variantComboBox.Name = "variantComboBox"; this.variantComboBox.Size = new System.Drawing.Size(208, 29); this.variantComboBox.TabIndex = 17; @@ -373,7 +378,7 @@ private System.Windows.Forms.ToolStripMenuItem applyColorMaskToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem playAnimationsToolStripMenuItem; private MetroFramework.Controls.MetroLabel tileNameLabel; - private MetroFramework.Controls.MetroLabel variantLabel; + private MetroFramework.Controls.MetroLabel internalTileNameLabel; private MetroFramework.Controls.MetroButton clearColorButton; private MetroFramework.Controls.MetroButton setColorButton; private MetroFramework.Controls.MetroTrackBar colorSlider; diff --git a/PCK-Studio/Forms/Editor/TextureAtlasEditor.cs b/PCK-Studio/Forms/Editor/TextureAtlasEditor.cs index 874fd5e6..4db6e920 100644 --- a/PCK-Studio/Forms/Editor/TextureAtlasEditor.cs +++ b/PCK-Studio/Forms/Editor/TextureAtlasEditor.cs @@ -195,8 +195,8 @@ namespace PckStudio.Forms.Editor private void SetImageDisplayed(int index) { tileNameLabel.Text = string.Empty; - - variantLabel.Visible = false; + internalTileNameLabel.Text = string.Empty; + variantComboBox.Visible = false; variantComboBox.Items.Clear(); variantComboBox.SelectedItem = null; @@ -221,6 +221,7 @@ namespace PckStudio.Forms.Editor selectTilePictureBox.Image = dataTile.Texture; tileNameLabel.Text = $"{dataTile.Tile.DisplayName}"; + internalTileNameLabel.Text = $"{dataTile.Tile.InternalName}"; selectTilePictureBox.BlendColor = GetBlendColor(); selectTilePictureBox.UseBlendColor = applyColorMaskToolStripMenuItem.Checked; @@ -244,7 +245,7 @@ namespace PckStudio.Forms.Editor setColorButton.Enabled = clearColorButton.Enabled = dataTile.Tile.ColourEntry.HasCustomColour; clearColorButton.Enabled = false; - variantComboBox.Enabled = variantLabel.Visible = variantComboBox.Visible = dataTile.Tile.ColourEntry.Variants.Length > 1; + variantComboBox.Enabled = variantComboBox.Visible = dataTile.Tile.ColourEntry.Variants.Length > 1; if (dataTile.Tile.ColourEntry.IsWaterColour && _colourTable.WaterColors.Count > 0) { @@ -411,7 +412,15 @@ namespace PckStudio.Forms.Editor { if (_colourTable.Colors.FirstOrDefault(entry => entry.Name == colorKey) is ColorContainer.Color color) { - return color.ColorPallette; + var final_color = color.ColorPallette; + + // Enchanted hits are hardcoded and do not have color table entries + if (dataTile.Tile.InternalName == "enchanted_hit") + // this is directly based on Java's source code for handling enchanted hits + // it just multiplies the red by 0.3 and green by .8 of the color assigned to the critical hit particle + final_color = Color.FromArgb((int)(final_color.R * 0.3f), (int)(final_color.R * 0.8f), final_color.B); + + return final_color; } } else if (_colourTable.WaterColors.FirstOrDefault(entry => entry.Name == colorKey) is ColorContainer.WaterColor waterColor) diff --git a/PCK-Studio/Resources/atlases/tileData.json b/PCK-Studio/Resources/atlases/tileData.json index 138f4be8..6303343e 100644 --- a/PCK-Studio/Resources/atlases/tileData.json +++ b/PCK-Studio/Resources/atlases/tileData.json @@ -2311,8 +2311,8 @@ } }, { - "internalName": "", - "displayName": "" + "internalName": "shulker_top_overlay", + "displayName": "Shulker Box (Break Particles) (Overlay) (Unused)" }, { "internalName": "cauldron_water",