mirror of
https://github.com/Anuken/Mindustry.git
synced 2026-01-18 23:32:08 -08:00
Fixed negative item bug
This commit is contained in:
parent
04569e76d6
commit
fc57175056
2 changed files with 2 additions and 5 deletions
|
|
@ -514,6 +514,7 @@ public class Control extends Module{
|
|||
|
||||
public void removeItem(ItemStack req){
|
||||
items[req.item.id] -= req.amount;
|
||||
if(items[req.item.id] < 0) items[req.item.id] = 0; //prevents negative item glitches in multiplayer
|
||||
shouldUpdateItems = true;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -123,11 +123,7 @@ public class NetServer extends Module{
|
|||
packet.playerid = connections.get(id).id;
|
||||
|
||||
Recipe recipe = Recipes.getByResult(Block.getByID(packet.block));
|
||||
if (recipe != null) {
|
||||
for (ItemStack stack : recipe.requirements) {
|
||||
Vars.control.removeItem(stack);
|
||||
}
|
||||
}
|
||||
if (recipe != null) Vars.control.removeItems(recipe.requirements);
|
||||
|
||||
Net.sendExcept(id, packet, SendMode.tcp);
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue