The first value is measured in ticks I believe (tick = 1/20 of a second), at least that's how it is for addPotionEffect. The second value is the 'amplifier' (at least that's how it's documented). Not 100% sure but I believe it amplifies the effect of said potion. 0 = no amplifier.
The arguments of setPotionEffect and addPotionEffect do different things. Trust me, I've comprehensively studied the code and tested both methods.
Rollback Post to RevisionRollBack
“Computers are incredibly fast, accurate and stupid; humans are incredibly slow, inaccurate and brilliant; together they are powerful beyond imagination."
The Meaning of Life, the Universe, and Everything.
Join Date:
4/1/2012
Posts:
61
Member Details
There is an easier way for adding blocks to creative inventory. go to containercreative and go to the part where it says all the block's names. type in mod_modnamehere.blocknamehere
There is an easier way for adding blocks to creative inventory. go to containercreative and go to the part where it says all the block's names. type in mod_modnamehere.blocknamehere
That is stupid! That ruins the whole point of not editing base classes. Not editing base classes makes mods a lot more compatible with others. Adding to ContainerCreative is just lazy.
“Computers are incredibly fast, accurate and stupid; humans are incredibly slow, inaccurate and brilliant; together they are powerful beyond imagination."
Erm Techguy I was following your ACHIEVEMENT tutorial but I fail... Can you please help?
I want so when you put OBSIDIAN in crafting table and craft INGOT you get the achivement
and that ACHIEVEMENT requires : WE NEED TO GO DEEPER achievement. erm I hope you understood.
Heres the CODE
package net.minecraft.src;
public class mod_AchievementObsidianMod extends BaseMod
{
public static final Achievement ObsidianMod = new Achievement(4560, "ObsidianMod", -1, 10, mod_obsidianingot.obsidian_ingot, null).registerAchievement();
public void load()
{
ModLoader.addAchievementDesc(ObsidianMod, "OoOo! New ingot =D", "Craft Obsidian Ingot!");
}
public void takenFromCrafting(EntityPlayer entityplayer, ItemStack itemstack, IInventory iinventory)
{
if(itemstack.itemID == mod_obsidianingot.obsidian_ingot.shiftedIndex)
{
entityplayer.addStat(ObsidianMod, 1);
}
}
static Achievement Obsidian = AchievementList.portal, Obsidian1;
public String getVersion()
{
return "1.2.5";
}
}
Change the null in the public static final line to Obsidian.
public static final Achievement Obsidiamod_obsidianingot.obsidian_ingot, Obsidian).registerAchievement();nMod = new Achievement(4560, "ObsidianMod", -1, 10,
“Computers are incredibly fast, accurate and stupid; humans are incredibly slow, inaccurate and brilliant; together they are powerful beyond imagination."
public void generateNether(World world, Random random, int chunkX, int chunkZ)
{
for(int i = 0; i < 100; i++)
{
int randPosX = chunkX + random.nextInt(16);
int randPosY = random.nextInt(128);
int randPosZ = chunkZ + random.nextInt(16);
(new WorldGenNetherMod (NetherRiumOre.blockID, 150)).generate(world, random, randPosX, randPosY, randPosZ);
}
}
Use the generateNether method included with ModLoader, leave everything else the same(still using the worldgen file you created though).
Rollback Post to RevisionRollBack
“Computers are incredibly fast, accurate and stupid; humans are incredibly slow, inaccurate and brilliant; together they are powerful beyond imagination."
I just finished my Totem block decorations, and I want to test them on my other computer. If I recompile it now, will everything still stay the same in my Eclipse folder (As in nothing will be modified or moved in other directories and whatnot) and will my written block files reobfuscate into something else on eclipse. Or will this all just go into a folder in the root directory so everything on eclipse would be safe?
I just finished my Totem block decorations, and I want to test them on my other computer. If I recompile it now, will everything still stay the same in my Eclipse folder (As in nothing will be modified or moved in other directories and whatnot) and will my written block files reobfuscate into something else on eclipse. Or will this all just go into a folder in the root directory so everything on eclipse would be safe?
All of the code can be found on SRC folder. Nothing will change in your codes if you recompile or reobfuscate, just don't decompile or else everything will go down the drain.
Make 2 diffrent mod_***** and link it to the same Entity.java if u want them to behave the same. Or have 2 mod_***** eg. mod_npcone linked to Entitynpcone.java + mod_npctwo linked to Entitynpctwo.java
I am trying to make a flower, and it doesn't seem to be spawning anywhere.
I can craft and place it, but it just will not spawn. Here is my code
The part of the code for the flower in my mod_ class
// Snake Grass
public static final Block SnakeGrass = new BlockSnakeGrass(165, 0).setBlockName("SnakeGrass");
{
SnakeGrass.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/Snake.png");
ModLoader.registerBlock(SnakeGrass);
ModLoader.addName(SnakeGrass, "SnakeGrass");
ModLoader.addRecipe(new ItemStack(SnakeGrass, 1), new Object [] {"#", Character.valueOf('#'), Block.dirt});
}
public String getVersion()
{
return "1.2.5";
}
The Block class
package net.minecraft.src;
import java.util.Random;
public class BlockSnakeGrass extends Block
{
protected BlockSnakeGrass(int i, int j)
{
super(i, Material.vine);
blockIndexInTexture = j;
setTickRandomly(true);
float f = 0.2F;
setBlockBounds(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, f * 3F, 0.5F + f);
}
public boolean canPlaceBlockAt(World world, int i, int j, int k)
{
return super.canPlaceBlockAt(world, i, j, k) && canThisPlantGrowOnThisBlockID(world.getBlockId(i, j - 1, k));
}
protected boolean canThisPlantGrowOnThisBlockID(int i)
{
return i == Block.grass.blockID || i == Block.dirt.blockID || i == Block.tilledField.blockID;
}
public void onNeighborBlockChange(World world, int i, int j, int k, int l)
{
super.onNeighborBlockChange(world, i, j, k, l);
checkFlowerChange(world, i, j, k);
}
public void updateTick(World world, int i, int j, int k, Random random)
{
checkFlowerChange(world, i, j, k);
}
protected final void checkFlowerChange(World world, int i, int j, int k)
{
if (!canBlockStay(world, i, j, k))
{
dropBlockAsItem(world, i, j, k, world.getBlockMetadata(i, j, k), 0);
world.setBlockWithNotify(i, j, k, 0);
}
}
public boolean canBlockStay(World world, int i, int j, int k)
{
return (world.getFullBlockLightValue(i, j, k) >= 8 || world.canBlockSeeTheSky(i, j, k)) && canThisPlantGrowOnThisBlockID(world.getBlockId(i, j - 1, k));
}
public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int i, int j, int k)
{
return null;
}
public boolean isOpaqueCube()
{
return false;
}
public boolean renderAsNormalBlock()
{
return false;
}
public int getRenderType()
{
return 1;
}
/**
* Returns the ID of the items to drop on destruction.
*/
public int idDropped(int par1, Random par2Random, int par3)
{
if (par2Random.nextInt(8) == 0)
{
return mod_Scavenger.Worm.shiftedIndex;
}
else
{
return -1;
}
}
/**
* Returns the usual quantity dropped by the block plus a bonus of 1 to 'i' (inclusive).
*/
public int quantityDroppedWithBonus(int par1, Random par2Random)
{
return 1 + par2Random.nextInt(par1 * 2 + 1);
}
/**
* Called when the player destroys a block with an item that can harvest it. (i, j, k) are the coordinates of the
* block and l is the block's subtype/damage.
*/
public void harvestBlock(World par1World, EntityPlayer par2EntityPlayer, int par3, int par4, int par5, int par6)
{
if (!par1World.isRemote && par2EntityPlayer.getCurrentEquippedItem() != null && par2EntityPlayer.getCurrentEquippedItem().itemID == Item.shears.shiftedIndex)
{
par2EntityPlayer.addStat(StatList.mineBlockStatArray[blockID], 1);
dropBlockAsItem_do(par1World, par3, par4, par5, new ItemStack(mod_Scavenger.SnakeGrass, 1, par6));
}
else
{
super.harvestBlock(par1World, par2EntityPlayer, par3, par4, par5, par6);
}
}
}
I am trying to make a flower, and it doesn't seem to be spawning anywhere.
I can craft and place it, but it just will not spawn. Here is my code
The part of the code for the flower in my mod_ class
// Snake Grass
public static final Block SnakeGrass = new BlockSnakeGrass(165, 0).setBlockName("SnakeGrass");
{
SnakeGrass.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/Snake.png");
ModLoader.registerBlock(SnakeGrass);
ModLoader.addName(SnakeGrass, "SnakeGrass");
ModLoader.addRecipe(new ItemStack(SnakeGrass, 1), new Object [] {"#", Character.valueOf('#'), Block.dirt});
}
public String getVersion()
{
return "1.2.5";
}
The Block class
package net.minecraft.src;
import java.util.Random;
public class BlockSnakeGrass extends Block
{
protected BlockSnakeGrass(int i, int j)
{
super(i, Material.vine);
blockIndexInTexture = j;
setTickRandomly(true);
float f = 0.2F;
setBlockBounds(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, f * 3F, 0.5F + f);
}
public boolean canPlaceBlockAt(World world, int i, int j, int k)
{
return super.canPlaceBlockAt(world, i, j, k) && canThisPlantGrowOnThisBlockID(world.getBlockId(i, j - 1, k));
}
protected boolean canThisPlantGrowOnThisBlockID(int i)
{
return i == Block.grass.blockID || i == Block.dirt.blockID || i == Block.tilledField.blockID;
}
public void onNeighborBlockChange(World world, int i, int j, int k, int l)
{
super.onNeighborBlockChange(world, i, j, k, l);
checkFlowerChange(world, i, j, k);
}
public void updateTick(World world, int i, int j, int k, Random random)
{
checkFlowerChange(world, i, j, k);
}
protected final void checkFlowerChange(World world, int i, int j, int k)
{
if (!canBlockStay(world, i, j, k))
{
dropBlockAsItem(world, i, j, k, world.getBlockMetadata(i, j, k), 0);
world.setBlockWithNotify(i, j, k, 0);
}
}
public boolean canBlockStay(World world, int i, int j, int k)
{
return (world.getFullBlockLightValue(i, j, k) >= 8 || world.canBlockSeeTheSky(i, j, k)) && canThisPlantGrowOnThisBlockID(world.getBlockId(i, j - 1, k));
}
public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int i, int j, int k)
{
return null;
}
public boolean isOpaqueCube()
{
return false;
}
public boolean renderAsNormalBlock()
{
return false;
}
public int getRenderType()
{
return 1;
}
/**
* Returns the ID of the items to drop on destruction.
*/
public int idDropped(int par1, Random par2Random, int par3)
{
if (par2Random.nextInt(8) == 0)
{
return mod_Scavenger.Worm.shiftedIndex;
}
else
{
return -1;
}
}
/**
* Returns the usual quantity dropped by the block plus a bonus of 1 to 'i' (inclusive).
*/
public int quantityDroppedWithBonus(int par1, Random par2Random)
{
return 1 + par2Random.nextInt(par1 * 2 + 1);
}
/**
* Called when the player destroys a block with an item that can harvest it. (i, j, k) are the coordinates of the
* block and l is the block's subtype/damage.
*/
public void harvestBlock(World par1World, EntityPlayer par2EntityPlayer, int par3, int par4, int par5, int par6)
{
if (!par1World.isRemote && par2EntityPlayer.getCurrentEquippedItem() != null && par2EntityPlayer.getCurrentEquippedItem().itemID == Item.shears.shiftedIndex)
{
par2EntityPlayer.addStat(StatList.mineBlockStatArray[blockID], 1);
dropBlockAsItem_do(par1World, par3, par4, par5, new ItemStack(mod_Scavenger.SnakeGrass, 1, par6));
}
else
{
super.harvestBlock(par1World, par2EntityPlayer, par3, par4, par5, par6);
}
}
}
I replied to you in Mod Development.
Rollback Post to RevisionRollBack
“Computers are incredibly fast, accurate and stupid; humans are incredibly slow, inaccurate and brilliant; together they are powerful beyond imagination."
can u please give a a code template of a weapon like a sword?
Look on the post below the OP, there is a tool tutorial there. It includes swords.
Rollback Post to RevisionRollBack
“Computers are incredibly fast, accurate and stupid; humans are incredibly slow, inaccurate and brilliant; together they are powerful beyond imagination."
Right so you want to have 2 mobs right?
so you make mod 1 (name eg= Smiley Creeper) with .java files mod_Smileycreeper + EntitySmileycreeper yes? [remember to put your prefrences into the code TECHGUY gave you](you would only have the model and render classes if you were making it completely your own)
THEN, you make mob number 2 (name eg= Spesh Creeper) with the .java's mod_SpeshCreeper + EntitySpeshCreeper. Once you have done that, you recompile and reobf. DONE.
Having multiple mod_ class can slow the game. Modders always prefers to use 1 mod_ class only.
how do u seperate so its just a sword instead of a whole kit
Well, don't do the "public static final Item" code for the pickaxe, hoe, shovel and axe. Don't make the ItemPickaxe and the other classes except the one associated with the sword.
Right so you want to have 2 mobs right?
so you make mod 1 (name eg= Smiley Creeper) with .java files mod_Smileycreeper + EntitySmileycreeper yes? [remember to put your prefrences into the code TECHGUY gave you](you would only have the model and render classes if you were making it completely your own)
THEN, you make mob number 2 (name eg= Spesh Creeper) with the .java's mod_SpeshCreeper + EntitySpeshCreeper. Once you have done that, you recompile and reobf. DONE.
Only one mod_ class should ever be used.
Rollback Post to RevisionRollBack
“Computers are incredibly fast, accurate and stupid; humans are incredibly slow, inaccurate and brilliant; together they are powerful beyond imagination."
Hey TechGuy, I did everything you said in generating my custom flowers. I made my WorldGenCustomFlower and made it to work with my flower in the generate method in the mod_ class. But in the WorldGenCustomFlower, I don't what to edit there or something. And it errors in my mod_ class because it says that the constructor WorldGenCustomFlower (int, int) is undefined. What do I do?
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
The arguments of setPotionEffect and addPotionEffect do different things. Trust me, I've comprehensively studied the code and tested both methods.
together they are powerful beyond imagination."
together they are powerful beyond imagination."
That would require a rewrite of the crafting system.
Change the null in the public static final line to Obsidian.
together they are powerful beyond imagination."
public void generateNether(World world, Random random, int chunkX, int chunkZ) { for(int i = 0; i < 100; i++) { int randPosX = chunkX + random.nextInt(16); int randPosY = random.nextInt(128); int randPosZ = chunkZ + random.nextInt(16); (new WorldGenNetherMod (NetherRiumOre.blockID, 150)).generate(world, random, randPosX, randPosY, randPosZ); } }Use the generateNether method included with ModLoader, leave everything else the same(still using the worldgen file you created though).together they are powerful beyond imagination."
All of the code can be found on SRC folder. Nothing will change in your codes if you recompile or reobfuscate, just don't decompile or else everything will go down the drain.
umm what?can u give me an example of mod_npcone
-
View User Profile
-
View Posts
-
Send Message
Curse PremiumI can craft and place it, but it just will not spawn. Here is my code
The part of the code for the flower in my mod_ class
// Snake Grass public static final Block SnakeGrass = new BlockSnakeGrass(165, 0).setBlockName("SnakeGrass"); { SnakeGrass.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/Snake.png"); ModLoader.registerBlock(SnakeGrass); ModLoader.addName(SnakeGrass, "SnakeGrass"); ModLoader.addRecipe(new ItemStack(SnakeGrass, 1), new Object [] {"#", Character.valueOf('#'), Block.dirt}); } public String getVersion() { return "1.2.5"; }The Block class
package net.minecraft.src; import java.util.Random; public class BlockSnakeGrass extends Block { protected BlockSnakeGrass(int i, int j) { super(i, Material.vine); blockIndexInTexture = j; setTickRandomly(true); float f = 0.2F; setBlockBounds(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, f * 3F, 0.5F + f); } public boolean canPlaceBlockAt(World world, int i, int j, int k) { return super.canPlaceBlockAt(world, i, j, k) && canThisPlantGrowOnThisBlockID(world.getBlockId(i, j - 1, k)); } protected boolean canThisPlantGrowOnThisBlockID(int i) { return i == Block.grass.blockID || i == Block.dirt.blockID || i == Block.tilledField.blockID; } public void onNeighborBlockChange(World world, int i, int j, int k, int l) { super.onNeighborBlockChange(world, i, j, k, l); checkFlowerChange(world, i, j, k); } public void updateTick(World world, int i, int j, int k, Random random) { checkFlowerChange(world, i, j, k); } protected final void checkFlowerChange(World world, int i, int j, int k) { if (!canBlockStay(world, i, j, k)) { dropBlockAsItem(world, i, j, k, world.getBlockMetadata(i, j, k), 0); world.setBlockWithNotify(i, j, k, 0); } } public boolean canBlockStay(World world, int i, int j, int k) { return (world.getFullBlockLightValue(i, j, k) >= 8 || world.canBlockSeeTheSky(i, j, k)) && canThisPlantGrowOnThisBlockID(world.getBlockId(i, j - 1, k)); } public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int i, int j, int k) { return null; } public boolean isOpaqueCube() { return false; } public boolean renderAsNormalBlock() { return false; } public int getRenderType() { return 1; } /** * Returns the ID of the items to drop on destruction. */ public int idDropped(int par1, Random par2Random, int par3) { if (par2Random.nextInt(8) == 0) { return mod_Scavenger.Worm.shiftedIndex; } else { return -1; } } /** * Returns the usual quantity dropped by the block plus a bonus of 1 to 'i' (inclusive). */ public int quantityDroppedWithBonus(int par1, Random par2Random) { return 1 + par2Random.nextInt(par1 * 2 + 1); } /** * Called when the player destroys a block with an item that can harvest it. (i, j, k) are the coordinates of the * block and l is the block's subtype/damage. */ public void harvestBlock(World par1World, EntityPlayer par2EntityPlayer, int par3, int par4, int par5, int par6) { if (!par1World.isRemote && par2EntityPlayer.getCurrentEquippedItem() != null && par2EntityPlayer.getCurrentEquippedItem().itemID == Item.shears.shiftedIndex) { par2EntityPlayer.addStat(StatList.mineBlockStatArray[blockID], 1); dropBlockAsItem_do(par1World, par3, par4, par5, new ItemStack(mod_Scavenger.SnakeGrass, 1, par6)); } else { super.harvestBlock(par1World, par2EntityPlayer, par3, par4, par5, par6); } } }I replied to you in Mod Development.
together they are powerful beyond imagination."
can u please give a a code template of a weapon like a sword?
Look on the post below the OP, there is a tool tutorial there. It includes swords.
together they are powerful beyond imagination."
how do u seperate so its just a sword instead of a whole kit
Having multiple mod_ class can slow the game. Modders always prefers to use 1 mod_ class only.
Well, don't do the "public static final Item" code for the pickaxe, hoe, shovel and axe. Don't make the ItemPickaxe and the other classes except the one associated with the sword.
Only one mod_ class should ever be used.
together they are powerful beyond imagination."