本文整理汇总了Java中net.minecraftforge.fml.common.registry.EntityEntry类的典型用法代码示例。如果您正苦于以下问题:Java EntityEntry类的具体用法?Java EntityEntry怎么用?Java EntityEntry使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
EntityEntry类属于net.minecraftforge.fml.common.registry包,在下文中一共展示了EntityEntry类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: registerTeleportBlacklist
import net.minecraftforge.fml.common.registry.EntityEntry; //导入依赖的package包/类
public static void registerTeleportBlacklist(String[] blacklist)
{
TELEPORT_BLACKLIST_CLASSES.clear();
for (String name : blacklist)
{
EntityEntry entry = ForgeRegistries.ENTITIES.getValue(new ResourceLocation(name));
if (entry != null && entry.getEntityClass() != null)
{
TELEPORT_BLACKLIST_CLASSES.add(entry.getEntityClass());
}
else
{
EnderUtilities.logger.warn("Unknown Entity type '{}' on the teleport blacklist", name);
}
}
}
示例2: generateDefaultSpawnCosts
import net.minecraftforge.fml.common.registry.EntityEntry; //导入依赖的package包/类
private static String[] generateDefaultSpawnCosts(){
List<String> lines = Lists.newArrayList();
for(EntityEntry entry : ForgeRegistries.ENTITIES.getValues()){
if(EntityLiving.class.isAssignableFrom(entry.getEntityClass())) {
lines.add(entry.getName()+":0");
}
}
return lines.toArray(new String[lines.size()]);
}
示例3: getMobList
import net.minecraftforge.fml.common.registry.EntityEntry; //导入依赖的package包/类
private String[] getMobList(){
List<String> lines = Lists.newArrayList();
for(EntityEntry entry : ForgeRegistries.ENTITIES.getValues()){
if(EntityLiving.class.isAssignableFrom(entry.getEntityClass())) {
lines.add(entry.getName());
}
}
return lines.toArray(new String[lines.size()]);
}
示例4: createEntity
import net.minecraftforge.fml.common.registry.EntityEntry; //导入依赖的package包/类
private static EntityEntry createEntity(Class<? extends Entity> entityClass, String name, int eggPrimary, int eggSecondary) {
ResourceLocation location = new ResourceLocation(Reference.MOD_ID, name);
EntityEntry entry = new EntityEntry(entityClass, location.toString());
entry.setRegistryName(location);
entry.setEgg(new EntityList.EntityEggInfo(location, eggPrimary, eggSecondary));
entities.add(entry);
return entry;
}
示例5: registerPenguins
import net.minecraftforge.fml.common.registry.EntityEntry; //导入依赖的package包/类
@SubscribeEvent
public static void registerPenguins(RegistryEvent.Register<EntityEntry> event) {
int id = 0;
for (EntityEntry entry : entities) {
event.getRegistry().register(entry);
id++;
EntityRegistry.registerModEntity(entry.getRegistryName(), entry.getEntityClass(), entry.getName(), id, Waddles.instance, 64, 1, true, entry.getEgg().primaryColor, entry.getEgg().secondaryColor);
}
}
示例6: addPenguinSpawn
import net.minecraftforge.fml.common.registry.EntityEntry; //导入依赖的package包/类
public static void addPenguinSpawn(Class<? extends EntityAgeable> penguinClass, EntityEntry penguinEntry, int defaultWeight, int defaultMin, int defaultMax, Biome... biomes) {
String subCategoryNames = ConfigurationHandler.CATEGORY_PENGUIN_SPAWNS + Configuration.CATEGORY_SPLITTER + penguinEntry.getRegistryName().getResourcePath();
int weight = ConfigurationHandler.config.get(subCategoryNames, "Weight", defaultWeight).getInt();
int min = ConfigurationHandler.config.get(subCategoryNames, "Min", defaultMin).getInt();
int max = ConfigurationHandler.config.get(subCategoryNames, "Max", defaultMax).getInt();
ConfigurationHandler.config.save();
if (weight != 0) {
EntityRegistry.addSpawn(penguinClass, weight, min, max, EnumCreatureType.CREATURE, biomes);
}
}
示例7: setMobColours
import net.minecraftforge.fml.common.registry.EntityEntry; //导入依赖的package包/类
public static void setMobColours(Map<String, Integer> mobColours)
{
if (mobColours == null || mobColours.isEmpty())
idealMobColours = null;
else
{
idealMobColours = new HashMap<String, Integer>();
// Convert the names from our XML entity type into recognisable entity names:
String id = null;
for (String oldname : mobColours.keySet())
{
for (EntityEntry ent : net.minecraftforge.fml.common.registry.ForgeRegistries.ENTITIES)
{
if (ent.getName().equals(oldname))
{
id = ent.getRegistryName().toString();
break;
}
}
if (id != null)
{
idealMobColours.put(id, mobColours.get(oldname));
}
}
}
texturesToColours.clear();
}
示例8: register
import net.minecraftforge.fml.common.registry.EntityEntry; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public void register(InfinityMod mod, IForgeRegistry<EntityEntry> registry) {
ResourceLocation registryName = new ResourceLocation(mod.getModId(), this.getName());
if(hasEgg) {
this.setEgg(new EntityList.EntityEggInfo(registryName, primaryColor, secondaryColor));
}
if(doSpawn && EntityLiving.class.isAssignableFrom(this.getEntityClass())) {
EntityRegistry.addSpawn((Class<? extends EntityLiving>) this.getEntityClass(), weight, min, max, type, biomes);
}
InfinityLib.proxy.register(mod, registry, this, this.getName());
this.callback.run();
}
示例9: registerEntities
import net.minecraftforge.fml.common.registry.EntityEntry; //导入依赖的package包/类
@Override
public void registerEntities(InfinityMod mod, IForgeRegistry<EntityEntry> registry) {
ReflectionHelper.forEachIn(mod.getModEntityRegistry(), EntityRegistryEntry.class, (EntityRegistryEntry entry) -> {
if(entry.isEnabled()) {
entry.registerClient(mod, registry);
}
});
}
示例10: registerEntities
import net.minecraftforge.fml.common.registry.EntityEntry; //导入依赖的package包/类
default void registerEntities(InfinityMod mod, IForgeRegistry<EntityEntry> registry) {
ReflectionHelper.forEachIn(mod.getModEntityRegistry(), EntityRegistryEntry.class,
(EntityRegistryEntry entry) -> {
if (entry.isEnabled()) {
entry.register(mod, registry);
}
});
}
示例11: registerEntitys
import net.minecraftforge.fml.common.registry.EntityEntry; //导入依赖的package包/类
@SubscribeEvent
public void registerEntitys (RegistryEvent.Register<EntityEntry> event) {
for (final EntityEntryBuilder<? extends Entity> entry : this.helper.getEntities()) {
event.getRegistry().register(entry.build());
}
}
示例12: getEntityClass
import net.minecraftforge.fml.common.registry.EntityEntry; //导入依赖的package包/类
public Class<? extends EntityLivingBase> getEntityClass() {
return _entityClassLookupCache.computeIfAbsent(entityID, id ->
Optional.ofNullable(ForgeRegistries.ENTITIES.getValue(new ResourceLocation(id)))
.map(EntityEntry::getEntityClass)
.filter(EntityLivingBase.class::isAssignableFrom)
.map(c -> c.asSubclass(EntityLivingBase.class))
).orElse(null);
}
示例13: setValue
import net.minecraftforge.fml.common.registry.EntityEntry; //导入依赖的package包/类
@Override
public void setValue(BackpackEntityEntry value) {
_value = value;
Optional<EntityEntry> entry = getEntityEntry(value.entityID);
_knownEntity = entry.isPresent();
Severity severity = Status.getSeverity(getStatus());
boolean isFine = (severity == Severity.FINE);
int numEntries = value.getEntries().size();
String entriesTextKey = "config." + WearableBackpacks.MOD_ID + ".entity.entry";
// First we try to translate "[...].entity.entry.<num>".
String entriesText = I18n.format(entriesTextKey + "." + numEntries);
if (entriesText.equals(entriesTextKey + "." + numEntries))
// If not found, use "[...].entity.entry" instead.
entriesText = I18n.format(entriesTextKey, numEntries);
// ... I miss C#'s ?? operator :(
buttonMove.setEnabled(!value.isDefault);
buttonRemove.setEnabled(!value.isDefault);
labelName.setText(getEntityEntryName(entry, value.entityID));
labelName.setColor(value.isDefault ? GuiUtils.getColorCode('8', true)
: isFine ? GuiUtils.getColorCode('7', true)
: severity.foregroundColor);
buttonEdit.setText(entriesText);
if (!_knownEntity) buttonEdit.setTextColor(Severity.WARN.foregroundColor);
else buttonEdit.unsetTextColor();
}
示例14: register
import net.minecraftforge.fml.common.registry.EntityEntry; //导入依赖的package包/类
public static void register(IForgeRegistry<EntityEntry> event)
{
ModelResourceLocation res0 = new ModelResourceLocation(EntityRock.GetRegistryName(), "entity");
EntityEntry entry0 = EntityEntryBuilder.create().entity(EntityRock.class).id(res0, 0).name(EntityRock.GetRegistryName()).tracker(15, 80, true).build();
ModelResourceLocation res1 = new ModelResourceLocation(EntityGrenade.GetRegistryName(), "entity");
EntityEntry entry1 = EntityEntryBuilder.create().entity(EntityGrenade.class).id(res1, 1).name(EntityGrenade.GetRegistryName()).tracker(15, 80, true).build();
ModelResourceLocation res2 = new ModelResourceLocation(EntityDynamite.GetRegistryName(), "entity");
EntityEntry entry2 = EntityEntryBuilder.create().entity(EntityDynamite.class).id(res2, 2).name(EntityDynamite.GetRegistryName()).tracker(15, 80, true).build();
event.registerAll(entry0, entry1, entry2);
}
示例15: onEntityRegister
import net.minecraftforge.fml.common.registry.EntityEntry; //导入依赖的package包/类
@SubscribeEvent
public void onEntityRegister(Register<EntityEntry> e) {
for (MobInfo mob : MobInfo.values()) {
EntityEntry entry = new EntityEntry(mob.getClz(), mob.getName());
ResourceLocation name = new ResourceLocation(EnderZoo.MODID, mob.getName());
entry.setRegistryName(name);
entry.setEgg(new EntityEggInfo(name, mob.getEggBackgroundColor(), mob.getEggForegroundColor()));
e.getRegistry().register(entry);
registerEntity(mob);
}
}