ProjectSky Posted April 13, 2016 Share Posted April 13, 2016 How to remove items from the world? Link to comment Share on other sites More sharing options...
RoboMat Posted April 13, 2016 Share Posted April 13, 2016 You mean items that are lying on the floor? Link to comment Share on other sites More sharing options...
ProjectSky Posted April 13, 2016 Author Share Posted April 13, 2016 4 minutes ago, RoboMat said: You mean items that are lying on the floor? Sorry for my bad English, I mean to remove items from the map (floor and other containers). Link to comment Share on other sites More sharing options...
RoboMat Posted April 13, 2016 Share Posted April 13, 2016 You need to get the reference to the item you want to remove and the reference of the inventory (container, floor, player) you want to remove the item from. Basically something like this: player:getInventory():Remove(item); Link to comment Share on other sites More sharing options...
ProjectSky Posted April 13, 2016 Author Share Posted April 13, 2016 @RoboMat local player = getSpecificPlayer(0); local inv = player:getInventory(); inv:Remove(item); I try to use this code, but it doesn't seem to be able to remove items on the floor. Link to comment Share on other sites More sharing options...
ShuiYin Posted April 13, 2016 Share Posted April 13, 2016 13 minutes ago, Sky_Orc_Mm said: @RoboMat local player = getSpecificPlayer(0); local inv = player:getInventory(); inv:Remove(item); I try to use this code, but it doesn't seem to be able to remove items on the floor. Look at how i removed my ash on my mod PZ Vanilla Patch latest release Link to comment Share on other sites More sharing options...
ProjectSky Posted December 12, 2016 Author Share Posted December 12, 2016 (edited) Edit: I recently looked at the javadoc, it helped me a lot, so the problem solved. local sq = getCell():getGridSquare(x, y, z); if (sq ~= nil) then for i = sq:getObjects():size(), 1, -1 do local obj = sq:getObjects():get(i - 1); if instanceof(obj, "IsoWorldInventoryObject") then if obj:getItem():getFullType() == ItemTable then sq:transmitRemoveItemFromSquare(obj) obj:removeFromSquare(); end end end end Edited December 12, 2016 by Sky_Orc_Mm problem solved. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now