I guess this might be a pretty simple question, but for some reason I can't get this code to work. I'm familiar with java and it seems to be alright, it also produces no errors during compilation nor during testing with the client.
So first I made a class called LevelTwoDoor which extended BlockDoor, the only real difference was adding a simple if statement that returned false if the player's level was lower than 2. Here is the class (the rest of the code is just copied from the original BlockDoor class). I added attempts at printing a message to the player before every possible return statement, but none showed. I also tried to kill them by setting their health to 0 before every return statement, and that never happened. So I'm assuming this whole class is somehow not actually in the game, although the item does appear. The if statement was added right at the beginning of the onBlockActivated method:
Assuming that code isn't wrong (probably is considering this is my first attempt), the problem could be in me registering the LevelTwoDoor to the mod. The texture obviously doesn't appear, but the outline of the "level two door" does appear, and does switch orientation when I click it (below level 2 despite the if statement), and the messages never show up nor do I ever die as I should. I guess a problem could be in the casting of levelTwoDoor, but I did try to make it a LevelTwoDoor, a BlockDoor, and a Block, and I tried casting it in multiple ways. There's a chance I missed one, so if you think that's the problem let me know.
Again I could be doing something completely wrong, or there could be a silly mistake, either way I'll appreciate any help I could get. Also, has no one implemented level-gated doors yet? I didn't find any when I searched around.