- 382
- 2
- 24
Почему не добавляется моб? В инвентаре яйца нет. Командой /summon -- пишет нет такого существа.
Главный класс:
package madruvasialc.rtw;
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.FMLPreInitializationEvent;
import cpw.mods.fml.common.registry.EntityRegistry;
import madruvasialc.rtw.mobs.DUkrest;
import net.minecraft.entity.EntityList;
@Mod(name = RTW.NAME, modid = RTW.MODID, version = RTW.VERSION)
public class RTW
{
@SidedProxy(clientSide = "madruvasialc.rtw.ClientProxy", serverSide = "madruvasialc.rtw.CommonProxy")
public static CommonProxy proxy;
@Instance("rtw")
public static RTW instance;
public static final String NAME = "Rome Total War";
public static final String MODID = "rtw";
public static final String VERSION = "0.0.1";
public void preLoad(FMLPreInitializationEvent event)
{
registerEntity(DUkrest.class, "du_krest", 0xFF0000, 0x000000);
proxy.registerRenderers();
}
@EventHandler
public void load(FMLInitializationEvent event)
{
}
public static void registerEntity(Class entityClass, String name, int primaryColor, int secondaryColor)
{
int entityID = EntityRegistry.findGlobalUniqueEntityId();
long seed = name.hashCode();
EntityRegistry.registerGlobalEntityID(entityClass, name, entityID);
EntityRegistry.registerModEntity(entityClass, name, entityID, instance, 64, 1, true); //эта строка не нужна(зачем она?)
EntityList.entityEggs.put(Integer.valueOf(entityID), new EntityList.EntityEggInfo(entityID, primaryColor, secondaryColor));
}
}
Сервер:
package madruvasialc.rtw;
public class CommonProxy {
public void registerRenderers()
{
}
}
Клиент:
package madruvasialc.rtw;
import cpw.mods.fml.client.registry.RenderingRegistry;
import madruvasialc.rtw.mobs.DUkrest;
import madruvasialc.rtw.mobs.RenderDUkrest;
import net.minecraft.client.model.ModelBiped;
public class ClientProxy extends CommonProxy{
public void registerRenderers()
{
RenderingRegistry.registerEntityRenderingHandler(DUkrest.class, new RenderDUkrest(new ModelBiped(), 0.5F));
}
}
Класс моба:
package madruvasialc.rtw.mobs;
import net.minecraft.entity.monster.EntityMob;
import net.minecraft.world.World;
public class DUkrest extends EntityMob
{
public DUkrest(World par1World)
{
super(par1World);
}
}
Рендер моба:
package madruvasialc.rtw.mobs;
import net.minecraft.client.model.ModelBiped;
import net.minecraft.client.renderer.entity.RenderBiped;
import net.minecraft.entity.Entity;
import net.minecraft.util.ResourceLocation;
public class RenderDUkrest extends RenderBiped
{
private static final ResourceLocation textureLocation = new ResourceLocation("trw:textures/entity/du_krest.png");
public RenderDUkrest(ModelBiped model, float shadowSize)
{
super(model, shadowSize);
}
@Override
protected ResourceLocation getEntityTexture(Entity par1Entity)
{
return textureLocation;
}
}