当前位置: 首页>>代码示例>>Java>>正文


Java IForgeRegistry类代码示例

本文整理汇总了Java中net.minecraftforge.fml.common.registry.IForgeRegistry的典型用法代码示例。如果您正苦于以下问题:Java IForgeRegistry类的具体用法?Java IForgeRegistry怎么用?Java IForgeRegistry使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


IForgeRegistry类属于net.minecraftforge.fml.common.registry包,在下文中一共展示了IForgeRegistry类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onMessage

import net.minecraftforge.fml.common.registry.IForgeRegistry; //导入依赖的package包/类
@SuppressWarnings({"ReturnOfNull", "ConstantConditions"})
@Override
public IMessage onMessage(SpawnCustomParticleMessage message, MessageContext ctx)
{
    final ParticleManager effectRenderer = Minecraft.getMinecraft().effectRenderer;

    final IForgeRegistry<ICustomParticleFactory> registry = GameRegistry.findRegistry(ICustomParticleFactory.class);
    final ICustomParticleFactory factory = registry.getValue(message.getParticleResourceLocation());

    final Particle particle = factory.getParticleFactory().createParticle(-1,
            Minecraft.getMinecraft().thePlayer.worldObj,
            message.getXCoordinate(),
            message.getYCoordinate(),
            message.getZCoordinate(),
            message.getParticleSpeed(),
            message.getParticleSpeed(),
            message.getParticleSpeed(),
            message.getParticleArgs()
    );

    effectRenderer.addEffect(particle);

    return null;
}
 
开发者ID:AtomicBlom,项目名称:ShearMadness,代码行数:25,代码来源:SpawnCustomParticleMessageHandler.java

示例2: onMessage

import net.minecraftforge.fml.common.registry.IForgeRegistry; //导入依赖的package包/类
@SuppressWarnings({"ReturnOfNull", "ConstantConditions"})
@Override
public IMessage onMessage(PlayCustomSoundMessage message, MessageContext ctx)
{
    final IForgeRegistry<SoundEvent> registry = GameRegistry.findRegistry(SoundEvent.class);

    Minecraft.getMinecraft().thePlayer.worldObj.playSound(
            message.getPosX(), message.getPosY(), message.getPosZ(),
            registry.getValue(message.getSoundEvent()),
            message.getCategory(),
            message.getVolume(), message.getPitch(),
            message.shouldDistanceDelay()
    );

    return null;
}
 
开发者ID:AtomicBlom,项目名称:ShearMadness,代码行数:17,代码来源:PlayCustomSoundMessageHandler.java

示例3: registerDarkSteelUpgrades

import net.minecraftforge.fml.common.registry.IForgeRegistry; //导入依赖的package包/类
@SubscribeEvent(priority = EventPriority.HIGH)
public static void registerDarkSteelUpgrades(@Nonnull RegistryEvent.Register<IDarkSteelUpgrade> event) {
  final IForgeRegistry<IDarkSteelUpgrade> registry = event.getRegistry();
  registry.register(EnergyUpgrade.EMPOWERED);
  registry.register(EnergyUpgrade.EMPOWERED_TWO);
  registry.register(EnergyUpgrade.EMPOWERED_THREE);
  registry.register(EnergyUpgrade.EMPOWERED_FOUR);
  registry.register(JumpUpgrade.JUMP_ONE);
  registry.register(JumpUpgrade.JUMP_TWO);
  registry.register(JumpUpgrade.JUMP_THREE);
  registry.register(SpeedUpgrade.SPEED_ONE);
  registry.register(SpeedUpgrade.SPEED_TWO);
  registry.register(SpeedUpgrade.SPEED_THREE);
  registry.register(GliderUpgrade.INSTANCE);
  registry.register(ElytraUpgrade.INSTANCE);
  registry.register(SoundDetectorUpgrade.INSTANCE);
  registry.register(SwimUpgrade.INSTANCE);
  registry.register(NightVisionUpgrade.INSTANCE);
  registry.register(TravelUpgrade.INSTANCE);
  registry.register(SpoonUpgrade.INSTANCE);
  registry.register(ExplosiveUpgrade.INSTANCE);
}
 
开发者ID:SleepyTrousers,项目名称:EnderIO,代码行数:23,代码来源:DarkSteelRecipeManager.java

示例4: register

import net.minecraftforge.fml.common.registry.IForgeRegistry; //导入依赖的package包/类
/**
 * Register IForgeRegistryEntries in registry
 * @param features Class with IForgeRegistryEntries
 * @param registry Registry to where the entries should get registered
 * @param <T> IForgeRegistryEntry<T>
 */
public static <T extends IForgeRegistryEntry<T>> void register(Class features, IForgeRegistry<T> registry){
    Field[] fields = features.getDeclaredFields();
    for (Field field : fields) {
        if (field.isAnnotationPresent(Feature.class) && registry.getRegistrySuperType().isAssignableFrom(field.getType())){
            try {
                registry.register((T) field.get(null));
                MrglgaghCore.logger.info(field.getName() + " registered!");
            } catch (IllegalAccessException | IllegalArgumentException e) {
                MrglgaghCore.logger.error("Can't access feature field: " + field.getName() + ". Make sure it is public static!", e);
            }
        }
    }
}
 
开发者ID:sedlak477,项目名称:MrglgaghCore,代码行数:20,代码来源:FeatureLoader.java

示例5: onRegisterSounds

import net.minecraftforge.fml.common.registry.IForgeRegistry; //导入依赖的package包/类
@SubscribeEvent
@Optional.Method(modid = ChanceCubesReference.CHANCE_CUBES_MODID)
public static void onRegisterSounds(RegistryEvent.Register<SoundEvent> event) {
    final IForgeRegistry<SoundEvent> registry = event.getRegistry();
    registry.register(new SoundEvent(ChanceCubeSheepDied).setRegistryName(ChanceCubeSheepDied));
    registry.register(new SoundEvent(ChanceCubeGiantCubeSpawned).setRegistryName(ChanceCubeGiantCubeSpawned));
}
 
开发者ID:AtomicBlom,项目名称:ShearMadness,代码行数:8,代码来源:ChanceCubeForgeEvents.java

示例6: onRegisterCustomParticles

import net.minecraftforge.fml.common.registry.IForgeRegistry; //导入依赖的package包/类
@SubscribeEvent
@Optional.Method(modid = ChanceCubesReference.CHANCE_CUBES_MODID)
public static void onRegisterCustomParticles(RegistryEvent.Register<ICustomParticleFactory> event) {
    final IForgeRegistry<ICustomParticleFactory> registry = event.getRegistry();
    registry.register(new SheepHeadParticle.Factory()
            .setRegistryName(new ResourceLocation(CommonReference.MOD_ID, "sheep_head"))
    );
}
 
开发者ID:AtomicBlom,项目名称:ShearMadness,代码行数:9,代码来源:ChanceCubeForgeEvents.java

示例7: registerBlocks

import net.minecraftforge.fml.common.registry.IForgeRegistry; //导入依赖的package包/类
@SubscribeEvent
public static void registerBlocks(RegistryEvent.Register<Block> event) {
          
    LOG.info("Registering blocks");
    IForgeRegistry<Block> registry = event.getRegistry();
    GeoBlocks.BLOCKS.forEach(registry::register);
}
 
开发者ID:JayAvery,项目名称:geomastery,代码行数:8,代码来源:Geomastery.java

示例8: registerItems

import net.minecraftforge.fml.common.registry.IForgeRegistry; //导入依赖的package包/类
@SubscribeEvent
public static void registerItems(RegistryEvent.Register<Item> event) {

    LOG.info("Registering items");
    IForgeRegistry<Item> registry = event.getRegistry();
    GeoItems.ITEMS.forEach(registry::register);
}
 
开发者ID:JayAvery,项目名称:geomastery,代码行数:8,代码来源:Geomastery.java

示例9: createAllowedValues

import net.minecraftforge.fml.common.registry.IForgeRegistry; //导入依赖的package包/类
private static List<ResourceLocation> createAllowedValues(IForgeRegistry<?> registry) {
	List<ResourceLocation> values = Lists.newArrayList(registry.getKeys());
	Collections.sort(values, new Comparator<ResourceLocation>() {
		@Override
		public int compare(ResourceLocation first, ResourceLocation second) {
			return String.CASE_INSENSITIVE_ORDER.compare(first.toString(), second.toString());
		}
	});
	return values;
}
 
开发者ID:Earthcomputer,项目名称:Easy-Editors,代码行数:11,代码来源:GuiSelectFromRegistry.java

示例10: registerBlocks

import net.minecraftforge.fml.common.registry.IForgeRegistry; //导入依赖的package包/类
/**
 * Register this mod's {@link Block}s.
 *
 * @param event The event
 */
@SubscribeEvent
public static void registerBlocks(RegistryEvent.Register<Block> event) {
    final IForgeRegistry<Block> registry = event.getRegistry();

    final Block[] blocks = {SIGN_STANDING_WOOD, SIGN_WALL_WOOD, SIGN_STANDING_METAL, SIGN_WALL_METAL};

    registry.registerAll(blocks);
}
 
开发者ID:GoryMoon,项目名称:MoarSigns,代码行数:14,代码来源:ModBlocks.java

示例11: registerItemBlocks

import net.minecraftforge.fml.common.registry.IForgeRegistry; //导入依赖的package包/类
/**
 * Register this mod's {@link ItemBlock}s.
 *
 * @param event The event
 */
@SubscribeEvent
public static void registerItemBlocks(RegistryEvent.Register<Item> event) {
    final ItemBlock[] items = {

    };

    final IForgeRegistry<Item> registry = event.getRegistry();

    for (final ItemBlock item : items) {
        registry.register(item.setRegistryName(item.getBlock().getRegistryName()));
        ITEM_BLOCKS.add(item);
    }
}
 
开发者ID:GoryMoon,项目名称:MoarSigns,代码行数:19,代码来源:ModBlocks.java

示例12: registerItems

import net.minecraftforge.fml.common.registry.IForgeRegistry; //导入依赖的package包/类
/**
 * Register this mod's {@link Item}s.
 *
 * @param event The event
 */
@SubscribeEvent
public static void registerItems(RegistryEvent.Register<Item> event) {
    NuggetRegistry.init();

    final Item[] items = {SIGN, DEBUG, NUGGET, SIGN_TOOLBOX};

    final IForgeRegistry<Item> registry = event.getRegistry();

    for (final Item item : items) {
        registry.register(item);
        ITEMS.add(item);
    }
}
 
开发者ID:GoryMoon,项目名称:MoarSigns,代码行数:19,代码来源:ModItems.java

示例13: registerDarkSteelUpgrades

import net.minecraftforge.fml.common.registry.IForgeRegistry; //导入依赖的package包/类
@SubscribeEvent
public static void registerDarkSteelUpgrades(@Nonnull RegistryEvent.Register<IDarkSteelUpgrade> event) {
  final IForgeRegistry<IDarkSteelUpgrade> registry = event.getRegistry();
  registry.register(SolarUpgrade.SOLAR1);
  registry.register(SolarUpgrade.SOLAR2);
  registry.register(SolarUpgrade.SOLAR3);
}
 
开发者ID:SleepyTrousers,项目名称:EnderIO,代码行数:8,代码来源:SolarUpgradeManager.java

示例14: registerDarkSteelUpgrades

import net.minecraftforge.fml.common.registry.IForgeRegistry; //导入依赖的package包/类
@SubscribeEvent
public static void registerDarkSteelUpgrades(@Nonnull RegistryEvent.Register<IDarkSteelUpgrade> event) {
  final IForgeRegistry<IDarkSteelUpgrade> registry = event.getRegistry();
  registry.register(new NaturalistEyeUpgrade());
  registry.register(new ApiaristArmorUpgrade(EntityEquipmentSlot.FEET));
  registry.register(new ApiaristArmorUpgrade(EntityEquipmentSlot.LEGS));
  registry.register(new ApiaristArmorUpgrade(EntityEquipmentSlot.CHEST));
  registry.register(new ApiaristArmorUpgrade(EntityEquipmentSlot.HEAD));
  Log.info("Dark Steel Upgrades: Forestry integration loaded");
}
 
开发者ID:SleepyTrousers,项目名称:EnderIO,代码行数:11,代码来源:ForestryControl.java

示例15: injectBlocks

import net.minecraftforge.fml.common.registry.IForgeRegistry; //导入依赖的package包/类
public static void injectBlocks(@Nonnull IForgeRegistry<Block> registry) {
  registry.register(Glowstone.createGlowstone());
  registry.register(Redstone.createRedstone());
  registry.register(Ender.createEnder());
  NNList.of(Alloy.class).apply(new Callback<Alloy>() {
    @Override
    public void apply(@Nonnull Alloy alloy) {
      registry.register(Metal.createMetal(alloy));
    }
  });

}
 
开发者ID:SleepyTrousers,项目名称:EnderIO,代码行数:13,代码来源:TicControl.java


注:本文中的net.minecraftforge.fml.common.registry.IForgeRegistry类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。