aldahick / luaforge Goto Github PK
View Code? Open in Web Editor NEWMinecraft Forge in Lua
License: MIT License
Minecraft Forge in Lua
License: MIT License
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
Using an itemid greater than 169 in any craft handler causes minecraft to crash when loading.
Example:
craftingHandler.addSmeltingRecipe(1, 328, .5)
dump of error
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
-- 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`
Dunno why, FIX IT :P
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.
I actually do alot of Django and we use jenkins at work, but I use gitlab-ci at home...
I would recommend you use Travis, it's free for opensource projects it won't require you to setup a server or maintain a server.
Need to add Tile Entity support. After that, CC API will be added in.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.