I am just diddling around in 1.7.10. My girlfriend and I have our own server that I am hosting from my computer, but I am wanting to replace the 50+ mods that we have with my own custom mod (By that I mean I am replacing the idea of the smeltery with self-introduced upgradeable armor and weapons that only require the crafting table etc). I am making everything my own/not stealing code/textures/etc. I have a few problems currently as I have never really programmed in java before.
First issue: I am trying to program in the idea of a health boost with a full set of armor, but the boost is removed when you unequip one of those items. When I try to apply X (half) hearts of life as a health boost I am actually getting X WHOLE hears of life. Not a big deal, maybe I just don't know exactly how the health boost function works.
My attempt at removing the boost is not working.
Also, if you log out and then in again, you get an additional application of the health boost. I would like to get rid of that.
If you have levels for armor, I recommend creating a separate custom Item class that you use as an object for your armor, then register some model variants. The way you should be doing loops in java is not the same as python (I assume this because you use new Range(10)).
for(int i = 0; i < 10; i++) { ... }
This will loop from 1-10, including 10.
So, the way I would start this is create a item called HardDiamondHelmet, then store an int called level.
Then, when your desired thing happens, increment the level variable by 1.
Then, in the item classes getModel() method, check for level, maybe like this.
So, now, you just need to create 4 classes for each armor piece, and register the path's like that.
You can even improve it by adding a MAX_LEVEL variable, and looping through that to get all the armor textures, instead of specifying them one by one.
This sounds more compact than what I have done so far. I have used Python in the past, but the tiny code I have there I found as a solution to someone else's problem on a different site.
I was doing the leveling through the crafting bench. I attempted to see what I could do with this idea, but Eclipse is confused about this "ModelResourceLocation".
This sounds more compact than what I have done so far. I have used Python in the past, but the tiny code I have there I found as a solution to someone else's problem on a different site.
I was doing the leveling through the crafting bench. I attempted to see what I could do with this idea, but Eclipse is confused about this "ModelResourceLocation".
It is exactly as it should be. If I change the end from lightsaber_blue to diamond_sword (that is the image that came with minecraft) everything works. If I open diamond_sword and save it as lightsaber_blue it no longer works. It can be the EXACT SAME image, but with a different name and the texture will not load.
Changing from "lightsaber_blue" to "diamond_sword" should only work if you have a .png called "diamond_sword" in your personal resources/assets/newmod/textures/items folder. If this is not the case, double-check your texture locations and double-check that the folder is called "items", not "item". If all else fails, here's a tutorial you can reference (although you seem to be doing okay so far).
Everything is named correctly and I have both "lightsaber_blue" (I made this) and diamond_sword (created by Mojang) in the same location.
I will check out the tutorial, but I have already followed one that ended up working for using .png's that came with minecraft and .png's from minecraft that I just changed black/white scale and stuff through the 'adjustments' tab in paint.net.
/edit I checked out the tutorial and it is basically what I am doing. The only thing different is he uses an 'except' line that I have not used. I am guessing that is a backup texture in case the first fails to load.
/edit again: All of a sudden it is loading textures that I have created, but where I have not placed pixels in the texture it has a bunch of whiteness.....annoying. I tried updating the texture in paint.net, but it is not changing.
/edit again again: I just needed to refresh eclipse a few times. I tried this multiple times, but n+1 was the charm.
/edit again again again: White pixel issue solved itself.....not sure how....
I am just diddling around in 1.7.10. My girlfriend and I have our own server that I am hosting from my computer, but I am wanting to replace the 50+ mods that we have with my own custom mod (By that I mean I am replacing the idea of the smeltery with self-introduced upgradeable armor and weapons that only require the crafting table etc). I am making everything my own/not stealing code/textures/etc. I have a few problems currently as I have never really programmed in java before.
First issue: I am trying to program in the idea of a health boost with a full set of armor, but the boost is removed when you unequip one of those items. When I try to apply X (half) hearts of life as a health boost I am actually getting X WHOLE hears of life. Not a big deal, maybe I just don't know exactly how the health boost function works.
My attempt at removing the boost is not working.
Also, if you log out and then in again, you get an additional application of the health boost. I would like to get rid of that.
Issue Three:solved
If you have levels for armor, I recommend creating a separate custom Item class that you use as an object for your armor, then register some model variants. The way you should be doing loops in java is not the same as python (I assume this because you use new Range(10)).
This will loop from 1-10, including 10.
So, the way I would start this is create a item called HardDiamondHelmet, then store an int called level.
Then, when your desired thing happens, increment the level variable by 1.
Then, in the item classes getModel() method, check for level, maybe like this.
So, now, you just need to create 4 classes for each armor piece, and register the path's like that.
You can even improve it by adding a MAX_LEVEL variable, and looping through that to get all the armor textures, instead of specifying them one by one.
Heres a full example:
https://gist.github.com/SolarCactus/16e633208d41d09d1409
I'm not crazy, i'm just not user friendly
--> Click here to get BETA ACCESS to this mod and upcoming server! <--
This sounds more compact than what I have done so far. I have used Python in the past, but the tiny code I have there I found as a solution to someone else's problem on a different site.
I was doing the leveling through the crafting bench. I attempted to see what I could do with this idea, but Eclipse is confused about this "ModelResourceLocation".
"ModelResourceLocation" is for 1.8 only.
Ah. Thanks. So how can I modify that for 1.7.10?
And a new issue arose. I am trying to add lightsabers into my mod and my first texture for a blue lightsaber is not working....
The image below is here: "New Mod\src\main\java\assets\newmod\textures\items"
Here is the applicable code:
LightsaberBlue
MItems
Am I doing something wrong in these?
Ok, sorry, I didn't know you were doing this for 1.7. I don't know much about model variants in 1.7, so I can't help you, unfortunately.
For your other problem however, what is your MODID?
your modid should be in your main class.
it has to be EXACTLY "newmod" for your texture to work.
If it is, it could be your path.
Your path should be:
resources/assets/newmod/textures/items/lightsaber_blue.png
I'm not crazy, i'm just not user friendly
--> Click here to get BETA ACCESS to this mod and upcoming server! <--
It is exactly as it should be. If I change the end from lightsaber_blue to diamond_sword (that is the image that came with minecraft) everything works. If I open diamond_sword and save it as lightsaber_blue it no longer works. It can be the EXACT SAME image, but with a different name and the texture will not load.
Changing from "lightsaber_blue" to "diamond_sword" should only work if you have a .png called "diamond_sword" in your personal resources/assets/newmod/textures/items folder. If this is not the case, double-check your texture locations and double-check that the folder is called "items", not "item". If all else fails, here's a tutorial you can reference (although you seem to be doing okay so far).
Thank you for the reply
Everything is named correctly and I have both "lightsaber_blue" (I made this) and diamond_sword (created by Mojang) in the same location.
I will check out the tutorial, but I have already followed one that ended up working for using .png's that came with minecraft and .png's from minecraft that I just changed black/white scale and stuff through the 'adjustments' tab in paint.net.
/edit I checked out the tutorial and it is basically what I am doing. The only thing different is he uses an 'except' line that I have not used. I am guessing that is a backup texture in case the first fails to load.
/edit again: All of a sudden it is loading textures that I have created, but where I have not placed pixels in the texture it has a bunch of whiteness.....annoying. I tried updating the texture in paint.net, but it is not changing.
/edit again again: I just needed to refresh eclipse a few times. I tried this multiple times, but n+1 was the charm.
/edit again again again: White pixel issue solved itself.....not sure how....
Bump
Bump