If you still need help with the function that checks blocks I can probably help you with that too, but I'll need specific information about exactly how the area is to be checked, including how far above and below the centerpoint to check, and how far away.
I've done a decent bit with blocks interacting with their environment recently.
Hello there.
I am new in modding (just half a day coding). I'm trying to make some new mobs to my Hardcore server.
I have been already added modified Zombies (poisonous, setting player on fire and immuned themselves to fire, ets), Creepers with some new explosion effects. But I can do nothing with skeletons. I've trying to make them shooting fire, poisonous, slowing arrows - but can't. And I have no idea how to do that. If you know how to solve this problem or/and urls/manuals where I can get explanation of how to do this, please help.
You'll need to create a new arrow for them to fire, and a new EntityAI file that clones the one they use to fire arrows, but allows them to use your special one. You can modify the new arrow to have the properties you want the skeleton's arrows to have.
A new arrow involves:
1. A new EntityArrow file
2. A new RenderArrow file
If you got far enough to add potion effects to new Zombies in half a day you can probably figure out how to make new EntityArrowNameHere and RenderArrowNameHere files based from the original ones.
The EntityAIArrowAttack clone will only need to be altered to create a new instance of your newly-made EntityArrowNameHere file, rather than the old arrow.
That should cover the general idea of what needs to be done so you can at least get on track in the right direction.
How the fudge do i do that?! Anyway, if your unfamiliar with IC2 uranium spawning, it spawns in veins of 1 or 2 and is very rare(rarer than diamond) right now, its about a 6-15 vein, and i want it above layer 2, like layer 7 or soo.
Basically you make a copy file of WorldGenMinable (you'll want to use a different name, say WorldGenBedrock), then in the one place where it says "stone.blockID" you change this to "bedrock.blockID"
Then in the generateSurface() method in your mod_ file to use your new copy of WorldGenMinable
That almost worked. Now the load screen for generating a new world finishes and I get a black screen with the cross-hairs and 'on hand' inventory visible. That's it. Nothing else. And it doesn't explain why the error message brought up an entirely different line of code.
What was the new error? (cut out most of the huge wave of repeated crap if it appeared again, all that stuff that repeats excessively is the generator looping itself to death or whatever it does)
Also is your test vine WorldGen file a clone of WorldGenVine?
public void onEntityCollidedWithBlock(World world, int i, int j, int k, Entity entity)
{
EntityItem collidedItem = null;
if(entity instanceof EntityItem)
{
collidedItem = (EntityItem)entity;
if(collidedItem.item.itemID == Item.bone.shiftedIndex && world.getBlockId(j, k, i) == mod_CreepInfection.Ooze.blockID)
{
World.setBlockWithNotify(i, j, k, mod_CreepInfection.Spore.blockID);
}
}
still getting "Cannot make a static reference to the non-static method setBlockWithNotify(int, int, int, int) from the type World"
this code here will be related to spores creation, but the for loop is what im looking into for the haze block. to clarify its function i want it where haze checks to see if theres a spore within range, annd itll check to make sure its not within range of the ooze block.
The problem is you're using "World."
This is trying to use the actual World class, and not a variable with the "type" of World
Use "world" instead, which is the actual parameter (which happens to be the instance of the World object the game is using) anything executing this method has to pass to it.
If you have bigger ideas for the mod then i'd suggest WIP section otherwise if you think it is finished then Mods section.
As to the spawning issue i'd suggest making a new thread on it, most people seem to think a thread is solved if it has a high number of replies =p
If he wants to make it spawn at layer 2 he'll need to make a new WorldGenMinable clone file that replaces bedrock instead of stone, since most of the blocks in layer 2 will be bedrock.
Yeah, I've seen the throwableheading but any idea on how to make it like a throwable entity?
The general rule is that if you want something to act like something else, you go dig through the code of what you want it to act like.
Go find .setThrowableHeading(X, Y, Z, XVel, ZVel) in EntityThrowable (hint, the parameters will be obfuscated, I just use those names so you know what they actually are) and figure out how to translate it into something the TNT entity can use.
I made a new entity for TNT that is supposed to appear when you put it in a dispenser. Once you activate it the dispenser is supposed to shoot out primed TNT, I got that part down but the TNT doesn't fly forward. How can I make it fly constantly where it's faced?
Look at the dispenser block code that actually fires things. Hint: your TNT entity probably doesn't have an equivalent of .setThrowableHeading(X, Y, Z, Xvelocity, Zvelocity) yet.
I'm having trouble, I'm trying to convert my entity into SMP but when I take out ModLoader.getUniqueEntityID()) I get an error that's underlining ID.
public void load()
{
{
ModLoader.RegisterEntityID(EntityTNTPrimedDispenser.class, "TNT Dispenser", ID);
}
}
[/size][/font][/size][/font][/color]
[color=#000000][font=monospace, monospace][size=x-small][font=arial,helvetica,sans-serif][size=medium] public void addRenderer(Map map)
{
map.put(EntityTNTPrimedDispenser.class, new RenderTNTPrimedDispenser());
}
{
This is what I have.
In multiplayer you have to assign an actual number ID to entities (go look in EntityList to see what IDs are already used), and don't make spam posts in the wrong thread.
Nope. Eclipse doesn't seem to want to cooperate on my computer (I've been using Notepad++ to edit my code instead). I also can't test it through MCP for reasons I don't understand. (The command window spews gibberish at me.) In any case, the problem has to lie within the code of my mod somewhere because Minecraft works just fine when I have ModLoader, ModLoaderMP, and Forge installed. It's when I add my mod that the problems happen.
I've faced this before. It seems to happen when too much of the block gets generated for it to handle, or something wonky happens that throws it into an infinite loop during generation.
protected void doFireball(EntityPlayer par1EntityPlayer, World par2World, ItemStack par3ItemStack)
{
boolean rightButtonDown = Mouse.isButtonDown(1);
if (isActive() == false)
{
return;
}
if (isActive() == true)
{
if (EntityPlayer.inventory.getCurrentItem() == null && rightButtonDown == true)
{
EntitySmallFireball entitysmallfireball = new EntitySmallFireball(par2World);
par2World.spawnEntityInWorld(new EntitySmallFireball(par2World));
}
}
}
There is no error, but it doesn't work. isActive() is a method defined earlier to determine if the class is active (I had six classes working from a base class that would cycle around them).
Any help? I'm trying to spawn a fireball (blaze-style, not ghast) on a barehanded right click for an elemental mod.
EntitySmallFireball has 3 constructors.
Try using the second one:
public EntitySmallFireball(World world, EntityLiving entityliving, double x, double y, double z)
The parameters x, y, and z will be the coordinates of wherever the fireball is supposed to spawn in the world, which in this case is probably the current location of the Entity that's doing the firing, possibly with a small offset to prevent it from spawning inside the player's head.
I figured out the issue with the armor. It's not compatible with EE2 because EE2 uses the same armor material. ID's. I wonder if I can change them... Let me check.
And yes, Opal just produces a very small amount of light. I'll increase it in the next bugfix.
As for obsidian, leggings aren't showing up for me, so I'll check really quickly.
EDIT: It shows debugging in Eclipse, but not the actual game... Strange. I'll try decompiling again. Let's see.
Well, I finally came around to check your mod out...
...so while I'm here:
1. Keep going
2. You can probably place the armor material IDs in a config file the same way block and item ids are
I'm leaving this post here for the future reference of everyone, these are the names most commonly considered correct for their respective parenthesis-like characters in accordance with my personal experiences.
Braces may have an actual official name that isn't "braces," but I tend to just see them called braces, and I know that they're neither called parenthesis nor brackets.
This should expunge some of the confusion people keep having over their names.
Yeah, it works now. I fixed it without reading, but thanks for your help. Now, my problem is that it ONLY loads one texture.
So now, I need it to load all of them. Is it something to do with the ModLoader.addOverride?
Here is my mod_Eludia file, so that someone can tell me what I did wrong:
package net.minecraft.src;
import java.util.Random;
public class mod_Eludia extends BaseMod{
//Declarations\\
//Blocks\\
public static final Block TurquoiseVein = (new BlockTurquoiseVein(186, ModLoader.addOverride("/terrain.png", "/Eludia/TurVein.png")).setHardness(1.5F).setResistance(0.5F).setBlockName("Turquoise Vein"));
public static final Block TurquoiseBlock = (new BlockTurquoise(187, ModLoader.addOverride("/terrain.png", "/Eludia/TurBlock.png")).setHardness(2.0F).setResistance(1.0F).setBlockName("Turquoise Block"));
public static final Block IronTurquoiseAlloy = (new BlockIronTurquoiseAlloy(188, ModLoader.addOverride("/terrain.png", "/Eludia/TurBlock.png")).setHardness(6.3F).setResistance(7.2F).setBlockName("Turqiose Iron Alloy"));
public static final Block Oven = (new BlockOven(200, ModLoader.addOverride("/terrain.png", "/Eludia/OvenFront.png")).setHardness(6.3F).setResistance(7.2F).setBlockName("Oven"));
//Blocks\\
//Tools\\
//Tools\\
//Armor\\
//Armor\\
//Items\\
public static final Item Turquoise = (new ItemTurquoise(17000).setIconIndex(ModLoader.addOverride("/gui/items.png", "/Eludia/Tur.png")).setItemName("Turquoise"));
public static final Item PowderedTurquoise = (new ItemPowderedTurquoise(17001).setIconIndex(ModLoader.addOverride("/gui/items.png", "/Eludia/TurPowder.png")).setItemName("Powdered Turquoise"));
public static final Item LiquidTurquoise = (new ItemLiquidTurquoise(17002).setIconIndex(ModLoader.addOverride("/gui/items.png", "/Eludia/TurLiquid.png")).setItemName("Liquid Turquoise"));
//Items\\
//Multi-Sided Textures\\
public static int ovenTop;
public static int ovenFront;
public static int ovenBottom;
//Multi-Sided Textures\\
//Declarations\\
public void load(){
//Registering Blocks\\
ModLoader.registerBlock(TurquoiseVein);
ModLoader.registerBlock(TurquoiseBlock);
ModLoader.registerBlock(IronTurquoiseAlloy);
ModLoader.registerBlock(Oven);
//Registering Blocks\\
//Adding Names\\
ModLoader.addName(TurquoiseVein, "Turquoise Vein");
ModLoader.addName(Turquoise, "Turquoise");
ModLoader.addName(TurquoiseBlock, "Turquoise Block");
ModLoader.addName(PowderedTurquoise, "Powdered Turquoise");
ModLoader.addName(LiquidTurquoise, "Liquified Turquoise");
ModLoader.addName(IronTurquoiseAlloy, "Iron and Turquoise Alloy");
ModLoader.addName(Oven, "Oven");
//Adding Names\\
//Shapeless\\
//Shapeless\\
//Recipes\\
ModLoader.addRecipe(new ItemStack(Oven, 1), (new Object[] {"d", Character.valueOf('d'), Block.dirt}));
//Recipes\\
//Smelting\\
ModLoader.addSmelting(PowderedTurquoise.shiftedIndex, new ItemStack(LiquidTurquoise, 1));
//Smelting\\
//Texture Definitions\\
ovenTop = ModLoader.addOverride("/terrain.png", "/Eludia/OvenTop.png");
ovenFront = ModLoader.addOverride("/terrain.png", "/Eludia/OvenFront.png");
ovenBottom = ModLoader.addOverride("/terrain.png", "/Eludia/OvenBottom.png");
//Texture Definitions\\
//World, DO NOT EDIT!\\
world = ModLoader.getMinecraftInstance().theWorld;
//World, DO NOT EDIT!\\
}
//Generator\\
private World world;
public void GenerateSurface(World world, Random rand, int chunkX, int chunkZ)
{
for(int a= 0; a < 20; a++)
{
int randPosX = chunkX + rand.nextInt(16);
int randPosY = rand.nextInt(64);
int randPosZ = chunkZ + rand.nextInt(16);
(new WorldGenMinable(TurquoiseVein.blockID, 20)).generate(world, rand, randPosX, randPosY, randPosZ);
}
}
//Generator\\
public String getVersion(){
return "Eludia Mod for Minecraft 1.2.5";
}
}
And here is the BlockOven file:
package net.minecraft.src;
import java.util.Random;
public class BlockOven extends Block{
public BlockOven(int i, int j){
super(i, j, Material.iron);
}
public int quantityDropped(Random random){
return 1;
}
public int idDropped(int i, Random random, int j){
return mod_Eludia.Oven.blockID;
}
public int getBlockTextureFromSideAndMetada(int i, int j){
if(i == 0){
return mod_Eludia.ovenBottom;
}
else if(i == 1){
return mod_Eludia.ovenTop;
}
else if(i == 2){
return mod_Eludia.ovenFront;
}
else if(i == 3){
return mod_Eludia.ovenFront;
}
else if(i == 4){
return mod_Eludia.ovenFront;
}
else if(i == 5){
return mod_Eludia.ovenFront;
}
if(j == 1){
return 166;
}
return j != 2 ? 20 : 177;
}
}
When you need to use a specific texture ID it becomes a pain. ModLoader doesn't consistently override a texture onto the same sprite slot every time, so the integer value of the location of your texture files will change just about every time you add another texture, and using any mod besides your own will also affect this. There has to be a way to fix it but I don't know how, only the cause of the problem.
0
If you still need help with the function that checks blocks I can probably help you with that too, but I'll need specific information about exactly how the area is to be checked, including how far above and below the centerpoint to check, and how far away.
I've done a decent bit with blocks interacting with their environment recently.
1
You'll need to create a new arrow for them to fire, and a new EntityAI file that clones the one they use to fire arrows, but allows them to use your special one. You can modify the new arrow to have the properties you want the skeleton's arrows to have.
A new arrow involves:
1. A new EntityArrow file
2. A new RenderArrow file
If you got far enough to add potion effects to new Zombies in half a day you can probably figure out how to make new EntityArrowNameHere and RenderArrowNameHere files based from the original ones.
The EntityAIArrowAttack clone will only need to be altered to create a new instance of your newly-made EntityArrowNameHere file, rather than the old arrow.
That should cover the general idea of what needs to be done so you can at least get on track in the right direction.
0
Basically you make a copy file of WorldGenMinable (you'll want to use a different name, say WorldGenBedrock), then in the one place where it says "stone.blockID" you change this to "bedrock.blockID"
Then in the generateSurface() method in your mod_ file to use your new copy of WorldGenMinable
0
What was the new error? (cut out most of the huge wave of repeated crap if it appeared again, all that stuff that repeats excessively is the generator looping itself to death or whatever it does)
Also is your test vine WorldGen file a clone of WorldGenVine?
2
The problem is you're using "World."
This is trying to use the actual World class, and not a variable with the "type" of World
Use "world" instead, which is the actual parameter (which happens to be the instance of the World object the game is using) anything executing this method has to pass to it.
0
If he wants to make it spawn at layer 2 he'll need to make a new WorldGenMinable clone file that replaces bedrock instead of stone, since most of the blocks in layer 2 will be bedrock.
0
The general rule is that if you want something to act like something else, you go dig through the code of what you want it to act like.
Go find .setThrowableHeading(X, Y, Z, XVel, ZVel) in EntityThrowable (hint, the parameters will be obfuscated, I just use those names so you know what they actually are) and figure out how to translate it into something the TNT entity can use.
0
Look at the dispenser block code that actually fires things. Hint: your TNT entity probably doesn't have an equivalent of .setThrowableHeading(X, Y, Z, Xvelocity, Zvelocity) yet.
1
In multiplayer you have to assign an actual number ID to entities (go look in EntityList to see what IDs are already used), and don't make spam posts in the wrong thread.
0
I've faced this before. It seems to happen when too much of the block gets generated for it to handle, or something wonky happens that throws it into an infinite loop during generation.
First try reducing...
...to something more like 10, instead of 64.
0
EntitySmallFireball has 3 constructors.
Try using the second one:
The parameters x, y, and z will be the coordinates of wherever the fireball is supposed to spawn in the world, which in this case is probably the current location of the Entity that's doing the firing, possibly with a small offset to prevent it from spawning inside the player's head.
0
Well, I finally came around to check your mod out...
...so while I'm here:
1. Keep going
2. You can probably place the armor material IDs in a config file the same way block and item ids are
0
...which will probably be the case.
0
( parenthesis )
{ braces/curly parenthesis/braces/brackets }
[ brackets ]
I'm leaving this post here for the future reference of everyone, these are the names most commonly considered correct for their respective parenthesis-like characters in accordance with my personal experiences.
Braces may have an actual official name that isn't "braces," but I tend to just see them called braces, and I know that they're neither called parenthesis nor brackets.
This should expunge some of the confusion people keep having over their names.
0
When you need to use a specific texture ID it becomes a pain. ModLoader doesn't consistently override a texture onto the same sprite slot every time, so the integer value of the location of your texture files will change just about every time you add another texture, and using any mod besides your own will also affect this. There has to be a way to fix it but I don't know how, only the cause of the problem.