How to make brick like Rainbow Brick?

alienblox

Terrarian
I was trying to make a brick like Rainbow Brick for my mod and I couldn't get it to work.
Can anyone post code to make a tile like Rainbow Brick?
 
Error here
 

Attachments

  • Desktop Screenshot 2024.02.08 - 18.24.51.37.png
    Desktop Screenshot 2024.02.08 - 18.24.51.37.png
    238.1 KB · Views: 18
Again I don't know what the error numbers are lol
You'd have to post the code and actual error message.

If you changed the method back to void, are you still trying to return a value? That wouldn't be valid.
 
public override void DrawEffects(int i, int j, SpriteBatch spriteBatch, ref TileDrawInfo drawData)

instead of

public override Color? DrawEffects(int i, int j, SpriteBatch spriteBatch, ref TileDrawInfo drawData)

Then change the drawData.finalColor
 
public override void DrawEffects(int i, int j, SpriteBatch spriteBatch, ref TileDrawInfo drawData)

instead of

public override Color? DrawEffects(int i, int j, SpriteBatch spriteBatch, ref TileDrawInfo drawData)

Then change the drawData.finalColor
I had no error but when I tested the mod, the tile did not glow
C#:
using System;
using Terraria.ID;
using Terraria;
using Terraria.ModLoader;
using AlienbloxMod.Items.Tiles;
using static Terraria.ID.ContentSamples.CreativeHelper;
using log4net.Core;
using System.Drawing;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria.DataStructures;
using Color = Microsoft.Xna.Framework.Color;

namespace AlienbloxMod.Tiles.Other
{
    public class RainbowPlateTile : ModTile
    {
        public override void SetStaticDefaults()
        {
            Main.tileSolid[Type] = true;
            Main.tileMergeDirt[Type] = false;
            Main.tileBlockLight[Type] = false;
            Main.tileBouncy[Type] = false;
            Main.tileColor = new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB);

            DustType = DustID.ArgonMoss;
            AddMapEntry(Color.LightGoldenrodYellow, CreateMapEntryName());
        }

        public override void DrawEffects(int i, int j, SpriteBatch spriteBatch, ref TileDrawInfo drawData)
        {
            drawData.finalColor = Main.DiscoColor;
        }
    }
}
 
Back
Top Bottom