Modding FR

kifkif43

Bucheron
29 Avril 2011
173
2
13
J'ai un probleme, comment faire pour faire ouvrir un inventaire l'orsque l'on fais clique droit sur une entité ?
 

billa38

Aventurier
3 Juillet 2011
5
0
0
moi j'ai vraiment un problème qui m'arrivent a chaque fois

je lance recomplie.bat --> tout se passe bien, aucune erreur
et la je lance startclient et a chaque fois dans le message d'erreur il me met

"failed to load mod from mod_Mymod.class"

est ce que quelqu'un a une idée ?
pourtant j'ai vraiment l'impressoin de tout faire comme il faut mais on diarait qu'il n'arrive pas à acceder a mon mod

j’attends vos réponses, merci
 

billa38

Aventurier
3 Juillet 2011
5
0
0
mais si le recompile.bat me donne aucune erreur, coment ca se fais que ca plante à starclient ?

enfin ok je,met mon code

voila le mod_Plutonium.java

package net.minecraft.src;

public class mod_Plutonium extends BaseMod
{
public mod_Plutonium()
{
ModLoader.RegisterBlock(ironblocUranium);
ModLoader.RegisterBlock(ironblocPlutonium);

ModLoader.AddName(ironblocUranium, "Uranium IronBlock");
ModLoader.AddName(ironblocPlutonium, "Plutonium IronBlock");

ModLoader.AddRecipe(new ItemStack(ironblocUranium, 1), new Object[]
{"XXX", "XXX", "XXX", Character.valueOf('X'), mod_Uranium.uraniumIngot});
}

public static final Block ironblocUranium = (new BlockironblocUranium(1000,ModLoader.addOverride("/terrain.png", "/bloc/ironblocUranium.png"))).setHardness(4.0F).setResistance(10F).setStepSound(Block.soundMetalFootstep).setLightValue(0.6F).setBlockName("Uranium IronBlock");
public static final Block ironblocPlutonium = (new BlockironblocPlutonium(1001,ModLoader.addOverride("/terrain.png", "/bloc/ironblocPlutonium.png"))).setHardness(4.0F).setResistance(10F).setStepSound(Block.soundMetalFootstep).setLightValue(0.6F).setBlockName("Plutonium IronBlock");

public String Version()
{
return "1.6.6";
}
}

et je precise que la variable mod_Uranium.uraniumIngot viens d'un autre mod qui marche très bien lui

donc le problème ne viens pas de là

et voilà les 2 blocs

le premier :
package net.minecraft.src;

import java.util.Random;

public class BlockironblocPlutonium extends Block
{
public BlockironblocPlutonium(int i, int j)
{
super(i, j, Material.iron);
}
public int idDropped(int i, Random random)
{
return Block.cobblestone.blockID;
}
public void onEntityCollidedWithBlock(World world, int i, int j, int k, Entity entity)
{
entity.attackEntityFrom(null, 10);
}
}
 

billa38

Aventurier
3 Juillet 2011
5
0
0
le 2ème

package net.minecraft.src;

import java.util.Random;

public class BlockironblocUranium extends Block
{
public BlockironblocUranium(int i, int j)
{
super(i, j, Material.iron);
}
public int idDropped(int i, Random random)
{
return Block.cobblestone.blockID;
}
public void onEntityCollidedWithBlock(World world, int i, int j, int k, Entity entity)
{
entity.attackEntityFrom(null, 10);
}

a ok merci je test, mais je croyait quon pouvait aller aussi loin quon le voulai ??
 

billa38

Aventurier
3 Juillet 2011
5
0
0
a mais ok je savait pas merci, je test

ca marche !!

merci beaucoup, puré ca fais longtemps que je cherche et en fait c'était juste à cause des ID

tien et j'aimerai qu'on me donne une liste de tous les types de blocs SVP,

je connais .rock, .iron, .ground, .tnt
et c'est tout, est ce qu'on peut tous me les donner merci d'avance
 

KiwiAtomique

Architecte en herbe
8 Mai 2011
81
1
106
Salut !

J'aimerais savoir comment rendre apprivoisable une animal ?
J'ai regardé du côté de EntityWolf, j'ai fait quelques trucs pour rendre apprivoisable une vache, mais lorsque je fais clique droit avec du blé (Item que j'ai défini pour qu'elle soit apprivoisé) sur la vache, le jeu bug et :

Code:
Mods loaded: 2
ModLoader Beta 1.6.6
net.minecraft.src.mod_SeedBeer 1.6.6

      Minecraft has crashed!      
      ----------------------      

Minecraft has stopped running because it encountered a problem.

If you wish to report this, please copy this entire text and email it to [email protected].
Please include a description of what you did when the error occured.



--- BEGIN ERROR REPORT 13d2c391 --------
Generated 03/07/11 22:06

Minecraft: Minecraft Beta 1.6.6
OS: Windows 7 (x86) version 6.1
Java: 1.6.0_26, Sun Microsystems Inc.
VM: Java HotSpot(TM) Client VM (mixed mode), Sun Microsystems Inc.
LWJGL: 2.4.2
OpenGL: ATI Radeon HD 5700 Series version 4.0.9836 Compatibility Profile Context, ATI Technologies Inc.

java.lang.NullPointerException
	at net.minecraft.src.DataWatcher.getWatchableObjectByte(DataWatcher.java:45)
	at net.minecraft.src.EntityCow.isCowTamed(EntityCow.java:107)
	at net.minecraft.src.EntityCow.onLivingUpdate(EntityCow.java:37)
	at net.minecraft.src.EntityLiving.onUpdate(EntityLiving.java:207)
	at net.minecraft.src.World.updateEntityWithOptionalForce(World.java:1426)
	at net.minecraft.src.World.updateEntity(World.java:1402)
	at net.minecraft.src.World.updateEntities(World.java:1376)
	at net.minecraft.client.Minecraft.runTick(Minecraft.java:1187)
	at net.minecraft.client.Minecraft.run(Minecraft.java:480)
	at java.lang.Thread.run(Unknown Source)
--- END ERROR REPORT 3222e9e0 ----------


Le code source du EntityCow :

Code:
// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.kpdus.com/jad.html
// Decompiler options: packimports(3) braces deadcode 

package net.minecraft.src;


// Referenced classes of package net.minecraft.src:
//            EntityAnimal, Item, EntityPlayer, InventoryPlayer, 
//            ItemStack, World, NBTTagCompound

public class EntityCow extends EntityAnimal
{

	public EntityCow(World world)
    {
        super(world);
        looksWithInterest = false;
        texture = "/mob/cow.png";
        setSize(0.9F, 1.3F);
        timeUntilNextLeather = rand.nextInt(6000) + 6000;
    }

    public void onLivingUpdate ()
    {
        super.onLivingUpdate();
        looksWithInterest = false;
        if(hasCurrentTarget() && !hasPath())
        {
            Entity entity = getCurrentTarget();
            if(entity instanceof EntityPlayer)
            {
                EntityPlayer entityplayer = (EntityPlayer)entity;
                ItemStack itemstack = entityplayer.inventory.getCurrentItem();
                if(itemstack != null)
                {
                    if(!isCowTamed() && itemstack.itemID == Item.wheat.shiftedIndex)
                    {
                        looksWithInterest = true;
                    } else
                    if(isCowTamed() && (Item.itemsList[itemstack.itemID] instanceof ItemFood))
                    {
                        looksWithInterest = ((ItemFood)Item.itemsList[itemstack.itemID]).getIsCowsFavoriteMeat();
                    }
                }
            }
        }
        if(!worldObj.multiplayerWorld && --timeUntilNextLeather <= 0)
        {
            worldObj.playSoundAtEntity(this, "mob.cow1", 1.0F, (rand.nextFloat() - rand.nextFloat()) * 0.2F + 1.0F);
            dropItem(Item.leather.shiftedIndex, 1);
            dropItem(Item.bucketMilk.shiftedIndex, 1);
            timeUntilNextLeather = rand.nextInt(6000) + 6000;
        }	
    }
    
    public void writeEntityToNBT(NBTTagCompound nbttagcompound)
    {
        super.writeEntityToNBT(nbttagcompound);
    }

    public void readEntityFromNBT(NBTTagCompound nbttagcompound)
    {
        super.readEntityFromNBT(nbttagcompound);
    }
    
    protected String getLivingSound()
    {
        return "mob.cow";
    }

    protected String getHurtSound()
    {
        return "mob.cowhurt";
    }

    protected String getDeathSound()
    {
        return "mob.cowhurt";
    }

    protected float getSoundVolume()
    {
        return 0.4F;
    }

    protected int getDropItemId()
    {
        return Item.leather.shiftedIndex;
    }

    public boolean interact(EntityPlayer entityplayer)
    {
        ItemStack itemstack = entityplayer.inventory.getCurrentItem();
        if(itemstack != null && itemstack.itemID == Item.bucketEmpty.shiftedIndex)
        {
            entityplayer.inventory.setInventorySlotContents(entityplayer.inventory.currentItem, new ItemStack(Item.bucketMilk));
            return true;
        } else
        {
            return false;
        }
    }
    
    public boolean isCowTamed()
    {
        return (dataWatcher.getWatchableObjectByte(16) & 4) != 0;
    }

    public void setCowTamed(boolean flag)
    {
        byte byte0 = dataWatcher.getWatchableObjectByte(16);
        if(flag)
        {
            dataWatcher.updateObject(16, Byte.valueOf((byte)(byte0 | 4)));
        } else
        {
            dataWatcher.updateObject(16, Byte.valueOf((byte)(byte0 & -5)));
        }
    }
    
    private boolean looksWithInterest;
    public int timeUntilNextLeather;
}

Une idée ? Merci d'avance !!