public override void HitWire(int i, int j) { if (Main.netMode == 1) { return; } TransferAssemblerTileEntity entity; if (!TryGetEntity(i, j, out entity)) { return; } if (entity.item.IsAir || entity.stock.stack > 0) { return; } inventory.Clear(); foreach (var c in ModContent.GetInstance <TransferAgent>().FindContainerAdjacent(i, j)) { inventory.RegisterContainer(c); } bool foundRecipe = false; for (int r = 0; r < Recipe.maxRecipes && !Main.recipe[r].createItem.IsAir; r++) { if (Main.recipe[r].createItem.type == entity.item.type) { foundRecipe = true; if (TryMakeRecipe(Main.recipe[r], entity)) { break; } } } if (!foundRecipe) { entity.Status = TransferAssemblerTileEntity.StatusKind.NoRecipe; } inventory.Clear(); NetMessage.SendData(MessageID.TileEntitySharing, -1, -1, null, entity.ID, entity.Position.X, entity.Position.Y); }
public override void DoAction(IEventArgs args) { fr = (FreeRuleEventArgs)args; PlayerEntity playerEntity = (PlayerEntity)fr.GetEntity(player); _playerEntity = playerEntity; if (playerEntity != null) { FreeData fd = (FreeData)playerEntity.freeData.FreeData; _ground = fd.freeInventory.GetInventoryManager().GetInventory(ChickenConstant.BagGround); _ground.Clear(); var bin2Ds = args.GameContext.session.serverSessionObjects.Bin2dManager.GetBin2Ds(); foreach (var bin2DState in bin2Ds) { bin2DState.Bin2D.Retrieve( new Rect(playerEntity.position.Value.x - 100, playerEntity.position.Value.z - 100, 200, 200), onFind); } _ground.GetInventoryUI().ReDraw(fr, _ground, true); } }
private void handleFromGround(string from, string to, ServerRoom room, FreeData fd) { if (from.StartsWith(Ground) && !to.StartsWith(Ground)) { SimpleItemInfo info = PickupItemUtil.GetGroundItemInfo(room, fd, from); if (info.cat > 0) { ItemInventory inv = fd.freeInventory.GetInventoryManager().GetInventory("ground"); if (inv != null) { inv.Clear(); FreeItem item = FreeItemManager.GetItem(room.FreeArgs, FreeItemConfig.GetItemKey(info.cat, info.id), info.count); item.GetParameters().AddPara(new IntPara("entityId", info.entityId)); inv.AddItem(room.FreeArgs, item, false); DragGroundOne(fd, room, to); } else { Debug.LogErrorFormat("inventory {0} not existed.", from); } } } }
private void ClearPart(ISkillArgs fr, FreeData fd, int key) { for (int i = 1; i <= 5; i++) { ItemInventory ii = fd.freeInventory.GetInventoryManager().GetInventory("w" + key + "" + i); if (ii != null) { ii.Clear(); ii.GetInventoryUI().ReDraw(fr, ii, true); } } }