Stupid Programming mistakes


#1

I have decided to make a thread about stupid mistakes you have made while programming.
This doesn’t have to be mistakes it can be stupid things you made.


#2

Spent 4 hours debugging why my code involving lighting a portal wasn’t working, only to later realize I was using sheers the whole time…


#3

My biggest flaw has to be the trivial patches, when I get the time to spend on something largish, I can often pull it off in a single go; But, it’s the trivial changes which I often mess up the most, often because I either otherthink them or because I’m just trying to get a quick patch in for some issue before I go to bed; Always ends well \o/


#4

Me: Adds particles to plugin
Me Later Testing the plugin: Why wont the particles spawn/show
Me: I will use a Particle API
Me Testing Again: Why wont the particles spawn/show
Me Again later: OH, I disabled particles on my client.

What is the moral? That your code is sometimes fine but your are an idiot.


#5

This is not really about a single mistake I once made, but about my favourite kind of programming-mistakes:

I mix up values on a regular basis (especially when I’m doing some kind of geometry involving matrices and vectors) and sometimes there are results that make me giggle:

I tried to make some kind of “banner preview” for a confirmation dialog, that involves a design-procedure where players can set their clan banners. The plan was to always display the banner in front of the players view and rotate it with him, as he changes position and/or head rotation, as if the banner was locked on his head and would always stay in the center of his view. :smiley:

What I created however, was a coward banner, that always tries to hide from you, so you never get to see it in first-person-perspective. On top of that, I changed the packet-logic back and forth, as I was testing in first person and was wondering why the banner did not spawn at all. :blush:


#6

I was developing the “stampede” command for TC++ and wanted to make cows follow the player. The first idea I came up with for that was constantly adding small bits of velocity to the cows toward the player. I tested it and it worked fine, then I flew up into the air- and the cows followed :stuck_out_tongue:

Needless to say, I kept that in.


#7

I had this amazing packets based sign shop plugin (with bells and whistles, plugin requester called me a god after I completely finished it)

So basically, this is the snippet of (broken) code:

event.packet.listNbtModifier.read(0).map(NbtFactory::asCompound).forEach {
    val teType = it.getString("id")
    debugLog("Found tile entity: $teType")

    // Target only signs
    if(teType != "minecraft:sign")
        return // <--- should be [email protected]

    // Build location object and try to find corresponding shop sign
    val location = Location(event.player.world, it("x"), it("y"), it("z"))
    val shopSign = database.getSign(location)
            ?: [email protected]

    // Replace sign lines
    debugLog("Rewriting (MAP_CHUNK) sign at (${location.world.name}: ${location.blockX} ${location.blockY} ${location.blockZ})")
    it.writeSignData(event.player, shopSign)
}

And then I debugged 6 hours why the heck are other tile entities in chunks with signs missing their data (skulls without skins etc.)

:tada: :tada: :tada: :tada: :tada:

LPT: staying up more than 24 hours is not good idea :wink:


#8

This is 100% something I would do, and probably have done. I used to write a lot of Skript stuff before learning Java, and countless times I’ve done stupid stuff like that!

100% Done this too. Wondering why something’s not working only to realize I turned it off in my settings.

Another dumb thing I’ve done, is working with configs. Wondering why in gods name this crap ain’t working, only to realize I forgot to enable it in the config I literally just wrote Face Palm