本文整理汇总了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;
}
示例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;
}
示例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);
}
示例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);
}
}
}
}
示例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));
}
示例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"))
);
}
示例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);
}
示例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);
}
示例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;
}
示例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);
}
示例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);
}
}
示例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);
}
}
示例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);
}
示例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");
}
示例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));
}
});
}