Java 类net.minecraftforge.fml.common.registry.IForgeRegistry 实例源码

项目:ShearMadness    文件:SpawnCustomParticleMessageHandler.java   
@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;
}
项目:ShearMadness    文件:PlayCustomSoundMessageHandler.java   
@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;
}
项目:EnderIO    文件:DarkSteelRecipeManager.java   
@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);
}
项目:MrglgaghCore    文件:FeatureLoader.java   
/**
 * 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);
            }
        }
    }
}
项目:ShearMadness    文件:ChanceCubeForgeEvents.java   
@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));
}
项目:ShearMadness    文件:ChanceCubeForgeEvents.java   
@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"))
    );
}
项目:geomastery    文件:Geomastery.java   
@SubscribeEvent
public static void registerBlocks(RegistryEvent.Register<Block> event) {

    LOG.info("Registering blocks");
    IForgeRegistry<Block> registry = event.getRegistry();
    GeoBlocks.BLOCKS.forEach(registry::register);
}
项目:geomastery    文件:Geomastery.java   
@SubscribeEvent
public static void registerItems(RegistryEvent.Register<Item> event) {

    LOG.info("Registering items");
    IForgeRegistry<Item> registry = event.getRegistry();
    GeoItems.ITEMS.forEach(registry::register);
}
项目:Easy-Editors    文件:GuiSelectFromRegistry.java   
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;
}
项目:MoarSigns    文件:ModBlocks.java   
/**
 * 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);
}
项目:MoarSigns    文件:ModBlocks.java   
/**
 * 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);
    }
}
项目:MoarSigns    文件:ModItems.java   
/**
 * 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);
    }
}
项目:EnderIO    文件:SolarUpgradeManager.java   
@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);
}
项目:EnderIO    文件:ForestryControl.java   
@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");
}
项目:EnderIO    文件:TicControl.java   
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));
    }
  });

}
项目:EnderIO    文件:ThaumcraftUtil.java   
@SubscribeEvent
public static void registerDarkSteelUpgrades(@Nonnull RegistryEvent.Register<IDarkSteelUpgrade> event) {
  if (Loader.isModLoaded("Thaumcraft")) {
    final IForgeRegistry<IDarkSteelUpgrade> registry = event.getRegistry();
    registry.register(GogglesOfRevealingUpgrade.INSTANCE);
    Log.info("Dark Steel Upgrades: Thaumcraft integration loaded");
  }
}
项目:CustomWorldGen    文件:RegistryEvent.java   
public Register(ResourceLocation location, IForgeRegistry<T> registry)
{
    super(registry.getRegistrySuperType());
    this.location = location;
    this.registry = registry;
}
项目:CustomWorldGen    文件:RegistryEvent.java   
public IForgeRegistry<T> getRegistry()
{
    return registry;
}
项目:Easy-Editors    文件:GuiSelectFromRegistry.java   
public GuiSelectFromRegistry(GuiScreen prevScreen, ICallback<ResourceLocation> callback, IForgeRegistry<T> registry,
        String title) {
    super(prevScreen, callback, createAllowedValues(registry), title);
    this.registry = registry;
}
项目:Easy-Editors    文件:GuiSelectFromRegistry.java   
public GuiSelectFromRegistry(GuiScreen prevScreen, ICallback<ResourceLocation> callback, IForgeRegistry<T> registry,
        String title, int slotHeight) {
    super(prevScreen, callback, createAllowedValues(registry), title, slotHeight);
    this.registry = registry;
}
项目:Easy-Editors    文件:CommandSlotSelectFromRegistry.java   
public CommandSlotSelectFromRegistry(String nullLabel, String nullErrorMessage, IForgeRegistry<T> registry) {
    super(nullLabel, nullErrorMessage);
    this.registry = registry;
}
项目:EnderIO    文件:EnderIOIntegrationTic.java   
@Override
public void injectBlocks(@Nonnull IForgeRegistry<Block> registry) {
  if (isLoaded()) {
    TicControl.injectBlocks(registry);
  }
}
项目:EnderIO    文件:RegistryCallbacks.java   
@SuppressWarnings("unchecked")
@Override
public void onCreate(Map<ResourceLocation, ?> slaveset, BiMap<ResourceLocation, ? extends IForgeRegistry<?>> doNotTouch) {
  ((Map<ResourceLocation, NNList<ResourceLocation>>) slaveset).put(Registry.PRIOLIST, new NNList<ResourceLocation>());
}
项目:EnderIO    文件:RegistryCallbacks.java   
@SuppressWarnings("unchecked")
@Override
public void onClear(IForgeRegistry<IFarmerJoe> joe, Map<ResourceLocation, ?> slaveset) {
  ((Map<ResourceLocation, NNList<ResourceLocation>>) slaveset).get(Registry.PRIOLIST).clear();
}
项目:Toms-Mod    文件:ResearchHandler.java   
@Override
public void onCreate(Map<ResourceLocation, ?> slaveset, BiMap<ResourceLocation, ? extends IForgeRegistry<?>> registries) {

}
项目:Toms-Mod    文件:ResearchHandler.java   
@Override
public void onClear(IForgeRegistry<Research> is, Map<ResourceLocation, ?> slaveset) {

}
项目:EnderIO    文件:IEnderIOAddon.java   
/**
 * This allows addons to manually register additional blocks during Ender IO's block registration, i.e. using {@link EnderIO#DOMAIN} for their blocks'
 * registry name.
 * <p>
 * Don't use this for your general blocks, those go into the {@link ModObjectRegistry}. This is for things like fluid blocks that cannot be mod-objected.
 * 
 */
default void injectBlocks(@Nonnull IForgeRegistry<Block> registry) {
}