I am not completly new to programming, only Java while I am familiar with Lua and C++, but I just started using eclipse 2 days.
Anyways, I kinda figured out how I think it should look like, but I manged to even to be able to start the game from eclipse. However the tool wont get thrown:
publicvoid onItemRightClick(EntityEnderPearl g) //<<<<<<<<<<<------------ I think I need to do something with RightClick, also I'm not sure what the void class does either but eclipse told me to make it a void.
{
class EntityEnderPearl extends EntityThrowable //<<<<<<-------- I dont know what this does but it seems important
{
public EntityEnderPearl(World par1World)
{
super(par1World);
}
public EntityEnderPearl(World par1World, EntityLiving par2EntityLiving)
{
super(par1World, par2EntityLiving);
}
public EntityEnderPearl(World par1World, double par2, double par4, double par6)
{
super(par1World, par2, par4, par6);
}
/**
* Called when the throwable hits a block or entity.
I think it should look something like this but I think I need to put all the other scipts like EntityThrowable into this one, making it 1 big pile of script.
Most of this:
class EntityEnderPearl extends EntityThrowable //<<<<<<-------- I dont know what this does but it seems important
{
public EntityEnderPearl(World par1World)
{
super(par1World);
}
public EntityEnderPearl(World par1World, EntityLiving par2EntityLiving)
{
super(par1World, par2EntityLiving);
}
public EntityEnderPearl(World par1World, double par2, double par4, double par6)
{
super(par1World, par2, par4, par6);
}
/**
* Called when the throwable hits a block or entity.
*/
protected void onImpact(MovingObjectPosition par1MovingObjectPosition)
{
if (par1MovingObjectPosition.entityHit != null)
{
if (!par1MovingObjectPosition.entityHit.attackEntityFrom(DamageSource.causeThrownDamage(this, thrower), 0));
}
for (int i = 0; i < 32; i++)
{
worldObj.spawnParticle("magicSpell", posX, posY + rand.nextDouble() * 2D, posZ, rand.nextGaussian(), 0.0D, rand.nextGaussian());
}
if (!worldObj.isRemote)
{
if (thrower != null)
{
thrower.setPositionAndUpdate(posX, posY, posZ);
thrower.fallDistance = 0.0F;
thrower.attackEntityFrom(DamageSource.fall, 5);
}
setDead();
}
Should be in a separate class altogether. Then, in onItemRightClick, just like ItemEnderPearlDoes, you need to spawn EntityEnderPearl.
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
{
if (!par2World.isRemote)
{
par2World.spawnEntityInWorld(new EntityEnderPearl(par2World, par3EntityPlayer));
}
}
Then you have a new class, with that big chunk of code that I posted above from your post.
package net.minecraft.src;
public class EntityEnderPearl extends EntityThrowable //<<<<<<-------- I dont know what this does but it seems important
{
public EntityEnderPearl(World par1World)
{
super(par1World);
}public EntityEnderPearl(World par1World, EntityLiving par2EntityLiving)
{
super(par1World, par2EntityLiving);
}
public EntityEnderPearl(World par1World, double par2, double par4, double par6)
{
super(par1World, par2, par4, par6);
}/**
* Called when the throwable hits a block or entity.
*/
protected void onImpact(MovingObjectPosition par1MovingObjectPosition)
{
if (par1MovingObjectPosition.entityHit != null)
{
if (!par1MovingObjectPosition.entityHit.attackEntityFrom(DamageSource.causeThrownDamage(this, thrower), 0));
}
for (int i = 0; i < 32; i++)
{
worldObj.spawnParticle("magicSpell", posX, posY + rand.nextDouble() * 2D, posZ, rand.nextGaussian(), 0.0D, rand.nextGaussian());
} if (!worldObj.isRemote)
{
if (thrower != null)
{
thrower.setPositionAndUpdate(posX, posY, posZ);
thrower.fallDistance = 0.0F;
thrower.attackEntityFrom(DamageSource.fall, 5);
}
setDead();
}
}
I got my spawner to stop having errors! Now it will just spawn pigs My currant code:
package net.minecraft.src;
import java.util.Random;
public class WorldGenBoat extends WorldGenerator
{
public WorldGenBoat()
{
}
public boolean generate(World world, Random random, int i, int j, int k)
{
if(world.getBlockId(i, j -1, k) == Block.waterStill.blockID && world.getBlockId(i, j, k) ==
0)
{
int wood = Block.planks.blockID;
//Body railing
world.setBlockWithNotify(i, j, k, wood);
world.setBlockWithNotify(i, j, k +1, wood);
world.setBlockWithNotify(i, j, k +2, wood);
world.setBlockWithNotify(i, j, k +3, wood);
world.setBlockWithNotify(i, j, k +4, wood);
world.setBlockWithNotify(i, j, k +5, wood);
world.setBlockWithNotify(i, j, k +6, wood);
world.setBlockWithNotify(i, j, k +7, wood);
world.setBlockWithNotify(i, j, k -1, wood);
world.setBlockWithNotify(i, j, k -2, wood);
//test
world.setBlockWithNotify(i +3, j, k -1, Block.mobSpawner.blockID);
TileEntityMobSpawner tileentitymobspawner = (TileEntityMobSpawner)
world.getBlockTileEntity(i, j, k);
if (tileentitymobspawner != null)
{
tileentitymobspawner.setMobID(pickMobSpawner(random));
}
else
{
System.err.println((new StringBuilder()).append("Failed to fetch mob spawner
entity at (").append(i).append(", ").append(j).append(", ").append(k).append
(")").toString());
}
//end of test
return true;
}
return false;
}
//test
private String pickMobSpawner(Random random)
{
int i = random.nextInt(4);
if (i == 0)
{
return "Skeleton";
}
if (i == 1)
{
return "Zombie";
}
if (i == 2)
{
return "Zombie";
}
if (i == 3)
{
return "Spider";
}
else
{
return "";
}
}
//end
}
The problem is (I think) that the mob spawner is null, because it gives me the "Failed to fetch mob spawner entity at (i, j, k)" thing, like the code tells it to if the mob spawner is null.
Edit; actually, I don't think that it even spawns the pigs it just has a pig spinning inside of it.
Try adding a println just after it picks the mobID, just to see which one it picks, or even whether or not it is called.
if (tileentitymobspawner != null)
{
tileentitymobspawner.setMobID(pickMobSpawner(random));
System.out.println("Mob ID Picked");
}
Also, maybe try and add a mob to the else statement, just for testing purposes.
Will you upload the fence code please i need that to finish my mod please upload
I could probably upload a working fence code pretty quickly, but I don't have any time to write an explanation. So therefore, I will not be uploading it yet.
Rollback Post to RevisionRollBack
“Computers are incredibly fast, accurate and stupid; humans are incredibly slow, inaccurate and brilliant; together they are powerful beyond imagination."
Try adding a println just after it picks the mobID, just to see which one it picks, or even whether or not it is called.
if (tileentitymobspawner != null)
{
tileentitymobspawner.setMobID(pickMobSpawner(random));
System.out.println("Mob ID Picked");
}
Also, maybe try and add a mob to the else statement, just for testing purposes.
I tried to and the println part and it didn't help, it still tells me (exact quote):
[17:17:14] Attempting to use default windows plug-in.
[17:17:14] Loading: net.java.games.input.DirectAndRawInputEnvironmentPlugin
[17:17:14]
[17:17:14] Starting up SoundSystem...
[17:17:14] Initializing LWJGL OpenAL
[17:17:14] (The LWJGL binding of OpenAL. For more information, see http://w
ww.lwjgl.org)
[17:17:14] OpenAL initialized.
[17:17:14]
[17:17:24] Failed to fetch mob spawner entity at (154, 63, 338)
[17:18:01] Failed to fetch mob spawner entity at (223, 63, 442)
[17:18:08] Failed to fetch mob spawner entity at (169, 63, 497)
[17:18:10] Failed to fetch mob spawner entity at (38, 63, 417)
[17:18:12] Failed to fetch mob spawner entity at (38, 63, 264)
and I am not sure how I would add a mob to the else statement, would I just add a
tileentitymobspawner.setMobID("Spider");
or something to that effect, in the else statement part?
Description Resource Path Location Type
The method setPotionEffect(String) in the type Item is not applicable for the arguments (int, int, int, float) mod_MoItems.java /Client/src/net/minecraft/src line 7 Java Problem
What does work is .setPotionEffect("potion.heal");
That doesn't seem to add any effect though. I guess that needs to be updated for 1.2.4. Thanks for helping me.
Someone told me that i shouldnt havemore than one mod_ file, i dont get whatthey meen =/ i have different mod_ ifles and they work but with biomes it doesnt... listent hi time, i CHANEG my blocxk in the biome to bedrockand itworks...
plz can someone help? check back to see my codes
It is true that you shouldn't have more than one mod_ class. It is unnecessary. I have no clue what you are talking about when you are saying bedrock and biome. I can't understand your spelling and grammar.
I tried to and the println part and it didn't help, it still tells me (exact quote):
[17:17:14] Attempting to use default windows plug-in.
[17:17:14] Loading: net.java.games.input.DirectAndRawInputEnvironmentPlugin
[17:17:14]
[17:17:14] Starting up SoundSystem...
[17:17:14] Initializing LWJGL OpenAL
[17:17:14] (The LWJGL binding of OpenAL. For more information, see http://w
ww.lwjgl.org)
[17:17:14] OpenAL initialized.
[17:17:14]
[17:17:24] Failed to fetch mob spawner entity at (154, 63, 338)
[17:18:01] Failed to fetch mob spawner entity at (223, 63, 442)
[17:18:08] Failed to fetch mob spawner entity at (169, 63, 497)
[17:18:10] Failed to fetch mob spawner entity at (38, 63, 417)
[17:18:12] Failed to fetch mob spawner entity at (38, 63, 264)
and I am not sure how I would add a mob to the else statement, would I just add a
tileentitymobspawner.setMobID("Spider");
or something to that effect, in the else statement part?
Yeah, just make it so that the string isn't empty. Try putting the System.out line before the tileentitymobspawner.setMobID line. I'm sort of working on the same thing at the moment so I'll try and get mine working.
Is it possible to add multiple potion effects to an item? Doesn't seem to work.
I don't think so.
Rollback Post to RevisionRollBack
“Computers are incredibly fast, accurate and stupid; humans are incredibly slow, inaccurate and brilliant; together they are powerful beyond imagination."
What do i need to add to my HumanNpc code to make the npc to have the new AI?
I can post my code if you want, but it is just like the human npc code like TechGuy made (Just that it extends EntityMob)
He is a hostile mob, but he is just stupid like the old zombies, please reply someone!!!
package net.minecraft.src;
import net.minecraft.src.moreDecoritives.*;
public class mod_MoreDecrotives extends BaseMod {
public static final Block SandStonePillarTop = new BlockSandStonePillarTop(200, 0).setBlockName("sandStonePillarCap").setHardness(0.8F).setStepSound(Block.soundStoneFootstep).setResistance(4F).setLightValue(1F);
public static final Block SandStonePillarMiddle = new BlockSandStonePillarMiddle(201, 0).setBlockName("sandStonePillar").setHardness(0.8F).setStepSound(Block.soundStoneFootstep).setResistance(4F).setLightValue(1F);
public static final Block SandStonePillarBottom = new BlockSandStonePillarBottom(202, 0).setBlockName("sandStonePillarBase").setHardness(0.8F).setStepSound(Block.soundStoneFootstep).setResistance(4F).setLightValue(1F);
public static int SandStonePillarCaps = ModLoader.addOverride( "/terrain.png", "/moreDecoritives/SandStonePillarEndcaps.png");
public static int SandStonePillarTopSides = ModLoader.addOverride( "/terrain.png", "/moreDecoritives/SandStonePillarTop.png");
public static int SandStonePillarMiddleSides = ModLoader.addOverride( "/terrain.png", "/moreDecoritives/SandStonePillarMiddle.png");
public static int SandStonePillarBottomSides = ModLoader.addOverride( "/terrain.png", "/moreDecoritives/SandStonePillarBottom.png");
public void load() {
ModLoader.registerBlock(SandStonePillarTop);
ModLoader.registerBlock(SandStonePillarMiddle);
ModLoader.registerBlock(SandStonePillarBottom);
ModLoader.addName(SandStonePillarTop, "Sandstone Pillar Cap");
ModLoader.addName(SandStonePillarMiddle, "Sandstone Pillar Middle");
ModLoader.addName(SandStonePillarBottom, "Sandstone Pillar Base");
ModLoader.addRecipe(new ItemStack(SandStonePillarTop, 5 ), new Object[] { "###", "#", "#", Character.valueOf('#'), Block.sand });
ModLoader.addRecipe(new ItemStack(SandStonePillarMiddle, 3 ), new Object[] { "#", "#", "#", Character.valueOf('#'), Block.sand });
ModLoader.addRecipe(new ItemStack(SandStonePillarBottom, 5 ), new Object[] { "#", "#", "###", Character.valueOf('#'), Block.sand });
}
public String getVersion() {
return "1.2.4";
}
}
the error
java.lang.StringIndexOutOfBoundsException: String index out of range: 5
at java.lang.String.charAt(Unknown Source)
at fr.a(SourceFile:549)
at ModLoader.addRecipe(ModLoader.java:401)
at mod_MoreDecrotives.load(mod_MoreDecrotives.java:28)
at ModLoader.init(ModLoader.java:891)
at ModLoader.addAllRenderers(ModLoader.java:189)
at ahu.<init>(ahu.java:79)
at ahu.<clinit>(ahu.java:9)
at net.minecraft.client.Minecraft.a(SourceFile:267)
at net.minecraft.client.Minecraft.run(SourceFile:650)
at java.lang.Thread.run(Unknown Source)
package net.minecraft.src;
import net.minecraft.src.moreDecoritives.*;
public class mod_MoreDecrotives extends BaseMod {
public static final Block SandStonePillarTop = new BlockSandStonePillarTop(200, 0).setBlockName("sandStonePillarCap").setHardness(0.8F).setStepSound(Block.soundStoneFootstep).setResistance(4F).setLightValue(1F);
public static final Block SandStonePillarMiddle = new BlockSandStonePillarMiddle(201, 0).setBlockName("sandStonePillar").setHardness(0.8F).setStepSound(Block.soundStoneFootstep).setResistance(4F).setLightValue(1F);
public static final Block SandStonePillarBottom = new BlockSandStonePillarBottom(202, 0).setBlockName("sandStonePillarBase").setHardness(0.8F).setStepSound(Block.soundStoneFootstep).setResistance(4F).setLightValue(1F);
public static int SandStonePillarCaps = ModLoader.addOverride( "/terrain.png", "/moreDecoritives/SandStonePillarEndcaps.png");
public static int SandStonePillarTopSides = ModLoader.addOverride( "/terrain.png", "/moreDecoritives/SandStonePillarTop.png");
public static int SandStonePillarMiddleSides = ModLoader.addOverride( "/terrain.png", "/moreDecoritives/SandStonePillarMiddle.png");
public static int SandStonePillarBottomSides = ModLoader.addOverride( "/terrain.png", "/moreDecoritives/SandStonePillarBottom.png");
public void load() {
ModLoader.registerBlock(SandStonePillarTop);
ModLoader.registerBlock(SandStonePillarMiddle);
ModLoader.registerBlock(SandStonePillarBottom);
ModLoader.addName(SandStonePillarTop, "Sandstone Pillar Cap");
ModLoader.addName(SandStonePillarMiddle, "Sandstone Pillar Middle");
ModLoader.addName(SandStonePillarBottom, "Sandstone Pillar Base");
ModLoader.addRecipe(new ItemStack(SandStonePillarTop, 5 ), new Object[] { "###", "#", "#", Character.valueOf('#'), Block.sand });
ModLoader.addRecipe(new ItemStack(SandStonePillarMiddle, 3 ), new Object[] { "#", "#", "#", Character.valueOf('#'), Block.sand });
ModLoader.addRecipe(new ItemStack(SandStonePillarBottom, 5 ), new Object[] { "#", "#", "###", Character.valueOf('#'), Block.sand });
}
public String getVersion() {
return "1.2.4";
}
}
the error
java.lang.StringIndexOutOfBoundsException: String index out of range: 5
at java.lang.String.charAt(Unknown Source)
at fr.a(SourceFile:549)
at ModLoader.addRecipe(ModLoader.java:401)
at mod_MoreDecrotives.load(mod_MoreDecrotives.java:28)
at ModLoader.init(ModLoader.java:891)
at ModLoader.addAllRenderers(ModLoader.java:189)
at ahu.<init>(ahu.java:79)
at ahu.<clinit>(ahu.java:9)
at net.minecraft.client.Minecraft.a(SourceFile:267)
at net.minecraft.client.Minecraft.run(SourceFile:650)
at java.lang.Thread.run(Unknown Source)
Your recipes must have equal spaces in them. So, instead of this:
What do i need to add to my HumanNpc code to make the npc to have the new AI?
I can post my code if you want, but it is just like the human npc code like TechGuy made (Just that it extends EntityMob)
He is a hostile mob, but he is just stupid like the old zombies, please reply someone!!!
Add this to the constructor of your entity class:
getNavigator().setBreakDoors(true);
tasks.addTask(0, new EntityAISwimming(this));
tasks.addTask(1, new EntityAIBreakDoor(this));
tasks.addTask(2, new EntityAIAttackOnCollide(this, net.minecraft.src.EntityPlayer.class, moveSpeed, false));
tasks.addTask(3, new EntityAIAttackOnCollide(this, net.minecraft.src.EntityVillager.class, moveSpeed, true));
tasks.addTask(4, new EntityAIMoveTwardsRestriction(this, moveSpeed));
tasks.addTask(5, new EntityAIMoveThroughVillage(this, moveSpeed, false));
tasks.addTask(6, new EntityAIWander(this, moveSpeed));
tasks.addTask(7, new EntityAIWatchClosest(this, net.minecraft.src.EntityPlayer.class, 8F));
tasks.addTask(7, new EntityAILookIdle(this));
targetTasks.addTask(1, new EntityAIHurtByTarget(this, false));
targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, net.minecraft.src.EntityPlayer.class, 16F, 0, true));
targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, net.minecraft.src.EntityVillager.class, 16F, 0, false));
“Computers are incredibly fast, accurate and stupid; humans are incredibly slow, inaccurate and brilliant; together they are powerful beyond imagination."
very nice tutorials! i like how you explain each line of code and not just write the code out.
Thanks!
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 think i got a good sugestion that isnt on your list at all
you know how to make stairs you use return 10; in the getrendertype() , well how about a tutorial about how to make a unique render type so we can make anything we want ?
for example , i want to make a corner stair like block where its 1/4 block on top half , and 3/4 on bottom half .
i think i got a good sugestion that isnt on your list at all
you know how to make stairs you use return 10; in the getrendertype() , well how about a tutorial about how to make a unique render type so we can make anything we want ?
for example , i want to make a corner stair like block where its 1/4 block on top half , and 3/4 on bottom half .
I don't think that would be render types, more like custom block modelling. I could probably find out what all the renderTypes actually do, and make an index on the OP, but I'm not doing block modelling at the moment.
“Computers are incredibly fast, accurate and stupid; humans are incredibly slow, inaccurate and brilliant; together they are powerful beyond imagination."
package net.minecraft.src;
import java.util.Map;
public class mod_gallifrey extends BaseMod
{
public static final Block cheese = new Block(160, null).setBlockName("cheese").setHardness(1F).setResistance(2F).setLightValue(3F);
public void load()
{
/* sontaran */
ModLoader.registerEntityID(sontaran.class, "sontaran.png", ModLoader.getUniqueEntityId());
ModLoader.addSpawn(sontaran.class, 12, 4, 10, EnumCreatureType.monster);
/* cheese Block */
cheese.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/mods/cheese.png");
ModLoader.registerBlock(cheese);
ModLoader.addName(cheese, "cheeseblock");
ModLoader.addRecipe(new ItemStack(cheese, 9), new Object [] {"###", 3, Character.valueOf('#'), Item.bucketMilk});
}
public void addRenderer(Map map)
{
map.put(sontaran.class, new RenderBiped(new ModelBiped(), 0.5F));
}
public String getVersion()
{
return "1.2.4";
}
}
Mods loaded: 1
ModLoader 1.2.4
Minecraft has crashed!
----------------------
Minecraft has stopped running because it encountered a problem.
--- BEGIN ERROR REPORT 2f72aab9 --------
Generated 28/03/12 7:01 PM
Minecraft: Minecraft 1.2.4
OS: Windows XP (x86) version 5.1
Java: 1.7.0_03, Oracle Corporation
VM: Java HotSpot™ Client VM (mixed mode), Oracle Corporation
LWJGL: 2.4.2
OpenGL: ATI Radeon Xpress 1150 x86/MMX/3DNow!/SSE2 version 2.0.6388 WinXP Release, ATI Technologies Inc.
java.lang.ExceptionInInitializerError
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at java.lang.Class.newInstance0(Unknown Source)
at java.lang.Class.newInstance(Unknown Source)
at net.minecraft.src.ModLoader.addMod(ModLoader.java:286)
at net.minecraft.src.ModLoader.readFromClassPath(ModLoader.java:1278)
at net.minecraft.src.ModLoader.init(ModLoader.java:848)
at net.minecraft.src.ModLoader.addAllRenderers(ModLoader.java:156)
at net.minecraft.src.RenderManager.&--#60;init&--#62;(RenderManager.java:85)
at net.minecraft.src.RenderManager.&--#60;clinit&--#62;(RenderManager.java:12)
at net.minecraft.client.Minecraft.startGame(Minecraft.java:422)
at net.minecraft.client.Minecraft.run(Minecraft.java:783)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.NullPointerException
at net.minecraft.src.Block.&--#60;init&--#62;(Block.java:242)
at net.minecraft.src.mod_gallifrey.&--#60;clinit&--#62;(mod_gallifrey.java:7)
... 15 more
--- END ERROR REPORT 3f90236b ----------
the error is definitely in the mod_ file because it was working when i had more than 1 mod_ file then i gave it to my friend to put the codes into 1 mod_ file and i tried it and it didn't work this error occurred on start up. I didn't compile before testing if that makes a difference (my friend compiles before testing)
p.s to make code tags you MUST type code in capse e.g [CODE1] works but [code1] does not
package net.minecraft.src;
import java.util.Map;
public class mod_gallifrey extends BaseMod
{
public static final Block cheese = new Block(160, null).setBlockName("cheese").setHardness(1F).setResistance(2F).setLightValue(3F);
public void load()
{
/* sontaran */
ModLoader.registerEntityID(sontaran.class, "sontaran.png", ModLoader.getUniqueEntityId());
ModLoader.addSpawn(sontaran.class, 12, 4, 10, EnumCreatureType.monster);
/* cheese Block */
cheese.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/mods/cheese.png");
ModLoader.registerBlock(cheese);
ModLoader.addName(cheese, "cheeseblock");
ModLoader.addRecipe(new ItemStack(cheese, 9), new Object [] {"###", 3, Character.valueOf('#'), Item.bucketMilk});
}
public void addRenderer(Map map)
{
map.put(sontaran.class, new RenderBiped(new ModelBiped(), 0.5F));
}
public String getVersion()
{
return "1.2.4";
}
}
Mods loaded: 1
ModLoader 1.2.4
Minecraft has crashed!
----------------------
Minecraft has stopped running because it encountered a problem.
--- BEGIN ERROR REPORT 2f72aab9 --------
Generated 28/03/12 7:01 PM
Minecraft: Minecraft 1.2.4
OS: Windows XP (x86) version 5.1
Java: 1.7.0_03, Oracle Corporation
VM: Java HotSpot™ Client VM (mixed mode), Oracle Corporation
LWJGL: 2.4.2
OpenGL: ATI Radeon Xpress 1150 x86/MMX/3DNow!/SSE2 version 2.0.6388 WinXP Release, ATI Technologies Inc.
java.lang.ExceptionInInitializerError
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at java.lang.Class.newInstance0(Unknown Source)
at java.lang.Class.newInstance(Unknown Source)
at net.minecraft.src.ModLoader.addMod(ModLoader.java:286)
at net.minecraft.src.ModLoader.readFromClassPath(ModLoader.java:1278)
at net.minecraft.src.ModLoader.init(ModLoader.java:848)
at net.minecraft.src.ModLoader.addAllRenderers(ModLoader.java:156)
at net.minecraft.src.RenderManager.&--#60;init&--#62;(RenderManager.java:85)
at net.minecraft.src.RenderManager.&--#60;clinit&--#62;(RenderManager.java:12)
at net.minecraft.client.Minecraft.startGame(Minecraft.java:422)
at net.minecraft.client.Minecraft.run(Minecraft.java:783)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.NullPointerException
at net.minecraft.src.Block.&--#60;init&--#62;(Block.java:242)
at net.minecraft.src.mod_gallifrey.&--#60;clinit&--#62;(mod_gallifrey.java:7)
... 15 more
--- END ERROR REPORT 3f90236b ----------
the error is definitely in the mod_ file because it was working when i had more than 1 mod_ file then i gave it to my friend to put the codes into 1 mod_ file and i tried it and it didn't work this error occurred on start up. I didn't compile before testing if that makes a difference (my friend compiles before testing)
p.s to make code tags you MUST type code in capse e.g [CODE1] works but [code1] does not
Post your sontaran class please.
Rollback Post to RevisionRollBack
“Computers are incredibly fast, accurate and stupid; humans are incredibly slow, inaccurate and brilliant; together they are powerful beyond imagination."
ok , i did just a min ago find a tut on it , but i'm gonna have to actualy sit down and study it for quite some time , cause the 2 ppl doing the tut ( yes 2 ppl , 1 tut DX ) are crap at explaining how it works
but yeah its kinda custom block modeling but the main part i was looking for was getting the block to render how the model is supposed to
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
Excuse me for my stupidty and please discontinue my case.
Most of this:
class EntityEnderPearl extends EntityThrowable //<<<<<<-------- I dont know what this does but it seems important { public EntityEnderPearl(World par1World) { super(par1World); } public EntityEnderPearl(World par1World, EntityLiving par2EntityLiving) { super(par1World, par2EntityLiving); } public EntityEnderPearl(World par1World, double par2, double par4, double par6) { super(par1World, par2, par4, par6); } /** * Called when the throwable hits a block or entity. */ protected void onImpact(MovingObjectPosition par1MovingObjectPosition) { if (par1MovingObjectPosition.entityHit != null) { if (!par1MovingObjectPosition.entityHit.attackEntityFrom(DamageSource.causeThrownDamage(this, thrower), 0)); } for (int i = 0; i < 32; i++) { worldObj.spawnParticle("magicSpell", posX, posY + rand.nextDouble() * 2D, posZ, rand.nextGaussian(), 0.0D, rand.nextGaussian()); } if (!worldObj.isRemote) { if (thrower != null) { thrower.setPositionAndUpdate(posX, posY, posZ); thrower.fallDistance = 0.0F; thrower.attackEntityFrom(DamageSource.fall, 5); } setDead(); }Should be in a separate class altogether. Then, in onItemRightClick, just like ItemEnderPearlDoes, you need to spawn EntityEnderPearl.
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { if (!par2World.isRemote) { par2World.spawnEntityInWorld(new EntityEnderPearl(par2World, par3EntityPlayer)); } }Then you have a new class, with that big chunk of code that I posted above from your post.
package net.minecraft.src; public class EntityEnderPearl extends EntityThrowable //<<<<<<-------- I dont know what this does but it seems important { public EntityEnderPearl(World par1World) { super(par1World); }public EntityEnderPearl(World par1World, EntityLiving par2EntityLiving) { super(par1World, par2EntityLiving); } public EntityEnderPearl(World par1World, double par2, double par4, double par6) { super(par1World, par2, par4, par6); }/** * Called when the throwable hits a block or entity. */ protected void onImpact(MovingObjectPosition par1MovingObjectPosition) { if (par1MovingObjectPosition.entityHit != null) { if (!par1MovingObjectPosition.entityHit.attackEntityFrom(DamageSource.causeThrownDamage(this, thrower), 0)); } for (int i = 0; i < 32; i++) { worldObj.spawnParticle("magicSpell", posX, posY + rand.nextDouble() * 2D, posZ, rand.nextGaussian(), 0.0D, rand.nextGaussian()); } if (!worldObj.isRemote) { if (thrower != null) { thrower.setPositionAndUpdate(posX, posY, posZ); thrower.fallDistance = 0.0F; thrower.attackEntityFrom(DamageSource.fall, 5); } setDead(); } }Hahaha, Thankyou very much :D.
Try adding a println just after it picks the mobID, just to see which one it picks, or even whether or not it is called.
if (tileentitymobspawner != null) { tileentitymobspawner.setMobID(pickMobSpawner(random)); System.out.println("Mob ID Picked"); }Also, maybe try and add a mob to the else statement, just for testing purposes.
I could probably upload a working fence code pretty quickly, but I don't have any time to write an explanation. So therefore, I will not be uploading it yet.
together they are powerful beyond imagination."
[left]
package net.minecraft.src;[/left] import java.util.Random; public class EntityHenchman extends EntityMob { public EntityHenchman(World world) { super(world); texture = "/batman/henchman.png"; moveSpeed = 0.5F; attackStrength = 6; //take this line out if this class doesn't extend EntityMob. } public int getMaxHealth() { return 10; } protected String getLivingSound() { return "mob.villager.default"; } protected String getHurtSound() { return "mob.villager.defaulthurt"; } protected String getDeathSound() { return "mob.villager.defaultdeath"; } protected int getDropItemId() { return (Item.ingotIron.shiftedIndex); } protected void dropFewItems(boolean par1, int par2) { int i = rand.nextInt(3 + par2); for (int j = 0; j < i; j++) { dropItem(Item.ingotGold.shiftedIndex, 1); } i = rand.nextInt(3 + par2); for (int k = 0; k < i; k++) { dropItem(Item.redstone.shiftedIndex, 1); } } protected boolean canDespawn() { return false; } }EDIT: Sorry, I was being derpy. The code above was an edited version that fixed all my problems. I was an idiot and tried to use the zombie AI :/
-
View User Profile
-
View Posts
-
Send Message
Curse PremiumI tried to and the println part and it didn't help, it still tells me (exact quote):
tileentitymobspawner.setMobID("Spider");or something to that effect, in the else statement part?
setPotionEffect(Potion.hunger.id, 30, 0, 1F).setItemName("anynamehere");
Description Resource Path Location Type
The method setPotionEffect(String) in the type Item is not applicable for the arguments (int, int, int, float) mod_MoItems.java /Client/src/net/minecraft/src line 7 Java Problem
What does work is .setPotionEffect("potion.heal");
That doesn't seem to add any effect though. I guess that needs to be updated for 1.2.4. Thanks for helping me.
src\minecraft\net\minecraft\src\mod_Useless.java:6: cannot find symbol
symbol : method setBlockName(java.lang.String)
location: class net.minecraft.src.BlockUseless
0).setBlockName("Don").setHardness(3F).setResistance(4F).setLightValue(1F);
^
src\minecraft\net\minecraft\src\BlockUseless.java:15: cannot find symbol
symbol : variable blockID
location: class net.minecraft.src.Block
return mod_Useless.Useless.blockID;
^
src\minecraft\net\minecraft\src\mod_Useless.java:8: cannot find symbol
symbol : variable blockIndexInTexture
location: class net.minecraft.src.Block
{ Useless.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/mod/Random.png");
^
src\minecraft\net\minecraft\src\mod_Useless.java:11: cannot find symbol
symbol : variable dirt
location: class net.minecraft.src.Block
ModLoader.addRecipe(new ItemStack(Useless,1),new Object [] {" # ", Character.valueOf('#'),Block.dirt,});
^
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
4 errors
BlockUseless
package net.minecraft.src; public class mod_Useless extends BaseMod { public static final Block Useless = new BlockUseless(160, 0).setBlockName("Don").setHardness(3F).setResistance(4F).setLightValue(1F); public void load() { Useless.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/mod/Random.png"); ModLoader.registerBlock(Useless); ModLoader.addName(Useless, "Don"); ModLoader.addRecipe(new ItemStack(Useless,1),new Object [] {" # ", Character.valueOf('#'),Block.dirt,}); } public String getVersion() { return "1.2.4"; } }package net.minecraft.src; public class mod_Useless extends BaseMod { public static final Block Useless = new BlockUseless(160, 0).setBlockName("Don").setHardness(3F).setResistance(4F).setLightValue(1F); public void load() { Useless.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/mod/Random.png"); ModLoader.registerBlock(Useless); ModLoader.addName(Useless, "Don"); ModLoader.addRecipe(new ItemStack(Useless,1),new Object [] {" # ", Character.valueOf('#'),Block.dirt,}); } public String getVersion() { return "1.2.4"; } }nvm got it working. Is it possible to add multiple potion effects to an item? Doesn't seem to work.
It is true that you shouldn't have more than one mod_ class. It is unnecessary. I have no clue what you are talking about when you are saying bedrock and biome. I can't understand your spelling and grammar.
Yeah, just make it so that the string isn't empty. Try putting the System.out line before the tileentitymobspawner.setMobID line. I'm sort of working on the same thing at the moment so I'll try and get mine working.
You posted your mod_ class twice.
I don't think so.
together they are powerful beyond imagination."
I can post my code if you want, but it is just like the human npc code like TechGuy made (Just that it extends EntityMob)
He is a hostile mob, but he is just stupid like the old zombies, please reply someone!!!
package net.minecraft.src; import net.minecraft.src.moreDecoritives.*; public class mod_MoreDecrotives extends BaseMod { public static final Block SandStonePillarTop = new BlockSandStonePillarTop(200, 0).setBlockName("sandStonePillarCap").setHardness(0.8F).setStepSound(Block.soundStoneFootstep).setResistance(4F).setLightValue(1F); public static final Block SandStonePillarMiddle = new BlockSandStonePillarMiddle(201, 0).setBlockName("sandStonePillar").setHardness(0.8F).setStepSound(Block.soundStoneFootstep).setResistance(4F).setLightValue(1F); public static final Block SandStonePillarBottom = new BlockSandStonePillarBottom(202, 0).setBlockName("sandStonePillarBase").setHardness(0.8F).setStepSound(Block.soundStoneFootstep).setResistance(4F).setLightValue(1F); public static int SandStonePillarCaps = ModLoader.addOverride( "/terrain.png", "/moreDecoritives/SandStonePillarEndcaps.png"); public static int SandStonePillarTopSides = ModLoader.addOverride( "/terrain.png", "/moreDecoritives/SandStonePillarTop.png"); public static int SandStonePillarMiddleSides = ModLoader.addOverride( "/terrain.png", "/moreDecoritives/SandStonePillarMiddle.png"); public static int SandStonePillarBottomSides = ModLoader.addOverride( "/terrain.png", "/moreDecoritives/SandStonePillarBottom.png"); public void load() { ModLoader.registerBlock(SandStonePillarTop); ModLoader.registerBlock(SandStonePillarMiddle); ModLoader.registerBlock(SandStonePillarBottom); ModLoader.addName(SandStonePillarTop, "Sandstone Pillar Cap"); ModLoader.addName(SandStonePillarMiddle, "Sandstone Pillar Middle"); ModLoader.addName(SandStonePillarBottom, "Sandstone Pillar Base"); ModLoader.addRecipe(new ItemStack(SandStonePillarTop, 5 ), new Object[] { "###", "#", "#", Character.valueOf('#'), Block.sand }); ModLoader.addRecipe(new ItemStack(SandStonePillarMiddle, 3 ), new Object[] { "#", "#", "#", Character.valueOf('#'), Block.sand }); ModLoader.addRecipe(new ItemStack(SandStonePillarBottom, 5 ), new Object[] { "#", "#", "###", Character.valueOf('#'), Block.sand }); } public String getVersion() { return "1.2.4"; } }the error
Your recipes must have equal spaces in them. So, instead of this:
ModLoader.addRecipe(new ItemStack(SandStonePillarBottom, 5 ), new Object[] { "#", "#", "###", Character.valueOf('#'), Block.sand });it needs to be
ModLoader.addRecipe(new ItemStack(SandStonePillarBottom, 5 ), new Object[] { " # ", " # ", "###", Character.valueOf('#'), Block.sand });Add this to the constructor of your entity class:
Then this method anywhere else.
protected boolean isAIEnabled() { return true; }together they are powerful beyond imagination."
Thanks!
together they are powerful beyond imagination."
also can you please do a tutorial on making ranged mobs?
you know how to make stairs you use return 10; in the getrendertype() , well how about a tutorial about how to make a unique render type so we can make anything we want ?
for example , i want to make a corner stair like block where its 1/4 block on top half , and 3/4 on bottom half .
For code you do:
Without the 1s.
You can also press the button above the text area that looks like this:
For spoilers you do:
I don't think that would be render types, more like custom block modelling. I could probably find out what all the renderTypes actually do, and make an index on the OP, but I'm not doing block modelling at the moment.
together they are powerful beyond imagination."
package net.minecraft.src; import java.util.Map; public class mod_gallifrey extends BaseMod { public static final Block cheese = new Block(160, null).setBlockName("cheese").setHardness(1F).setResistance(2F).setLightValue(3F); public void load() { /* sontaran */ ModLoader.registerEntityID(sontaran.class, "sontaran.png", ModLoader.getUniqueEntityId()); ModLoader.addSpawn(sontaran.class, 12, 4, 10, EnumCreatureType.monster); /* cheese Block */ cheese.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/mods/cheese.png"); ModLoader.registerBlock(cheese); ModLoader.addName(cheese, "cheeseblock"); ModLoader.addRecipe(new ItemStack(cheese, 9), new Object [] {"###", 3, Character.valueOf('#'), Item.bucketMilk}); } public void addRenderer(Map map) { map.put(sontaran.class, new RenderBiped(new ModelBiped(), 0.5F)); } public String getVersion() { return "1.2.4"; } }Mods loaded: 1 ModLoader 1.2.4 Minecraft has crashed! ---------------------- Minecraft has stopped running because it encountered a problem. --- BEGIN ERROR REPORT 2f72aab9 -------- Generated 28/03/12 7:01 PM Minecraft: Minecraft 1.2.4 OS: Windows XP (x86) version 5.1 Java: 1.7.0_03, Oracle Corporation VM: Java HotSpot™ Client VM (mixed mode), Oracle Corporation LWJGL: 2.4.2 OpenGL: ATI Radeon Xpress 1150 x86/MMX/3DNow!/SSE2 version 2.0.6388 WinXP Release, ATI Technologies Inc. java.lang.ExceptionInInitializerError at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) at java.lang.reflect.Constructor.newInstance(Unknown Source) at java.lang.Class.newInstance0(Unknown Source) at java.lang.Class.newInstance(Unknown Source) at net.minecraft.src.ModLoader.addMod(ModLoader.java:286) at net.minecraft.src.ModLoader.readFromClassPath(ModLoader.java:1278) at net.minecraft.src.ModLoader.init(ModLoader.java:848) at net.minecraft.src.ModLoader.addAllRenderers(ModLoader.java:156) at net.minecraft.src.RenderManager.&--#60;init&--#62;(RenderManager.java:85) at net.minecraft.src.RenderManager.&--#60;clinit&--#62;(RenderManager.java:12) at net.minecraft.client.Minecraft.startGame(Minecraft.java:422) at net.minecraft.client.Minecraft.run(Minecraft.java:783) at java.lang.Thread.run(Unknown Source) Caused by: java.lang.NullPointerException at net.minecraft.src.Block.&--#60;init&--#62;(Block.java:242) at net.minecraft.src.mod_gallifrey.&--#60;clinit&--#62;(mod_gallifrey.java:7) ... 15 more --- END ERROR REPORT 3f90236b ----------the error is definitely in the mod_ file because it was working when i had more than 1 mod_ file then i gave it to my friend to put the codes into 1 mod_ file and i tried it and it didn't work this error occurred on start up. I didn't compile before testing if that makes a difference (my friend compiles before testing)
p.s to make code tags you MUST type code in capse e.g [CODE1] works but [code1] does not
Post your sontaran class please.
together they are powerful beyond imagination."
but yeah its kinda custom block modeling but the main part i was looking for was getting the block to render how the model is supposed to