Java Code Examples for net.minecraftforge.fml.common.FMLLog#fine()

The following examples show how to use net.minecraftforge.fml.common.FMLLog#fine() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PythonCode.java    From pycode-minecraft with MIT License 6 votes vote down vote up
private void ensureCompiled() {
    if (!this.codeChanged) return;
    FMLLog.fine("Eval my code: %s", this.code);

    // now execute the code
    try {
        PythonEngine.eval(this.code, this.context);
        if (!world.isRemote) {
            ((WorldServer)world).spawnParticle(EnumParticleTypes.CRIT,
                    pos.getX() + .5, pos.getY() + 1, pos.getZ() + .5,
                    20, 0, 0, 0, .5, new int[0]);
        }
    } catch (ScriptException e) {
        failz0r(world, pos, "Error running code, traceback:\n%s", stackTraceToString(e));
    }
    this.codeChanged = false;
}
 
Example 2
Source File: PythonEngine.java    From pycode-minecraft with MIT License 5 votes vote down vote up
private PythonEngine() {
    ScriptEngineManager manager = new ScriptEngineManager();
    engine = (PyScriptEngine) manager.getEngineByName("python");
    if (engine == null) {
        FMLLog.severe("FAILED to getBlock Python");
    } else {
        FMLLog.fine("Got Python");
    }
    try {
        engine.eval("print 'Python Ready'");
    } catch (ScriptException e) {
        FMLLog.severe("Python failed: %s", e);
    }
}
 
Example 3
Source File: WorldRetrogen.java    From simpleretrogen with GNU General Public License v3.0 5 votes vote down vote up
@SubscribeEvent
public void tickStart(TickEvent.WorldTickEvent tick)
{
    World w = tick.world;
    if (!(w instanceof WorldServer))
    {
        return;
    }
    if (tick.phase == TickEvent.Phase.START)
    {
        counter = 0;
        getSemaphoreFor(w);
    }
    else
    {
        ListMultimap<ChunkPos, String> pending = pendingWork.get(w);
        if (pending == null)
        {
            return;
        }
        ImmutableList<Entry<ChunkPos, String>> forProcessing = ImmutableList.copyOf(Iterables.limit(pending.entries(), maxPerTick + 1));
        for (Entry<ChunkPos, String> entry : forProcessing)
        {
            if (counter++ > maxPerTick)
            {
                FMLLog.fine("Completed %d retrogens this tick. There are %d left for world %s", counter, pending.size(), w.getWorldInfo().getWorldName());
                return;
            }
            runRetrogen((WorldServer)w, entry.getKey(), entry.getValue());
        }
    }
}
 
Example 4
Source File: WorldRetrogen.java    From simpleretrogen with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator, IChunkProvider chunkProvider)
{
    FMLLog.fine("Passing generation for %s through to underlying generator", tag);
    delegate.generate(random, chunkX, chunkZ, world, chunkGenerator, chunkProvider);
    ChunkPos chunkCoordIntPair = new ChunkPos(chunkX, chunkZ);
    completeRetrogen(chunkCoordIntPair, world, tag);
}
 
Example 5
Source File: WorldRetrogen.java    From simpleretrogen with GNU General Public License v3.0 5 votes vote down vote up
private void runRetrogen(WorldServer world, ChunkPos chunkCoords, String retroClass)
{
    long worldSeed = world.getSeed();
    Random fmlRandom = new Random(worldSeed);
    long xSeed = fmlRandom.nextLong() >> 2 + 1L;
    long zSeed = fmlRandom.nextLong() >> 2 + 1L;
    long chunkSeed = (xSeed * chunkCoords.chunkXPos + zSeed * chunkCoords.chunkZPos) ^ worldSeed;

    fmlRandom.setSeed(chunkSeed);
    ChunkProviderServer providerServer = world.getChunkProvider();
    IChunkGenerator generator = ObfuscationReflectionHelper.getPrivateValue(ChunkProviderServer.class, providerServer, "field_186029_c", "chunkGenerator");
    delegates.get(retroClass).delegate.generate(fmlRandom, chunkCoords.chunkXPos, chunkCoords.chunkZPos, world, generator, providerServer);
    FMLLog.fine("Retrogenerated chunk for %s", retroClass);
    completeRetrogen(chunkCoords, world, retroClass);
}