Bonjours,
Je suis débutant dans le modding et je voudrais que mon mob soit attirer par un block de fer par exemple mais j’ai cherché et il ne donne dans les réponses que des bout de code d’entité existant dans minecraft vanilla et comme je l’ai dit precedamment je suis débutant je ne sais pas comment faire
:::
package fr.clashofclan.common;
import java.awt.Color;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.EventHandler;
import cpw.mods.fml.common.Mod.Instance;
import cpw.mods.fml.common.SidedProxy;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.registry.EntityRegistry;
import cpw.mods.fml.common.registry.GameRegistry;
import fr.clashofclan.proxy.CommonProxy;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.creativetab.CreativeTabs;
@Mod(modid = "clashofclan", name = "Clash Of Clan", version = "1.0.0")
public class ClashOfClan {
@Instance("clashofclan")
public static ClashOfClan instance;
public static final String MODID = "clashofclan";
@SidedProxy(clientSide = "fr.clashofclan.proxy.ClientProxy", serverSide = "fr.clashofclan.proxy.CommonProxy")
public static CommonProxy proxy;
public static Block firstblock;
@EventHandler
public void preInit(FMLPreInitializationEvent event)
{
firstblock = new Firstblock().setBlockName("test").setCreativeTab(CreativeTabs.tabBlock);
GameRegistry.registerBlock(firstblock, ItemFirstbloc.class, "block_test");
}
@EventHandler
public void init(FMLInitializationEvent event)
{
proxy.registerRender();
EntityRegistry.registerGlobalEntityID(Mobclassique.class, "mobclassique", EntityRegistry.findGlobalUniqueEntityId(), new Color(0, 255, 0).getRGB(), new Color(255, 0, 0).getRGB());
EntityRegistry.registerModEntity(Mobclassique.class, "mobclassique", 420, this.instance, 40, 1, true);
}
@EventHandler
public void postInit(FMLPostInitializationEvent event)
{
}
}
::::::
| package fr.clashofclan.common; |
| |
| import net.minecraft.block.Block; |
| import net.minecraft.entity.Entity; |
| import net.minecraft.entity.EntityCreature; |
| import net.minecraft.entity.SharedMonsterAttributes; |
| import net.minecraft.entity.monster.EntityMob; |
| import net.minecraft.init.Blocks; |
| import net.minecraft.util.MovingObjectPosition; |
| import net.minecraft.world.World; |
| |
| public class Mobclassique extends EntityCreature |
| { |
| public Mobclassique(World world) |
| { |
| super(world); |
| } |
| public void applyEntityAttributes() |
| { |
| super.applyEntityAttributes(); |
| this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(20D); |
| |
| |
| this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.8D); |
| } |
| public Entity getEntityToAttack() |
| { |
| return null; |
| } |
| } |
::::::
| package fr.clashofclan.client; |
| |
| import fr.clashofclan.common.ClashOfClan; |
| import fr.clashofclan.common.Mobclassique; |
| import net.minecraft.client.model.ModelBiped; |
| import net.minecraft.client.renderer.entity.RenderBiped; |
| import net.minecraft.entity.EntityLiving; |
| import net.minecraft.util.ResourceLocation; |
| |
| public class RenderMobclassique extends RenderBiped { |
| |
| public final ResourceLocation texture = new ResourceLocation(ClashOfClan.MODID, "textures/entity/mobclassique.png"); |
| |
| public RenderMobclassique(ModelBiped model, float shadow) |
| { |
| super(model, shadow); |
| } |
| protected ResourceLocation getEntityTexture(EntityLiving living) |
| { |
| return this.getMobclassiqueTexture((Mobclassique)living); |
| } |
| |
| private ResourceLocation getMobclassiqueTexture(Mobclassique mobclassique) |
| { |
| return texture; |
| } |
| } |
:::
Voila