Setup Performance Query

Discussion in 'Community Talk' started by i_Matt, May 12, 2020.

  1. i_Matt

    i_Matt Member

    Messages:
    3
    Likes Received:
    0
    Local Time:
    9:44 AM
    Hey!

    I'm currently trying to automate emeralds by slaughtering innocent villagers in the masses. An issue I ran into was that the smeltry has to have some material in to massacre the villagers for their emeralds. So I wrote a Computer Craft program which checks if there's more than an emerald gem in the smeltry before allowing a liquid translocator to extract.

    Here's my code, can someone confirm that this wont have too much of a performance impact on the server
    Code:
    smeltry = peripheral.wrap("back")
    while true do
      smeltryTank = smeltry.getTankInfo()
      emeraldAmount = smeltryTank[1]["contents"]["amount"] / 640
      if emeraldAmount > 1 then
    	rs.setOutput("bottom", false)
      else
    	rs.setOutput("bottom", true)
      end
      sleep(0.05)
    end
     
    Last edited: May 12, 2020
  2. Sandstroem

    Sandstroem Well-Known Member

    Messages:
    1,528
    Likes Received:
    821
    Local Time:
    10:44 AM
    I don't know how well computer craft is coded, but I would assume that someone who builds a Lua parser into mc knows how to code.

    I would increase that sleep. There is no point to check things each tick, make it a second or even more.
     
  3. i_Matt

    i_Matt Member

    Messages:
    3
    Likes Received:
    0
    Local Time:
    9:44 AM
    it's needed so the translocator is turned off before the smeltry is emptied because I need a small amount of molten emerald left in there to kill the villagers, I guess I could up the amount stored in the smeltry at once so the translocator takes longer to transfer it and then increase the sleep
     
  4. Sandstroem

    Sandstroem Well-Known Member

    Messages:
    1,528
    Likes Received:
    821
    Local Time:
    10:44 AM
    Why not leave a different liquid in there that doesn't get pulled?
     
  5. i_Matt

    i_Matt Member

    Messages:
    3
    Likes Received:
    0
    Local Time:
    9:44 AM
    That's a much better idea that way the computer isn't needed, cheers mate
     
  6. BlazeFTB

    BlazeFTB Well-Known Member

    Messages:
    127
    Likes Received:
    26
    Local Time:
    4:44 AM
    Thats what i always do when building murder factory's, I use 1 iron nuget and make sure it is always at the bottom in the controller by using fluid filters.
     

Share This Page