Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package.loaded.curlib = nil;
- package.loaded.textalign = nil;
- local curlib = require("curlib");
- local align = require("textalign");
- component = require("component");
- debug = component.debug;
- local term = require("term");
- local gpu = component.gpu;
- local running = true;
- x1,y1,z1 = 0,-1,0
- world = debug.getWorld();
- player = debug.getPlayer("3131CuNb");
- --player = debug.getPlayer("boubou_19");
- file=io.open("data3")
- text=file:read("*a")
- itemArray=require("serialization").unserialize(text)
- function refreshCord ()
- x,y,z = player.getPosition();
- x1,y1,z1 = math.floor(x),math.floor(y)+2,math.floor(z);
- end
- local app = curlib.app:new();
- local win1 = curlib.window:new({ x = 3, y = 2,
- width = 60, height = 20, shadow = true});
- local button = curlib.button:new({
- x = win1.width - 9,
- y = win1.height -1,
- width = 8, height = 1,
- text = "Quit", shadow = true}
- );
- playerName = curlib.input:new({x = 45, y = 3, width = 12,text = "Primelock"});
- input1 = curlib.input:new({x = 10, y = 3, width = 30});
- input2 = curlib.input:new({x = 2, y = 17, width = 30,text="dreamcraft:item.GlowingMarshmallow"});
- meta = curlib.input:new({x = 35, y = 14, width = 6,text = "0"})
- inputBlockID = curlib.input:new({x = 35, y = 12, width = 6,text = "3327"})
- button.onClick = function(control, x, y)
- app.status("my click function called");
- running = false;
- end
- local btnAlign1 = curlib.button:new({ x = 2, y = 10, width = 15, height = 2, text = "CommandBlock"});
- local addCode = curlib.button:new({ x = 2, y = 3, width = 10, height = 1, text = "addCode"});
- local playerTP = curlib.button:new({ x = 45, y = 6, width = 10, height = 1, text = "PlayerTP"});
- local removeBlockUp = curlib.button:new({ x = 2, y = 7, width = 15, height = 2, text = "removeBlockUp"});
- local btnAlign2 = curlib.button:new({ x = 2, y = 5, width = 10, height = 1, text = "give Items"});
- local popInfinityChest = curlib.button:new({ x = 35, y = 5, width = 5, height = 5, text = "popBlock"});
- local doubleAll = curlib.button:new({ x = 57, y = 8, width = 10, height = 5, text = "doubleAll"});
- btnAlign1.onClick = function (control, x, y)
- refreshCord ()
- world.setBlock(x1,y1,z1,137,0);
- end
- removeBlockUp.onClick = function (control, x, y)
- refreshCord ()
- world.setBlock(x1,y1,z1,0,0);
- end
- playerTP.onClick = function (control, x, y)
- refreshCord ()
- Pn = playerName.text
- goodPlayerName = "a"
- for n,pl in pairs(debug.getPlayers()) do
- if type(pl) == "string" then
- if string.find(pl, Pn)~=nil then
- goodPlayerName = pl
- end
- end
- end
- pi = debug.getPlayer(goodPlayerName)
- wd = pi.getWorld()
- if wd == nil then
- print("nothing")
- else
- x,y,z = pi.getPosition()
- if world.getBlockId(x1,y1,z1) == 2742 then
- nbt = world.getTileNBT(x1,y1,z1)
- if nbt["value"]["IsActive"]["value"]== 1 then
- nbt["value"]["Dislocator"]["value"]["tag"]["value"]["DimentionName"]["value"]=wd.getDimensionName()
- nbt["value"]["Dislocator"]["value"]["tag"]["value"]["X"]["value"]=x
- nbt["value"]["Dislocator"]["value"]["tag"]["value"]["Y"]["value"]=y+10
- nbt["value"]["Dislocator"]["value"]["tag"]["value"]["Z"]["value"]=z
- world.setTileNBT(x1,y1,z1,nbt)
- end
- end
- end
- end
- popInfinityChest.onClick = function (control, x, y)
- refreshCord ()
- world.setBlock(x1,y1,z1,tonumber(inputBlockID.text),tonumber(meta.text));
- end
- doubleAll.onClick = function (control, x, y)
- refreshCord ()
- if world.getBlockId(x1,y1,z1) == 3327 then
- nbt = world.getTileNBT(x1,y1,z1)
- for k = 1, 244 do
- nbtk=nbt["value"]["Contents"]["value"][k]
- if nbtk~= nil then
- -- nbt["value"]["Contents"]["value"][k]["value"]["intCount"]["value"]=nbtk["value"]["intCount"]["value"]*2
- nbt["value"]["Contents"]["value"][k]["value"]["intCount"]["value"]=nbtk["value"]["intCount"]["value"]*8
- end
- end
- world.setTileNBT(x1,y1,z1,nbt)
- end
- end
- addCode.onClick = function (control, x, y)
- refreshCord ()
- inpu = input1.text
- nbt = world.getTileNBT(x1,y1,z1)
- nbt["value"]["Command"]["value"]=inpu
- world.setTileNBT(x1,y1,z1,nbt)
- end
- btnAlign2.onClick = function (control, x, y)
- refreshCord ()
- inpu = itemArray[tonumber(inputBlockID.text)]
- metaData = 0
- if meta.text ~= "" and inpu ~= "" then
- metaData = tonumber(meta.text)
- world.insertItem(inpu,64,tonumber(metaData),"",x1,y1,z1,1)
- end
- end
- win1:addChild(button);
- win1:addChild(btnAlign1);
- win1:addChild(btnAlign2);
- win1:addChild(popInfinityChest);
- win1:addChild(removeBlockUp);
- win1:addChild(addCode);
- win1:addChild(playerName);
- win1:addChild(playerTP);
- win1:addChild(doubleAll);
- win1:addChild(input1);
- win1:addChild(input2);
- win1:addChild(inputBlockID);
- win1:addChild(meta);
- --adds the window to the app
- app:addChild(win1);
- --initializes the app and makes a first screen draw of everything
- app:init();
- -- application main loop
- while running do
- local event, addr, arg1, arg2, arg3 = app:doEvents();
- if (event == "clipboard") then
- input2.text= arg1
- end
- if (event == "interrupted") then
- running = false;
- end
- end
- curlib.cleanPalette();
- gpu.setBackground(0);
- gpu.setForeground(0xc1c1c1);
- term.clear();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement