Giter Site home page Giter Site logo

luaforge's People

Contributors

aldahick avatar cloudhunter avatar samrg472 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

luaforge's Issues

Crashing when using client.preloadTexture

So I made a simple mod that added crafting recipes. I ran it and it ran fine no problems at all. Then i wanted to add my own block. so i made my block put in the code and used client.preloadTexture to load the texture. But when i try to run it, it gives me an error. here it is

[ForgeModLoader] Fatal errors were detected during the transition from INITIALIZATION to POSTINITIALIZATION. Loading cannot continue
2012-11-21 22:29:00 [SEVERE] [ForgeModLoader]
mcp Minecraft Coder Pack Unloaded->Constructed->Pre-initialized->Initialized
FML Forge Mod Loader Unloaded->Constructed->Pre-initialized->Initialized
Forge Minecraft Forge Unloaded->Constructed->Pre-initialized->Initialized
LuaForgeCore LuaForgeCore Unloaded->Constructed->Pre-initialized->Initialized
LuaForge LuaForge Unloaded->Constructed->Pre-initialized->Errored

Loading error

Reminder to add a print if the file is not a .lua or has no @mod called. Of course, the equivalent of @mod in Lua.

Minecraft Folder?

I was wanting a way to reference the minecraft location. I made a way if you use the normal location by finding the OS, but I can to the issue of MultiMC

Fundamental new Access to Forge API possible


-- Block = luaforge.block.new(number blockID, luaforge.materials material)
block = luaforge.block.new(2019, luaforge.materials.rock)

-- luaforge.block.setCreativeTab(Block block, luaforge.creativetabs creativeTab)
luaforge.block.setCreativeTab(block, luaforge.creativetabs.tabRedstone)

-- luaforge.game.registerBlock(Block block, string name)
-- Note that this method's name parameter does not change the name displayed while ingame.
luaforge.game.registerBlock(block, "testblock")
function vardump(value, depth, key)
  local linePrefix = ""
  local spaces = ""

  if key ~= nil then
    linePrefix = "["..key.."] = "
  end

  if depth == nil then
    depth = 0
  else
    depth = depth + 1
    for i=1, depth do spaces = spaces .. "  " end
  end

  if type(value) == 'table' then
    mTable = getmetatable(value)
    if mTable == nil then
      print(spaces ..linePrefix.."(table) ")
    else
      print(spaces .."(metatable) ")
        value = mTable
    end     
    for tableKey, tableValue in pairs(value) do
      vardump(tableValue, depth, tableKey)
    end
  elseif type(value)    == 'function' or 
      type(value)   == 'thread' or 
      type(value)   == 'userdata' or
      value     == nil
  then
    print(spaces..tostring(value))
  else
    print(spaces..linePrefix.."("..type(value)..") "..tostring(value))
  end
end

function mytest()
print("mytest!!!");
print("mytest!!!");
print("mytest!!!");
print("mytest!!!");
print("mytest!!!");
print("mytest!!!");
print("mytest!!!");
print("mytest!!!");
print("mytest!!!");
print("mytest!!!");
print("mytest!!!");
print("mytest!!!");
end

-- fml = luajava.bindClass("cpw.mods.fml.common.network.NetworkModHandler");
-- fml = luajava.newInstance("cpw.mods.fml.common.network.NetworkModHandler")

function getRun()

--print("test");
--[[if i == 1 then
i = 0
print "aqui"
print(io.read())
end]]
--luajava.bindClass("java.lang.String")
print("teste2 ");
luajava.bindClass("java.lang.Thread"):sleep(5000)
luajava.newInstance("java.lang.String", "lalala");
--print("fim thread");

-- print(param:toString());
print("TESTTESTTESTsan" );


--c1 = luajava.bindClass("cpw.mods.fml.server.FMLServerHandler") -- customItemRenderers


-- print(cpw.mods.fml.common.Loader:getModList())
--print(ch)
--vardump(ch:getHandlerList())
print("######################")
print("######################")
print("######################")
print("######################")
print("######################")
print("######################")
print("######################")
print("######################")
print("######################")
print("######################")
print("######################")
print("######################")




--print(fml:instance());

--tp = luajava.newInstance("cpw.mods.fml.common.TickType");
--tpp = tp:getSystemJavaCompiler()
print("######################")
print("######################")
print("######################")
print("######################")
print("######################")

--fml = luajava.bindClass("net.minecraftforge.classloading.FMLForgePlugin")
--print(fml.RUNTIME_DEOBF)

--fml = luajava.bindClass("net.minecraftforge.common.ForgeVersion")
--print(fml:getVersion())

--fml = luajava.bindClass("net.minecraftforge.common.MinecraftForge")
--print(fml.EVENT_BUS)




--runner = luajava.createProxy("net.minecraftforge.event.IEventListener",{invoke=mytest});

fml = luajava.newInstance("net.minecraftforge.event.entity.player.PlayerInteractEvent")
bla = luajava.bindClass("net.minecraftforge.event.EventPriority")
priority = bla["NORMAL"]
-- --priority = bla:fromName("NORMAL")
-- --bla = fml:getListenerList():register(0, priority, listener)
-- --bla = fml:getListenerList():getListeners(0)
-- --print(type(bla["NORMAL"])) -- output: userdata

-- Exception in thread "Thread-8" java.lang.ExceptionInInitializerError
-- Client> 2013-08-07 06:07:59 [INFO] [STDERR]  at kz.<clinit>(SourceFile:61)
-- Client> 2013-08-07 06:07:59 [INFO] [STDERR]  at aqw.<clinit>(SourceFile:411)
-- Client> 2013-08-07 06:07:59 [INFO] [STDERR]  at yx.<clinit>(SourceFile:6)
-- Client> 2013-08-07 06:07:59 [INFO] [STDERR]  at yb.<clinit>(SourceFile:94)
-- Client> 2013-08-07 06:07:59 [INFO] [STDERR]  at net.minecraftforge.client.MinecraftForgeClient.<clinit>(MinecraftForgeClient.java:23)
--mfc = luajava.newInstance("net.minecraftforge.client.MinecraftForgeClient")
--print(mfc.registerItemRenderer)


--runner:invoke()

i = luajava.bindClass("net.minecraftforge.event.IEventListener")
print(i)

event = luajava.createProxy("net.minecraftforge.event.IEventListener", {invoke=mytest});

print("######################")
print("######################")
print("######################")
print("######################")
print("######################")
print("######################")
print("######################")
print("######################")
print("######################")
print("######################")
print("######################")
print("######################")


end

-- for i=0,100 do
f = luajava.createProxy("java.lang.Runnable",{run=getRun}); -- (i, luajava.newInstance("java.lang.String", "str param"))
--print(f:toString())

t = luajava.newInstance("java.lang.Thread", f);
print(t:toString())

t:start()


vardump(luaforge)
sys = luajava.bindClass("java.lang.System")
print ( sys:currentTimeMillis() )


-- Client> 2013-08-06 11:03:53 [INFO] [STDERR] In mod testmod
-- Client> 2013-08-06 11:03:53 [INFO] [STDERR] Error: @luamods\testmod/main.lua:56 vm error: java.lang.ClassCastException: sun.misc.Launcher$AppClassLoader cannot be cast to net.minecraft.launchwrapper.LaunchClassLoader
-- Client> 2013-08-06 11:03:53 [INFO] [STDERR] stack traceback:
-- vardump(fml:instance())



--ch = luajava.bindClass("cpw.mods.fml.client")
--ch = luajava.bindClass("net.minecraftforge.event.Event")


My only problem is, that I can't instanciate a IEventListener with luajava! When that problem would be solvable, nothing stops us to add our own lua-events to Forge :)

The interessting code starts here:

`--fml = luajava.bindClass("net.minecraftforge.common.MinecraftForge")
--print(fml.EVENT_BUS)

We have full access to the EVENT_BUS :D

So can somebody make that LuaForge let us make a IEventListener?

The error I got when trying to make luajava-IEventListener with


event = luajava.createProxy("net.minecraftforge.event.IEventListener", {invoke=mytest});

is:

``Client> 2013-08-08 02:43:51 [INFO] [STDERR] Exception in thread "Thread-8" tiin57.lib.luaj.vm2.LuaError: @luamods\testmod/main.lua:152 vm error: java.lang.IllegalArgumentException: interface net.minecraftforge.event.IEventListener is not visible from class loader`

item.createItem creates item with the wrong ID

If an item is created with an ID of 1000 the item is created with 1256 instead.

This breaks crafting recipes because it expects the id to be 1000 and not 1256.

The addition of 256 to an ID is constant and always reproducible.

Self-reminder

Need to add Tile Entity support. After that, CC API will be added in.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.