Advertisement
Delros12

Minecraft Terrain Generator

Jan 7th, 2018 (edited)
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.94 KB | None | 0 0
  1. function round(x)
  2. if x%2 ~= 0.5 then
  3. return math.floor(x+0.5)
  4. end
  5. return x-0.5
  6. end
  7. function putTexture(part, frontF, backF, topF, bottomF, leftF, rightF, className)
  8. local faces = {"Front", "Back", "Top", "Bottom", "Left", "Right"}
  9. for i,f in pairs(faces) do
  10. local decal = Instance.new(className, part)
  11. decal.StudsPerTileU = 2.6
  12. decal.StudsPerTileV = 2.6
  13. if i == 1 then decal.Texture = frontF decal.Name = f end
  14. if i == 2 then decal.Texture = backF or frontF decal.Name = f end
  15. if i == 3 then decal.Texture = topF or frontF decal.Name = f end
  16. if i == 4 then decal.Texture = bottomF or frontF decal.Name = f end
  17. if i == 5 then decal.Texture = leftF or frontF decal.Name = f end
  18. if i == 6 then decal.Texture = rightF or frontF decal.Name = f end
  19. decal.Face = f
  20. end
  21. return part
  22. end
  23. local x1 = 60
  24. local z1 = 5
  25. local y1 = 60
  26. local RS = game:GetService("RunService").RenderStepped
  27. for x = 1, y1 do
  28. for z = 1, x1 do
  29. for y = 1, z1 do
  30. local block = Instance.new("Part", workspace)
  31. block.Material = "Fabric"
  32. block.Anchored = true
  33. block.Size = Vector3.new(2.6, 2.6, 2.6)
  34. block.CFrame = CFrame.new((x1/2) + x * 2.6, (round((math.noise(x/12, 0.154, z/12)*26) / 2.6) * 2.6) - (y * 2.6), (z1/2) + z * 2.6)
  35. if y == 1 then
  36. putTexture(block, "rbxassetid://96430337", "rbxassetid://96430337",
  37. "rbxassetid://96430265", "rbxassetid://179655033",
  38. "rbxassetid://96430337", "rbxassetid://96430337", "Texture")
  39. elseif y == 2 then
  40. putTexture(block, "rbxassetid://179655033", "rbxassetid://179655033",
  41. "rbxassetid://179655033", "rbxassetid://179655033",
  42. "rbxassetid://179655033", "rbxassetid://179655033", "Texture")
  43. elseif y >= 3 then
  44. putTexture(block, "rbxassetid://75880927", "rbxassetid://75880927",
  45. "rbxassetid://75880927", "rbxassetid://75880927",
  46. "rbxassetid://75880927", "rbxassetid://75880927", "Texture")
  47. end
  48. end
  49. end
  50. RS:wait()
  51. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement