Java Code Examples for cpw.mods.fml.common.registry.EntityRegistry#registerModEntity()

The following examples show how to use cpw.mods.fml.common.registry.EntityRegistry#registerModEntity() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ModEntityList.java    From Et-Futurum with The Unlicense 6 votes vote down vote up
private static void registerEntity(Class<? extends Entity> entityClass, String entityName, int id, Object mod, int trackingRange, int updateFrequency, boolean sendsVelocityUpdates, int eggColour1, int eggColour2, boolean hasEgg) {
	EntityRegistry.registerModEntity(entityClass, entityName, id, mod, trackingRange, updateFrequency, sendsVelocityUpdates);

	if (id >= array.length) {
		EntityData[] newArray = new EntityData[id + 5];
		for (int i = 0; i < array.length; i++)
			newArray[i] = array[i];
		array = newArray;
	}
	if (array[id] != null)
		throw new IllegalArgumentException("ID " + id + " is already being used! Please report this error!");
	else {
		array[id] = new EntityData(entityName, id, eggColour1, eggColour2, hasEgg);
		map.put(id, entityClass);
	}
}
 
Example 2
Source File: Chisel.java    From Chisel-2 with GNU General Public License v2.0 6 votes vote down vote up
@EventHandler
public void init(FMLInitializationEvent event) {
	Features.init();

	NetworkRegistry.INSTANCE.registerGuiHandler(this, new ChiselGuiHandler());

	addWorldgen(Features.MARBLE, ChiselBlocks.marble, Configurations.marbleAmount);
	addWorldgen(Features.LIMESTONE, ChiselBlocks.limestone, Configurations.limestoneAmount);
	addWorldgen(Features.ANDESITE, ChiselBlocks.andesite, Configurations.andesiteAmount, 40, 100, 0.5);
	addWorldgen(Features.GRANITE, ChiselBlocks.granite, Configurations.graniteAmount, 40, 100, 0.5);
	addWorldgen(Features.DIORITE, ChiselBlocks.diorite, Configurations.dioriteAmount, 40, 100, 0.5);
	GameRegistry.registerWorldGenerator(GeneratorChisel.INSTANCE, 1000);

       EntityRegistry.registerModEntity(EntityChiselSnowman.class, "snowman", 0, this, 80, 1, true);

	proxy.init();
	MinecraftForge.EVENT_BUS.register(this);
	FMLCommonHandler.instance().bus().register(instance);

	FMLInterModComms.sendMessage("Waila", "register", "com.cricketcraft.chisel.compat.WailaCompat.register");
}
 
Example 3
Source File: LookingGlass.java    From LookingGlass with GNU General Public License v3.0 5 votes vote down vote up
@EventHandler
public void init(FMLInitializationEvent event) {
	// Our one and only entity.
	EntityRegistry.registerModEntity(com.xcompwiz.lookingglass.entity.EntityPortal.class, "lookingglass.portal", 216, this, 64, 10, false);

	sidedProxy.init();
}
 
Example 4
Source File: CommonProxy.java    From NOVA-Core with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public void preInit(FMLPreInitializationEvent evt) {
	GameRegistry.registerTileEntity(FWTile.class, "novaTile");
	int globalUniqueEntityId = EntityRegistry.findGlobalUniqueEntityId();
	EntityRegistry.registerGlobalEntityID(FWEntity.class, "novaEntity", globalUniqueEntityId);
	EntityRegistry.registerModEntity(FWEntity.class, "novaEntity", globalUniqueEntityId, NovaMinecraft.instance, 64, 20, true);
}
 
Example 5
Source File: MoCreatures.java    From mocreaturesdev with GNU General Public License v3.0 5 votes vote down vote up
/**
 * For Litterbox and kittybeds
 * 
 * @param entityClass
 * @param entityName
 */
protected void registerEntity(Class<? extends Entity> entityClass, String entityName)
{
    int entityID = EntityRegistry.findGlobalUniqueEntityId();
    LanguageRegistry.instance().addStringLocalization("entity." + entityName + ".name", "en_US", entityName);
    //private static EntityEggInfo searchEggColor(Class entityClass , int entityId)
    //EntityEggInfo eggColors = MoCEggColour.searchEggColor(entityClass, entityID);
    EntityRegistry.registerGlobalEntityID(entityClass, entityName, entityID);
    EntityRegistry.registerModEntity(entityClass, entityName, entityID, instance, 128, 1, true);
}
 
Example 6
Source File: MoCreatures.java    From mocreaturesdev with GNU General Public License v3.0 5 votes vote down vote up
private void registerEntity(Class<? extends Entity> entityClass, String entityName, int eggColor, int eggDotsColor, String visibleName)
{
    int entityID = EntityRegistry.findGlobalUniqueEntityId();
    LanguageRegistry.instance().addStringLocalization("entity." + entityName + ".name", "en_US", visibleName);
    EntityRegistry.registerGlobalEntityID(entityClass, entityName, entityID, eggColor, eggDotsColor);
    EntityRegistry.registerModEntity(entityClass, entityName, entityID, instance, 128, 1, true);
}
 
Example 7
Source File: EntityRegistrator.java    From PneumaticCraft with GNU General Public License v3.0 5 votes vote down vote up
public static void init(){
    // Entities
    // parms: entity class, mobname (for spawners), id, modclass, max player
    // distance for update, update frequency, boolean keep server updated
    // about velocities.
    EntityRegistry.registerModEntity(EntityVortex.class, "Vortex", 0, PneumaticCraft.instance, 80, 1, true);
    EntityRegistry.registerModEntity(EntityChopperSeeds.class, "Chopper Plant Seeds Entity", 2, PneumaticCraft.instance, 80, 1, true);
    EntityRegistry.registerModEntity(EntityPotionCloud.class, "Potion Cloud", 3, PneumaticCraft.instance, 80, 1, true);
    EntityRegistry.registerModEntity(EntityDrone.class, "Drone", 4, PneumaticCraft.instance, 80, 1, true);
    EntityRegistry.registerModEntity(EntityLogisticsDrone.class, "logisticDrone", 5, PneumaticCraft.instance, 80, 1, true);
    // Entity Eggs:
    // registerEntityEgg(EntityRook.class, 0xffffff, 0x000000);
}
 
Example 8
Source File: RegisteredEntities.java    From Gadomancy with GNU Lesser General Public License v3.0 4 votes vote down vote up
private static void registerEntity(Class<? extends Entity> entityClass, String name, int trackingRange, int updateFreq, boolean sendVelUpdates) {
    int id = EntityRegistry.findGlobalUniqueEntityId();
    EntityRegistry.registerGlobalEntityID(entityClass, name, id);
    EntityRegistry.registerModEntity(entityClass, name, id, Gadomancy.instance, trackingRange, updateFreq, sendVelUpdates);
}
 
Example 9
Source File: ArchimedesShipMod.java    From archimedes-ships with MIT License 4 votes vote down vote up
@EventHandler
public void initMod(FMLInitializationEvent event)
{
	registerBlocksAndItems();
	
	EntityRegistry.registerModEntity(EntityShip.class, "shipmod", 1, this, 64, modConfig.shipEntitySyncRate, true);
	EntityRegistry.registerModEntity(EntityEntityAttachment.class, "attachment", 2, this, 64, 100, false);
	EntityRegistry.registerModEntity(EntitySeat.class, "attachment.seat", 3, this, 64, 100, false);
	EntityRegistry.registerModEntity(EntityParachute.class, "parachute", 4, this, 32, modConfig.shipEntitySyncRate, true);
	
	//In g/cm^3
	/*MaterialDensity.addDensity(Material.air, 0F);
	//MaterialDensity.addDensity(Material.wood, 0.700F);
	MaterialDensity.addDensity(Material.wood, 0.500F);
	MaterialDensity.addDensity(Material.rock, 2.500F);
	MaterialDensity.addDensity(Material.water, 1.000F);
	MaterialDensity.addDensity(Material.lava, 2.500F);
	MaterialDensity.addDensity(Material.ice, 0.916F);
	//MaterialDensity.addDensity(Material.iron, 7.874F);
	MaterialDensity.addDensity(Material.iron, 5.000F);
	MaterialDensity.addDensity(Material.anvil, 5.000F);
	//MaterialDensity.addDensity(Material.glass, 2.600F);
	MaterialDensity.addDensity(Material.glass, 0.400F);
	MaterialDensity.addDensity(Material.leaves, 0.200F);
	MaterialDensity.addDensity(Material.plants, 0.200F);
	//MaterialDensity.addDensity(Material.cloth, 1.314F);
	MaterialDensity.addDensity(Material.cloth, 0.700F);
	MaterialDensity.addDensity(Material.sand, 1.600F);
	MaterialDensity.addDensity(Material.ground, 2.000F);
	MaterialDensity.addDensity(Material.grass, 2.000F);
	MaterialDensity.addDensity(Material.clay, 2.000F);
	MaterialDensity.addDensity(Material.gourd, 0.900F);
	MaterialDensity.addDensity(Material.sponge, 0.400F);
	MaterialDensity.addDensity(Material.craftedSnow, 0.800F);
	MaterialDensity.addDensity(Material.tnt, 1.200F);
	MaterialDensity.addDensity(Material.piston, 1.000F);
	MaterialDensity.addDensity(Material.cloth, 0.100F);
	MaterialDensity.addDensity(materialFloater, 0.04F);
	MaterialDensity.addDensity(blockBalloon, 0.02F);*/
	
	proxy.registerKeyHandlers(modConfig);
	proxy.registerEventHandlers();
	proxy.registerRenderers();
	proxy.registerPackets(pipeline);
}
 
Example 10
Source File: BaseEntityRegistry.java    From Electro-Magic-Tools with GNU General Public License v3.0 4 votes vote down vote up
public static void registerEMTEntities() {

        EntityRegistry.registerModEntity(EntityLaser.class, "entityLaser", entityIDs++, ElectroMagicTools.instance, 80, 3, true);
        EntityRegistry.registerModEntity(EntityArcher.class, "entityArcher", entityIDs++, ElectroMagicTools.instance, 80, 3, true);
        registerEntityEgg(ARCHER_CLASS, 0x99111F, 0xE5685);
    }
 
Example 11
Source File: Chisel.java    From Chisel with GNU General Public License v2.0 4 votes vote down vote up
@EventHandler
public void preInit(FMLPreInitializationEvent event)
{
    File configFile = event.getSuggestedConfigurationFile();
    Configurations.configExists = configFile.exists();
    Configurations.config = new Configuration(configFile);
    Configurations.config.load();
    Configurations.refreshConfig();

    tabChisel = new CreativeTabs("tabChisel")
    {
        @Override
        public Item getTabIconItem()
        {
            return chisel;
        }
    };

    chisel = (ItemChisel) new ItemChisel(Carving.chisel).setTextureName("chisel:chisel").setCreativeTab(CreativeTabs.tabTools);
    GameRegistry.registerItem(chisel, "chisel");

    if(Configurations.featureEnabled("cloud"))
    {
        itemCloudInABottle = (ItemCloudInABottle) new ItemCloudInABottle().setTextureName("Chisel:cloudinabottle").setCreativeTab(CreativeTabs.tabTools);
        EntityRegistry.registerModEntity(EntityCloudInABottle.class, "CloudInABottle", 1, this, 40, 1, true);
        GameRegistry.registerItem(itemCloudInABottle, "cloudinabottle");
    }

    if(Configurations.featureEnabled("ballOfMoss"))
    {
        itemBallOMoss = (ItemBallOMoss) new ItemBallOMoss().setTextureName("Chisel:ballomoss").setCreativeTab(CreativeTabs.tabTools);
        EntityRegistry.registerModEntity(EntityBallOMoss.class, "BallOMoss", 2, this, 40, 1, true);
        GameRegistry.registerItem(itemBallOMoss, "ballomoss");
    }

    if(Configurations.featureEnabled("smashingRock"))
    {
        smashingRock = (ItemSmashingRock) new ItemSmashingRock().setTextureName("Chisel:smashingrock").setCreativeTab(CreativeTabs.tabTools);
        EntityRegistry.registerModEntity(EntitySmashingRock.class, "SmashingRock", 2, this, 40, 1, true);
        GameRegistry.registerItem(smashingRock, "smashingrock");
    }
    ChiselBlocks.load();
    proxy.preInit();
}
 
Example 12
Source File: ClientProxy.java    From PneumaticCraft with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void registerRenders(){
    SPECIAL_RENDER_TYPE_VALUE = RenderingRegistry.getNextAvailableRenderId();
    blockRenderers.add(new RenderElevatorFrame());
    blockRenderers.add(new RenderChargingStationPad());

    for(ISBRHPneumatic renderer : blockRenderers) {
        RenderingRegistry.registerBlockHandler(renderer);
    }

    RenderingRegistry.registerBlockHandler(new RenderModelBase());
    // RenderingRegistry.registerBlockHandler(new RendererSpecialBlock());
    registerBaseModelRenderer(Blockss.airCompressor, TileEntityAirCompressor.class, new ModelAirCompressor("airCompressor"));
    registerBaseModelRenderer(Blockss.advancedAirCompressor, TileEntityAdvancedAirCompressor.class, new ModelAirCompressor("advancedAirCompressor"));
    registerBaseModelRenderer(Blockss.assemblyController, TileEntityAssemblyController.class, new ModelAssemblyController());
    registerBaseModelRenderer(Blockss.assemblyDrill, TileEntityAssemblyDrill.class, new ModelAssemblyDrill());
    registerBaseModelRenderer(Blockss.assemblyIOUnit, TileEntityAssemblyIOUnit.class, new ModelAssemblyIOUnit());
    registerBaseModelRenderer(Blockss.assemblyLaser, TileEntityAssemblyLaser.class, new ModelAssemblyLaser());
    registerBaseModelRenderer(Blockss.assemblyPlatform, TileEntityAssemblyPlatform.class, new ModelAssemblyPlatform());
    registerBaseModelRenderer(Blockss.chargingStation, TileEntityChargingStation.class, new ModelChargingStation());
    registerBaseModelRenderer(Blockss.creativeCompressor, TileEntityCreativeCompressor.class, new BaseModel("creativeCompressor.obj"));
    registerBaseModelRenderer(Blockss.electrostaticCompressor, TileEntityElectrostaticCompressor.class, new BaseModel("electrostaticCompressor.obj"));
    registerBaseModelRenderer(Blockss.elevatorBase, TileEntityElevatorBase.class, new ModelElevatorBase());
    registerBaseModelRenderer(Blockss.pneumaticDoor, TileEntityPneumaticDoor.class, new ModelPneumaticDoor());
    registerBaseModelRenderer(Blockss.pneumaticDoorBase, TileEntityPneumaticDoorBase.class, new ModelPneumaticDoorBase());
    registerBaseModelRenderer(Blockss.pressureChamberInterface, TileEntityPressureChamberInterface.class, new ModelPressureChamberInterface());
    registerBaseModelRenderer(Blockss.securityStation, TileEntitySecurityStation.class, new ModelComputer(Textures.MODEL_SECURITY_STATION));
    registerBaseModelRenderer(Blockss.universalSensor, TileEntityUniversalSensor.class, new ModelUniversalSensor());
    registerBaseModelRenderer(Blockss.uvLightBox, TileEntityUVLightBox.class, new ModelUVLightBox());
    registerBaseModelRenderer(Blockss.vacuumPump, TileEntityVacuumPump.class, new ModelVacuumPump());
    registerBaseModelRenderer(Blockss.omnidirectionalHopper, TileEntityOmnidirectionalHopper.class, new ModelOmnidirectionalHopper(Textures.MODEL_OMNIDIRECTIONAL_HOPPER));
    registerBaseModelRenderer(Blockss.liquidHopper, TileEntityLiquidHopper.class, new ModelLiquidHopper());
    registerBaseModelRenderer(Blockss.programmer, TileEntityProgrammer.class, new ModelComputer(Textures.MODEL_PROGRAMMER));
    registerBaseModelRenderer(Blockss.plasticMixer, TileEntityPlasticMixer.class, new ModelPlasticMixer());
    registerBaseModelRenderer(Blockss.liquidCompressor, TileEntityLiquidCompressor.class, new BaseModel("liquidCompressor.obj"));
    registerBaseModelRenderer(Blockss.advancedLiquidCompressor, TileEntityAdvancedLiquidCompressor.class, new BaseModel("liquidCompressor.obj", "advancedLiquidCompressor.png"));
    registerBaseModelRenderer(Blockss.heatSink, TileEntityHeatSink.class, new ModelHeatSink());
    registerBaseModelRenderer(Blockss.vortexTube, TileEntityVortexTube.class, new ModelVortexTube());
    registerBaseModelRenderer(Blockss.thermopneumaticProcessingPlant, TileEntityThermopneumaticProcessingPlant.class, new ModelThermopneumaticProcessingPlant());
    registerBaseModelRenderer(Blockss.refinery, TileEntityRefinery.class, new ModelRefinery());
    registerBaseModelRenderer(Blockss.gasLift, TileEntityGasLift.class, new ModelGasLift());
    registerBaseModelRenderer(Blockss.keroseneLamp, TileEntityKeroseneLamp.class, new ModelKeroseneLamp());
    registerBaseModelRenderer(Blockss.sentryTurret, TileEntitySentryTurret.class, new ModelSentryTurret());

    ClientRegistry.bindTileEntitySpecialRenderer(TileEntityPressureTube.class, new RenderPressureTube());
    ClientRegistry.bindTileEntitySpecialRenderer(TileEntityAirCannon.class, new RenderAirCannon());
    // ClientRegistry.bindTileEntitySpecialRenderer(TileEntityElevatorBase.class, new RenderElevatorBase());
    // ClientRegistry.bindTileEntitySpecialRenderer(TileEntityAdvancedPressureTube.class, new RenderAdvancedPressureTube());
    ClientRegistry.bindTileEntitySpecialRenderer(TileEntityAphorismTile.class, new RenderAphorismTile());
    ClientRegistry.bindTileEntitySpecialRenderer(TileEntityElevatorCaller.class, new RenderElevatorCaller());
    // ClientRegistry.bindTileEntitySpecialRenderer(TileEntityProgrammableController.class, new RenderProgrammableController());
    // ClientRegistry.bindTileEntitySpecialRenderer(TileEntitySentryTurret.class, new RenderSentryTurret());

    MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(Blockss.pressureTube), new RenderItemPressureTube(false));
    MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(Blockss.advancedPressureTube), new RenderItemPressureTube(true));

    MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(Blockss.airCannon), new RenderModelBase(new ModelAirCannon()));
    MinecraftForgeClient.registerItemRenderer(Itemss.vortexCannon, new RenderItemVortexCannon());
    // MinecraftForgeClient.registerItemRenderer(Blocks.elevatorBase, new RenderItemElevatorBase());
    MinecraftForgeClient.registerItemRenderer(Itemss.cannonBarrel, new RenderItemCannonParts(false));
    MinecraftForgeClient.registerItemRenderer(Itemss.stoneBase, new RenderItemCannonParts(true));
    MinecraftForgeClient.registerItemRenderer(Itemss.pneumaticCylinder, new RenderItemPneumaticCilinder());
    //   MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(Blockss.advancedPressureTube), new RenderItemAdvancedPressureTube());
    MinecraftForgeClient.registerItemRenderer(Itemss.drone, new RenderItemDrone(false));
    MinecraftForgeClient.registerItemRenderer(Itemss.logisticsDrone, new RenderItemDrone(true));
    MinecraftForgeClient.registerItemRenderer(Itemss.programmingPuzzle, new RenderItemProgrammingPuzzle());
    MinecraftForgeClient.registerItemRenderer(Itemss.minigun, new RenderItemMinigun());
    if(Config.useHelmetModel) MinecraftForgeClient.registerItemRenderer(Itemss.pneumaticHelmet, new RenderItemPneumaticHelmet());

    RenderingRegistry.registerEntityRenderingHandler(EntityVortex.class, new RenderEntityVortex());
    RenderingRegistry.registerEntityRenderingHandler(EntityChopperSeeds.class, new RenderEntityChopperSeeds());
    RenderingRegistry.registerEntityRenderingHandler(EntityPotionCloud.class, new RenderEntityPotionCloud());
    RenderingRegistry.registerEntityRenderingHandler(EntityDrone.class, new RenderDrone(false));
    RenderingRegistry.registerEntityRenderingHandler(EntityLogisticsDrone.class, new RenderDrone(true));
    RenderingRegistry.registerEntityRenderingHandler(EntityProgrammableController.class, new RenderDrone(false));

    RenderingRegistry.registerEntityRenderingHandler(EntityRing.class, new RenderEntityRing());
    EntityRegistry.registerModEntity(EntityRing.class, "Ring", 100, PneumaticCraft.instance, 80, 1, true);

    registerModuleRenderers();
    super.registerRenders();
}