本文整理汇总了Java中net.minecraftforge.fml.common.FMLLog.log方法的典型用法代码示例。如果您正苦于以下问题:Java FMLLog.log方法的具体用法?Java FMLLog.log怎么用?Java FMLLog.log使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraftforge.fml.common.FMLLog
的用法示例。
在下文中一共展示了FMLLog.log方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: GameData
import net.minecraftforge.fml.common.FMLLog; //导入方法依赖的package包/类
public GameData()
{
iBlockRegistry = PersistentRegistryManager.createRegistry(PersistentRegistryManager.BLOCKS, Block.class, new ResourceLocation("minecraft:air"), MIN_BLOCK_ID, MAX_BLOCK_ID, true, BlockCallbacks.INSTANCE, BlockCallbacks.INSTANCE, BlockCallbacks.INSTANCE, BlockCallbacks.INSTANCE);
iItemRegistry = PersistentRegistryManager.createRegistry(PersistentRegistryManager.ITEMS, Item.class, null, MIN_ITEM_ID, MAX_ITEM_ID, true, ItemCallbacks.INSTANCE, ItemCallbacks.INSTANCE, ItemCallbacks.INSTANCE, ItemCallbacks.INSTANCE);
iPotionRegistry = PersistentRegistryManager.createRegistry(PersistentRegistryManager.POTIONS, Potion.class, null, MIN_POTION_ID, MAX_POTION_ID, false, PotionCallbacks.INSTANCE, PotionCallbacks.INSTANCE, PotionCallbacks.INSTANCE, null);
iBiomeRegistry = PersistentRegistryManager.createRegistry(PersistentRegistryManager.BIOMES, Biome.class, null, MIN_BIOME_ID, MAX_BIOME_ID, false, BiomeCallbacks.INSTANCE, BiomeCallbacks.INSTANCE, BiomeCallbacks.INSTANCE, null);
iSoundEventRegistry = PersistentRegistryManager.createRegistry(PersistentRegistryManager.SOUNDEVENTS, SoundEvent.class, null, MIN_SOUND_ID, MAX_SOUND_ID, false, null, null, null, null);
ResourceLocation WATER = new ResourceLocation("water");
iPotionTypeRegistry = PersistentRegistryManager.createRegistry(PersistentRegistryManager.POTIONTYPES, PotionType.class, WATER, MIN_POTIONTYPE_ID, MAX_POTIONTYPE_ID, false, null, null, null, null);
iEnchantmentRegistry = PersistentRegistryManager.createRegistry(PersistentRegistryManager.ENCHANTMENTS, Enchantment.class, null, MIN_ENCHANTMENT_ID, MAX_ENCHANTMENT_ID, false, null, null, null, null);
try
{
blockField = FinalFieldHelper.makeWritable(ReflectionHelper.findField(ItemBlock.class, "block", "field_150939" + "_a"));
}
catch (Exception e)
{
FMLLog.log(Level.FATAL, e, "Cannot access the 'block' field from ItemBlock, this is fatal!");
throw Throwables.propagate(e);
}
}
示例2: bake
import net.minecraftforge.fml.common.FMLLog; //导入方法依赖的package包/类
@Override
public IBakedModel bake(IModelState state, VertexFormat format, Function<ResourceLocation, TextureAtlasSprite> bakedTextureGetter)
{
IBakedModel bakedBase = null;
if (base != null)
bakedBase = base.bake(state, format, bakedTextureGetter);
ImmutableMap.Builder<String, IBakedModel> mapBuilder = ImmutableMap.builder();
for (Entry<String, Pair<IModel, IModelState>> entry : parts.entrySet())
{
Pair<IModel, IModelState> pair = entry.getValue();
mapBuilder.put(entry.getKey(), pair.getLeft().bake(new ModelStateComposition(state, pair.getRight()), format, bakedTextureGetter));
}
if(bakedBase == null && parts.isEmpty())
{
FMLLog.log(Level.ERROR, "MultiModel %s is empty (no base model or parts were provided/resolved)", location);
IModel missing = ModelLoaderRegistry.getMissingModel();
return missing.bake(missing.getDefaultState(), format, bakedTextureGetter);
}
return new Baked(location, true, bakedBase, mapBuilder.build());
}
示例3: captureConfig
import net.minecraftforge.fml.common.FMLLog; //导入方法依赖的package包/类
static void captureConfig(File configDir)
{
cfgFile = new File(configDir,"forgeChunkLoading.cfg");
config = new Configuration(cfgFile, true);
try
{
config.load();
}
catch (Exception e)
{
File dest = new File(cfgFile.getParentFile(),"forgeChunkLoading.cfg.bak");
if (dest.exists())
{
dest.delete();
}
cfgFile.renameTo(dest);
FMLLog.log(Level.ERROR, e, "A critical error occurred reading the forgeChunkLoading.cfg file, defaults will be used - the invalid file is backed up at forgeChunkLoading.cfg.bak");
}
syncConfigDefaults();
}
示例4: processPacket
import net.minecraftforge.fml.common.FMLLog; //导入方法依赖的package包/类
/**
* Passes this Packet on to the NetHandler for processing.
*/
@Override
public void processPacket(INetHandler inethandler)
{
this.netHandler = inethandler;
EmbeddedChannel internalChannel = NetworkRegistry.INSTANCE.getChannel(this.channel, this.target);
if (internalChannel != null)
{
internalChannel.attr(NetworkRegistry.NET_HANDLER).set(this.netHandler);
try
{
if (internalChannel.writeInbound(this))
{
badPackets.add(this.channel);
if (badPackets.size() % packetCountWarning == 0)
{
FMLLog.severe("Detected ongoing potential memory leak. %d packets have leaked. Top offenders", badPackets.size());
int i = 0;
for (Entry<String> s : Multisets.copyHighestCountFirst(badPackets).entrySet())
{
if (i++ > 10) break;
FMLLog.severe("\t %s : %d", s.getElement(), s.getCount());
}
}
}
internalChannel.inboundMessages().clear();
}
catch (FMLNetworkException ne)
{
FMLLog.log(Level.ERROR, ne, "There was a network exception handling a packet on channel %s", channel);
dispatcher.rejectHandshake(ne.getMessage());
}
catch (Throwable t)
{
FMLLog.log(Level.ERROR, t, "There was a critical exception handling a packet on channel %s", channel);
dispatcher.rejectHandshake("A fatal error has occurred, this connection is terminated");
}
}
}
示例5: registerGuiHandler
import net.minecraftforge.fml.common.FMLLog; //导入方法依赖的package包/类
/**
* Register an {@link IGuiHandler} for the supplied mod object.
*
* @param mod The mod to handle GUIs for
* @param handler A handler for creating GUI related objects
*/
public void registerGuiHandler(Object mod, IGuiHandler handler)
{
ModContainer mc = FMLCommonHandler.instance().findContainerFor(mod);
if (mc == null)
{
FMLLog.log(Level.ERROR, "Mod of type %s attempted to register a gui network handler during a construction phase", mod.getClass().getName());
throw new RuntimeException("Invalid attempt to create a GUI during mod construction. Use an EventHandler instead");
}
serverGuiHandlers.put(mc, handler);
clientGuiHandlers.put(mc, handler);
}
示例6: readMainConfig
import net.minecraftforge.fml.common.FMLLog; //导入方法依赖的package包/类
private static void readMainConfig() {
Configuration cfg = mainConfig;
try {
cfg.load();
cfg.addCustomCategoryComment(GeneralConfiguration.CATEGORY_GENERAL, "General settings");
GeneralConfiguration.init(cfg);
} catch (Exception e1) {
FMLLog.log(Level.ERROR, e1, "Problem loading config file!");
} finally {
if (mainConfig.hasChanged()) {
mainConfig.save();
}
}
}
示例7: warn
import net.minecraftforge.fml.common.FMLLog; //导入方法依赖的package包/类
public static void warn(String format, Object... data) {
FMLLog.log(TAG, Level.WARN, format, data);
}
示例8: debug
import net.minecraftforge.fml.common.FMLLog; //导入方法依赖的package包/类
public static void debug(String format, Object... data) {
FMLLog.log(TAG, Level.DEBUG, format, data);
}
示例9: info
import net.minecraftforge.fml.common.FMLLog; //导入方法依赖的package包/类
public static void info(String format, Object... data) {
FMLLog.log(TAG, Level.INFO, format, data);
}
示例10: error
import net.minecraftforge.fml.common.FMLLog; //导入方法依赖的package包/类
public static void error(String format, Object... data) {
FMLLog.log(TAG, Level.INFO, format, data);
}
示例11: toBytes
import net.minecraftforge.fml.common.FMLLog; //导入方法依赖的package包/类
@Override
void toBytes(ByteBuf buf)
{
super.toBytes(buf);
ByteBufUtils.writeUTF8String(buf, modId);
buf.writeInt(modEntityTypeId);
buf.writeLong(entity.getUniqueID().getMostSignificantBits());
buf.writeLong(entity.getUniqueID().getLeastSignificantBits());
// posX, posY, posZ
buf.writeDouble(entity.posX);
buf.writeDouble(entity.posY);
buf.writeDouble(entity.posZ);
// yaw, pitch
buf.writeByte((byte)(entity.rotationYaw * 256.0F / 360.0F));
buf.writeByte((byte) (entity.rotationPitch * 256.0F / 360.0F));
// head yaw
if (entity instanceof EntityLivingBase)
{
buf.writeByte((byte) (((EntityLivingBase)entity).rotationYawHead * 256.0F / 360.0F));
}
else
{
buf.writeByte(0);
}
ByteBuf tmpBuf = Unpooled.buffer();
PacketBuffer pb = new PacketBuffer(tmpBuf);
try
{
entity.getDataManager().writeEntries(pb);
} catch (IOException e)
{
FMLLog.log(Level.FATAL,e,"Encountered fatal exception trying to send entity spawn data watchers");
throw Throwables.propagate(e);
}
buf.writeBytes(tmpBuf);
if (entity instanceof IThrowableEntity)
{
Entity owner = ((IThrowableEntity)entity).getThrower();
buf.writeInt(owner == null ? entity.getEntityId() : owner.getEntityId());
double maxVel = 3.9D;
double mX = entity.motionX;
double mY = entity.motionY;
double mZ = entity.motionZ;
if (mX < -maxVel) mX = -maxVel;
if (mY < -maxVel) mY = -maxVel;
if (mZ < -maxVel) mZ = -maxVel;
if (mX > maxVel) mX = maxVel;
if (mY > maxVel) mY = maxVel;
if (mZ > maxVel) mZ = maxVel;
buf.writeInt((int)(mX * 8000D));
buf.writeInt((int)(mY * 8000D));
buf.writeInt((int)(mZ * 8000D));
}
else
{
buf.writeInt(0);
}
if (entity instanceof IEntityAdditionalSpawnData)
{
tmpBuf = Unpooled.buffer();
((IEntityAdditionalSpawnData)entity).writeSpawnData(tmpBuf);
buf.writeBytes(tmpBuf);
}
}
示例12: register
import net.minecraftforge.fml.common.FMLLog; //导入方法依赖的package包/类
public void register(Object target)
{
if (listeners.containsKey(target))
{
return;
}
ModContainer activeModContainer = Loader.instance().activeModContainer();
if (activeModContainer == null)
{
FMLLog.log(Level.ERROR, new Throwable(), "Unable to determine registrant mod for %s. This is a critical error and should be impossible", target);
activeModContainer = Loader.instance().getMinecraftModContainer();
}
listenerOwners.put(target, activeModContainer);
boolean isStatic = target.getClass() == Class.class;
@SuppressWarnings("unchecked")
Set<? extends Class<?>> supers = isStatic ? Sets.newHashSet((Class<?>)target) : TypeToken.of(target.getClass()).getTypes().rawTypes();
for (Method method : (isStatic ? (Class<?>)target : target.getClass()).getMethods())
{
if (isStatic && !Modifier.isStatic(method.getModifiers()))
continue;
else if (!isStatic && Modifier.isStatic(method.getModifiers()))
continue;
for (Class<?> cls : supers)
{
try
{
Method real = cls.getDeclaredMethod(method.getName(), method.getParameterTypes());
if (real.isAnnotationPresent(SubscribeEvent.class))
{
Class<?>[] parameterTypes = method.getParameterTypes();
if (parameterTypes.length != 1)
{
throw new IllegalArgumentException(
"Method " + method + " has @SubscribeEvent annotation, but requires " + parameterTypes.length +
" arguments. Event handler methods must require a single argument."
);
}
Class<?> eventType = parameterTypes[0];
if (!Event.class.isAssignableFrom(eventType))
{
throw new IllegalArgumentException("Method " + method + " has @SubscribeEvent annotation, but takes a argument that is not an Event " + eventType);
}
register(eventType, target, real, activeModContainer);
break;
}
}
catch (NoSuchMethodException e)
{
;
}
}
}
}
示例13: setPermissionHandler
import net.minecraftforge.fml.common.FMLLog; //导入方法依赖的package包/类
/**
* <b>Only use this in PreInit state!</b>
*/
public static void setPermissionHandler(IPermissionHandler handler)
{
Preconditions.checkNotNull(handler, "Permission handler can't be null!");
Preconditions.checkState(Loader.instance().getLoaderState().ordinal() <= LoaderState.PREINITIALIZATION.ordinal(), "Can't register after IPermissionHandler PreInit!");
FMLLog.log(Level.WARN, "Replacing " + permissionHandler.getClass().getName() + " with " + handler.getClass().getName());
permissionHandler = handler;
}
示例14: actionPerformed
import net.minecraftforge.fml.common.FMLLog; //导入方法依赖的package包/类
/**
* Called by the controls from the buttonList when activated. (Mouse pressed for buttons)
*/
@Override
protected void actionPerformed(GuiButton button) throws IOException
{
if (button.enabled)
{
SortType type = SortType.getTypeForButton(button);
if (type != null)
{
for (GuiButton b : buttonList)
{
if (SortType.getTypeForButton(b) != null)
{
b.enabled = true;
}
}
button.enabled = false;
sorted = false;
sortType = type;
this.mods = modList.getMods();
}
else
{
switch (button.id)
{
case 6:
{
this.mc.displayGuiScreen(this.mainMenu);
return;
}
case 20:
{
try
{
IModGuiFactory guiFactory = FMLClientHandler.instance().getGuiFactoryFor(selectedMod);
GuiScreen newScreen = guiFactory.mainConfigGuiClass().getConstructor(GuiScreen.class).newInstance(this);
this.mc.displayGuiScreen(newScreen);
}
catch (Exception e)
{
FMLLog.log(Level.ERROR, e, "There was a critical issue trying to build the config GUI for %s", selectedMod.getModId());
}
return;
}
}
}
}
super.actionPerformed(button);
}
示例15: check
import net.minecraftforge.fml.common.FMLLog; //导入方法依赖的package包/类
@Override
public boolean check(Map<String,String> remoteVersions, Side side)
{
try
{
return (Boolean) checkHandler.invoke(container.getMod(), remoteVersions, side);
}
catch (Exception e)
{
FMLLog.log(Level.ERROR, e, "Error occurred invoking NetworkCheckHandler %s at %s", checkHandler.getName(), container);
return false;
}
}