Thx for the great tutorials!! I love having an easy guide to creating my mods, but one thing i cant figure out is the textures i follow the tutorial exactly (I even tried 'copy and paste' it) and come up with no results. I am just left with a block that is Pink and Black called 'Test Block'. I would really like some help.. Aside from that i think your tutorial are excellent!!.Ok, so another thing is I was wondering if you could post a tutorial about ores, those i have messed around with but I can't get them to drop items and they crash most of the time. I would love for you to reply to my coment, so I can get back to modding ASAP. Thank You for the tutorials and i hope that you have a great day.
Thx for the great tutorials!! I love having an easy guide to creating my mods, but one thing i cant figure out is the textures i follow the tutorial exactly (I even tried 'copy and paste' it) and come up with no results. I am just left with a block that is Pink and Black called 'Test Block'. I would really like some help.. Aside from that i think your tutorial are excellent!!.Ok, so another thing is I was wondering if you could post a tutorial about ores, those i have messed around with but I can't get them to drop items and they crash most of the time. I would love for you to reply to my coment, so I can get back to modding ASAP. Thank You for the tutorials and i hope that you have a great day.
~Cincerely Beastplayer102
Did you create a new blockTest.png file in the block textures directory?
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.
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.
Thanks for the tip! I just updated the tutorial mentioning this much easier way of doing things.
I was wondering, how you would make an item into Armor, weapons, etc?
For a new sword, you can try extending the ItemSword class. I believe you have to override this method to set the damage:
public float func_150931_i()
{
return field_150933_b.getDamageVsEntity();
}
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.
The original tutorial on adding an entity model didn't include proxies, which is a bad way of doing things since it doesn't work in multiplayer. I've changed the tutorial around a bit.
textures for items work pretty much identically to how simple block textures work... and you can apply Sequiturian's tip as well,
the main thing is, use setTextureName() instead of setBlockTextureName()
example..
public class ItemTest extends Item {
protected ItemTest(String itemName) {
this.setUnlocalizedName(itemName); //don't need .substring(5)
this.setTextureName(TestBlock.MODID + ":cow_pie"); //use setTextureName() instead of setBlockTextureName()
this.setCreativeTab(TestBlock.test_tab);
}
/* DO NOT NEED THIS PART, Thanks Sequiturian
//I'm just leaving this here for informational purposes
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IIconRegister reg) {
this.itemIcon = reg.registerIcon(TestBlock.MODID + ":" + this.getIconString()); //this.getIconString() returns the value you set with setTextureName()
}
*/
}
I was wondering, how you would make an item into Armor, weapons, etc?
So far, the method of adding armor and weapons via Forge has not changed. I'm not saying it's not going to, but the method in place right now is pretty solid. Looking at the Forge and FML src verifies that all the needed functions still exist and are not marked for deprecation.
The reason this is better than extending the vanilla items is the ability to create items that are stronger/weaker than the bounds of vanilla. Not to mention the ability to add your own materials.
So far, the method of adding armor and weapons via Forge has not changed. I'm not saying it's not going to, but the method in place right now is pretty solid. Looking at the Forge and FML src verifies that all the needed functions still exist and are not marked for deprecation.
The reason this is better than extending the vanilla items is the ability to create items that are stronger/weaker than the bounds of vanilla. Not to mention the ability to add your own materials.
I just added a tutorial about AI & entity attributes, plus some links to other 1.7 tutorials. I'll probably take a break from adding tutorials for a bit, while I'm updating my mod, Eldritch Empires, to 1.7.
first of all, thank u for the tutorials.
I'm kinda new to modding. I got my new Blocks, some kinda of falling or not falling blocks, but i actually can't craft my items.
I just use Dirt in a shapless crafting recipie, my code:
GameRegistry.addShapelessRecipe(new ItemStack(Gravidirt, 1), new ItemStack(Blocks.dirt));
GraviDirt class only extends this class:
package com.mankel.blocks;
//all imports
public class GraviBlocks extends Block
{
public static boolean fallInstantly;
private final String MODID = FirstMod.MODID;
private static int instaceuse = 0;
protected GraviBlocks()
{
super(Material.sand);
this.setCreativeTab(FirstMod.tabMyMod);
}
protected GraviBlocks(Material m)
{
super(m);
this.setCreativeTab(FirstMod.tabMyMod);
}
public static boolean blocknearisStrongBlock(World world, int x, int y, int z)
{
Block[] blocks = new Block[5];
blocks[0] = world.getBlock(x + 1, y, z);
blocks[1] = world.getBlock(x - 1, y, z);
blocks[2] = world.getBlock(x, y + 1, z);
blocks[3] = world.getBlock(x, y, z + 1);
blocks[4] = world.getBlock(x, y, z - 1);
for (int i = 0; i < blocks.length; i++)
{
if ((blocks[i] instanceof BlockStrong) || (blocks[i] instanceof GravityDirt))
{
return true;
}
}
return false;
}
// COPIED FROM FALLINGBLOCK.class
/**
* Lets the block know when one of its neighbor changes. Doesn't know which neighbor changed
* (coordinates passed are their own) Args: x, y, z, neighbor Block
*/
public void onNeighborBlockChange(World world, int x, int y, int z, Block block)
{
world.scheduleBlockUpdate(x, y, z, this, this.tickRate(world));
}
/**
* Ticks the block if it's been scheduled
*/
public void updateTick(World world, int x, int y, int z, Random random)
{
if (!world.isRemote)
{
this.func_149830_m(world, x, y, z);
}
}
private void func_149830_m(World world, int x, int y, int z)
{
if (!blocknearisStrongBlock(world, x, y, z))
{
if (blockispenetrable(world, x, y - 1, z) && y >= 0)
{
byte b0 = 32;
if (!fallInstantly && world.checkChunksExist(x - b0, y - b0, z - b0, x + b0, y + b0, z + b0))
{
if (!world.isRemote)
{
EntityFallingBlock entityfallingblock = new EntityFallingBlock(world, (double) ((float) x + 0.5F), (double) ((float) y + 0.5F), (double) ((float) z + 0.5F), this, world.getBlockMetadata(x, y, z));
this.func_149829_a(entityfallingblock);
world.spawnEntityInWorld(entityfallingblock);
}
} else
{
world.setBlockToAir(x, y, z);
while (blockispenetrable(world, x, y - 1, z) && y > 0)
{
--y;
}
if (y > 0)
{
world.setBlock(x, y, z, this);
}
}
}
}
}
/**
* How many world ticks before ticking
*/
public int tickRate(World world)
{
return 2;
}
public static boolean blockispenetrable(World world, int x, int y, int z)
{
Block block = world.getBlock(x, y, z);
if (block.isAir(world, x, y, z))
{
return true;
} else if (block == Blocks.fire)
{
return true;
} else
{
// TODO: King, take a look here when doing liquids!
Material material = block.getMaterial();
return material == Material.water ? true : material == Material.lava;
}
}
}
}
thats my error code from Minecraft:
java.lang.NullPointerException: Rendering item
at net.minecraft.item.ItemStack.func_77960_j(ItemStack.java:231)
at net.minecraft.client.renderer.entity.RenderItem.renderItemIntoGUI(RenderItem.java:406)
at net.minecraft.client.renderer.entity.RenderItem.func_82406_b(RenderItem.java:548)
at net.minecraft.client.gui.inventory.GuiContainer.func_146977_a(GuiContainer.java:281)
at net.minecraft.client.gui.inventory.GuiContainer.func_73863_a(GuiContainer.java:110)
at net.minecraft.client.renderer.EntityRenderer.func_78480_b(EntityRenderer.java:1109)
at net.minecraft.client.Minecraft.func_71411_J(Minecraft.java:981)
at net.minecraft.client.Minecraft.func_99999_d(Minecraft.java:870)
at net.minecraft.client.main.Main.main(SourceFile:103)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at net.minecraft.launchwrapper.Launch.launch(Launch.java:134)
at net.minecraft.launchwrapper.Launch.main(Launch.java:28)
First of all, no need to add the number of items received unless it's greater than one.
Second, the arguments for a shapeless recipe are the ItemStack(object) result and the block or item objects used to craft. Block and item is different than ItemStack. That's why you're getting an error.
Let me know if you need anything explained further.
Hi, ty for the help now it works, but is it true that the recipes need to be in the preinit()-method?
cause when i took it in the init()-method, i got the same error.
Yes, now all items, blocks and recipes need to be registered during the preInit(FMLPreInitializationEvent). I'm not sure when it changed, but that's how it is now. Other optional things go there too like config generation. If you ever need to register an event bus put it in your init or load method.
I am having an issue when following your entity model tutorial.
in my ClientProxy class im getting an error with registerEntityRenderingHandler
also what am i meant to do with the EntityTest Class
A completed example would be very helpful so i can compare the files and make sure everything is the same.
Which error are you getting? And please post the code you're using for you ClientProxy class.
Also, if you followed the "Add an entity" tutorial, the EntityTest class should be all taken care of.
Hi,
my next problem seems to be, that i want to make a custom renderer for some of my blocks, i already figured out, that i need to override the
public int getRenderType(){}
public boolean renderAsNormalBlock(){}
public boolean isOpaqueCube(){}
functions right?
But im not sure which class i need to extend to get my own renderer registert.
I'm not sure if there's an easier way of doing it, but I had to create a new tile entity to use my own custom model for a block. I set getRenderType() to return -1, renderAsNormalBlock() and isOpaqueCube() to return false. Then used createNewTileEntity() in the block class to bind it to a tile entity. I don't think there's anything specific you need in the tile entity class, just have to put something like this within your client proxy:
ClientRegistry.bindTileEntitySpecialRenderer(MyTileEntity.class, new RenderMyTileEntity());
well okty for the answer.i asked, cause in the 1.6. u were able to register a custom renderer but those classes seem to be missing now :/gonna try the Tile entity way
Does this require a model? I'd like to make a few of my blocks look a bit "cooler" in the mod I just finished.
EDIT: Maybe I should read the OP first I have this topic on follow so the email directed me straight here.
EDIT2: So, this isn't what I was looking for. I am looking for a custom rendered block tutorial. Basically I want it to fit in the bounds of a normal block, but not completely solid. Maybe I'll look into the cauldron classes since they render very closely to what I want. If anyone has a tutorial on this that starts from scratch I'd appreciate a link. Thanks!
Thx for the great tutorials!! I love having an easy guide to creating my mods, but one thing i cant figure out is the textures i follow the tutorial exactly (I even tried 'copy and paste' it) and come up with no results. I am just left with a block that is Pink and Black called 'Test Block'. I would really like some help.. Aside from that i think your tutorial are excellent!!.Ok, so another thing is I was wondering if you could post a tutorial about ores, those i have messed around with but I can't get them to drop items and they crash most of the time. I would love for you to reply to my coment, so I can get back to modding ASAP. Thank You for the tutorials and i hope that you have a great day.
~Cincerely Beastplayer102
Did you create a new blockTest.png file in the block textures directory?
in your block class just put
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.
Thanks for the tip! I just updated the tutorial mentioning this much easier way of doing things.
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.
textures for items work pretty much identically to how simple block textures work... and you can apply Sequiturian's tip as well,
the main thing is, use setTextureName() instead of setBlockTextureName()
example..
So far, the method of adding armor and weapons via Forge has not changed. I'm not saying it's not going to, but the method in place right now is pretty solid. Looking at the Forge and FML src verifies that all the needed functions still exist and are not marked for deprecation.
The reason this is better than extending the vanilla items is the ability to create items that are stronger/weaker than the bounds of vanilla. Not to mention the ability to add your own materials.
Thx for the info ill be sure to check that out
Change your recipes to
First of all, no need to add the number of items received unless it's greater than one.
Second, the arguments for a shapeless recipe are the ItemStack(object) result and the block or item objects used to craft. Block and item is different than ItemStack. That's why you're getting an error.
Let me know if you need anything explained further.
Yes, now all items, blocks and recipes need to be registered during the preInit(FMLPreInitializationEvent). I'm not sure when it changed, but that's how it is now. Other optional things go there too like config generation. If you ever need to register an event bus put it in your init or load method.
in my ClientProxy class im getting an error with registerEntityRenderingHandler
also what am i meant to do with the EntityTest Class
A completed example would be very helpful so i can compare the files and make sure everything is the same.
Which error are you getting? And please post the code you're using for you ClientProxy class.
Also, if you followed the "Add an entity" tutorial, the EntityTest class should be all taken care of.
I'm not sure if there's an easier way of doing it, but I had to create a new tile entity to use my own custom model for a block. I set getRenderType() to return -1, renderAsNormalBlock() and isOpaqueCube() to return false. Then used createNewTileEntity() in the block class to bind it to a tile entity. I don't think there's anything specific you need in the tile entity class, just have to put something like this within your client proxy:
Does this require a model? I'd like to make a few of my blocks look a bit "cooler" in the mod I just finished.
EDIT: Maybe I should read the OP first I have this topic on follow so the email directed me straight here.
EDIT2: So, this isn't what I was looking for. I am looking for a custom rendered block tutorial. Basically I want it to fit in the bounds of a normal block, but not completely solid. Maybe I'll look into the cauldron classes since they render very closely to what I want. If anyone has a tutorial on this that starts from scratch I'd appreciate a link. Thanks!