If you want to know I tried my mod with the mc launcher and it didn't wipe player data so...
- Sea_Bass
- Registered Member
-
Member for 10 years, 10 months, and 9 days
Last active Tue, Sep, 6 2016 16:30:46
- 0 Followers
- 178 Total Posts
- 75 Thanks
-
1
Foeskes posted a message on Character Data Lost When World LoadsPosted in: Modification Development -
1
Foeskes posted a message on Character Data Lost When World LoadsPosted in: Modification DevelopmentI am pretty sure this is normal as it happens with me every once in a while, not sure why it would be a problem.
-
1
sky_01 posted a message on Character Data Lost When World LoadsPosted in: Modification DevelopmentThe same thing happens to me, about every 5th time. I'm using the .1492 release for 1.7.10. (not upgraded from 1.6 at all)
The world begins to load, then redirects to the menu. I open the world again and it usually works, though it says "Shutting down internal server," which means it was still loading the world from before.
I don't always have my inventory reset, but one time it reset my inventory even though it loaded on the first try.
As far as I know this only happens in development environment, so I stopped worrying about it and learned not to test anything too far from spawn.
No idea how to help, sorry.
-
124
Popgalop posted a message on Popgalops Beginner-Advanced Modloader Modding Tutorials (Taking requests)Posted in: Mapping and Modding TutorialsHere i will be posting video tutorials based on users requests. I will be using forge. I try to describe almost all parts off the code in the video. But ask any questions you have.
If their is a problem in one of my tutorials marked as please message me or post
a comment.
Coming Soon
-
1
BioMasterZap posted a message on Eldritch Empires - Minecraft Base Defense - now v0.9.1 - added 6 new golems!Since the mod just updated, I thought now would be a good time to make a Mod Spotlight for it. Sorry I didn't get to it sooner; I've been waiting to make on since the start of the year XD Anyway, I think I covered the mod well but let me know if I missed anything... and what the ranger golems do =PPosted in: WIP Mods
-
1
coolAlias posted a message on [1.7.2] Forge | Add new Block, Item, Entity, AI, Creative tab, Language localization, Block textures, Side texturesNice work - this is sure to be helpful to lots of folksPosted in: Mapping and Modding Tutorials -
1
Aeronica posted a message on [1.7.x] Modding with Forge #1 - JDK, Eclipse, Forge and GradlePosted in: Mapping and Modding Tutorials
Go ahead. I'm just sharing what I think may be useful.Quote from MrrGingerNinjaThanks, Aeronica, I'll put this in the OP if you don't mind
I'll add another tidbit here regarding running the server run configuration. Actually the server.properties file to be more precise. After being spoiled with pre-configured server.properties file from the pre-gradle Forge days I ran into an issue where I could not login to the server with my fake player name. All you need to do is change line online-mode=true to online-mode=false.
server.properties
. online-mode=false .
-
2
Sequiturian posted a message on [1.7.2] Forge | Add new Block, Item, Entity, AI, Creative tab, Language localization, Block textures, Side texturesActually, for a simple block you don't need to mess with Icon's at all:Posted in: Mapping and Modding Tutorials
in your block class just put
setBlockTextureName("<yourmodid>:<your-png-basename>");
No other code is required as long as you have a file called "assets\<yourmodid>\textures\blocks\<your-png-basename>.png" with your icon texture in your resources folder.
(replace the stuff inside <> with your own names. -
1
Slykyng posted a message on Eldritch Empires - Minecraft Base Defense - now v0.9.1 - added 6 new golems!Posted in: WIP ModsQuote from Sea_Bass
I've heard that path-finding and mob AI will be improved in Minecraft 1.8, hopefully that will fix a whole lot of the issues with this mod. I'm currently getting started with updating to 1.7. I'm going to have to rewrite a substantial part of the mod and I'm not sure how long that will take. Also, you should be able to set portal locations in the most recent version, I think I only took that option out for a couple versions.
Thanks mate, I'll give that a go.
I think one way I've seen other mods get around the path-finding problem is to have an engineer mob that builds bridges & ladders.
Cheers -
1
Renkin42 posted a message on Adding a block 1.7.2 +Posted in: Modification DevelopmentQuote from Sea_Bass
That was me just testing different things, I believe this is the best way of doing it, at least for a block without metadata:
blockTest = new BlockTest().setBlockName("blockTest"); GameRegistry.registerBlock(blockTest, blockTest.getUnlocalizedName().substring(5));
It seems to work no matter what string you put into registerBlock. Not sure exactly what that's used for.
That String is used for the /give code. For example, if you use "blockTest" and your mod id is "example", the command in-game would be /give player example:blockTest. - To post a comment, please login.
10
First, I'll explain how it works:
Getting Started
Make a collector (recipe below) and right click to turn it on/off. While it's on, a portal will be created in a random location nearby. Attacking creatures will come from the portal and attempt to destroy the collector. It's up to you to make sure they don't do that.
The collector collects magic essence, which also comes through the portal, so you must have a clear path between the collector and the portal for the collector to work properly. Magic essence is nearly invisible, but if you look carefully, you can notice the sparkles. When the magic essence reaches the collector, it drops a condensed magic essence item.
You can use the condensed magic essence, to build defensive golems, create items, or combine 9 together to get a diamond.
Enemies
They come in 4 varieties, regular Zoblins, Zoblin Bombers, Zoblin Warriors and the much more difficult Zoblin Boss. Make sure to kill bombers quickly, as they can blow up and destroy the collector.
Rabid Dwarfs
These come in 3 regular varieties, the normal Rabid Dwarfs, Dwarf Miners and Dwarf Warriors. Miners carry a pickaxe that they use to destroy blocks, so be careful (work in progress). There's also the Dwarven Demolitionist, a boss mob that throws bombs. Destroy them quick before they explode!
Defense
There are 3 basic golems that can be upgraded into new forms, the stone archer, stone mage, and stone warrior. Check the recipes section for how to make the blocks that spawn them. A couple other notes, they can take a little while to spawn at first, and if it's killed, just wait a little bit and another one should spawn in its place.
The golem wand is used to upgrade your defensive golems. While holding the wand, right click on the spawner block (not the golem itself) to see upgrade options.
Base class upgrade: 5 exp levels + condensed magic essence
Elite class upgrade: 10 exp levels + required upgrade crystal
Recipes
Collector
Golem Part
Stone Archer Spawner (requires undamaged bow)
Stone Warrior Spawner (requires undamaged iron sword)
Stone Mage Spawner
Golem Wand
Portal Focus
Ice Crystal
Fire Crystal
Poison Crystal (those are fermented spider eyes)
Dark Crystal
Earth Crystal
Hero's Crystal
It requires Forge 9.11.1.965, and all you've got to do is drop it in your mods folder. It has now been upgraded to 1.6.4, and it should be working for both single player and multi player.There is a 1.7 version, though I don't recommend it yet. View the details here, and use at own risk.It's also open-source, though I haven't updated this with the newer version yet: GitHub page.
Change Log
0.9
More Mod Showcases
My first mod showcase, thanks jackdavid12345! I changed the mechanics of the collector and the portals, but most of it still applies to the most recent version:
Future Plans
More defensive itemsWorking multiplayerA golem "forge" block and more types of golemsBetter looking models, textures, & iconsZoblin dimension, other dimensions...I'd like to continue to expand this mod, but I also realize it's an enormous amount of work for a single person. If anybody would like to assist me in creating this, I could use help with coding, modeling, textures... pretty much everything. If you're interested, leave a reply with an example of your work.
1
44
Also, make sure you're using the latest recommended release for Forge, currently 10.12.0.1024. If you try using earlier version of Forge 1.7, many of the method names will likely not be the same. If you need help setting up your programming environment, that describes the process.
1. Add new Block and Creative Tab
First, here's a very basic mod class to begin with:
You can adjust these two lines to provide a unique Mod ID and a version for your mod. I've been told the Mod ID must be all lowercase letters now.
This line declares the block:
This line sets up a new creative tab:
And these two lines are used to register the block using the unlocalized name "blockTest":
If you're upgrading from previous versions of MC, note that blocks must now be registered inside a FMLPreInitializationEvent, FMLInitializationEvent no longer works.
Now we need two more classes, one for the block, and one for the creative tab. I'll start with the block:
This is about as basic as you can get for a block, super(Material.ground); sets the material type for the block and this.setCreativeTab(MyMod.tabMyMod); sets which creative tab that you see the block in.
Finally, here's the code to set up a creative tab:
The part you probably want to change is Item.getItemFromBlock(Blocks.dirt). The getTabIconItem() method returns an Item and uses its icon for the creative tab. I wanted to use the dirt block icon, so I used Item.getItemFromBlock() to change the dirt block (Blocks.dirt) into an Item type.
That's it for now! You may have noticed this mod is missing some rather important things, such as an icon for the block and localized names. I should be adding those to the tutorial later as I discover how to set all that up myself.
2. Language Localization
If you try running the mod, you'll notice the block and the creative tab have odd names in game. The block will be called something like tile.blockTest.name, where "blockTest" is the unlocalized name for the block. Because minecraft is translated into many many different languages, the name for the block that's used in the code doesn't use any specific language. You have to add a file to tell MC how to translate unlocalized names into whichever language the user has chosen, a process known as language localization.
Other tutorials say you're supposed to use different folders for the language files, but there's only one location I've gotten able to work with forge v1024. Within your forge directory navigate to "src\main\resources\" and create a folder named assets. Within this folder create another folder with your Mod ID as the name, and then within that folder, create a folder named "lang". Using the code from the first tutorial, it should look something like this:
forge-directory\src\main\resources\assets\mymod\lang
The lang folder is where you'll be putting all your localization files. For instance, I speak US English, so I'll want to create a localization file named "en_US.lang". For other language codes, you can check "forge-directory\eclipse\assets\lang" for a long list of examples. Within the localization file you should have something that looks like this:
tile.blockTest.name uses the unlocalized name of the block we added in the first tutorial, and "Test Block" is the name we want to display in game. itemGroup.MyMod is the unlocalized name of the creative tab, and if you're not sure about a specific unlocalized name, you can always hover your mouse over an object in game and if it hasn't been named yet, it will give you the unlocalized name.
If you've done everything correctly, you should be able to start the game now and see the new names you've set.
3. Add a texture to your block
If you've followed the tutorial so far, your block should have a magenta and black checkered pattern in game. That's the default texture that is set when MC can't find any other texture to use for the block. Setting your own texture is relatively simple, we just have to declare a new variable and override a couple methods from the Block class.
Update: If you only have a single block texture you want to use, this tutorial is a bit of overkill. To make things much simpler you can use the method setBlockTextureName(MyMod.MODID + ":" + "blockTest") when registering the block, or within your block's class constructor. If you do that, you can skip the rest of this tutorial, which sets you up for using multiple textures with a block. Thanks to Sequiturian for the tip!
First, in the BlockTest class you want to add:
This creates a variable called blockIcon to store the texture in. Also, notice the @SideOnly(Side.CLIENT). Minecraft separates the client and server, and since the graphics are handled on the client side, you add this line so they're only loaded on the client.
Next we add this method:
This registers the texture, and lets the client know where to find the texture. If you're using the code from the tutorial so far, it will use the following location for textures:
forge-directory\src\main\resources\assets\mymod\textures\blocks
And it will search for a file named "blockTest.png" in that directory to use as the texture. Note that "mymod" is what I set the mod ID to in the first tutorial, and "blockTest" is the unlocalized name for the block. Finally, we need this last method:
This method returns the actual texture we want to use for the block, which was set in the registerBlockIcons() method. This should be all you need to get block textures working, though this only works properly for very simple blocks. Blocks with different textures per side, and blocks with different textures based upon metadata will not work properly. I believe the two parameters on the getIcon() method will give you the side and the metadata, though I'll save how to use those for another tutorial.
The class for the block we added should now look something like this:
4. Sided block textures
First, I'm gonna share a quick tip on how to find out on your own how a method works. I want to know what the two parameters on getIcon(int p_149691_1_, int p_149691_2_) do, so I'll use
in the getIcon() method to output the values for each parameter to the console in Eclipse. Turns out p_149691_1_ counts from 0 to 5, while p_149691_2_ stays zero. I know the block texture can be set differently for the 6 different sides of the block, and I haven't set the metadata, so that should be zero. It should now be obvious which one I need to use to set sided textures.
First, I'm going to add a new IIcon object:
Then add this line in registerBlockIcons():
Note that I'm adding '+ "Top"' to the end of the string, this means it will look for blockTestTop.png in the block texture directory.
Lastly, I need to change the getIcon() method so it returns blockIconTop for the top side of the block. I looked in the BlockGrass class to find that "1" corresponds to that side of a block. Here's my new method, and I've changed the parameters to make it easier to understand:
If you add a texture image named blockTestTop.png to your block texture directory ( forge-directory\src\main\resources\assets\mymod\textures\blocks ), you should now see that texture on the top side of the block when running MC.
Here's what my full BlockTest class looks like now:
5. Add an item
If you understood the process of adding a block in the first tutorial, adding a new item should be cake. I'm going to use the same basic mod code I used in the first tutorial, and add this line to declare an object of the Item type named itemTest. It should go right next to where blockTest was declared.
Next I'll add this line inside the preInit() method. You can also just use Item() instead of ItemTest() if you don't want to use a custom class for your new item.
I've gone over how the unlocalized name works in previous tutorials, so I'll focus upon the setTextureName() method. It takes a string in the following format "ModID:texture-name", which in this case is "mymod:itemTest". This tells minecraft where to look for your textures, "mymod" is the assets directory, and since it's looking for an item texture, its going to search within the "textures/items" directory within "mymod". Within that directory, it's going to look for an image named "itemTest.png", so the full path should be along the lines of forge-directory\src\main\resources\assets\mymod\textures\items\itemTest.png .
One more line to add to our mod file within the preInit() method:
This is what registers the item, i.e. the part that adds your item into the game itself. Finally, we need to create a new class file named ItemTest, I kept mine super-simple, all it does is set which creative tab to use.
And that's it! You should now have a new item in-game. Here's my full mod class now if you need to refer to it:
Whoops, I seem to have forgotten something important that I covered in a previous tutorial, notice what it is? When I load up the game, my item is named item.itemTest.name, the name hasn't been localized! No worries, I just need to add this line to my language localization file: item.itemTest.name=Item Test
6. Add an entity
It takes a few lines of code to add an entity, and if you've got a lot of entities it can be a pain to write out the code over and over again. To streamline the process, I use a method to take care of all the repetitive work which I've inserted into my mod class:
The first line within registerEntity() is to get a unique ID for the entity. The next four lines generate random colors for the spawn egg using the entity's name as a random seed. If you want to set colors yourself, you could easily adjust the method to take the primary and secondary colors as method parameters.
These lines register the entity ID, register the entity itself, and add a spawn egg respectively. It's mostly the same as MC 1.6, though I had to change EntityEggInfo to EntityList.EntityEggInfo. You may have noticed we haven't declared the instance variable yet, so let's add this line to our mod class. Put it near the top, but underneath the MODID string declaration.
One more thing the mod class needs, and that's to actually call the method we just created. Put this line within the preInit() method:
Okay, now we need to make the EntityTest class that I just referred to for our entity. Here's some very basic code that's simplified to the point of not really being practical:
This class extends EntityMob, which are the hostile monster types of entities. EntityCreature, EntityAnimal, and EntityLiving are all examples of other entity types that you can extend.
Finally, we give a localized name to our new entity by putting this into our language localization file:
entity.entityTest.name=Entity Test
That should be it! If you start minecraft, you should see a new spawn egg under the Miscellaneous creative tab. Using it should create a retarded white box within the game. Not very useful, but not bad to begin with! I'll add more tutorials about making entities smarter and more attractive.
7. Give entity a model
If you're not very comfortable coding Java, you may want to stick to easier things like blocks and items. These tutorials are going to start getting a bit more complicated now.
If you want to mod Minecraft properly, you have to understand how the client-server model works. All the rendering, the parts of the code that display graphics, happen on the client side. This isn't something the server needs to deal with at all. To separate the client and server code we're now going to create proxies, and then use the client proxy to give a proper model to our entity.
First, you'll need this in your main mod class:
This tells Forge which classes we want to use for the client and server proxies. Notice it refers to a new java package, "mymod.proxy" so go ahead and create that now. Next create the server proxy class, CommonProxy, and paste this code inside:
Not much there since we don't need to do anything with the server side at the moment. Next create a new class named ClientProxy and paste this code inside:
The RenderingRegistry.registerEntityRenderingHandler() method tells MC how to render your new entity. The RenderTest class will be used to render EntityTest entities and it will use the ModelBiped class for the model. ModelBiped is the basic player model. Also, the float that's the second parameter in RenderTest determines the shadow size.
Now we'll need to add a call to registerRenderers() within our main mod class. I put this line at the end of the preInit() method:
Next, create the RenderTest class, and paste this code inside:
The class constructor is simple enough, we just pass the parameters on to the RenderBiped class, the superclass of RenderTest. The rest of this code is used to set the texture, getEntityTexture() returns textureLocation, which *gasp* holds the location of the texture. We set it similar to the same way we set block and item textures, but we use a ResourceLocation type and I added some more information on what directory to find the texture in.
Since I'm using the same model the player uses, any player skin should work fine as a texture for my entity. I'm just testing things out, so I'm going to use the Steve skin, which will go in the location we set using ResourceLocation(MyMod.MODID + ":" + "textures/models/entityTest.png") . If you haven't tweaked your MODID, the path to the texture should be something like this: forge-directory\src\main\resources\assets\mymod\textures\models\entityTest.png
And that should be it, if you start minecraft and spawn the entity, it should now be using the basic biped model with the Steve skin.
8. Entity attributes and AI
If you used the previous tutorials to create an entity, you may have noticed that when you spawn it, it moves painfully slow. We need to set entity attributes, so go ahead and add this code to your entity's class:
This code should be fairly self-explanatory, you get the attribute, for instance maxHealth, and then use setBaseValue() to set the value. I should explain knockbackRestistance some, which ranges from 0.0D to 1.0D (the D stands for double, a primitive data type). 0.0D means 0% knockback resistance, so the entity will be knocked back every hit. 1.0D means 100% knockback resistance, so the entity will never be knocked back.
An important thing to understand abbout attributes is that they're saved per entity. This means you can do things like set them to random values or even alter an entity's attributes after it's been spawned, though I wont go in to how to do that here.
After adding attributes, it may be that you're happy with the way your entity behaves, and in that case there's no reason to add any "advanced" artifical intelligence (AI). However, if you do want more control over your entity's behavior you'll need to add this method:
Now this method by itself will just make your entity stand there and stare straight forward. When you've got AI enabled, you have to tell your entity specifically how to behave. We'll do that by adding AI tasks to your entity's class constructor. Here's what I used:
The numbers that are the first parameter of the addTask method determine the priority of the task. We put EntityAISwimming as 1, since we don't want our entity to drown in water. The EntityAIAttackOnCollide is the basic attack type that mobs like zombies and spiders use. EntityAIWander tells the mob to wander around when it's not attacking. I'll let you figure out what EntityAIWatchClosest does, and EntityAILookIdle makes the mob look around when it's just standing there.
Then there's the target tasks, which lets the entity know how to choose attack targets. EntityAIHurtByTarget will target any mob that does damage to our entity, and EntityAINearestAttackableTarget will target any nearby entity that matches the second parameter, in this case EntityPlayer.class.
That should be it, if you run the game your entity should now behave like a regular mob. One thing to be careful about is any mobs that were created in your game before you changed attributes around. You'll have to spawn new entities for them to use the new attributes you set.
Other 1.7.2 tutorials
Here's some other tutorials to check out:
Happy modding!
1
For a new sword, you can try extending the ItemSword class. I believe you have to override this method to set the damage:
I'm probably not going to cover armor or weapons with my tutorials. Hopefully someone else will add their own, though you may be able to use tutorials for 1.5 and 1.6 as I don't believe much has changed in the armor and weapon code.
1
I actually just added a tutorial on how to do this while you were writing your comment. =)
I tried adding item textures a few different ways, but the only thing that worked for me was using .setTextureName() during PreInitialization. Here's the code I used:
1
It's been a combination of what I already knew about modding 1.5 and 1.6, searching the internet, trial and error, plus digging through the code. A lot of it I've had to figure out myself. Some of the earlier 1.7 tutorials were a good start, though you usually have to modify them some to get working.
1
Sure! I'd love to see more examples of 1.7.2 code, there's a whole lot I'm still learning myself. I'm not sure how much I'll be getting into the world gen aspects for this tutorial though. My current plan is to do block metadata, tile entities, mob entities, item creation and packet handling tutorials.
1
It's "like a notepad file". If you're using windows, you can create a new text document, then rename it to en_US.lang. Make sure you've set things up to not hide file extensions, or it will still be a text file. You must put the names you want your custom blocks, items, entities and creative tab to use inside that file, or they'll be named things like tile.blockTest.name within the game.
1
1
When you use blockTest.getUnlocalizedName() I believe it returns the string tile.blockTest . Using the substring(5) method trims the first 5 characters in the string so you just get the unlocalized named without the "tile." part.
And textures for blocks is what I plan on doing for my next tutorial, just as soon as I figure out how to get it working myself.