Jump to content

[1.7.2] LuaCraft - Minecraft & Forge modding with Lua


Recommended Posts

Posted

Hey there, BlackAwps and I have been working on LuaCraft again, this time around it is a Forge mod.

 

Right now we support Minecraft 1.7.2 / Forge 10.12.1.1060, future versions should be easy to port.

 

Repo: https://bitbucket.org/luastoned/luacraft-forge

Download: http://luacraft.com/#download

We have our own forum at: http://forum.luacraft.com

 

width=800 height=467http://img.luastoned.com/luacraft_forge_v4.png[/img]

 

Here are some code samples to get everyone started.

 

High Jump, makes players jump quite high and take no fall damage.

function entityFall(ent, distance)
if (IsPlayer(ent)) then
	return true
end
end
hook.Add("entity.fall", "Fall!", entityFall)

function entityJump(ent)
local jumpVec = Vector(0, 0, 1.5)
if (IsPlayer(ent)) then
	ent:SetVelocity(jumpVec)
end
end
hook.Add("entity.jump", "Jump!", entityJump)

 

Biome name, your position and information about what you look at.

local font = surface.GetDefaultFont()

local matEye = Resource("silkicons:eye.png")
local matMap = Resource("silkicons:map.png")
local matTime = Resource("silkicons:time.png")
local matWorld = Resource("silkicons:world.png")

function _R.World:GetTimeString()
local worldTime = (self:GetTime() + 8000) % 24000
local hour = math.floor(worldTime / 1000)
local minute = math.floor((worldTime % 1000 / 1000) * 60) % 60

return string.format("%02d:%02d", hour, minute)
end

function extraInfo(time, phase)
local world = World()
local me = LocalPlayer()
local pos = me:GetPos()
local biome = world:GetBiome(pos)

surface.SetTexture(matWorld)
surface.DrawTexturedRect(2, 2, 8, 
font:DrawText(biome, 12, 2, true)

surface.SetTexture(matMap)
surface.DrawTexturedRect(2, 12, 8, 
font:DrawText(string.format("%d, %d", math.floor(pos.x), math.floor(pos.y)), 12, 12, true)

surface.SetTexture(matTime)
surface.DrawTexturedRect(2, 22, 8, 
font:DrawText(world:GetTimeString(), 12, 22, true)

local tr = me:GetEyeTrace()
if (tr.HitBlock) then
	surface.SetTexture(matEye)
	surface.DrawTexturedRect(2, 32, 8, 
	font:DrawText(tr.HitBlock:GetName(), 12, 32, true)
end
end
hook.Add("render.gameoverlay", "Extra Info", extraInfo)

 

3D rendering, because everyone loves that!

local vec1 = Vector(-190, 315, 72)
local vec2 = vec1 + Vector(0, 0, 1.2) 

local ang1 = Angle(0, 160, 0)

local lightGrey = Color(200, 200, 200, 255)
local lightBlue = Color(50, 50, 230, 255)

function gameRender(renderTime)
render.SetDrawColor(lightBlue)
render.DrawText("LuaCraft!", vec2, ang1, 1.25, true)

render.SetDrawColor(lightGrey)
render.DrawText("Forge modding with Lua", vec3, ang1, 0.5)
end
hook.Add("render.world", "3D Render", gameRender)

 

Have fun with this and feel free to post suggestions or whatever else is on your mind.

Happy coding!

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.